From f60327c377097f67ed42c349bda2a54c3147b7be Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 07 三月 2024 16:35:45 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
index 2d8c76a..50467cc 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
@@ -8,6 +8,7 @@
         <result column="scheduling_quantity" property="schedulingQuantity"/>
         <result column="order_number" property="orderNumber"/>
         <result column="scheduling_id" property="schedulingId"/>
+        <result column="order_id" property="orderId"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result column="project" property="project"/>
@@ -60,14 +61,13 @@
             left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
         where  ps.scheduling_id IS NOT NULL
            and od.create_time between #{selectTime1} and #{selectTime2}
-
           and position(#{processes} in ps.processes)
           and position(#{orderId} in ps.order_id)
 
     </select>
 
     <!--    鏌ヨ宸叉帓浜у甫璁㈠崟缂栧彿鐨勬暟鎹�-->
-    <select id="SelectSchedulingNotMp">
+    <select id="selectSchedulingNotMp">
         select date(ps.scheduled_start_time) as scheduled_start_time,
         date(ps.plan_end_time) as plan_end_time,
         od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
@@ -108,14 +108,15 @@
     <select id="selectLastSchedulingMp">
         select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
                round(od.width*od.height*od.quantity/1000000,2) as area,
-               (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
-               round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
-               IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
-               round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
+               (od.quantity-IFNULL(sum(ps.scheduling_quantity),0)) as pendingProductionQuantity,
+               round(od.width*od.height*(od.quantity-IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as pendingProductionArea,
+               IFNULL(sum(ps.scheduling_quantity),0) as productionScheduledQuantity,
+               round(od.width*od.height*(IFNULL(sum(ps.scheduling_quantity),0))/1000000,2) as productionScheduledArea,
                od.product_name,od.shape
         from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
                                    left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
         where od.create_time between #{selectTime1} and #{selectTime2} and od.quantity-IFNULL(ps.scheduling_quantity,0)>0
+        group by od.order_id,od.order_number
     </select>
 
     <select id="selectMaxId">
@@ -151,4 +152,13 @@
                now()
               )
     </insert>
+
+    <update id="ExamineSchedulingMp">
+        update production_scheduling set review_status=1,reviewer=#{userName} where
+        scheduling_id=#{schedulingId}
+    </update>
+
+    <delete id="deleteSchedulingMp">
+        delete from production_scheduling where scheduling_id=#{schedulingId}
+    </delete>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0