From 958883d6f4dac68fcbbccadb4e7f87e963eee0e8 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 09 七月 2025 12:32:40 +0800
Subject: [PATCH] 新增盘点提取库存后可以删除明细

---
 zy-asrs-common/src/main/resources/mapper/wms/OrderDetlMapper.xml |  120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 119 insertions(+), 1 deletions(-)

diff --git a/zy-asrs-common/src/main/resources/mapper/wms/OrderDetlMapper.xml b/zy-asrs-common/src/main/resources/mapper/wms/OrderDetlMapper.xml
index 21c299c..be427a1 100644
--- a/zy-asrs-common/src/main/resources/mapper/wms/OrderDetlMapper.xml
+++ b/zy-asrs-common/src/main/resources/mapper/wms/OrderDetlMapper.xml
@@ -17,10 +17,40 @@
         </if>
     </sql>
 
-    <select id="selectItem" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
+    <select id="selectWorkingDetls" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
         select * from wms_order_detl
         where 1=1
         and order_id = #{orderId}
+        and qty &lt; anfme
+    </select>
+
+    <select id="selectDetls" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
+        select * from wms_order_detl
+        where 1=1
+          and order_id = #{orderId}
+          and host_id = #{hostId}
+    </select>
+
+    <select id="selectItem" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
+        select top 1 * from wms_order_detl
+        where 1=1
+        and order_id = #{orderId}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+<!--            <otherwise>-->
+<!--                and (batch IS NULL OR batch = '')-->
+<!--            </otherwise>-->
+        </choose>
+    </select>
+
+    <select id="selectItem2" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
+        select * from wms_order_detl
+        where 1=1
+        and order_no = #{orderNo}
         and matnr = #{matnr}
         <choose>
             <when test="batch != null and batch != ''">
@@ -45,4 +75,92 @@
         <include refid="pakOutPageCondition"></include>
     </select>
 
+    <update id="increase">
+        update wms_order_detl
+        set qty = qty + #{qty}
+        where 1=1
+        and order_id = #{orderId}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
+    <update id="decrease">
+        update wms_order_detl
+        set work_qty = work_qty - #{qty}
+        where 1=1
+        and order_no = #{orderNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
+    <update id="increaseQtyByOrderNo">
+        update wms_order_detl
+        set qty = qty + #{qty}
+        where 1=1
+        and order_no = #{orderNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
+    <update id="increaseWorkQtyByOrderNo">
+        update wms_order_detl
+        set work_qty = work_qty + #{qty}
+        where 1=1
+        and order_no = #{orderNo}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
+    <update id="increaseWorkQty">
+        update wms_order_detl
+        set work_qty = work_qty + #{workQty}
+        where 1=1
+        and order_id = #{orderId}
+        and matnr = #{matnr}
+        and host_id = #{hostId}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
+    <insert id="addToLogTable">
+        INSERT INTO man_order_detl_log SELECT * FROM man_order_detl WHERE id = #{id}
+    </insert>
 </mapper>

--
Gitblit v1.9.1