From 0c8c0da73efb15fc92c23c023acaed2d1860e0aa Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 04 七月 2024 11:02:30 +0800
Subject: [PATCH] #

---
 zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml |   68 +++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml b/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
index 33a25e8..1be1642 100644
--- a/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
+++ b/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
@@ -16,15 +16,15 @@
     <select id="selectAndLogByOrderNoGroupByMatnrOfSum" resultType="com.zy.asrs.common.wms.entity.WrkDetl">
         select awd.wrk_no, awd.io_time, awd.matnr, sum(awd.anfme) as anfme
         from wms_wrk_detl awd
-                 left join wms_wrk_mast awm on awd.wrk_no = awm.wrk_no and awd.io_time = awm.io_time
+        left join wms_wrk_mast awm on awd.wrk_mast_id = awm.id and awd.host_id = awm.host_id
         where order_no = #{orderNo}
         group by awd.wrk_no, awd.io_time, awd.matnr
         union
         select distinct awdl.wrk_no, awdl.io_time, awdl.matnr, sum(awdl.anfme) as anfme
         from wms_wrk_detl_log awdl
-                 left join wms_wrk_mast_log awml on awdl.wrk_no = awml.wrk_no and awdl.io_time = awml.io_time
+        left join wms_wrk_mast_log awml on awdl.wrk_mast_id = awml.id and awdl.host_id = awml.host_id
         where awdl.order_no = #{orderNo}
-          and (awml.manu_type is null or awml.manu_type != '鎵嬪姩鍙栨秷')
+        and (awml.manu_type is null or awml.manu_type != '鎵嬪姩鍙栨秷')
         group by awdl.wrk_no, awdl.io_time, awdl.matnr
     </select>
 
@@ -40,18 +40,60 @@
     </update>
 
     <select id="selectAndLogByOrderNo" resultType="com.zy.asrs.common.wms.entity.WrkDetl">
-        select awd.*
-        from wms_wrk_detl awd
-                 left join wms_wrk_mast awm on awd.wrk_no = awm.wrk_no and awd.io_time = awm.io_time
+        select wd.*
+        from wms_wrk_detl wd
+        left join wms_wrk_mast wm on wd.wrk_mast_id = wm.id and wd.host_id = wm.host_id
         where order_no = #{orderNo}
-        and host_id = #{hostId}
+        and wd.host_id = #{hostId}
         union
-        select distinct awdl.*
-        from wms_wrk_detl_log awdl
-                 left join wms_wrk_mast_log awml on awdl.wrk_no = awml.wrk_no and awdl.io_time = awml.io_time
-        where awdl.order_no = #{orderNo}
-          and host_id = #{hostId}
-          and (awml.manu_type is null or awml.manu_type != '鎵嬪姩鍙栨秷')
+        select distinct wdl.*
+        from wms_wrk_detl_log wdl
+        left join wms_wrk_mast_log wml on wdl.wrk_mast_id = wml.id and wdl.host_id = wml.host_id
+        where wdl.order_no = #{orderNo}
+        and wdl.host_id = #{hostId}
+        and (wml.manu_type is null or wml.manu_type != '鎵嬪姩鍙栨秷')
     </select>
 
+    <select id="selectPakoutQuery" resultType="com.zy.asrs.common.wms.entity.WrkDetl">
+        select
+        awd.*
+        from wms_wrk_detl awd
+        left join asr_wrk_mast awm on awd.wrk_mast_id = awm.id and awd.host_id = awm.host_id
+        where 1=1
+        and awm.wrk_sts = 199
+        and (awd.inspect is null or awd.inspect = 0)
+        and awm.sta_no = #{staNo}
+        and awd.matnr + '-' + awd.batch = #{matnr}
+    </select>
+
+    <update id="updateInspect">
+        update wms_wrk_detl
+        set inspect = 1
+        where 1=1
+        and wrk_no = #{wrkNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <include refid="batchSeq"></include>
+    </update>
+
+    <delete id="deleteItem">
+        delete from wms_wrk_detl
+        where 1=1
+        and wrk_no = #{wrkNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <include refid="batchSeq"></include>
+    </delete>
+
+    <update id="updateAnfme">
+        update wms_wrk_detl
+        set anfme = #{anfme}
+        , modi_time = getdate()
+        where 1=1
+        and wrk_no = #{wrkNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <include refid="batchSeq"></include>
+    </update>
+
 </mapper>

--
Gitblit v1.9.1