From c69c4dd89ef52edcee896c6a9c150aa6c2809e84 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 17 二月 2025 13:55:39 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |   98 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 87 insertions(+), 11 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 857d95e..bace961 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -227,18 +227,31 @@
     <!--    鏇存柊鍒嗘灦鐘舵��-->
     <update id="updateDeleteState">
         update
-            sd.order_glass_detail as ogd left join flow_card as fc
+            sd.order_glass_detail as ogd left join pp.flow_card as fc
                 on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number
         set ogd.splitting_status=0
-        where fc.process_id = #{processId}
+        where
+        <if test="processId=='all'">
+            ogd.order_id = #{orderId}
+        </if>
+        <if test="processId!='all'">
+            fc.process_id = #{processId}
+        </if>
+
 
     </update>
 
     <!--    鍒犻櫎娴佺▼鍗�-->
     <update id="deleteFlowCardMp">
         delete
-        from flow_card as fc
-        where fc.process_id = #{processId}
+        from pp.flow_card as fc
+        where
+        <if test="processId=='all'">
+            fc.order_id = #{orderId}
+        </if>
+        <if test="processId!='all'">
+            fc.process_id = #{processId}
+        </if>
     </update>
 
     <!--    鍒嗘灦鏂板鏄庣粏鏌ヨ-->
@@ -313,6 +326,13 @@
         from reporting_work as rw
         where rw.process_id = #{processId} and reviewed_state>=0
     </select>
