From 76bf2824bf55e8f4c3ccbc14b3b2719bf8fb219f Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期二, 03 九月 2024 10:10:47 +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 |   52 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 32 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 92f06ae..3f27de0 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -195,15 +195,17 @@
                ogd.production_id,
                od.product_id,
                od.product_name,
-               SUM(od.quantity)            as quantity,
+               ROUND(SUM(od.quantity)-IFNULL(sum(fc.quantity)/count(fc.technology_number),0))            as quantity,
                SUM(od.compute_gross_area)  as compute_gross_area,
                round(sum(od.perimeter), 2) as perimeter
         from sd.order_detail as od
                  left join
-             (select order_id, order_number, production_id, splitting_status
+             (select order_id, order_number,technology_number, production_id, splitting_status
               from sd.order_glass_detail
               GROUP BY order_id, order_number) as ogd
              on od.order_id = ogd.order_id and od.order_number = ogd.order_number
+                 left join flow_card as fc on fc.order_id = od.order_id and fc.order_number = od.order_number
+            and fc.technology_number=ogd.technology_number
         where od.order_id = #{orderId}
           and ogd.splitting_status = 0
 
@@ -241,7 +243,7 @@
                od.quantity,
                od.compute_gross_area,
                p.total_thickness,
-               od.quantity           as baiscQuantity,
+               ROUND(od.quantity-IFNULL(sum(fc.quantity)/count(fc.technology_number),0))           as baiscQuantity,
                od.compute_gross_area as 'computeGrossArea',
                p.total_thickness     AS 'totalThickness',
                p.thickness,
@@ -266,6 +268,8 @@
                             FROM sd.order_detail
                             WHERE order_id = #{orderId}) as ods
                            on ods.order_id = od.order_id and ods.order_number = od.order_number
+                 left join flow_card as fc on fc.order_id = od.order_id and fc.order_number = od.order_number
+                           and fc.technology_number=ogd.technology_number
         where od.order_id = #{orderId}
           and ogd.production_id = #{productionId}
           and ogd.splitting_status = 0
@@ -480,8 +484,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 +527,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 +566,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 +763,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,7 +887,7 @@
                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,
@@ -945,7 +949,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
@@ -1128,7 +1134,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
@@ -1218,7 +1225,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,
@@ -1264,7 +1271,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
@@ -1501,7 +1509,7 @@
                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,
@@ -1541,7 +1549,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>
 
@@ -1554,8 +1562,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,
@@ -1981,7 +1989,7 @@
                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,
@@ -2019,7 +2027,7 @@
                               ogd.technology_number = fc.technology_number
         where fc.process_id = #{processId}
           and fc.order_number = #{orderNumber}
-        group by fc.process_id, od.order_number, width, height
+        group by od.order_number, width, height
         order by fc.process_id
     </select>
 
@@ -2095,4 +2103,8 @@
         where fc.process_id = #{processId}
     </update>
 
+    <delete id="deleteflowCardSort">
+        delete from flow_card_sort where process_id = #{processId}
+    </delete>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0