From ab335a89280e8bc22068c8dc42787959dfbfb466 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 29 八月 2024 15:30:03 +0800
Subject: [PATCH] 新增物料出库打印

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |   62 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 20 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 7f34b09..fd7a0ee 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -480,8 +480,8 @@
                       ogdss.technology_number,
                       ogd.glass_address,
                       ROUND(sum(fc.quantity) / (count(DISTINCT fc.technology_number))) as quantity,
-                      sum(ogd.total_area)                                              as total_area,
-                      # SUM(ogd.child_width*child_height*fc.quantity/(count(DISTINCT ogd.technology_number))) as total_area,
+                      # sum(ogd.total_area)                                              as total_area,
+                      ROUND(SUM(ogd.child_width*ogd.child_height*fc.quantity)/1000000/(count(DISTINCT fc.technology_number)),2) as total_area,
                       od.product_name,
                       ogdss.concatenated_glass_child                                   as glass_child,
                       fc.founder,
@@ -523,8 +523,8 @@
                       ogdss.technology_number,
                       ogd.glass_address,
                       ROUND(sum(fc.quantity) / (count(DISTINCT fc.technology_number))) as quantity,
-                      sum(ogd.total_area)                                              as total_area,
-                      # SUM(ogd.child_width*child_height*fc.quantity/(count(DISTINCT ogd.technology_number))) as total_area,
+                     #  sum(ogd.total_area)                                              as total_area,
+                      ROUND(SUM(ogd.child_width*ogd.child_height*fc.quantity)/1000000/(count(DISTINCT fc.technology_number)),2) as total_area,
                       od.product_name,
                       ogdss.concatenated_glass_child                                   as glass_child,
                       fc.founder,
@@ -562,7 +562,7 @@
                       ogdss.technology_number,
                       ogd.glass_address,
                       ROUND(sum(fc.quantity) / (count(DISTINCT fc.technology_number))) as quantity,
-                      sum(ogd.total_area)                                              as total_area,
+                      ROUND(SUM(ogd.child_width*ogd.child_height*fc.quantity)/1000000/(count(DISTINCT fc.technology_number)),2) as total_area,
                       od.product_name,
                       ogdss.concatenated_glass_child                                   as glass_child,
                       fc.founder,
@@ -759,7 +759,7 @@
                o.customer_id,
                ogd.child_width                as width,
                ogd.child_height               as height,
-               od.quantity,
+               fc.quantity,
                od.order_number                as orderNumber,
                fc.technology_number           as technologyNumber,
                ogd.glass_child,
@@ -883,13 +883,13 @@
                od.processing_note                                    as processingNote,
                width,
                height,
-               od.quantity,
+               fc.quantity,
                od.order_number                                       as orderNumber,
                fc.technology_number                                  as technologyNumber,
                od.building_number                                    as buildingNumber,
                od.product_name                                       as productName,
                od.edging_type                                        as edgingType,
-               p.remarks,
+               od.remarks,
                c.customer_abbreviation                               as customerAbbreviation,
                p.product_abbreviation                                as productAbbreviation,
                fc.process_id                                         as processId,
@@ -945,7 +945,9 @@
                od.product_name,
                ogd.glass_child,
                fc.print_status,
-               pl.reporting_work_id
+               pl.reporting_work_id,
+               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                AS glassNumber
+
         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
@@ -1023,7 +1025,8 @@
         from sd.order_detail as od
                  left join flow_card as fc on od.order_id = fc.order_id and od.order_number = fc.order_number
         where fc.process_id = #{processId}
