修复库存分布问题

This commit is contained in:
2025-10-31 14:50:20 +08:00
parent 3e964b4d23
commit 6028f90246
2 changed files with 7 additions and 14 deletions

View File

@@ -39,13 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN mc.item_type = 'product' THEN p.product_code
WHEN mc.item_type = 'raw_material' THEN r.raw_material_code
ELSE NULL
END AS itemCode
${ew.customSqlSegment}
END AS itemCode,
COUNT(*) AS totalQuantity,
SUM(CASE WHEN mc.status = 1 THEN 1 ELSE 0 END) AS onTheWay
FROM wms_material_coil mc
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id AND w.del_flag = 0
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id AND p.del_flag = 0
LEFT JOIN wms_raw_material r ON mc.item_type = 'raw_material' AND mc.item_id = r.raw_material_id AND r.del_flag = 0
WHERE mc.del_flag = 0 AND mc.data_type = 1
${ew.customSqlSegment}
</select>
<!-- 按仓库统计库存分布 -->