From 00860b3f449e5b3289f2809c199dd56ec75d46e3 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 20 十月 2025 08:57:20 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapper/OrderDetlMapper.xml |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/OrderDetlMapper.xml b/src/main/resources/mapper/OrderDetlMapper.xml
index 030c8f9..3cecff7 100644
--- a/src/main/resources/mapper/OrderDetlMapper.xml
+++ b/src/main/resources/mapper/OrderDetlMapper.xml
@@ -68,7 +68,7 @@
         where 1=1
         and order_no = #{orderNo}
         and matnr = #{matnr}
-        <if test="batch!=null">
+        <if test="batch!=null and batch!='' ">
             and batch = #{batch}
         </if>
     </select>
@@ -133,7 +133,26 @@
             and order_no like '%' + #{orderNo} + '%'
         </if>
         and matnr = #{matnr}
-        and batch = #{batch}
+        <choose>
+            <when test="batch != null and batch!=''  ">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </select>
+    <select id="selectCountToAsrByMatnr" resultType="java.lang.Long">
+        SELECT ISNULL(SUM(anfme), 0) FROM asr_loc_detl WHERE matnr = #{matnr}
+        <if test="batch!=null and batch!='' ">
+            and batch = #{batch}
+        </if>
+    </select>
+    <select id="selectCountToManByMatnr" resultType="java.lang.Long">
+        SELECT ISNULL(SUM(anfme), 0) FROM man_loc_detl WHERE matnr = #{matnr}
+        <if test="batch!=null and batch!='' ">
+            and batch = #{batch}
+        </if>
     </select>
 
     <update id="increase">
@@ -211,4 +230,36 @@
         </choose>
     </update>
 
+    <update id="increaseAnfme">
+        update man_order_detl
+        set anfme = anfme + #{qty}
+        where 1=1
+        and order_id = #{orderId}
+        and matnr = #{matnr}
+        <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 man_order_detl
+        set work_qty = work_qty + #{qty}
+        where 1=1
+        and order_no = #{orderNo}
+        and matnr = #{matnr}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
 </mapper>

--
Gitblit v1.9.1