From 74a80161d264f597b827ef91fcd9230be407d7f4 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 02 九月 2025 16:52:46 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/LocDetlMapper.xml |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 70de3ea..21166f4 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -98,7 +98,7 @@
             and a.anfme like '%' + #{anfme} + '%'
         </if>
         <if test="batch!=null and batch!='' ">
-            and a.batch like  #{batch}
+            and a.batch like  '%' + #{batch} + '%'
         </if>
         <if test="startTime!=null and endTime!=null">
             and a.modi_time between #{startTime} and #{endTime}
@@ -106,13 +106,20 @@
         <if test="crnNo!=null and crnNo!='' ">
             and b.crn_no=#{crnNo}
         </if>
+        <if test="specs!=null and specs!='' ">
+            and a.specs=#{specs}
+        </if>
+        <if test="model!=null and model!='' ">
+            and a.model=#{model}
+        </if>
+
     </sql>
 
     <select id="getStockOutPage" resultMap="BaseResultMap">
         select * from
         (
         select
-        ROW_NUMBER() over (order by a.appe_time,a.matnr,a.loc_no) as row,
+        ROW_NUMBER() over (order by a.source desc, a.appe_time,a.matnr,a.loc_no) as row,
         a.*
         from asr_loc_detl a
         left join asr_loc_mast b on a.loc_no = b.loc_no
@@ -120,6 +127,7 @@
         and b.loc_sts = 'F'
         <include refid="stockOutCondition"></include>
         ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+
     </select>
 
     <select id="getStockOutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
@@ -205,6 +213,7 @@
         where 1=1
         and b.loc_sts = 'F'
         and a.matnr = #{matnr}
+        and b.loc_attribute = 1
         <!--        <choose>-->
         <!--            <when test="batch != null and batch != ''">-->
         <!--                and a.batch = #{batch}-->
@@ -322,5 +331,18 @@
         where loc_no=#{locNo}
     </select>
 
+    <select id="selectByMatnr" resultType="com.zy.asrs.entity.LocDetl">
+        select * from asr_loc_detl where matnr=#{matnr}
+    </select>
 
+    <select id="selectMatnrSpecs" resultMap="BaseResultMap">
+        select
+            top 1 *
+        from asr_loc_detl a
+                 left join asr_loc_mast b on a.loc_no = b.loc_no
+        where 1=1
+          and b.loc_no = #{locNo}
+          and a.matnr = #{matnr}
+          and a.specs = #{specs}
+    </select>
 </mapper>

--
Gitblit v1.9.1