From 74afa7174d1f6159aa2f7d2404903b36e13cef1f Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 10 三月 2025 14:46:18 +0800
Subject: [PATCH] 流程卡分家删除部分已分流程卡后重新分架数量不正确问题,次破报表后端求和sql语法错误调整

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 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 5d3fedf..6be0699 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -211,7 +211,7 @@
                ogd.production_id,
                od.product_id,
                od.product_name,
-               ROUND(SUM(od.quantity)-IFNULL(sum(fc.quantity)/count(fc.technology_number),0))            as quantity,
+               ROUND(SUM(DISTINCT od.quantity)-IFNULL(sum(fc.quantity)/fc.layers_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
@@ -272,7 +272,7 @@
                od.quantity,
                od.compute_gross_area,
                p.total_thickness,
-               ROUND(od.quantity-IFNULL(sum(fc.quantity)/count(fc.technology_number),0))           as baiscQuantity,
+               ROUND(od.quantity-IFNULL(sum(fc.quantity)/fc.layers_number,0))           as baiscQuantity,
                od.compute_gross_area as 'computeGrossArea',
                p.total_thickness     AS 'totalThickness',
                ifnull(p.thickness,'') as thickness,
@@ -289,7 +289,7 @@
         from 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
-                 left join sd.product as p on od.product_name = p.product_name
+                 left join sd.product as p on od.product_id = p.id
                  left join (SELECT order_id,
                                    order_number,
                                    JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S01')) AS S01,
@@ -2858,7 +2858,7 @@
     </select>
 
     <select id="flowCardToOptimizeCount">
-        select count(*) from pp.flow_card where order_id = #{orderId} and engineering_occupancy=1
+        select count(*) from pp.flow_card where order_id = #{orderId} and project_no is not null
     </select>
 
     <select id="getFlowCardDetail" >
@@ -2899,13 +2899,28 @@
     
     <select id="getOrderDetailByProductionId">
         select * from (select a.*,
+                              a.quantity as 'baiscQuantity',
+                              #{glassThickness} as 'thickness',
         IF(a.height >= a.width, a.height, a.width) as 'long',
         IF(a.height &lt; a.width, a.height, a.width) as 'short'
         from sd.order_detail as a
         left join sd.order_glass_detail as b
         on a.order_id = b.order_id and a.order_number = b.order_number
         where a.order_id = #{orderId} and b.production_id = #{productionId}
+
         group by a.order_number) as c
+        <if test="type=='scope'">
+            where  c.`long` &lt;= #{inLenMax}
+                and c.`long` >= #{inLenMin}
+                and c.`short` >= #{inShortMin}
+                and c.`short` &lt;= #{inShortMax}
+        </if>
+        <if test="type=='notScope'">
+            where  !(c.`long` &lt;= #{inLenMax}
+            and c.`long` >= #{inLenMin}
+            and c.`short` >= #{inShortMin}
+            and c.`short` &lt;= #{inShortMax})
+        </if>
         order by c.`long` desc
     </select>
 
@@ -2938,7 +2953,7 @@
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                  AS glassNumber,
                od.order_number,
                ogd.child_width as width,
-               ogd.child_height as height,
+               ogd.child_height as height
         from sd.order_glass_detail as ogd
                  left join sd.order_detail as od on od.order_id = ogd.order_id and od.order_number = ogd.order_number
                  left join sd.`order` as o on o.order_id = ogd.order_id

--
Gitblit v1.8.0