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

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |  118 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 93 insertions(+), 25 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
index 9383dd5..3d56b73 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -81,7 +81,38 @@
                     </if>
 
 
-        group by a.process_Id;
+        group by a.process_Id
+        ORDER BY a.id desc
+        limit #{offset},#{pageSize};
+    </select>
+
+
+    <select id="getPageTotal">
+        select
+        CEILING(count(a.process_Id)/#{pageSize}) as 'pageTotal',
+        count(distinct a.process_Id) as 'total'
+        from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
+        left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
+        where a.create_time between #{selectTime1} and #{selectTime2}
+        <if test="flowCard.orderId != null and flowCard.orderId != ''">
+            and a.order_id regexp #{flowCard.orderId}
+        </if>
+        <if test="flowCard.productionId != null and flowCard.productionId != ''">
+            and a.process_Id regexp #{flowCard.productionId}
+        </if>
+        <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
+            and c.product_id regexp #{flowCard.orderDetail.productId}
+        </if>
+        <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">
+            and c.product_name regexp #{flowCard.orderDetail.productName}
+        </if>
+
+        <if test="flowCard.order.project != null and flowCard.order.project!= ''">
+            and b.project regexp #{flowCard.order.project}
+        </if>
+
+        ORDER BY a.id desc
+        limit #{offset},#{pageSize};
     </select>
 
     <!--鍒嗘灦鏌ヨ-->
@@ -101,7 +132,7 @@
         where o.production_order=2 and ogd.splitting_status=0 and o.create_time between #{selectTime1} and #{selectTime2}
 
         <if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
-            and o.order_id, regexp #{flowCard.order.orderId}
+            and o.order_id regexp #{flowCard.order.orderId}
         </if>
         <if test="flowCard.order.customerName != null and flowCard.order.customerName != ''">
             and o.customer_name regexp #{flowCard.order.customerName}
@@ -132,7 +163,7 @@
     </select>
 
 <!--    鍒嗘灦鏄庣粏鏌ヨ-->
-    <select id="DetailsSelectMp" resultMap="flowCardMap">
+    <select id="detailsSelectMp" resultMap="flowCardMap">
         select od.order_id,
         ogd.production_id,
         od.product_id,
@@ -158,30 +189,25 @@
         group by od.order_id, ogd.production_id
     </select>
 
-    <update id="UpdateDeleteState">
-        update sd.order_glass_detail as ogd
-        set ogd.production_id=null,
-            ogd.production_time=null,
-            ogd.founder=null
-        where ogd.production_id = #{processId}
+    <!--    鏇存柊鍒嗘灦鐘舵��-->
+    <update id="updateDeleteState">
+        update
+            sd.order_glass_detail as ogd left join flow_card as fc
+                on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number
+        set ogd.splitting_status=0
+        where ogd.order_id=#{orderId}  and fc.process_id=#{processId}
 
     </update>
 
     <!--    鍒犻櫎娴佺▼鍗�-->
-    <update id="DeleteFlowCardMp">
-        update sd.order_detail as od left join sd.order_glass_detail as ogd
-            on od.order_id = ogd.order_id and od.order_number = ogd.order_number
-        set ogd.production_id=null,
-            ogd.production_time=null,
-            ogd.founder=null
-        where od.order_id = #{orderId}
-          and ogd.production_id = #{processId}
+    <update id="deleteFlowCardMp">
+        delete from flow_card as fc where fc.process_id=#{processId}
     </update>
 
     <!--    鍒嗘灦鏂板鏄庣粏鏌ヨ-->
 
     <!--resultMap="flowCardMap"-->
-    <select id="SelectNoCardMp" >
+    <select id="selectNoCardMp" >
 
         select
         od.order_number,
@@ -208,14 +234,14 @@
     </select>
 
     <!--淇敼鎺掔増鐘舵��-->
-    <update id="UpdateLayoutStatusMp">
+    <update id="updateLayoutStatusMp">
         update flow_card as fc
         set fc.layout_status=2
         where fc.process_id = #{processId}
     </update>
 
 <!--    鏌ヨ瀵瑰簲娴佺▼鍗″彿鎺掔増鐘舵��-->
-    <select id="SelectLayoutStatus">
+    <select id="selectLayoutStatus">
         select fc.layout_status
         from flow_card as fc
         where fc.process_id = #{processId}
@@ -223,13 +249,13 @@
     </select>
 
 <!--    鏌ヨ鎶ュ伐琛ㄥ唴鏄惁鏈夊搴旀祦绋嬪崱-->
-    <select id="ReportingWorkCount">
+    <select id="reportingWorkCount">
         select COUNT(rw.process_id)
         from reporting_work as rw
         where rw.process_id = #{processId}
     </select>
 <!--    鎻掑叆Flow_card琛�-->
-    <insert id="AddFlowCardMp">
+    <insert id="addFlowCardMp">
         insert into
             flow_card (
             order_id,
@@ -240,6 +266,7 @@
             technology_number,
             quantity,
             founder,
+            layers_number,
             splitFrame_time,
             create_time
         )
@@ -252,6 +279,7 @@
             ogd.technology_number,
             #{quantity},
             #{userName},
+            #{layer},
             NOW(),
             NOW()
 
@@ -263,22 +291,62 @@
     </insert>
 
 <!--    鏇存柊鍒嗘灦鐘舵��-->
-    <update id="UpdateFlowState">
+    <update id="updateFlowState">
         update sd.order_glass_detail as ogd
         set ogd.splitting_status=1
         where ogd.production_id=#{productionId} and ogd.order_number=#{orderNumber}
     </update>
 <!--    鏌ヨ鏈垎鏋剁殑鏉℃暟-->
-    <select id="SelectFlowCount">
+    <select id="selectFlowCount">
         select COUNT(*)
         from sd.order_glass_detail as ogd
         where ogd.order_id = left(#{productionId},10)
           and ogd.splitting_status = 0
     </select>
 <!--   淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬�-->
-    <update id="UpdateProcessingCard">
+    <update id="updateProcessingCard">
         update sd.`order` as o
         set o.processing_card=#{state}
         where o.order_id=left(#{productionId},10)
     </update>
+
+<!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
+    <select id="selectOkSchedulingMp">
+        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),
+               (od.quantity-IFNULL(ps.scheduling_quantity,0)),
+               round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2),
+               IFNULL(ps.scheduling_quantity,0),
+               round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2),
+               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.order_id=#{orderId} and ps.processes=#{processes} and ps.scheduling_id IS NOT NULL
+
+    </select>
+<!--    鏌ヨ鏈帓鐗堟暟鎹�-->
+    <select id="selectNoSchedulingMp">
+
+    </select>
+<!--    棣栨鏌ヨ鎺掔増鏁版嵁-->
+    <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.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}
+    </select>
+
+<!--   鏌ヨ瀵瑰簲搴忓彿鐨勫眰鏁�-->
+    <select id="selectLayer">
+        select COUNT(ogd.order_number)
+        from sd.order_glass_detail as ogd
+        where ogd.production_id = #{productionId}
+          and ogd.order_number=#{orderNumber}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0