From 68d7be0814e89ef811c2e7c435dff7af64ea60c1 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期二, 03 十二月 2024 10:11:21 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |  128 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 121 insertions(+), 7 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 79f2ed6..cd6fa30 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -430,11 +430,11 @@
                 ifnull(g.completed_quantity,0) as nextQuantitySum,  -- 鍚庡伐搴忓凡瀹屾垚
                 if((f.completed_quantity
                     -ifnull(g.completed_quantity,0))
-                    &gt;=
+                    >
                    a.completed_quantity,
                     0,
-                   (a.completed_quantity-f.completed_quantity
-                       +ifnull(g.completed_quantity,0))
+                   (f.completed_quantity
+                       -ifnull(g.completed_quantity,0))
                     )  as minQuantity -- 淇敼鏈�灏忔暟
             </if>
             <if test="nextProcess == null or nextProcess == ''">  -- 鏈�鍚庝竴閬撳伐搴�
@@ -533,7 +533,7 @@
                            on rwd.reporting_work_id = rw.reporting_work_id and rwd.order_number = ogd.order_number and
                               rwd.technology_number = ogd.technology_number
         where rw.reviewed_state != 2
-          and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
+          and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
           and position(#{orderId} in rw.order_id)
           and rw.reviewed_state!=-1
           and o.create_order>0
@@ -576,7 +576,7 @@
                            on rwd.reporting_work_id = rw.reporting_work_id and rwd.order_number = ogd.order_number and
                               rwd.technology_number = ogd.technology_number
         where rw.reviewed_state != 2
-          and rw.reporting_work_time between #{selectTime1} and #{selectTime2} and position(#{orderId} in rw.order_id)
+          and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') 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 != ''">
@@ -705,7 +705,7 @@
 
                  left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id
         where rw.reviewed_state != 2
-          and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
+          and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
           and position(#{processId} in rw.process_id)
           and position(#{state} in dd.quality_ins_status)
           and rw.reviewed_state!=-1
@@ -735,7 +735,7 @@
 
                  left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id
         where rw.reviewed_state != 2
-          and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
+          and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
           and position(#{processId} in rw.process_id)
           and position(#{state} in dd.quality_ins_status)
           and rw.reviewed_state!=-1
@@ -886,4 +886,118 @@
         where reporting_work_id=#{reportingWorkId} and order_number = #{orderSort}
           and technology_number = #{technologyNumber}
     </update>
+
+    <select id="selectUserProcess">
+        select address from erp_user_info.user where login_name=#{userId}
+    </select>
+
+    <select id="getSelectProcessJiajiao">
+        SELECT * FROM (
+                          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>
+
+    <select id="getSelectProcessDuoqu">
+        SELECT * FROM (
+                          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>
+
+    <select id="SelectReworlDetailMpReview">
+        SELECT
+        fc.order_number,
+        ogd.glass_child,
+        ogd.technology_number,
+        ogd.glass_address,
+        fc.quantity AS quantity_card,
+        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,
+        odpd.reporting_work_num as completed,
+        odpd.broken_num as onceBroken,
+        ogd.`group`,
+        if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag, -- 鍒ゆ柇鏄惁宸茬粡瀹屾垚锛屽凡缁忓畬鎴愪笉搴忓彿鍜屽悓搴忓彿鏁伴噺鐩稿悓鎵嶈兘鎻愪氦
+        od.other_columns,
+        ogd.id as 'glassId'
+        ,rws.reviewed_state
+        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 == '澶硅兌' 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 POSITION(technology_number in #{technologyStr})
+            limit 1)
+        </if>
+
+
+        LEFT JOIN flow_card AS fc
+        ON fc.order_id = ogd.order_id
+        and fc.production_id=ogd.production_id
+        AND fc.order_number = ogd.order_number
+        AND fc.technology_number = ogd.technology_number
+        left join sd.order_process_detail as odpd
+        ON  odpd.order_id = fc.order_id
+        AND odpd.order_number = fc.order_number
+        AND odpd.technology_number = fc.technology_number
+        and odpd.process_id = fc.process_id
+        left join sd.order_process_detail as odpds
+        ON  odpds.id = odpd.id-1
+        left join
+        (SELECT
+        sum(rw.rework_num) as 'patchNumSum',
+        rw.process_id,rw.order_sort,rw.technology_number,
+        rwk.this_process
+        from
+        rework as rw
+        LEFT JOIN
+        reporting_work as rwk
+        on rw.reporting_work_id =rwk.reporting_work_id
+        where rwk.this_process=#{process}
+        and rw.review_status=0
+        and rw.process_id = #{processIdStr}
+        GROUP BY rw.process_id,rw.order_sort,rw.technology_number) as c
+        on c.process_id = fc.process_id
+        and c.order_sort = fc.order_number
+        and c.technology_number = fc.technology_number
+        left join (select reviewed_state as reviewed_state ,
+        process_id,a.reporting_work_id,b.technology_number,b.order_number
+        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})
+        GROUP BY a.reporting_work_id,b.order_number,b.technology_number
+        ) as rws
+        on rws.process_id = fc.process_id and rws.order_number=fc.order_number and rws.technology_number=fc.technology_number
+        WHERE
+        fc.process_id = #{processIdStr}
+        <if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰' and process != '鎵撹兌鍜岀矘妗�' ">
+            AND POSITION(fc.technology_number in #{technologyStr})
+        </if>
+        AND odpd.process = #{process}
+        and rws.reviewed_state=0
+        order by fc.order_number
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0