From 2780cb79b2239d64f4578e30c255fbd751e12c62 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 12 三月 2024 08:17:01 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/target/classes/mapper/pp/ReportingWork.xml |   41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml b/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
index 2ce4438..333af58 100644
--- a/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/target/classes/mapper/pp/ReportingWork.xml
@@ -9,6 +9,8 @@
         <result property="previousProcess" column="previous_process"/>
         <result property="nextProcess" column="next_process"/>
         <result property="thisProcess" column="this_process"/>
+        <result property="reviewedState" column="reviewed_state"/>
+        <result property="previousProcessQuantity" column="previous_process_quantity"/>
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result property="customerId" column="customer_id"/>
             <result property="customerName" column="customer_name"/>
@@ -17,7 +19,6 @@
         <association property="flowCard" javaType="com.example.erp.entity.pp.FlowCard">
             <result property="orderId" column="order_id"/>
             <result property="productionId" column="production_id"/>
-            <result property="quantity" column="quantity"/>
         </association>
         <association property="reportingWorkDetail" javaType="com.example.erp.entity.pp.ReportingWorkDetail">
             <result property="completedQuantity" column="completed_quantity"/>
@@ -31,14 +32,20 @@
                o.customer_id,
                o.customer_name,
                o.project,
-               SUM(fc.quantity)   as quantity,
+               SUM(fc.quantity)   as previous_process_quantity,
                #{previousProcess} as previous_process,
                #{nextProcess}     as next_process,
-               #{process} as  this_process
+               #{process} as  this_process,
+               ifnull((rw.reviewed_state),1) as reviewed_state  -- 涓嬪伐搴忓鏍哥姸鎬�
         from sd.order as o
-                 left join flow_card as fc on fc.order_id = o.order_id
+        left join flow_card as fc on fc.order_id = o.order_id
+        left join (select if(count(reviewed_state)>0 and process_id=null,1,0) as reviewed_state ,
+                          process_id
+                   from reporting_work
+                   where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr}) as rw
+        on rw.process_id = fc.process_id
         where fc.process_id = #{processIdStr}
-          and position(fc.technology_number in #{technologyStr})
+          and fc.technology_number = #{technologyStr}
         GROUP BY fc.process_id
     </select>
 
@@ -80,7 +87,7 @@
             ogd.child_width,
             ogd.child_height,
             od.shape,
-            fc.quantity -odpd.reporting_work_num + ifnull(c.patchNumSum,0) as quantity,
+            fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
             odpd.reporting_work_num_count as completed,
             odpd.broken_num as onceBroken
         FROM
@@ -123,14 +130,26 @@
             ogd.child_width,
             ogd.child_height,
             od.shape,
-            odpds.reporting_work_num -odpd.reporting_work_num + ifnull(c.patchNumSum,0) as quantity,
+            odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
             odpd.reporting_work_num_count as completed,
-            odpd.broken_num as onceBroken
+            odpd.broken_num as onceBroken,
+            ogd.`group`
+
+
         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
+        <if test="process == '澶硅兌'">
+            AND ogd.`group` = (select `group`
+                               from sd.order_glass_detail
+                               where order_id = ogd.order_id
+                               and order_number = ogd.order_number
+                               and technology_number =#{technologyStr}
+                               limit 1)
+        </if>
+
         LEFT JOIN flow_card AS fc
                 ON fc.order_id = ogd.order_id
                 and fc.production_id=ogd.production_id
@@ -152,8 +171,10 @@
             and c.technology_number = fc.technology_number
         WHERE
             fc.process_id = #{processIdStr}
-          AND fc.technology_number = #{technologyStr}
-          AND odpd.process = #{process}
+        <if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰'">
+           AND fc.technology_number = #{technologyStr}
+        </if>
+        AND odpd.process = #{process}
         order by fc.order_number
     </select>
 

--
Gitblit v1.8.0