From d3bf3d3917d8201d64e8e2c66e99afb7099487f9 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 23 十月 2025 17:01:23 +0800
Subject: [PATCH] 13

---
 src/main/resources/mapper/LocDetlMapper.xml |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 9deabb8..fbc5a32 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -53,10 +53,10 @@
     <sql id="batchSeq">
         <choose>
             <when test="batch != null and batch != ''">
-                and batch = #{batch}
+                and sku = #{batch}
             </when>
             <otherwise>
-                and (batch IS NULL OR batch = '')
+                and (sku IS NULL OR sku = '')
             </otherwise>
         </choose>
     </sql>
@@ -67,7 +67,14 @@
         where 1=1
         and loc_no = #{locNo}
         and matnr = #{matnr}
-        <include refid="batchSeq"></include>
+        <choose>
+            <when test="batch != null and batch != ''">
+                and sku = #{batch}
+            </when>
+            <otherwise>
+                and (sku IS NULL OR sku = '')
+            </otherwise>
+        </choose>
     </select>
 
     <delete id="deleteItem">
@@ -75,7 +82,14 @@
         where 1=1
         and loc_no = #{locNo}
         and matnr = #{matnr}
-        <include refid="batchSeq"></include>
+        <choose>
+            <when test="batch != null and batch != ''">
+                and sku = #{batch}
+            </when>
+            <otherwise>
+                and (sku IS NULL OR sku = '')
+            </otherwise>
+        </choose>
     </delete>
 
     <update id="updateAnfme">
@@ -85,7 +99,14 @@
         where 1=1
         and loc_no = #{locNo}
         and matnr = #{matnr}
-        <include refid="batchSeq"></include>
+        <choose>
+            <when test="batch != null and batch != ''">
+                and sku = #{batch}
+            </when>
+            <otherwise>
+                and (sku IS NULL OR sku = '')
+            </otherwise>
+        </choose>
     </update>
 
     <sql id="stockOutCondition">
@@ -245,8 +266,9 @@
         </if>
 
         order by
-        DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme
-        desc,
+        sku,
+        <!-- DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme
+        desc, -->
         NEWID(),
         case
         when (left(a.loc_no, 2) = '01') then 0

--
Gitblit v1.9.1