From de18cca83738bdf6b279046e34b910ccd5b73a84 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 07 三月 2024 08:17:50 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml |   75 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml b/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
index 3362936..3d35296 100644
--- a/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
+++ b/north-glass-erp/target/classes/mapper/pp/ProductionScheduling.xml
@@ -7,6 +7,7 @@
         <result column="processes" property="processes"/>
         <result column="scheduling_quantity" property="schedulingQuantity"/>
         <result column="order_number" property="orderNumber"/>
+        <result column="scheduling_id" property="schedulingId"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result column="project" property="project"/>
@@ -47,21 +48,21 @@
                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,
         ps.scheduling_quantity,
-        (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,
+#         (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,
         IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
         ps.reviewer,
-        od.product_name,od.shape
+        od.product_name,od.shape,ps.scheduling_id
         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  ps.scheduling_id IS NOT NULL
            and od.create_time between #{selectTime1} and #{selectTime2}
-        <if test="processes!=null and processes!=''">
-            and ps.processes regexp #{processes}
-        </if>
+
+          and position(#{processes} in ps.processes)
+          and position(#{orderId} in ps.order_id)
 
     </select>
 
@@ -72,22 +73,19 @@
         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,
         ps.scheduling_quantity,
-        (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,
+#         (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,
         IF(ps.review_status=0,"鏈鏍�","宸插鏍�") as review_status,
         ps.reviewer,
-        od.product_name,od.shape
+        od.product_name,od.shape,ps.scheduling_id
         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  ps.scheduling_id IS NOT NULL
-        and od.order_id regexp #{orderId}
-
-        <if test="processes!=null and processes!=''">
-            and ps.processes regexp #{processes}
-        </if>
+        where  (ps.scheduling_id IS NOT NULL )
+          and position(#{processes} in ps.processes)
+          and position(#{orderId} in ps.order_id)
 
     </select>
 <!--    鏌ヨ鏈帓浜ф暟鎹�-->
@@ -101,11 +99,9 @@
         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  isnull(ps.scheduling_id) and od.create_time between #{selectTime1} and #{selectTime2}
-        <if test="orderId!=null and orderId!=''">
-            and od.order_id regexp #{orderId}
+        where   od.quantity-IFNULL(ps.scheduling_quantity,0)>0 and od.create_time between #{selectTime1} and #{selectTime2}
 
-        </if>
+          and position(#{orderId} in ps.order_id)
     group by od.order_id,od.order_number
     </select>
 <!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
@@ -119,6 +115,45 @@
                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}
+        where od.create_time between #{selectTime1} and #{selectTime2} and od.quantity-IFNULL(ps.scheduling_quantity,0)>0
     </select>
+
+    <select id="selectMaxId">
+        select
+            COUNT(ps.scheduling_id)
+        from
+            `production_scheduling` as ps
+        where
+            date(ps.create_time) = curdate()
+    </select>
+
+    <insert id="insertSelective">
+        insert into production_scheduling(
+               scheduling_id,
+               order_id,
+               order_number,
+               processes,
+               scheduling_quantity,
+               scheduled_start_time,
+               plan_end_time,
+               notes,
+               create_time
+               )
+        VALUES(
+               #{schedulingId},
+               #{orderId},
+               #{orderNumber},
+               #{processes},
+               #{schedulingQuantity},
+               #{scheduledStartTime},
+               #{planEndTime},
+               #{notes},
+               now()
+              )
+    </insert>
+
+    <update id="ExamineSchedulingMp">
+        update production_scheduling set review_status=1,reviewer=#{userName} where
+        scheduling_id=#{schedulingId}
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0