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>
@@ -229,6 +229,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND COALESCE(pmd.PICKING_QUANTITY, 0) > 0
</select>
<select id="listPickingAggregatesByOutOrderNumbers"
resultType="com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingAggByOutOrderRow">
SELECT
omd.out_order_number AS outOrderNumber,
COALESCE(SUM(pmd.picking_quantity), 0) AS sumPickingQty,
COUNT(DISTINCT CASE WHEN COALESCE(pmd.picking_quantity, 0) &gt; 0 THEN pmd.material_base_info_id END) AS materialTypeCount
FROM out_material_detail omd
LEFT JOIN picking_material_detail pmd ON pmd.out_unique_id = omd.unique_id AND pmd.del_flag = 1
WHERE omd.out_order_number IN
<foreach collection="outOrderNumbers" item="num" open="(" separator="," close=")">
#{num}
</foreach>
AND omd.del_flag = 1
GROUP BY omd.out_order_number
</select>
<select id="selectOutUniqueIdsWithPickingByOutOrderNumber" resultType="java.lang.Long">
SELECT DISTINCT pmd.OUT_UNIQUE_ID
FROM picking_material_detail pmd
@@ -33,7 +33,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="directWarehouse" column="direct_warehouse" />
<result property="review" column="review" />
<result property="annexUrl" column="annex_url" />
<result property="materialQuantity" column="material_quantity" />
<result property="quantity" column="quantity" />
<result property="weightLimit" column="weight_limit" />
<result property="volumeLimit" column="volume_limit" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="alreadyAllocationQuantity" column="already_allocation_quantity" />
<result property="pickingQuantity" column="picking_quantity" />
<result property="checkQuantity" column="check_quantity" />
<result property="cancelOrder" column="cancel_order" />
<result property="cancelRemark" column="cancel_remark" />
<result property="cancelBy" column="cancel_by" />
@@ -93,7 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.out_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.receipt_notice_id, a.notice_number, a.out_order_number, a.status,
a.audit_status, a.audit_remark, a.audit_by, a.audit_by_name, a.audit_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_code,
a.shipper_name, a.order_type_code, a.order_type_name, a.customer_id, a.customer_code, a.customer_name, a.expect_time, a.supply_chain_number, a.priority_level_code,
a.priority_level_name, a.direct_warehouse, a.review, a.annex_url, a.material_quantity, a.quantity, a.weight_limit, a.volume_limit, a.check_quantity, a.cancel_order, a.cancel_remark, a.cancel_by, a.cancel_by_name,
a.priority_level_name, a.direct_warehouse, a.review, a.annex_url, a.material_quantity, a.quantity, a.weight_limit, a.volume_limit,
a.allocation_quantity, a.already_allocation_quantity, a.picking_quantity, a.check_quantity, a.cancel_order, a.cancel_remark, a.cancel_by, a.cancel_by_name,
a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.check_status,
a.check_task_distribution, a.check_task_distribution_time, a.check_operators_by, a.check_operators_name, a.mobilize_code,
a.remark, a.create_time, a.create_by, a.create_by_name,