feat(wms): 增加根据实际库区查询钢卷分布的接口及相关字段

This commit is contained in:
2025-11-17 17:57:57 +08:00
parent 3f507cef5b
commit 0b29ce7f50
6 changed files with 155 additions and 27 deletions

View File

@@ -149,7 +149,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
WHEN mc.item_type = 'product' THEN p.product_code
ELSE NULL
END as itemCode
END as itemCode,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.specification
WHEN mc.item_type = 'product' THEN p.specification
ELSE NULL
END as specification,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.material
WHEN mc.item_type = 'product' THEN p.material
ELSE NULL
END as material,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
ELSE NULL
END as surfaceTreatmentDesc,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
WHEN mc.item_type = 'product' THEN p.zinc_layer
ELSE NULL
END as zincLayer,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
WHEN mc.item_type = 'product' THEN p.manufacturer
ELSE NULL
END as manufacturer
FROM wms_material_coil mc
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
@@ -165,7 +190,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="itemId != null">
AND mc.item_id = #{itemId}
</if>
GROUP BY mc.item_type, mc.item_id, w.warehouse_id, w.warehouse_name
GROUP BY mc.item_type, mc.item_id, w.warehouse_id, w.warehouse_name, itemName, itemCode, specification, material,
surfaceTreatmentDesc, zincLayer, manufacturer
ORDER BY mc.item_type, mc.item_id, w.warehouse_id
</select>
<select id="selectVoListWithDynamicJoin" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
@@ -230,6 +256,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY w.actual_warehouse_id, w.actual_warehouse_name
ORDER BY w.actual_warehouse_id
</select>
<select id="getDistributionByActualItemType" resultType="java.util.Map">
SELECT
mc.item_type,
mc.item_id,
w.actual_warehouse_id,
w.actual_warehouse_name,
COUNT(mc.coil_id) as coil_count,
COALESCE(SUM(mc.gross_weight), 0) as total_gross_weight,
COALESCE(SUM(mc.net_weight), 0) as total_net_weight,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
WHEN mc.item_type = 'product' THEN p.product_name
ELSE NULL
END as itemName,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
WHEN mc.item_type = 'product' THEN p.product_code
ELSE NULL
END as itemCode,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.specification
WHEN mc.item_type = 'product' THEN p.specification
ELSE NULL
END as specification,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.material
WHEN mc.item_type = 'product' THEN p.material
ELSE NULL
END as material,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
ELSE NULL
END as surfaceTreatmentDesc,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
WHEN mc.item_type = 'product' THEN p.zinc_layer
ELSE NULL
END as zincLayer,
CASE
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
WHEN mc.item_type = 'product' THEN p.manufacturer
ELSE NULL
END as manufacturer
FROM wms_material_coil mc
LEFT JOIN wms_actual_warehouse w ON mc.actual_warehouse_id = w.actual_warehouse_id
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
WHERE mc.data_type = 1
AND mc.del_flag = '0'
AND (w.del_flag = '0' OR w.del_flag IS NULL)
and (mc.material_type='成品' or mc.material_type='原料')
and mc.status!=1
<if test="itemType != null and itemType != ''">
AND mc.item_type = #{itemType}
</if>
<if test="itemId != null">
AND mc.item_id = #{itemId}
</if>
GROUP BY mc.item_type, mc.item_id, w.actual_warehouse_id, w.actual_warehouse_name, itemName, itemCode, specification,
material,surfaceTreatmentDesc, zincLayer, manufacturer
ORDER BY mc.item_type, mc.item_id, w.actual_warehouse_id
</select>
</mapper>