From b7e08df5a07b3fa832a46ecc31983e16f2bccc8c Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 24 七月 2023 14:56:01 +0800
Subject: [PATCH] # 出库作业,和库存明细管理 排序

---
 src/main/resources/mapper/LocDetlMapper.xml |  159 ++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 140 insertions(+), 19 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index e72c016..230be50 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -55,6 +55,31 @@
         <if test="startTime!=null and endTime!=null">
             and a.modi_time between #{startTime} and #{endTime}
         </if>
+        <if test="memo!=null and memo!='' ">
+            and (
+               a.loc_no like '%' + #{memo} + '%'
+            or a.mat_no like '%' + #{memo} + '%'
+            or a.mat_name like '%' + #{memo} + '%'
+            or a.qty like '%' + #{memo} + '%'
+            or a.str3 like '%' + #{memo} + '%'
+            or a.unit like '%' + #{memo} + '%'
+            or a.specs like '%' + #{memo} + '%'
+            or a.size like '%' + #{memo} + '%'
+            or a.color like '%' + #{memo} + '%'
+            or a.supplier like '%' + #{memo} + '%'
+            or a.zpallet like '%' + #{memo} + '%'
+            or a.source like '%' + #{memo} + '%'
+            or a.vendor like '%' + #{memo} + '%'
+            or a.qty_box like '%' + #{memo} + '%'
+            or a.str3 like '%' + #{memo} + '%'
+            or a.str4 like '%' + #{memo} + '%'
+            or a.str5 like '%' + #{memo} + '%'
+            or a.memo like '%' + #{memo} + '%'
+            )
+        </if>
+        <if test="crnNo!=null and crnNo!='' ">
+            and b.crn_no=#{crnNo}
+        </if>
     </sql>
 
     <sql id="stockOutCondition1">
@@ -64,16 +89,80 @@
     <if test="mat_name!=null and mat_name!='' ">
         and mat_name like '%' + #{mat_name} + '%'
     </if>
+    <if test="supplier!=null and supplier!=''" >
+        and supplier like '%'+#{supplier}+'%'
+    </if>
     <if test="str3!=null and str3!=''" >
         and str3 like '%'+#{str3}+'%'
     </if>
+    <if test="str4!=null and str4!=''" >
+        and str4 like '%'+#{str4}+'%'
+    </if>
+    <if test="memo!=null and memo!='' ">
+        and (
+        mat_no like '%' + #{memo} + '%'
+        or mat_name like '%' + #{memo} + '%'
+        or qty like '%' + #{memo} + '%'
+        or str3 like '%' + #{memo} + '%'
+        or unit like '%' + #{memo} + '%'
+        or specs like '%' + #{memo} + '%'
+        or size like '%' + #{memo} + '%'
+        or color like '%' + #{memo} + '%'
+        or supplier like '%' + #{memo} + '%'
+        or source like '%' + #{memo} + '%'
+        or vendor like '%' + #{memo} + '%'
+        or qty_box like '%' + #{memo} + '%'
+        or str3 like '%' + #{memo} + '%'
+        or str4 like '%' + #{memo} + '%'
+        or str5 like '%' + #{memo} + '%'
+        or memo like '%' + #{memo} + '%'
+        )
+    </if>
+    </sql>
+
+    <sql id="stockOutCondition2">
+        <if test="matNo!=null and matNo!='' ">
+            and mat_no like '%' + #{matNo} + '%'
+        </if>
+        <if test="matName!=null and matName!='' ">
+            and mat_name like '%' + #{matName} + '%'
+        </if>
+        <if test="supplier!=null and supplier!=''" >
+            and supplier like '%'+#{supplier}+'%'
+        </if>
+        <if test="str3!=null and str3!=''" >
+            and str3 like '%'+#{str3}+'%'
+        </if>
+        <if test="str4!=null and str4!=''" >
+            and str4 like '%'+#{str4}+'%'
+        </if>
+        <if test="memo!=null and memo!='' ">
+            and (
+            mat_no like '%' + #{memo} + '%'
+            or mat_name like '%' + #{memo} + '%'
+            or qty like '%' + #{memo} + '%'
+            or str3 like '%' + #{memo} + '%'
+            or unit like '%' + #{memo} + '%'
+            or specs like '%' + #{memo} + '%'
+            or size like '%' + #{memo} + '%'
+            or color like '%' + #{memo} + '%'
+            or supplier like '%' + #{memo} + '%'
+            or source like '%' + #{memo} + '%'
+            or vendor like '%' + #{memo} + '%'
+            or qty_box like '%' + #{memo} + '%'
+            or str3 like '%' + #{memo} + '%'
+            or str4 like '%' + #{memo} + '%'
+            or str5 like '%' + #{memo} + '%'
+            or memo like '%' + #{memo} + '%'
+            )
+        </if>
     </sql>
 
     <select id="getStockOutPage" resultMap="BaseResultMap">
         select * from
         (
             select
-            ROW_NUMBER() over (order by a.appe_time,a.mat_no,a.loc_no) as row,
+            ROW_NUMBER() over (order by a.supplier,a.mat_no,a.loc_no) as row,
             a.*
             from asr_loc_detl a
             left join asr_loc_mast b on a.loc_no = b.loc_no
@@ -81,7 +170,7 @@
             and b.loc_sts = 'F'
             <include refid="stockOutCondition"></include>
         ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
-        order by supplier,modi_time,loc_no
+        order by supplier,appe_time,loc_no
     </select>
 
     <select id="getStockOutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
@@ -108,45 +197,77 @@
         where loc_no=#{locNo}
     </select>
     <select id="getStockStatis" resultMap="BaseResultMap">
-<!--        select a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from-->
-<!--        (-->
-<!--        select-->
-<!--        ROW_NUMBER() over (order by c.appe_time,c.mat_no,c.loc_no) as row,-->
-<!--        c.*-->
-<!--        from asr_loc_detl c-->
-<!--        ) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})-->
-<!--         <include refid="stockOutCondition"></include>-->
-<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3-->
-
         select * from
         (
         select ROW_NUMBER() over (order by a.mat_no) as row,
-        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from
+        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty,sum(all_qty) allQty, specs,unit,color,qty_box,weight,str4,str5  from
         (
         select
-        mat_name,mat_no,supplier,str3,qty
+        mat_name,mat_no,str3,qty,all_qty,specs,unit,color,qty_box,weight,str4,str5
         from asr_loc_detl c
         where 1=1
         <include refid="stockOutCondition1"></include>
         ) a
-        group by a.mat_no,a.mat_name,a.supplier,a.str3
+        group by a.mat_no,a.mat_name,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
         ) d
         where 1=1
         and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+        order by mat_no,specs
