From 7e68f7b8bf6c67be60faeac758511650c61c6f6d Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 29 十二月 2023 15:30:56 +0800
Subject: [PATCH] #

---
 zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 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 4a1b937..33a25e8 100644
--- a/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
+++ b/zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
@@ -2,4 +2,56 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zy.asrs.common.wms.mapper.WrkDetlMapper">
 
+    <sql id="batchSeq">
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </sql>
+
+    <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
+        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
+        where awdl.order_no = #{orderNo}
+          and (awml.manu_type is null or awml.manu_type != '鎵嬪姩鍙栨秷')
+        group by awdl.wrk_no, awdl.io_time, awdl.matnr
+    </select>
+
+    <update id="updateOrderNo">
+        update wms_wrk_detl
+        set order_no = #{orderNo}
+        , modi_time = getdate()
+        where 1=1
+        and wrk_no = #{wrkNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <include refid="batchSeq"></include>
+    </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
+        where order_no = #{orderNo}
+        and 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>
+
 </mapper>

--
Gitblit v1.9.1