自动化立体仓库 - WMS系统
#
18516761980
2022-04-07 8e41c3abbae355b626158a276c08ee68d9afd0f5
src/main/resources/mapper/LocDetlMapper.xml
@@ -89,9 +89,73 @@
    <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">
@@ -146,32 +210,50 @@
        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.supplier,a.str3,sum(a.qty) qty,specs,unit,color,qty_box,weight,str4,str5  from
        (
        select
        mat_name,mat_no,supplier,str3,qty
        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
        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})
    </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.supplier,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,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-->
<!--        count(1)-->
<!--        from asr_loc_detl a-->
<!--        where 1=1-->
<!--        <include refid="stockOutCondition1"></include>-->
    </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">-->