diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml index 7c4deac6a..c9c49a1fc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml @@ -572,7 +572,8 @@ ldsa.create_time, ldsa.update_user, ldsa.update_time, - (ldsa.incoming_num - oun.num) AS handQuantity, + (ldsa.incoming_num - if((select num from order_use_num where stock_article_id=ldsa.id) is null,0,(select num from order_use_num where stock_article_id=ldsa.id)))AS handQuantity, + ldsa.status, ldsa.is_deleted, ldsa.create_dept, ldsa.reserve1, ldsa.reserve2, ldsa.reserve3, ldsa.reserve4, ldsa.reserve5, ldsa.service_number, ldsa.order_code, @@ -612,7 +613,10 @@ LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldpl.id LEFT JOIN order_use_num AS oun ON ldsa.id = oun.stock_article_id - ldsa.order_status in ('10','20','30','70') and ldsa.reservation_status in ('10','20') AND (ldsa.incoming_num - oun.num) > 0 + ldsa.order_status in ('10','20','30','70') AND + + (ldsa.incoming_num - if((select num from order_use_num where stock_article_id=ldsa.id) is null,0,(select num from order_use_num where stock_article_id=ldsa.id)))>0 + and ldsa.warehouse_id = #{par.warehouseId}