From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index 7a14b0f..636a063 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -37,6 +37,7 @@
         <association property="flowCard" javaType="com.example.erp.entity.pp.FlowCard">
             <result property="orderId" column="order_id"/>
             <result property="productionId" column="production_id"/>
+            <result property="processId" column="processIdFirst"/>
         </association>
         <association property="reportingWorkDetail" javaType="com.example.erp.entity.pp.ReportingWorkDetail">
             <result property="completedQuantity" column="completed_quantity"/>
@@ -69,6 +70,7 @@
     <select id="AddSelectLastWorkMp" resultMap="reportingWorkMap">
         select o.order_id,
                fc.production_id,
+               fc.process_id as 'processIdFirst',
                o.customer_id,
                o.customer_name,
                o.project,
@@ -135,8 +137,15 @@
             ogd.child_width,
             ogd.child_height,
             if(od.shape=1,'鏅舰',if(od.shape=2,'寮傚舰','')) as shape,
-            fc.quantity -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num - ifnull(fc.termination_quantity,0)  as quantity,
-            fc.quantity -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num - ifnull(fc.termination_quantity,0)   as completedQuantity,
+        IF(odpd.reporting_work_num>=fc.quantity-fc.termination_quantity,
+        (fc.quantity  -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num),
+        IF((fc.quantity - ifnull(fc.termination_quantity,0) -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num )&lt;0,0,
+            (fc.quantity - ifnull(fc.termination_quantity,0) -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num)))
+        as quantity,
+        IF(odpd.reporting_work_num>=fc.quantity-fc.termination_quantity,
+        (fc.quantity  -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num),
+        IF((fc.quantity - ifnull(fc.termination_quantity,0) -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num )&lt;0,0,
+            (fc.quantity - ifnull(fc.termination_quantity,0) -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num)))   as completedQuantity,
             odpd.reporting_work_num as completed,
             odpd.broken_num as onceBroken,
             if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag, -- 鍒ゆ柇鏄惁宸茬粡瀹屾垚锛屽凡缁忓畬鎴愪笉搴忓彿鍜屽悓搴忓彿鏁伴噺鐩稿悓鎵嶈兘鎻愪氦
@@ -197,12 +206,23 @@
         ogd.child_width,
         ogd.child_height,
         if(od.shape=1,'鏅舰',if(od.shape=2,'寮傚舰','')) as shape,
-        if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num ) &lt; 0,
-        0,
-        odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as quantity,
-        if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) &lt; 0,
-        0,
-        odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as completedQuantity,
+        IF(
+        odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num&lt;=fc.quantity-fc.termination_quantity,
+        IF(odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num=fc.termination_quantity,0,
+            odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num),
+        IF(odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num-fc.termination_quantity&lt;0
+        ,0,
+        odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num-fc.termination_quantity)
+        )
+        AS quantity,
+        IF(
+        odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num&lt;=fc.quantity-fc.termination_quantity,
+        IF(odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num=fc.termination_quantity,0,
+            odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num),
+        IF(odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num-fc.termination_quantity&lt;0
+        ,0,
+        odpds.reporting_work_num_count + ifnull( c.patchNumSum, 0 ) - odpd.reporting_work_num_count - odpd.broken_num-fc.termination_quantity)
+        ) AS completedQuantity,
         odpd.reporting_work_num as completed,
         odpd.broken_num as onceBroken,
         ogd.`group`,
@@ -543,11 +563,11 @@
                 rwd.wornArea
         # (IF(rw.reviewed_state = 0, '鏈鏍�', IF(rw.reviewed_state = 1, '瀹℃牳閫氳繃', '瀹℃牳涓嶉�氳繃'))) as reviewed_state
         from