-          and fc.technology_number = #{technologyNumber}
+          and POSITION(fc.technology_number in #{technologyNumber})
+        GROUP BY other_columns
         order by IF(fc.sort != NULL or fc.sort != '', fc.sort, fc.order_number)
     </select>
 
@@ -1127,7 +1130,8 @@
                pl.rework_processes,
                od.product_name,
                ogd.glass_child,
-               pl.reporting_work_id
+               pl.reporting_work_id,
+               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS glassNumber
         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
@@ -1138,7 +1142,7 @@
                                            pl.order_sort = fc.order_number and
                                            pl.technology_number = fc.technology_number
         where pl.create_time between #{selectTime1} and #{selectTime2}
-        GROUP BY fc.process_id, ogd.technology_number, pl.reporting_work_id
+        GROUP BY fc.process_id,fc.order_number, ogd.technology_number, pl.reporting_work_id
         order by pl.id desc, fc.process_id, ogd.technology_number
     </select>
 
@@ -1217,7 +1221,7 @@
     <select id="getDetailListRefund">
         select fc.order_number,
                concat(round(ogd.child_width), "*", round(ogd.child_height))   as child_width,
-               (pl.patch_num)                                                 as quantity,
+               sum(pl.patch_num)                                                 as quantity,
                round(ogd.total_area, 2)                                       as total_area,
                od.perimeter,
                od.bend_radius,
@@ -1263,7 +1267,8 @@
                dd.responsible_process,
                dd.responsible_team,
                concat('瀵瑰簲鎴戝徃鍗曞彿', o.batch)                 AS otherRemarks,
-               dd.responsible_personnel
+               dd.responsible_personnel,
+               #{mergeTechnologyNumber} as  mergeTechnologyNumber
         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
@@ -1500,13 +1505,13 @@
                od.processing_note                                    as processingNote,
                round(ogd.child_width)                                as width,
                round(ogd.child_height)                               as height,
-               od.quantity,
+               fc.quantity,
                od.order_number                                       as orderNumber,
                fc.technology_number                                  as technologyNumber,
                od.building_number                                    as buildingNumber,
                od.product_name                                       as productName,
                od.edging_type                                        as edgingType,
-               p.remarks,
+               od.remarks,
                c.customer_abbreviation                               as customerAbbreviation,
                p.product_abbreviation                                as productAbbreviation,
                CONCAT(fc.process_id, '/', fc.technology_number)      as processId,
@@ -1540,7 +1545,7 @@
                                and fcs.process = #{process}
         where fc.process_id = #{processId}
           and position(fc.technology_number in #{technologyNumber})
-        group by od.order_number, ogd.technology_number, ogd.child_width, ogd.child_height
+        group by fc.process_id,od.order_number, ogd.technology_number, ogd.child_width, ogd.child_height
         order by IF(fcs.sort != NULL or fcs.sort != '', fcs.sort, fc.order_number)
     </select>
 
@@ -1553,8 +1558,8 @@
                fc.order_number,
                ogd.technology_number,
                ogd.glass_address,
-               sum(od.quantity)         as quantity,
-               sum(ogd.total_area)      as total_area,
+               sum(fc.quantity)                                                          as quantity,
+               round(sum(ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
                od.product_name,
                ogd.glass_child,
                fc.founder,
@@ -1986,7 +1991,7 @@
                od.building_number                                    as buildingNumber,
                od.product_name                                       as productName,
                od.edging_type                                        as edgingType,
-               p.remarks,
+               od.remarks,
                c.customer_abbreviation                               as customerAbbreviation,
                p.product_abbreviation                                as productAbbreviation,
                fc.process_id                                         as processId,
@@ -2077,4 +2082,21 @@
                        GROUP BY od.order_number
                        order by fc.process_id desc LIMIT 1),'') as process_id
     </select>
+
+    <select id="selectFlowCardMerge">
+        select *
+        from pp.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 = ogd.order_id and od.order_number = ogd.order_number
+        where fc.process_id = #{processId}
+        GROUP BY fc.order_id, fc.process_id, ogd.glass_child
+    </select>
+
+    <update id="updateFlowCardMerge">
+        update  pp.flow_card fc set fc.merge=1
+        where fc.process_id = #{processId}
+    </update>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0