From 64126dfd00ed90af484fbf7b173e00fcebc4f9fa Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 24 五月 2023 15:56:11 +0800
Subject: [PATCH] 入库通知档和历史档增加mat_type物料类型,组托增加mat_type

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

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index 65c7636..e88f471 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -78,6 +78,8 @@
         update asr_loc_detl
         set anfme = #{anfme}
         , modi_time = getdate()
+        , manu = #{manu}
+        , memo = #{memo}
         where 1=1
         and loc_no = #{locNo}
         and matnr = #{matnr}
@@ -94,8 +96,17 @@
         <if test="maktx!=null and maktx!='' ">
             and a.maktx like '%' + #{maktx} + '%'
         </if>
+        <if test="specs!=null and specs!='' ">
+            and a.specs like '%' + #{specs} + '%'
+        </if>
         <if test="anfme!=null and anfme!='' ">
             and a.anfme like '%' + #{anfme} + '%'
+        </if>
+        <if test="zpallet!=null and zpallet!='' ">
+            and a.zpallet like '%' + #{zpallet} + '%'
+        </if>
+        <if test="manu!=null and manu!='' ">
+            and a.manu like '%' + #{manu} + '%'
         </if>
         <if test="startTime!=null and endTime!=null">
             and a.modi_time between #{startTime} and #{endTime}
@@ -122,7 +133,7 @@
         select * from
         (
             select
-            ROW_NUMBER() over (order by a.appe_time,a.matnr,a.loc_no) as row,
+            ROW_NUMBER() over (order by a.loc_no,a.appe_time,a.matnr) as row,
             a.*
             from asr_loc_detl a
             left join asr_loc_mast b on a.loc_no = b.loc_no
@@ -231,78 +242,138 @@
         (
             select
             no = 1,
+            orderBy = 'false',
             b.bay1 as bay,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 1
             and b.row1 &lt;= 3
             group by b.bay1
             union
             select
             no = 2,
+            orderBy = 'true',
             b.bay1,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 4
             and b.row1 &lt;= 7
             group by b.bay1
             union
             select
             no = 3,
+            orderBy = 'false',
             b.bay1,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 8
             and b.row1 &lt;= 11
             group by b.bay1
             union
             select
             no = 4,
+            orderBy = 'true',
             b.bay1,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 12
             and b.row1 &lt;= 14
             group by b.bay1
             union
             select
             no = 5,
+            orderBy = 'false',
             b.bay1,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 15
             and b.row1 &lt;= 18
             group by b.bay1
             union
             select
             no = 6,
+            orderBy = 'true',
             b.bay1,
             sum(anfme) as count
             from asr_loc_detl a
             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 != ''">
+                    and a.batch = #{batch}
+                </when>
+                <otherwise>
+                    and (a.batch IS NULL OR a.batch = '')
+                </otherwise>
+            </choose>
             and b.row1 >= 19
             and b.row1 &lt;= 21
             group by b.bay1
@@ -363,9 +434,20 @@
             </if>
         )
         and a.matnr = #{matnr}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and a.batch = #{batch}
+            </when>
+            <otherwise>
+                and (a.batch IS NULL OR a.batch = '')
+            </otherwise>
+        </choose>
         and b.bay1 = #{bay}
         and b.loc_sts = 'F' and b.frozen != 1
-        order by b.row1 asc
+        order by b.row1
+        <if test="orderBy != null and orderBy != '' and orderBy == 'false'">
+            desc
+        </if>
     </select>
 
     <select id="queryStockAnfme" resultType="java.lang.Double">

--
Gitblit v1.9.1