From ebd793bbc910b095aaa15d9e733324bbeb8b94a9 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 12 一月 2026 08:13:08 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapper/LocDetlMapper.xml |   96 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 6726429..ad33ebc 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -44,6 +44,7 @@
         <result column="appe_user" property="appeUser" />
         <result column="appe_time" property="appeTime" />
         <result column="memo" property="memo" />
+        <result column="owner" property="owner" />
     </resultMap>
 
     <sql id="batchSeq">
@@ -107,6 +108,12 @@
         </if>
         <if test="manu!=null and manu!='' ">
             and a.manu like '%' + #{manu} + '%'
+        </if>
+        <if test="batch!=null and batch!='' ">
+            and a.batch like '%' + #{batch} + '%'
+        </if>
+        <if test="owner!=null and owner!='' ">
+            and a.owner = #{owner}
         </if>
         <if test="startTime!=null and endTime!=null">
             and a.modi_time between #{startTime} and #{endTime}
@@ -185,6 +192,42 @@
         ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
     </select>
 
+    <select id="getStockStatisDate" resultType="com.zy.asrs.entity.LocDetl">
+        select * from
+        (
+        select
+        ROW_NUMBER() over (order by a.anfme,a.batch desc) as row
+        , a.matnr
+        , a.loc_no as locNo
+        , a.batch
+        , a.anfme
+        , a.modi_time as modiTime
+        from asr_loc_detl a
+        where 1=1
+        <include refid="stockOutCondition"></include>
+        group by a.matnr,a.batch,a.anfme, a.loc_no, a.modi_time
+        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+    </select>
+
+    <select id="getStockStatisOut" resultType="com.zy.asrs.entity.LocDetl">
+        select * from
+        (
+        select
+        ROW_NUMBER() over (order by sum(a.anfme) desc) as row
+        , a.matnr
+        , sum(a.anfme) as anfme
+        from asr_loc_detl a
+        left join man_mat m
+        on m.matnr = a.matnr
+        where 1=1
+        <include refid="stockOutCondition"></include>
+        <if test="matType !=null and matType !='' ">
+            and m.mat_type = #{matType}
+        </if>
+        group by a.matnr
+        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+    </select>
+
     <select id="getStockStatisCount" parameterType="java.util.Map" resultType="java.lang.Integer">
      select count(1) as count from
         (
@@ -195,6 +238,35 @@
         <include refid="stockOutCondition"></include>
         group by a.matnr
      ) b
+    </select>
+
+    <select id="getStockStatisDateCount" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select count(1) as count from
+        (
+        select
+        a.matnr
+        from asr_loc_detl a
+        where 1=1
+        <include refid="stockOutCondition"></include>
+        group by a.matnr
+        ) b
+    </select>
+
+    <select id="getStockStatisOutCount" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select count(1) as count from
+        (
+        select
+        a.matnr
+        from asr_loc_detl a
+        left join man_mat m
+        on m.matnr = a.matnr
+        where 1=1
+        <include refid="stockOutCondition"></include>
+        <if test="matType !=null and matType !='' ">
+            and m.mat_type = #{matType}
+        </if>
+        group by a.matnr
+        ) b
     </select>
 
     <select id="getStockStatisExcel" resultType="com.zy.asrs.entity.LocDetl">
@@ -252,7 +324,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -275,7 +346,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -298,7 +368,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -321,7 +390,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -344,7 +412,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -367,7 +434,6 @@
             left join asr_loc_mast b on a.loc_no = b.loc_no
             where 1=1
             and b.loc_sts = 'F' and b.frozen != 1
-            and a.manu is null
             and a.matnr = #{matnr}
             <choose>
                 <when test="batch != null and batch != ''">
@@ -512,9 +578,17 @@
         SELECT  *  FROM [dbo].[asr_loc_detl_group] WHERE 1 = 1
         <include refid="groupListCondition"></include>
     </select>
+
     <select id="selectByLocNo" resultMap="BaseResultMap">
         SELECT * FROM asr_loc_detl WHERE loc_no = #{locNo}
+    </select>
 
+    <select id="selectByLocNosAndMatnr" resultMap="BaseResultMap">
+        SELECT * FROM asr_loc_detl WHERE loc_no in
+        <foreach item="item" collection="locNos" index="index"  separator="," open="(" close=")">
+            #{item}
+        </foreach>
+        and matnr = #{matnr}
     </select>
 
     <select id="searchByLike" resultMap="BaseResultMap">
@@ -539,4 +613,14 @@
         </if>
     </select>
 
+    <select id="findAreaByMatnr" resultMap="BaseResultMap">
+        select * from asr_loc_detl ld
+        left join asr_loc_mast lm
+        on lm.loc_no = ld.loc_no
+        where matnr = #{matnr}
+        and loc_type2 = #{locType2}
+        and loc_sts = 'F'
+        order by row1,bay1,lev1,ld.appe_time
+    </select>
+
 </mapper>

--
Gitblit v1.9.1