From ce06fcc3113dc45647910deef0e4adeaa97bfa3f Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 15 十月 2025 13:32:40 +0800
Subject: [PATCH] 语言修改

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |   85 ++++++++++++++++++++++++++++--------------
 1 files changed, 56 insertions(+), 29 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 a8921fe..4b457d3 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -84,7 +84,7 @@
                    from reporting_work as a
                        left join reporting_work_detail as b on a.reporting_work_id = b.reporting_work_id
                    where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr}
-                     and  POSITION(b.technology_number in #{technologyStr})
+                     and  FIND_IN_SET(b.technology_number , #{technologyStr})
                    ) as rw
         on rw.process_id = fc.process_id
         left join reporting_work_detail as rwd on rw.reporting_work_id = rwd.reporting_work_id and rwd.technology_number=fc.technology_number
@@ -102,7 +102,7 @@
     </select>
 
     <select id="SelectWorkBasicTeamsMp">
-        select * from erp_user_info.`user` WHERE address=#{process}
+        select id,login_name,user_name,address from erp_user_info.`user` WHERE address=#{process}
     </select>
 
     <!--    鏌ヨ娴佺▼鍗″伐鑹烘祦绋�-->
@@ -113,7 +113,7 @@
                        left join flow_card as fc on fc.order_id=o.order_id and fc.order_number=ogd.order_number and fc.technology_number=ogd.technology_number
                        where fc.process_id = #{processIdStr}
                          and o.create_order>0
-                         and POSITION(fc.technology_number in #{technologyStr})
+                         and FIND_IN_SET(fc.technology_number , #{technologyStr})
                        limit 1),'') as  process
 
     </select>
@@ -135,12 +135,14 @@
             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   as quantity,
-            fc.quantity -fc.export_number + ifnull(patch.patch_num,0) -odpd.reporting_work_num -odpd.broken_num   as completedQuantity,
+            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,
             odpd.reporting_work_num as completed,
             odpd.broken_num as onceBroken,
             if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag, -- 鍒ゆ柇鏄惁宸茬粡瀹屾垚锛屽凡缁忓畬鎴愪笉搴忓彿鍜屽悓搴忓彿鏁伴噺鐩稿悓鎵嶈兘鎻愪氦
-            od.other_columns
+        if(ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'')!='',
+            ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),''),
+            od.building_number) as s01Value
         FROM
             sd.order_detail AS od
         LEFT JOIN sd.order_glass_detail AS ogd
@@ -164,7 +166,7 @@
                 where
                 reporting_work.this_process = #{process}
                 and a.process_id=#{processIdStr}
