From 76bf2824bf55e8f4c3ccbc14b3b2719bf8fb219f Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期二, 03 九月 2024 10:10:47 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 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 76714ad..b6d53d3 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -83,11 +83,13 @@
                           process_id,a.reporting_work_id
                    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 b.technology_number=#{technologyStr}) as rw
+                   where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr}
+                     and  POSITION(b.technology_number in #{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
         where fc.process_id = #{processIdStr}
-          and fc.technology_number = #{technologyStr}
+          and POSITION(fc.technology_number in #{technologyStr})
           and if(#{reportType}=1,o.order_type!='鏍峰搧璁㈠崟',o.order_id!='')
         GROUP BY fc.process_id
     </select>
@@ -106,11 +108,13 @@
 
     <!--    鏌ヨ娴佺▼鍗″伐鑹烘祦绋�-->
     <select id="SelectTechnologicalProcess">
-        select ogd.process
-        from sd.order_glass_detail as ogd
-        where ogd.production_id = LEFT(#{processIdStr}, 11)
-          and ogd.technology_number=#{technologyStr}
-        limit 1
+        select ifnull((select ogd.process
+                       from sd.order_glass_detail as ogd
+                       left join sd.`order` as o on o.order_id=ogd.order_id
+                       where ogd.production_id = LEFT(#{processIdStr}, 11)
+                         and o.create_order>0
+                         and POSITION(ogd.technology_number in #{technologyStr})
+                       limit 1),'') as  process
 
     </select>
 
@@ -160,7 +164,7 @@
                 where
                 reporting_work.this_process = #{process}
                 and a.process_id=#{processIdStr}
-                and a.technology_number =  #{technologyStr}
+                and POSITION(a.technology_number in #{technologyStr})
                 and a.review_status = 1
                 group by a.process_id,a.order_sort,a.technology_number
             ) as patch
@@ -171,9 +175,11 @@
 
         WHERE
             fc.process_id = #{processIdStr}
-          AND fc.technology_number = #{technologyStr}
+          AND  POSITION(fc.technology_number in #{technologyStr})
           AND odpd.process = #{process}
           and if(#{reportType}=1,o.order_type!='鏍峰搧璁㈠崟',o.order_id!='')
+        group by fc.order_number,
+                 ogd.technology_number
         order by fc.order_number
     </select>
 
@@ -206,12 +212,12 @@
         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 == '澶硅兌'">
+        <if test="process == '澶硅兌' or (process == '鎵撹兌鍜岀矘妗�' and previousProcess=='澶硅兌')">
             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}
+                               and POSITION(technology_number in #{technologyStr})
                                limit 1)
         </if>
 
@@ -248,8 +254,8 @@
 
         WHERE
             fc.process_id = #{processIdStr}
-        <if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰'">
-           AND fc.technology_number = #{technologyStr}
+        <if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰' and process != '鎵撹兌鍜岀矘妗�' ">
+           AND POSITION(fc.technology_number in #{technologyStr})
         </if>
         AND odpd.process = #{process}
         order by fc.order_number
@@ -501,7 +507,7 @@
         select rw.reporting_work_id,
                (rw.reporting_work_time) as reporting_work_time,
                o.order_id,
-               rw.process_id,
+               CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct rwd.technology_number SEPARATOR '')) as process_id,
                o.project,
                o.batch,
                rw.this_process,
@@ -524,6 +530,7 @@
           and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
           and position(#{orderId} in rw.order_id)
           and rw.reviewed_state!=-1
+          and o.create_order>0
         <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''">
             and rw.reporting_work_id regexp #{reportingWork.reportingWorkId}
         </if>
@@ -565,6 +572,7 @@
         where rw.reviewed_state != 2
           and rw.reporting_work_time between #{selectTime1} and #{selectTime2} and position(#{orderId} in rw.order_id)
           and rw.reviewed_state!=-1
+          and o.create_order>0
         <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''">
             and rw.reporting_work_id regexp #{reportingWork.reportingWorkId}
         </if>
@@ -796,7 +804,7 @@
             left join reporting_work_detail as rwd on rw.reporting_work_id = rwd.reporting_work_id
         set rw.reviewed_state = 1
         where rw.process_id = #{substring} and rw.this_process=#{process}
-          and rwd.technology_number = #{result} and reviewed_state=0
+          and POSITION(rwd.technology_number in #{result}) and reviewed_state=0
     </update>
 
     <select id="getPatchConditionMp">

--
Gitblit v1.8.0