<!-- ldslNew.description_goods AS materialName,-->
<!-- ldslNew.cargo_norms AS cargoNorms,-->
<!-- t.cargoUnit AS cargoUnit,-->
<!-- ldslNew.tray_name AS trayName,-->
<!-- ldslNew.unpack AS unpack,-->
<!-- (SELECT SUM(aldrs.reality_num) FROM logpm_distribution_reservation_stocklist AS aldrs WHERE aldrs.reservation_id = #{reservationId} AND FIND_IN_SET(aldrs.stocklist_id,t.aaa)) AS realNum,-->
<!-- (SELECT SUM(newldrs.reservation_num) FROM logpm_distribution_reservation_stocklist AS newldrs WHERE newldrs.reservation_id = #{reservationId} AND FIND_IN_SET(newldrs.stocklist_id,t.aaa)) AS planNum,-->
<!-- (-->
<!-- select GROUP_CONCAT( DISTINCT (allocation_id)) from logpm_warehouse_updown_goods where association_value =ldslNew.cargo_number and warehouse_id=#{warehouseId} or association_value in (-->
<!-- SELECT order_package_code from logpm_distribution_parcel_list where conditions=2 and material_code=ldslNew.cargo_number and warehouse_id=#{warehouseId} )-->
<!-- LEFT JOIN logpm_distribution_stock_list ldsl ON ldrs.stocklist_id = ldsl.id-->
<!-- WHERE-->
<!-- ldrs.reservation_id = #{reservationId}-->
<!-- AND ldsl.market_name = #{mallName}-->
<!-- group by ldsl.cargo_number-->
<!-- ) t-->
<!-- LEFT JOIN logpm_distribution_stock_list ldslNew ON t.cargo_number = ldslNew.cargo_number-->
<!-- LEFT JOIN logpm_distribution_stock ldss ON ldss.stock_list_id = t.id-->
<!-- where ldslNew.is_deleted = 0-->
SELECT DISTINCT
ldslNew.sku AS sku,
ldslNew.cargo_number AS cargoNumber,
ldslNew.description_goods AS materialName,
ldslNew.cargo_norms AS cargoNorms,
t.cargoUnit AS cargoUnit,
ldslNew.tray_name AS trayName,
ldslNew.unpack AS unpack,
(SELECT SUM(aldrs.reality_num) FROM logpm_distribution_reservation_stocklist AS aldrs WHERE aldrs.reservation_id = #{reservationId} AND aldrs.stock_list_status != 2 AND FIND_IN_SET(aldrs.stocklist_id,t.aaa)) AS realNum,
(SELECT SUM(newldrs.reservation_num) FROM logpm_distribution_reservation_stocklist AS newldrs WHERE newldrs.reservation_id = #{reservationId} ANd newldrs.stock_list_status != 2 AND FIND_IN_SET(newldrs.stocklist_id,t.aaa))
@ -394,48 +358,6 @@
LEFT JOIN ( SELECT association_value, GROUP_CONCAT( DISTINCT ( allocation_id )) AS allocation_ids FROM logpm_warehouse_updown_goods WHERE warehouse_id = #{warehouseId} AND association_type = 4 GROUP BY association_value ) AS t2 ON t.cargo_number = t2.association_value
where ldslNew.is_deleted = 0
AND ldslNew.warehouse_id=#{warehouseId}
<!-- SELECT-->
<!-- ldsl.sku AS sku,-->
<!-- ldsl.cargo_number AS cargoNumber,-->
<!-- ldsl.description_goods AS materialName,-->
<!-- ldsl.cargo_norms AS cargoNorms,-->
<!-- ldsl.cargo_unit AS cargoUnit,-->
<!-- ldsl.tray_name AS trayName,-->
<!-- ldsl.unpack AS unpack,-->
<!-- ldsl.source_type AS sourceType,-->
<!-- ldrs.stocklist_id AS stockListId,-->
<!-- ldrs.reservation_num AS planNum,-->
<!-- (SELECT COUNT(ldss.id) FROM logpm_distribution_stock AS ldss WHERE ldss.stock_list_id = ldsl.id ) AS realNum,-->
<!-- CASE-->
<!-- ldsl.source_type-->
<!-- WHEN 1 THEN-->
<!-- (-->
<!-- SELECT-->
<!-- group_concat( DISTINCT lwug.allocation_id ) AS allocations-->
<!-- FROM-->
<!-- logpm_distribution_stock_list ldslnew-->
<!-- LEFT JOIN logpm_distribution_parcel_list ldpl ON ldpl.order_code = ldslnew.incoming_batch-->
<!-- AND ldpl.material_id = ldslnew.material_id-->
<!-- AND ldpl.conditions = '2'-->
<!-- LEFT JOIN logpm_warehouse_updown_goods lwug ON lwug.association_value = ldpl.order_package_code-->
<!-- WHERE-->
<!-- ldslnew.id = ldsl.id AND lwug.association_type = '3'-->
<!-- )-->
<!-- WHEN 2 THEN-->
<!-- ( SELECT group_concat( DISTINCT lwug.allocation_id ) AS allocations FROM logpm_warehouse_updown_goods lwug WHERE lwug.association_id = ldsl.material_id AND lwug.association_type = '4')-->