自动化立体仓库 - WMS系统
lty
2025-06-23 419c6a9b87b37be567a581d6a80d7e3f505d84e9
src/main/resources/mapper/MatMapper.xml
@@ -53,23 +53,28 @@
        FROM man_mat mm
        LEFT JOIN man_tag mt ON mm.tag_id = mt.id
        LEFT JOIN (
            select
            matnr,
            sum(anfme) as amount
            from man_loc_detl
            group by matnr
        ) as mld on mld.matnr = mm.matnr
        SELECT
        matnr,
        SUM(anfme) AS amount
        FROM man_loc_detl
        GROUP BY matnr
        ) AS mld ON mld.matnr = mm.matnr
        WHERE 1=1
        and (mm.memo is null or mm.memo != '打包上线')
        AND (CHARINDEX(','+#{tagId}+',', ','+mt.path+',') > 0 OR mt.id = #{tagId})
        <!-- ✅ 屏蔽 tag_id = 6 -->
        AND mt.id != 6
        <!-- ✅ 判断是否在路径中 or 本身 id 匹配 -->
        AND (CHARINDEX(',' + #{tagId} + ',', ',' + mt.path + ',') > 0 OR mt.id = #{tagId})
        <if test="matnr != null and matnr != ''">
            and mm.matnr like concat('%',#{matnr},'%')
            AND mm.matnr LIKE CONCAT('%', #{matnr}, '%')
        </if>
        <if test="maktx != null and maktx != ''">
            and mm.maktx like concat('%',#{maktx},'%')
        <if test="memo != null and memo != ''">
            AND mm.memo LIKE CONCAT('%', #{memo}, '%')
        </if>
        ORDER BY mm.create_time DESC
    </select>
    <select id="listByPage2" resultMap="BaseResultMap">
        SELECT
@@ -125,6 +130,17 @@
        ) t where t.matNo between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getBoxMemoMap" resultType="map">
        SELECT tag_id, memo
        FROM man_mat
        WHERE tag_id IN
        <foreach item="id" collection="tagIds" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </select>
    <select id="getStockOutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
        select
        count(1)