-                and POSITION(a.technology_number in #{technologyStr})
+                and FIND_IN_SET(a.technology_number , #{technologyStr})
                 and a.review_status = 1
                 group by a.process_id,a.order_sort,a.technology_number
             ) as patch
@@ -175,10 +177,10 @@
 
         WHERE
             fc.process_id = #{processIdStr}
-          AND  POSITION(fc.technology_number in #{technologyStr})
+          AND  FIND_IN_SET(fc.technology_number , #{technologyStr})
           AND odpd.process = #{process}
           and if(#{reportType}=1,o.order_type!='鏍峰搧璁㈠崟',o.order_id!='')
-        and o.create_order>0
+        and o.create_order>0 and fc.quantity - ifnull(fc.termination_quantity,0)>0
         group by fc.order_number,
                  ogd.technology_number
         order by fc.order_number
@@ -206,7 +208,10 @@
         ogd.`group`,
         if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag, -- 鍒ゆ柇鏄惁宸茬粡瀹屾垚锛屽凡缁忓畬鎴愪笉搴忓彿鍜屽悓搴忓彿鏁伴噺鐩稿悓鎵嶈兘鎻愪氦
         od.other_columns,
-        ogd.id as 'glassId',IFNULL(rws.reviewed_state,0) as reviewed_state
+        ogd.id as 'glassId',IFNULL(rws.reviewed_state,0) as reviewed_state,
+        if(ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'')!='',
+        ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),''),
+        od.building_number) as s01Value
 
         FROM
         sd.order_detail AS od
@@ -218,7 +223,7 @@
             from sd.order_glass_detail
             where order_id = ogd.order_id
             and order_number = ogd.order_number
-            and POSITION(technology_number in #{technologyStr})
+            and  FIND_IN_SET(technology_number , #{technologyStr})
             limit 1)
         </if>
 
@@ -257,7 +262,7 @@
         left join reporting_work_detail as b on a.reporting_work_id = b.reporting_work_id
         where this_process=#{previousProcess} and process_id= #{processIdStr} and a.reviewed_state>=0
         <if test="laminating == ''">
-            AND POSITION(b.technology_number in #{technologyStr})
+            AND FIND_IN_SET(b.technology_number , #{technologyStr})
         </if>
         GROUP BY b.order_number,b.technology_number
         ) as rws
@@ -267,7 +272,7 @@
 
         AND odpd.process = #{process}
         <if test="laminating == ''">
-            AND POSITION(fc.technology_number in #{technologyStr})
+            AND FIND_IN_SET(fc.technology_number , #{technologyStr})
         </if>
         order by fc.order_number
     </select>
@@ -298,8 +303,8 @@
 
     <select id="historyTeamsMp">
         SELECT
-            bdp.id,
-            bdp.basic_type,
+            bd.id,
+            bd.basic_type,
             rw.teams  as basic_name,
             bd.basic_name,bd.id AS basic_category,
             rw.process
@@ -411,7 +416,7 @@
 
 <!--鏌ヨ淇敼鎶ュ伐鏄庣粏鏁版嵁-->
     <select id="selectByReportingWorkId" >
-        select
+        select * from(select
             a.reporting_work_id,
             d.order_number,
             d.glass_child,
@@ -422,13 +427,17 @@
             d.child_height,
             if(e.shape=1,'鏅舰',if(e.shape=2,'寮傚舰','')) as shape,
             if(ifnull(a.completed_quantity+a.breakage_quantity,0)=0,
-                c.quantity-ifnull(a.completed_quantity+a.breakage_quantity,0),
+                0,
                 ifnull(a.completed_quantity+a.breakage_quantity,0)) as 'quantity', -- 鍙姤宸ユ暟
             ifnull(a.completed_quantity,0) as 'completedQuantity', -- 瀹屽伐鏁�
+            ifnull(a.completed_quantity,0) as 'completedQuantityComputed', -- 瀹屽伐鏁�
             ifnull(a.breakage_quantity,0) as 'breakageQuantity', -- 鐮存崯鏁�
             ifnull(f.completed_quantity,0) as thisQuantitySum ,-- 鏈伐搴忓畬宸ュ拰
             if(c.quantity-f.completed_quantity = 0 ,true,false) as saveFlag,
             e.other_columns,
+        if(ifnull(JSON_UNQUOTE(JSON_EXTRACT(e.other_columns, '$.S01')),'')!='',
+        ifnull(JSON_UNQUOTE(JSON_EXTRACT(e.other_columns, '$.S01')),''),
+        e.building_number) as s01Value,
         IF(count(pl.id)>0,'宸茶ˉ鐗�','') as patchStatusOther,
 
             <if test="nextProcess != null and nextProcess != ''">  -- 闈炴渶鍚庝竴閬撳伐搴�
@@ -437,19 +446,19 @@
                     -ifnull(g.completed_quantity,0))
                     >
                    a.completed_quantity,
-                a.completed_quantity,
+                (a.completed_quantity+ a.breakage_quantity),
                    (f.completed_quantity
-                       -ifnull(g.completed_quantity,0))
+                       -ifnull(g.completed_quantity,0) + a.breakage_quantity)
                     )  as minQuantity -- 淇敼鏈�灏忔暟
             </if>
             <if test="nextProcess == null or nextProcess == ''">  -- 鏈�鍚庝竴閬撳伐搴�
-#               c.received_quantity, -- 宸插叆搴撴暟閲�
-#               c.inventory_quantity, --   搴撳瓨鏁伴噺
+               c.received_quantity, -- 宸插叆搴撴暟閲�
+               c.inventory_quantity, --   搴撳瓨鏁伴噺
               if(ifnull(inventory_quantity,0)
                  -ifnull(c.received_quantity,0)
-                 &gt;= a.completed_quantity,0,
-                (a.completed_quantity-(ifnull(c.inventory_quantity,0)
-                    -ifnull(c.received_quantity,0)))
+                 &gt;= a.completed_quantity,a.completed_quantity,
+                (ifnull(c.inventory_quantity,0)
+                -ifnull(c.received_quantity,0))
                 )
                 as minQuantity -- 淇敼鏈�灏忔暟
             </if>
@@ -481,6 +490,7 @@
                        from reporting_work as rw
                        left join  reporting_work_detail  as rwd
                        on rw.reporting_work_id = rwd.reporting_work_id
+              where rw.reviewed_state>-1
                        group by rw.process_id,
                                 rw.this_process,
                                 rwd.order_number,
@@ -512,6 +522,7 @@
         </if>
         where b.reporting_work_id = #{reportingWorkId}
         GROUP BY c.order_number,c.technology_number
+        order BY c.order_number,c.technology_number) as result
     </select>
 <select id="selectReportingWorkMp" resultMap="reportingWorkMap">
     select rw.reporting_work_id,
@@ -540,8 +551,8 @@
 
             left join sd.`order` as o on o.order_id=rw.order_id
         where rw.reviewed_state != 2
-          and rw.reporting_work_time >= #{selectTime1}
-    AND rw.reporting_work_time &lt;  #{selectTime2}
+          and date(rw.reporting_work_time) >= date(#{selectTime1})
+    AND date(rw.reporting_work_time) &lt;=  date(#{selectTime2})
           and position(#{orderId} in rw.order_id)
           and rw.reviewed_state!=-1
           and o.create_order>0
@@ -552,7 +563,8 @@
             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}
@@ -918,6 +930,11 @@
 
                           SELECT * FROM sd.basic_data
                           WHERE basic_type='product' AND basic_category='process' AND basic_name='閽㈠寲'
+
+                          UNION
+
+                          SELECT * FROM sd.basic_data
+                          WHERE basic_type='product' AND basic_category='process' AND basic_name='鐑集'
                       ) AS combined_results;
     </select>
 
@@ -1035,8 +1052,8 @@
         AND ogd.technology_number = rwd.technology_number*/
         LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id
         WHERE rw.reviewed_state != 2
-        and rw.reporting_work_time >= #{selectTime1}
-        AND rw.reporting_work_time &lt;  #{selectTime2}
+        and date(rw.reporting_work_time) >= date(#{selectTime1})
+        AND date(rw.reporting_work_time) &lt;=  date(#{selectTime2})
         AND position(#{orderId} in rw.order_id)
         AND rw.reviewed_state != -1
         AND o.create_order > 0
@@ -1097,4 +1114,14 @@
         GROUP BY rw.reporting_work_id
         ORDER BY rw.reporting_work_id desc
     </select>
+
+    <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}
+    </select>
+
+    <select id="mesSelectWorkBasicTeamsMp">
+        select id,login_name,user_name,address from erp_user_info.`user`
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0