+<!--        select * from-->
+<!--        (-->
+<!--        select ROW_NUMBER() over (order by a.mat_no) as row,-->
+<!--        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from-->
+<!--        (-->
+<!--        select-->
+<!--        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5-->
+<!--        from asr_loc_detl c-->
+<!--        where 1=1-->
+<!--        <include refid="stockOutCondition1"></include>-->
+<!--        ) a-->
+<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5-->
+<!--        ) d-->
+<!--        where 1=1-->
+<!--        and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})-->
+<!--        order by a.mat_no,a.supplier-->
     </select>
     <select id="getStockStatisCount" resultType="integer">
+        select count(1) from
+        (
+        select ROW_NUMBER() over (order by a.mat_no) as row,
+        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from
+        (
         select
-        count(1)
-        from asr_loc_detl a
+        mat_name,mat_no,str3,qty,specs,unit,color,qty_box,weight,str4,str5
+        from asr_loc_detl c
+        where 1=1
+        <include refid="stockOutCondition1"></include>
+        ) a
+        group by a.mat_no,a.mat_name,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
+        ) d
+<!--        select count(1) from-->
+<!--        (-->
+<!--        select ROW_NUMBER() over (order by a.mat_no) as row,-->
+<!--        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from-->
+<!--        (-->
+<!--        select-->
+<!--        mat_name,mat_no,supplier,str3,qty,specs,unit,color,qty_box,weight,str4,str5-->
+<!--        from asr_loc_detl c-->
+<!--        where 1=1-->
+<!--        <include refid="stockOutCondition1"></include>-->
+<!--        ) a-->
+<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5-->
+<!--        ) d-->
     </select>
+<!--    <select id="getStockStatisExcel" resultType="com.zy.asrs.entity.LocDetl">-->
     <select id="getStockStatisExcel" resultMap="BaseResultMap">
      select
         ROW_NUMBER() over (order by a.mat_no, sum(a.qty) desc) as row
-        , a.mat_no, a.mat_name,a.supplier
+        , a.mat_no, a.mat_name,a.supplier,str3,specs,unit,color,qty_box as qtyBox,weight,str4,str5
         , sum(a.qty) as qty
         from asr_loc_detl a
         where 1=1
-        group by a.mat_no,a.mat_name,a.supplier
+        <include refid="stockOutCondition2"></include>
+        group by a.mat_no,a.mat_name,a.supplier,a.str3,a.specs,a.unit,a.color,a.qty_box,a.weight,a.str4,a.str5
     </select>
 
 <!--    <select id="getStockSum" resultMap="BaseResultMap">-->

--
Gitblit v1.9.1