WMS出库查询问题修改

This commit is contained in:
秦鸿展
2026-04-18 11:43:33 +08:00
parent bd2a5915ba
commit e0b3ddff04
10 changed files with 138 additions and 26 deletions
@@ -409,4 +409,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.uniqueId}
</foreach>
</update>
<!-- 出库列表:按单号批量聚合(仅 level=1,与列表上对父行汇总一致) -->
<select id="selectAggregatesForStockOutList" resultType="com.mhd.wms.domain.outMaterialDetail.repository.po.OutStockListMaterialAgg">
SELECT
a.out_order_number AS outOrderNumber,
COALESCE(SUM(a.outbound_quantity), 0) AS totalOutboundQuantity,
COALESCE(SUM(a.check_quantity), 0) AS checkQuantitySum,
COUNT(DISTINCT CASE
WHEN a.material_base_info_id IS NOT NULL THEN CAST(a.material_base_info_id AS VARCHAR(50))
ELSE a.material_code
END) AS materialKindCountDistinct
FROM out_material_detail a
WHERE a.del_flag = 1
AND a.level = 1
AND a.out_order_number IN
<foreach collection="outOrderNumbers" item="num" open="(" separator="," close=")">
#{num}
</foreach>
GROUP BY a.out_order_number
</select>
</mapper>