From 10a26b9b670efef0a2adba675c794c539846aa3c Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期五, 06 九月 2024 10:18:10 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml |   61 ++++++++++++++++++++++++++----
 1 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml b/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
index b440d69..d6accb8 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
@@ -9,7 +9,7 @@
 
 
     <!--鑾峰彇琛ョ墖鏁版嵁-->
-    <select id="SelectReplenish" >
+    <select id="SelectReplenish"  >
         select
         r.id,
         r.review_status,
@@ -22,7 +22,7 @@
         o.batch,
         od.building_number,
         od.product_name,
-        ogd.technology_number,
+        r.technology_number,
         ogd.glass_address,
         r.patch_num,
         od.width,
@@ -38,15 +38,17 @@
         r.patch_processes,
         r.reviewer,
         date(r.create_time) as create_time,
-        date(r.update_time) as update_time
+        date(r.update_time) as update_time,
+        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber
         from pp.patch_log r left join sd.order_detail od on r.order_id=od.order_id and r.order_sort=od.order_number
         left join sd.`order` o on r.order_id = o.order_id
         left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd
         on r.order_id = ogd.order_id and r.order_sort = ogd.order_number
         <where>
             date(r.create_time)>=#{startDate} and date(r.create_time) &lt;= #{endDate}
+            and o.create_order>0
         </where>
-         order by r.review_status
+         order by r.review_status,r.id desc
         limit #{offset},#{pageSize};
     </select>
 
@@ -88,6 +90,7 @@
         update pp.patch_log set reviewer=#{userName},review_status=1,update_time=now() where id=#{patchLog.id}
     </update>
 
+
     <update id="updateOrderProcessDetail"  >
         update sd.order_process_detail
         set reporting_work_num=reporting_work_num - #{patchLog.patchNum}
@@ -109,6 +112,11 @@
         update pp.damage_details set quantity=quantity+#{patchLog.patchNum},patch_status=1 where id=#{patchLog.reviewer}
     </update>
 
+    <update id="updateReportingWorkDetail"  >
+        update pp.reporting_work_detail set patch_status=1 where reporting_work_id=#{reportingWorkId}
+                                          and order_number=#{orderSort} and technology_number=#{technologyNumber}
+    </update>
+
 
     <select id="getSelectReplenish">
         select date(rw.reporting_work_time) as reportingWorkTime,
@@ -128,7 +136,8 @@
                od.width,
                od.height,
                od.shape,
-               dd.responsible_process as patchProcesses,
+               dd.responsible_process as responsibleProcess,
+               rw.this_process as patchProcesses,
                dd.breakage_quantity-dd.quantity as breakageQuantity,
                dd.return_process as patchProcesses,
                dd.breakage_reason as patchReason,
@@ -137,7 +146,7 @@
                dd.responsible_equipment as responsibleEquipment,
                dd.responsible_team as responsibleTeam,
                ROUND((dd.breakage_quantity-dd.quantity) * od.width * od.height / 1000000, 2) as patchArea,
-               rw.qualityIns_pector as qualityInsPector
+               rw.quality_inspector as qualityInspector
         from pp.damage_details dd
                  left join	pp.reporting_work_detail rwd on dd.reporting_work_id = rwd.reporting_work_id and dd.order_number=rwd.order_number  and dd.technology_number=rwd.technology_number
                  left join pp.reporting_work rw on dd.reporting_work_id = rw.reporting_work_id
@@ -147,9 +156,45 @@
                  left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd
                            on rw.order_id = ogd.order_id and dd.order_number = ogd.order_number
 
-        where  dd.breakage_quantity-dd.quantity>0 and dd.available=0 and (dd.responsible_process=rw.this_process or (dd.responsible_process!=rw.this_process and dd.qualityIns_status=1))
-
+        where  dd.breakage_quantity-dd.quantity>0 and dd.available=0 and (dd.responsible_process=rw.this_process or (dd.quality_ins_status!=1)) and rw.reviewed_state!=-1
+          and o.create_order>0
+        order by dd.id desc
     </select>
 
+    <delete id="deleteReplenishMp">
+        delete from pp.patch_log where patch_id=#{patchId}
+    </delete>
+
+    <update id="updatePatchDdMp">
+        update pp.damage_details set patch_status=0,quantity=quantity-#{qualityInspector}
+     where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber}
+    </update>
+
+    <update id="updatePatchBgMp">
+        update pp.reporting_work_detail set patch_status=0
+        where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber}
+    </update>
+
+    <update id="updateOrderProcessDetailCancel">
+        update sd.order_process_detail
+        set reporting_work_num=reporting_work_num + #{patchLog.patchNum}
+        where order_id = #{patchLog.orderId}
+          and process_id = #{patchLog.processId}
+          and order_number = #{patchLog.orderSort}
+          and technology_number = #{patchLog.technologyNumber}
+          and id <![CDATA[<]]> (select a.opdid
+                                from (select id as opdid
+                                      from sd.order_process_detail opd
+                                      where opd.order_id = #{patchLog.orderId}
+                                        and opd.process_id = #{patchLog.processId}
+                                        and opd.order_number = #{patchLog.orderSort}
+                                        and opd.technology_number = #{patchLog.technologyNumber}
+                                        and process = #{reportingWork.thisProcess}) as a)
+    </update>
+
+    <update id="updateReplenishCancel">
+        update pp.patch_log set reviewer=null,review_status=0,update_time=now() where id=#{patchLog.id}
+    </update>
+
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0