From 413a7e27886bcc87bbd8aaf995f09dbe82cb17e7 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期二, 06 五月 2025 14:56:08 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 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 2ac2c08..7e9e30c 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
@@ -37,7 +37,7 @@
         r.quality_inspector,
         r.patch_processes,
         r.reviewer,
-        date(r.create_time) as create_time,
+        r.create_time as create_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
@@ -213,15 +213,18 @@
                 and r.reviewer regexp #{patchLog.reviewer}
             </if>
         </where>
-              ) as zu
-        limit #{offset},#{pageSize};
+        ) as zu
     </select>
 
 
 
 
     <select id="getMaximum" >
-        select count(*) from pp.patch_log where  date(create_time)=CURDATE()
+        SELECT IFNULL(patch_id,'00')
+        FROM patch_log
+        WHERE DATE(create_time) = CURDATE()
+        ORDER BY create_time DESC
+            LIMIT 1;
     </select>
 
 
@@ -307,7 +310,7 @@
                            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.quality_ins_status!=1)) and rw.reviewed_state!=-1
-                and o.create_order>0
+                and o.create_order>0 and dd.patch_status=0
             <if test="patchLogAddDTO.orderId != null and patchLogAddDTO.orderId != ''">
                 and o.order_id regexp #{patchLogAddDTO.orderId}
             </if>
@@ -373,13 +376,14 @@
     </select>
 
     <delete id="deleteReplenishMp">
-        delete from pp.patch_log where patch_id=#{patchId}
+        delete from pp.patch_log where id=#{id}
     </delete>
 
-    <update id="updatePatchDdMp">
-        update pp.damage_details set patch_status=0,quantity=quantity-#{qualityInspector}
+    <delete id="updatePatchDdMp">
+        delete from pp.damage_details
      where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber}
-    </update>
+        and breakage_reason=#{patchReason}
+    </delete>
 
     <update id="updatePatchBgMp">
         update pp.reporting_work_detail set patch_status=0
@@ -407,5 +411,11 @@
         update pp.patch_log set reviewer=null,review_status=0,update_time=now() where id=#{patchLog.id}
     </update>
 
+    <select id="selectProjectCount">
+        SELECT COUNT(*)
+        FROM patch_log
+        WHERE process_id= #{processId} and patch_id=#{patchId} and technology_number = #{technologyNumber}
+          and project_no IS not NULL;
+    </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0