-            reporting_work as rw
+            pp.reporting_work as rw
     left join (
     SELECT cc.reporting_work_id,cc.goup,round(sum(cc.completedArea),2)  as completedArea ,round(sum(cc.wornArea),2)  as wornArea from  (SELECT rwds.reporting_work_id, GROUP_CONCAT(distinct rwds.technology_number SEPARATOR '') as goup,
     sum(rwds.child_width*rwds.child_height*completed_quantity/1000000)as completedArea,
-    sum(rwds.child_width*rwds.child_height*rwds.breakage_quantity/1000000) as wornArea  from reporting_work_detail as rwds GROUP BY rwds.reporting_work_id,order_number ) as cc GROUP BY cc.reporting_work_id)as rwd on rw.reporting_work_id=rwd.reporting_work_id
+    sum(rwds.child_width*rwds.child_height*rwds.breakage_quantity/1000000) as wornArea  from pp.reporting_work_detail as rwds GROUP BY rwds.reporting_work_id,order_number ) as cc GROUP BY cc.reporting_work_id)as rwd on rw.reporting_work_id=rwd.reporting_work_id
 
             left join sd.`order` as o on o.order_id=rw.order_id
         where rw.reviewed_state != 2
@@ -579,7 +599,7 @@
             and rw.device_name regexp #{reportingWork.deviceName}
         </if>
         <if test="reportingWork.teamsGroupsName != null and reportingWork.teamsGroupsName != ''">
-            and rw.teams_groups_name regexp #{reportingWork.teamsGroupsName}
+            and rw.teams_groups_name like concat('%', #{reportingWork.teamsGroupsName}, '%')
         </if>
         GROUP BY rw.reporting_work_id
         ORDER BY rw.reporting_work_id desc
@@ -1040,11 +1060,11 @@
         ROUND(SUM(rwd.wornArea), 2) AS wornArea,
         CEILING(count(rw.reporting_work_id)/#{pageSize}) as 'pageTotal',
         count(distinct rw.reporting_work_id) as 'total'
-        FROM reporting_work AS rw
+        FROM pp.reporting_work AS rw
         LEFT JOIN
         (SELECT cc.reporting_work_id,cc.goup,round(sum(cc.completedArea),2)  as completedArea ,round(sum(cc.wornArea),2)  as wornArea from  (SELECT rwds.reporting_work_id, GROUP_CONCAT(distinct rwds.technology_number SEPARATOR '') as goup,
         sum(rwds.child_width*rwds.child_height*completed_quantity/1000000)as completedArea,
-        sum(rwds.child_width*rwds.child_height*rwds.breakage_quantity/1000000) as wornArea  from reporting_work_detail as rwds GROUP BY rwds.reporting_work_id,order_number ) as cc GROUP BY cc.reporting_work_id)
+        sum(rwds.child_width*rwds.child_height*rwds.breakage_quantity/1000000) as wornArea  from pp.reporting_work_detail as rwds GROUP BY rwds.reporting_work_id,order_number ) as cc GROUP BY cc.reporting_work_id)
             AS rwd
                 ON rw.reporting_work_id = rwd.reporting_work_id
         /*LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = rw.order_id
@@ -1064,7 +1084,7 @@
             and o.order_id regexp #{reportingWork.orderId}
         </if>
         <if test="reportingWork.processId != null and reportingWork.processId != ''">
-            and rw.process_id regexp #{reportingWork.processId}
+            and CONCAT(rw.process_id,'/',rwd.goup) LIKE CONCAT('%', #{reportingWork.processId}, '%')
         </if>
         <if test="reportingWork.order.project != null and reportingWork.order.project != ''">
             and o.project regexp #{reportingWork.order.project}
@@ -1079,7 +1099,7 @@
             and rw.device_name regexp #{reportingWork.deviceName}
         </if>
         <if test="reportingWork.teamsGroupsName != null and reportingWork.teamsGroupsName != ''">
-            and rw.teams_groups_name regexp #{reportingWork.teamsGroupsName}
+            and rw.teams_groups_name like concat('%', #{reportingWork.teamsGroupsName}, '%')
         </if>
     </select>
 
@@ -1118,10 +1138,10 @@
     <select id="mesSelectWorkBasicDeviceMp">
         SELECT bdp.id,bdp.basic_type,bdp.basic_name, bd.basic_name as basic_category FROM  sd.basic_data as bd left join  `basic_data_produce` as bdp
         on bd.id=bdp.basic_category
-        where bd.basic_category="process" and bdp.basic_type="device" and bd.basic_name = #{process}
+        where bd.basic_category="process" and bdp.basic_type="device"
     </select>
 
     <select id="mesSelectWorkBasicTeamsMp">
-        select id,login_name,user_name,address from erp_user_info.`user`
+        select id,login_name,user_name,address from erp_user_info.`user` where address is not null
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0