自动化立体仓库 - WMS系统
zjj
2023-09-07 607e14a92ba7c0b2dc277591e93104b53274d282
src/main/resources/mapper/LocDetlMapper.xml
@@ -197,18 +197,19 @@
        where loc_no=#{locNo}
    </select>
    <select id="getStockStatis" resultMap="BaseResultMap">
        select * from
        select  * ,str6 as qty_box,(qty * str6) as all_qty from
        (
        select ROW_NUMBER() over (order by a.mat_no) as row,
        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty,sum(all_qty) all_qty, specs,unit,color,qty_box,weight,str4,str5  from
        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty, specs,unit,color,weight,str4,str5,num1,str6  from
        (
        select
        mat_name,mat_no,str3,qty,all_qty,specs,unit,color,qty_box,weight,str4,str5
        c.mat_name,c.mat_no,c.str3,c.qty,c.all_qty,c.specs,c.unit,c.color,c.weight,c.str4,c.str5,m.num1,m.str6
        from asr_loc_detl c
        LEFT JOIN bas_mat_code m ON c.mat_no = m.mat_no
        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
        group by a.mat_no,a.mat_name,a.str3,a.specs,a.unit,a.color,a.weight,a.str4,a.str5,num1,str6
        ) d
        where 1=1
        and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
@@ -234,15 +235,16 @@
        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
        a.mat_name,a.mat_no,a.str3,sum(a.qty) qty, specs,unit,color,qty_box,weight,str4,str5,num1,str6  from
        (
        select
        mat_name,mat_no,str3,qty,specs,unit,color,qty_box,weight,str4,str5
        c.mat_name,c.mat_no,c.str3,c.qty,c.all_qty,c.specs,c.unit,c.color,c.qty_box,c.weight,c.str4,c.str5,m.num1,m.str6
        from asr_loc_detl c
        LEFT JOIN bas_mat_code m ON c.mat_no = m.mat_no
        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
        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,num1,str6
        ) d
<!--        select count(1) from-->
<!--        (-->
@@ -270,7 +272,143 @@
        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">-->
    <sql id="selectAllWarningSql">
        <if test="mat_name != null and mat_name != '' ">
            and c.mat_name like '%' + #{mat_name} + '%'
        </if>
        <if test="mat_no != null and mat_no !='' ">
            and c.mat_no like '%' + #{mat_no} + '%'
        </if>
    </sql>
    <select id="selectAllWarning" resultType="com.zy.asrs.entity.LocDetlWarningDTO">
        SELECT
        *,(qty * str6) as all_qty
        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,
        num1,
        str6
        FROM
        (
        SELECT
        c.mat_name,
        c.mat_no,
        c.str3,
        c.qty,
        c.all_qty,
        c.specs,
        c.unit,
        c.color,
        c.qty_box,
        c.weight,
        c.str4,
        c.str5,
        m.num1,
        str6
        FROM
        asr_loc_detl c
        LEFT JOIN bas_mat_code m ON c.mat_no = m.mat_no
        WHERE
        1 = 1
        <include refid="selectAllWarningSql"></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,
        a.num1,
        str6
        ) d
        WHERE
        1 = 1
        AND qty &lt;= num1
        AND d.row BETWEEN ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getAllWarningCount" resultType="java.lang.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,
            SUM ( all_qty ) all_qty,
            specs,
            unit,
            color,
            qty_box,
            weight,
            str4,
            str5,
            num1
        FROM
            (
            SELECT
                c.mat_name,
                c.mat_no,
                c.str3,
                c.qty,
                c.all_qty,
                c.specs,
                c.unit,
                c.color,
                c.qty_box,
                c.weight,
                c.str4,
                c.str5,
                m.num1
            FROM
                asr_loc_detl c
                    LEFT JOIN bas_mat_code m ON c.mat_no = m.mat_no
            WHERE
                1 = 1
            <include refid="selectAllWarningSql"></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,
            a.num1
            ) d
        WHERE
            1 = 1
          AND qty &lt;= num1
    </select>
    <!--    <select id="getStockSum" resultMap="BaseResultMap">-->
<!--        select mat_no,mat_name,sum(qty) qty  from asr_loc_detl-->
<!--        group by mat_no,mat_name-->
<!--    </select>-->