diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml index b2d7cba79..d154c16a8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml @@ -141,7 +141,7 @@ where ldpl.material_name is not null and ldpl.stock_article_id = ldbs.stock_article_id) materialName, (select IFNULL(sum(lds.stock_quantity),0) from logpm_distribution_stock lds - where lds.stock_article = ldbs.stock_article_id ) preparedQuantity , + where lds.stock_article = ldbs.stock_article_id AND lds.bill_lading_id = ldbl.id ) preparedQuantity , (select COALESCE(GROUP_CONCAT(DISTINCT lwtg.tray_code SEPARATOR ','), '') from logpm_distribution_parcel_list ldpl LEFT JOIN logpm_warehouse_tray_goods lwtg on lwtg.association_id = ldpl.id and lwtg.association_type = '3' @@ -156,12 +156,12 @@ logpm_distrilbution_bill_lading AS ldbl LEFT JOIN logpm_distrilbution_bill_stock ldbs ON ldbs.bill_lading_id = ldbl.id LEFT JOIN logpm_distribution_stock_article ldsa on ldbs.stock_article_id = ldsa.id - LEFT JOIN logpm_distribution_stock lds on lds.stock_article = ldbs.stock_article_id + LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbl.id = ldbls.bill_lading_id ldbs.is_deleted = 0 and ldbs.bill_lading_id = #{param.billLadingId} and ldbs.order_status in (1,3) - GROUP BY ldbl.id + GROUP BY ldbl.id,ldbs.stock_article_id