From 1750abd11320f8d09ffe1580b7467dba87c86c89 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期三, 10 十二月 2025 14:40:25 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml |   73 ++++++++++++++++++++++++++++++++----
 1 files changed, 64 insertions(+), 9 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml
index 61f5e42..d513211 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml
@@ -6,7 +6,7 @@
 
     <insert id="insertOrderProcessDetail" >
         insert into
-            order_process_detail(
+            sd.order_process_detail(
                 order_id,
                 order_number,
                 technology_number,
@@ -78,11 +78,13 @@
                             when 'stepA' then 3
                             when 'stepD' then 4
                             when 'stepB' then 4
-                     end as sort
+                            else 1
+                     end as sortByprocess,
+                    b.sort as 'sort2'
 
 
         from order_process_detail
-        left join (select DISTINCT basic_name,nickname from basic_data where basic_category = 'process') as b
+        left join (select DISTINCT basic_name,nickname,sort from basic_data where basic_category = 'process') as b
         on b.basic_name = process
         where order_id = #{orderId}
         group by process) as a
@@ -99,7 +101,7 @@
                                                     group by opd.id) as a
                     GROUP BY process)   as sort1
         on sort1.process = a.process
-        order by sort,sort1.count,id
+        order by sortByprocess,sort1.count,sort2,id
 
     </select>
 
@@ -118,7 +120,9 @@
     <select id="getGlassLRow">
         select
              max(a.technology_number) as rowCount,
-             RowNum
+             RowNum,
+             a.order_number,
+             a.process_id
         from pp.flow_card as a
         left join
             (select min((@i:=@i+1)) AS RowNum,c.*
@@ -130,7 +134,7 @@
         on b.id = a.id
         where a.order_id = #{orderId}
         group by a.order_number,a.process_id
-        order by RowNum
+        order by a.process_id,a.order_number
 
     </select>
 
@@ -214,13 +218,24 @@
     </select>
 
     <select id="selectShiftQuantitySv">
-        select * from(select CAST(concat(b.order_id,'/',a.order_number,'/',a.technology_number) as char ) as 'order_id',
+        select *
+        <if test="step != null and step != ''">
+            ,sum(e.break) as 'breakage_quantity'
+            ,Round(sum(e.break)*e.area,2) as 'breakage_area'
+        </if>
+        <if test="step == null || step == ''">
+            ,e.break as 'breakage_quantity'
+            ,Round(e.break*e.area,2) as 'breakage_area'
+        </if>
+        from(select CAST(concat(b.order_id,'/',a.order_number,'/',a.technology_number) as char ) as 'order_id',
                c.child_width,
                c.child_height,
                a.completed_quantity,
-               a.breakage_quantity,
+               a.breakage_quantity as break,
                a.order_number,
-               b.reporting_work_id
+               b.reporting_work_id,
+               round(c.area*a.completed_quantity,2) as finish_area,
+               c.area
         from pp.reporting_work as b
         left join pp.reporting_work_detail as a
             on a.reporting_work_id = b.reporting_work_id
@@ -252,4 +267,44 @@
                   and b.process = #{thisProcess}
                 )
     </select>
+
+    <select id="selectProcessCardProgressSv">
+        select a.*,(b.quantity-b.termination_quantity) as 'quantity'
+        from order_process_detail as a
+        inner join pp.flow_card as b
+            on a.order_id = b.order_id
+            and a.process_id = b.process_id
+            and a.order_number = b.order_number
+            and a.technology_number = b.technology_number
+        where termination_status = 0
+          <if test="orderId != null and orderId != ''">
+            and a.order_id=#{orderId}
+          </if>
+          <if test="processId != null and processId != ''">
+            and a.process_id=#{processId}
+          </if>
+          <if test="orderNumber != null and orderNumber != ''">
+            and a.order_number=#{orderNumber}
+          </if>
+          <if test="technologyNumber != null and technologyNumber != ''">
+            and a.technology_number=#{technologyNumber}
+          </if>
+          <if test="process != null and process != ''">
+            and a.process=#{process}
+          </if>
+
+    </select>
+    
+    <select id="selectProcessSort">
+        select a.process,
+               ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS sort,
+               ifnull(b.nickname,"") as recombination
+        from sd.order_process_detail as a
+        inner join sd.basic_data as b
+                on a.process = b.basic_name and b.basic_category = 'process'
+                where a.order_id = #{orderId}
+                and a.process_id = #{processId}
+                and a.order_number =#{orderNumber}
+                and a.technology_number =#{technologyNumber}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0