自动化立体仓库 - WMS系统
pang.jiabao
7 小时以前 6cd08fe4de88df0a21851f96bdc4e617c5d92e36
src/main/resources/mapper/LocDetlMapper.xml
@@ -342,6 +342,9 @@
        <if test="specs!=null and specs!='' ">
            and a.specs like '%' + #{specs} + '%'
        </if>
        <if test="standby1!=null and standby1!='' ">
            and a.standby1 like '%' + #{standby1} + '%'
        </if>
    </sql>
    <select id="getStockOutPage" resultMap="BaseResultMap">
@@ -661,6 +664,20 @@
    <update id="frozenInventory">
        update asr_loc_detl set frozen = #{frozen} where loc_no = #{locNo} and matnr = #{matnr} and batch = #{batch}
    </update>
    <update id="updateDangerByLocNo">
        UPDATE d
        SET danger = CASE
                         WHEN t.cnt = 1 THEN 1
                         ELSE 2
            END
        FROM asr_loc_detl d
                 JOIN (
            SELECT loc_no, COUNT(DISTINCT standby1) AS cnt
            FROM asr_loc_detl
            WHERE loc_no = #{locNo}
            GROUP BY loc_no
        ) t ON d.loc_no = t.loc_no
    </update>
    <select id="selectSameDetlTodayBatch" resultType="java.lang.String">
        SELECT ld.loc_no FROM asr_loc_detl ld
@@ -763,5 +780,79 @@
        group by a.matnr,a.batch
        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getStockList" resultType="com.zy.asrs.entity.LocDetl">
        select
        *
        from
        (
        SELECT
        ROW_NUMBER() over (
        order by m.matnr desc) as row,
        m.matnr,
        m.maktx ,
        m.store_min boxType1,
        m.store_max boxType2,
        ISNULL(SUM(d.anfme),
        0) AS anfme
        FROM
        man_mat m
        LEFT JOIN asr_loc_detl d
        ON
        m.matnr = d.matnr
        WHERE
        m.store_min IS NOT NULL
        OR m.store_max IS NOT NULL
        <if test="matnr!=null and matnr!='' ">
            and m.matnr like '%' + #{matnr} + '%'
        </if>
        <if test="maktx!=null and maktx!='' ">
            and m.maktx like '%' + #{maktx} + '%'
        </if>
        GROUP BY
        m.matnr,
        m.maktx ,
        m.store_min,
        m.store_max
        HAVING
        ISNULL(SUM(d.anfme),0) &lt; m.store_min OR ISNULL(SUM(d.anfme),0) > m.store_max
        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getStockListCount" resultType="java.lang.Long">
        select
        count(*)
        from
        (
        SELECT
        ROW_NUMBER() over (
        order by m.matnr desc) as row,
        m.matnr,
        m.maktx ,
        m.store_min boxType1,
        m.store_max boxType2,
        ISNULL(SUM(d.anfme),
        0) AS anfme
        FROM
        man_mat m
        LEFT JOIN asr_loc_detl d
        ON
        m.matnr = d.matnr
        WHERE
        m.store_min IS NOT NULL
        OR m.store_max IS NOT NULL
        <if test="matnr!=null and matnr!='' ">
            and m.matnr like '%' + #{matnr} + '%'
        </if>
        <if test="maktx!=null and maktx!='' ">
            and m.maktx like '%' + #{maktx} + '%'
        </if>
        GROUP BY
        m.matnr,
        m.maktx ,
        m.store_min,
        m.store_max
        HAVING
        ISNULL(SUM(d.anfme),0) &lt; m.store_min OR ISNULL(SUM(d.anfme),0) > m.store_max
        ) t
    </select>
</mapper>