+    <!--    鏌ヨ鎶ュ伐琛ㄥ唴鏄惁鏈夊搴旀祦绋嬪崱-->
+    <select id="reportingWorkCountByOrderId">
+        select COUNT(rw.process_id)
+        from pp.reporting_work as rw
+        where rw.order_id = #{orderId} and reviewed_state>=0
+    </select>
+
     <!--    鎻掑叆Flow_card琛�-->
     <insert id="addFlowCardMp">
         insert into flow_card (order_id,
@@ -469,6 +489,14 @@
         where process_id = #{processId}
     </delete>
 
+    <delete id="deleteReportingWorkByOrderId">
+        delete
+        from sd.order_process_detail
+        where order_id = #{orderId}
+    </delete>
+
+
+
     <select id="selectPrintFlowCardMp">
         select order_id,
                project,
@@ -513,7 +541,8 @@
                       ogdss.concatenated_glass_child                                   as glass_child,
                       fc.founder,
                       date(fc.splitFrame_time)                                         as splitFrame_time,
-                      processed_part                                                   as process
+                      processed_part                                                   as process,
+                      merge
 
                from flow_card as fc
                         left join sd.order_glass_detail as ogd
@@ -641,7 +670,8 @@
                #{technologyNumber}                             as technologyNumber,
                concat(fc.process_id, '/', #{technologyNumber}) as processIdNumber,
                concat('瀵瑰簲鎴戝徃鍗曞彿', o.batch)                 AS otherRemarks,
-               ''                                              as qrcode
+               ''                                              as qrcode,
+               ifnull(rack,"")                                  as rack
         from flow_card as fc
                  left join sd.order_glass_detail as ogd
                            on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -710,7 +740,7 @@
                fc.quantity,
                round(ogd.total_area, 2)                                       as total_area,
                od.perimeter,
-               if(od.bend_radius!=null,od.bend_radius,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04'))) as bend_radius,
+               if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
                concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
                od.other_columns,
                round(ogd.child_width)                                         as width,
@@ -1394,6 +1424,37 @@
         order by IF(fcs.sort != NULL or fcs.sort != '', fcs.sort, fc.order_number)
     </select>
 
+    <select id="getDetailListMerge">
+        select fc.order_number,
+               concat(IF(ROUND(ogd.child_width, 1) = FLOOR(ogd.child_width), FLOOR(ogd.child_width), ROUND(ogd.child_width, 1)), "*", IF(ROUND(child_height, 1) = FLOOR(child_height), FLOOR(child_height), ROUND(child_height, 1)))   as child_width,
+               sum(fc.quantity) as quantity,
+               round(ogd.total_area, 2)                                       as total_area,
+               od.perimeter,
+               if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
+               concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
+               od.other_columns,
+               round(ogd.child_width)                                         as width,
+               round(ogd.child_height)                                        as height,
+               pd.separation,
+               fc.technology_number,
+               IFNULL(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')),'') as mapNumber,
+               od.building_number
+        from flow_card as fc
+                 left join sd.order_glass_detail as ogd
+                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
+                              fc.technology_number = ogd.technology_number
+                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
+                 left join sd.product_detail as pd
+                           on pd.prod_id = od.product_id and pd.glass_sort = ogd.technology_number
+                 left join flow_card_sort as fcs
+                           on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
+                              fcs.technology_number = fc.technology_number
+                               and fcs.process = #{process}
+        where fc.process_id = #{processId} and fc.`merge`=1
+        group by fc.process_id, fc.order_number
+        order by IF(fcs.sort != NULL or fcs.sort != '', fcs.sort, fc.order_number)
+    </select>
+
     <select id="getDetailListLikes">
         select fc.order_number,
                concat(round(ogd.child_width), "*", round(ogd.child_height))   as child_width,
@@ -1833,7 +1894,8 @@
                date(fc.splitFrame_time) as splitFrame_time,
             /* if(fc.print_status=0,'鏈墦鍗�','宸叉墦鍗�') as  print_status*/
                fc.print_status,
-               ogd.process
+               ogd.process,
+               merge
         from flow_card as fc
                  left join sd.order_glass_detail as ogd
                            on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number and
@@ -2054,7 +2116,8 @@
                       date(fc.splitFrame_time)                                                  as splitFrame_time,
                    /* if(fc.print_status=0,'鏈墦鍗�','宸叉墦鍗�') as  print_status*/
                       fc.print_status,
-                      ogd.process
+                      ogd.process,
+                      merge
                from flow_card as fc
                         left join sd.order_glass_detail as ogd
                                   on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number and
@@ -2501,6 +2564,15 @@
         delete from flow_card_sort where process_id = #{processId}
     </delete>
 
+    <delete id="deleteflowCardSortByOrderId">
+        delete from pp.flow_card_sort
+               where process_id =(
+                                  select process_id from pp.flow_card
+                                  where order_id=#{orderId}
+                                  group by process_id
+                )
+    </delete>
+
     <select id="getPrintProjectDetailsMp">
         SELECT opd.project_no,opd.stock_id,opl.glass_count FROM optimize_detail as opd left join optimize_layout as opl on opl.project_no=opd.project_no and opl.stock_id=opd.stock_id
         where opd.project_no=#{projectNo}
@@ -2728,13 +2800,15 @@
             od.product_name,
             ogd.glass_child,
             fc.patch_state,
-            ogd.process
+            ogd.process,
+            fcd.merge
         from  (select process_id,count(*) as quantity,order_sort,project_no,layer,patch_state from pp.optimize_detail where project_no = #{printProject} group by process_id,layer) as fc
                   left join sd.order_glass_detail as ogd
                             on ogd.order_id = SUBSTRING(fc.process_id,1,10)  and ogd.order_number = fc.order_sort and
                                ogd.technology_number = fc.layer
                   left join sd.order_detail as od on od.order_id = SUBSTRING(fc.process_id,1,10)  and od.order_number = fc.order_sort
                   left join sd.`order` as o on o.order_id = SUBSTRING(fc.process_id,1,10)
+                  left join pp.`flow_card` as fcd on fcd.process_id=fc.process_id and fcd.technology_number=ogd.technology_number and fcd.order_number=od.order_number
         where fc.project_no = #{printProject}
         GROUP BY fc.process_id, ogd.technology_number
         order by fc.process_id, ogd.technology_number
@@ -2756,5 +2830,7 @@
         select processPrintNum from optimize_project where project_no=#{projectNo}
     </select>
 
-
+    <select id="flowCardToOptimizeCount">
+        select count(*) from pp.flow_card where order_id = #{orderId} and engineering_occupancy=1
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0