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/LocDetlMapper.xml |   85 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 69 insertions(+), 16 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index ab1462b..dd66c92 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -48,11 +48,11 @@
 
     <sql id="batchSeq">
         <choose>
-            <when test="batch != null and batch != ''">
+            <when test="batch != null">
                 and batch = #{batch}
             </when>
             <otherwise>
-                and (batch IS NULL OR batch = '')
+                and (batch IS NULL)
             </otherwise>
         </choose>
     </sql>
@@ -100,6 +100,15 @@
         <if test="startTime!=null and endTime!=null">
             and a.modi_time between #{startTime} and #{endTime}
         </if>
+        <if test="batch!=null and batch!='' ">
+            and a.batch=#{batch}
+        </if>
+        <if test="crnNo!=null and crnNo!='' ">
+            and b.crn_no=#{crnNo}
+        </if>
+        <if test="zpallet!=null and zpallet!='' ">
+            and a.zpallet like '%' + #{zpallet} + '%'
+        </if>
     </sql>
 
     <select id="getStockOutPage" resultMap="BaseResultMap">
@@ -129,28 +138,44 @@
     <select id="getStockStatis" 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
-            where 1=1
-            <include refid="stockOutCondition"></include>
-            group by a.matnr
-         ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+        select
+        ROW_NUMBER() over (order by sum(a.anfme) desc) as row
+        , a.matnr
+        , sum(a.anfme) as anfme
+        from asr_loc_detl a
+        where 1=1
+        <!-- 鍔ㄦ�佹坊鍔犺鏍煎拰绫诲瀷鐨勬潯浠� -->
+        <if test="specs != null and specs != ''">
+            AND a.specs = #{specs}
+        </if>
+        <if test="brand != null and brand != ''">
+            AND a.brand = #{brand}
+        </if>
+        <include refid="stockOutCondition"></include>
+        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
+        select count(1) as count from
         (
         select
         a.matnr
         from asr_loc_detl a
         where 1=1
+        <!-- 鍔ㄦ�佹坊鍔犺鏍煎拰绫诲瀷鐨勬潯浠� -->
+        <if test="specs != null and specs != ''">
+            AND a.specs = #{specs}
+        </if>
+        <if test="brand != null and brand != ''">
+            AND a.brand = #{brand}
+        </if>
         <include refid="stockOutCondition"></include>
         group by a.matnr
-     ) b
+        ) b
     </select>
+
 
     <select id="getStockStatisExcel" resultType="com.zy.asrs.entity.LocDetl">
         select
@@ -207,11 +232,11 @@
 <!--                and (a.batch IS NULL OR a.batch = '')-->
 <!--            </otherwise>-->
 <!--        </choose>-->
-        <if test="batch != null and batch != ''">
+        <if test="batch != null">
             and a.batch = #{batch}
         </if>
         <if test="orderNo != null and orderNo != ''">
-            and a.orderNo = #{orderNo}
+            and a.order_no = #{orderNo}
         </if>
 
         <if test="locNos != null and locNos.size > 0">
@@ -291,11 +316,39 @@
     <select id="queryStockTotal" resultType="com.zy.asrs.entity.result.StockVo">
         select
         matnr,
+        maktx,
+        specs,
         batch,
         count(anfme) as count
         from asr_loc_detl
         where 1=1
-        group by matnr,batch
+        group by matnr,maktx,specs,batch
     </select>
+    <select id="sum" resultType="java.lang.Integer">
+        SELECT SUM(anfme) FROM asr_loc_detl
+    </select>
+    <select id="unreason" resultMap="BaseResultMap">
+        SELECT
+            *
+        FROM
+            [dbo].[asr_loc_detl]
+        WHERE
+            DATALENGTH( batch ) != 11 or
+            batch LIKE '%[a-z]%'
+    </select>
+
+    <select id="selectLocDetlSumQty" resultType="double">
+        select SUM(anfme) anfme
+        from asr_loc_detl
+        where loc_no=#{locNo}
+    </select>
+
+    <select id="getBomQyt" resultType="double">
+        select SUM(anfme) anfme
+        from asr_loc_detl
+        where bom_code = #{bomCode}
+        and matnr = #{matnr}
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.1