chen.lin
2026-02-11 8d5c50656d81dc3eb04a841ecd259adebf99424a
rsf-server/src/main/resources/mapper/manager/LocItemMapper.xml
@@ -11,6 +11,7 @@
                    li.loc_id,
                    li.loc_code,
                    l.barcode,
                    l.channel,
                    li.matnr_id,
                    li.matnr_code,
                    li.maktx,
@@ -22,6 +23,9 @@
                    man_loc_item li
                        INNER JOIN man_loc l ON l.id = li.loc_id
                    WHERE l.use_status = #{type}
                    <if test="channel != null">
                        AND l.channel = #{channel}
                    </if>
                GROUP BY
                    loc_id,
                    matnr_id,
@@ -30,4 +34,25 @@
            )t
            ${ew.customSqlSegment}
    </select>
    <select id="listStockByMatnrIds" resultType="java.util.HashMap">
        SELECT
            li.matnr_id AS matnrId,
            COALESCE(SUM(li.anfme), 0) AS stockQty,
            GROUP_CONCAT(DISTINCT li.loc_code ORDER BY li.loc_code) AS locCodes
        <if test="locUseStatus == null or locUseStatus == ''">
            , GROUP_CONCAT(DISTINCT l.use_status ORDER BY l.use_status) AS locStatuses
        </if>
        FROM man_loc_item li
        INNER JOIN man_loc l ON l.id = li.loc_id AND (l.deleted = 0 OR l.deleted IS NULL)
        WHERE li.deleted = 0
        AND li.matnr_id IN
        <foreach collection="matnrIds" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        <if test="locUseStatus != null and locUseStatus != ''">
            AND l.use_status = #{locUseStatus}
        </if>
        GROUP BY li.matnr_id
    </select>
</mapper>