from logpm_distribution_reservation_stocklist ldrs
left join logpm_distribution_stock_list ldst on ldst.id = ldrs.stocklist_id and ldst.is_deleted = 0
left join logpm_distribution_stock ldss on ldss.stock_list_id = ldst.id and ldss.reservation_id = #{reservationId} and ldss.is_deleted = 0
left join logpm_distribution_stock_list ldst on ldst.id = ldrs.stocklist_id and ldst.is_deleted = 0
left join logpm_distribution_stock ldss on ldss.stock_list_id = ldst.id and ldss.reservation_id = #{reservationId} and ldss.is_deleted = 0
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldst.material_id and lwug.association_type = '4' and ldst.market_id = lwug.market_id and ldst.incoming_batch = lwug.incoming_batch
where ldrs.reservation_id = #{reservationId}
and ldrs.is_deleted = 0
group by ldst.id,
ldst.storage_location,
ldst.description_goods,
ldst.sku,
ldst.cargo_norms,
ldrs.reservation_num,
ldst.cargo_unit,
ldst.tray_name,
ldst.unpack
and ldrs.is_deleted = 0
group by ldst.id, ldst.storage_location, ldst.description_goods, ldst.sku,ldrs.id,
from logpm_distribution_reservation_stocklist ldrs
LEFT JOIN logpm_distribution_stock_list ldsl on ldrs.stocklist_id = ldsl.id
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldsl.material_id and lwug.association_type = '4' and ldsl.market_id = lwug.market_id
LEFT JOIN logpm_distribution_stock_list ldsl on lddd.stock_list_id = ldsl.id
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldsl.material_id and lwug.association_type = '4' and ldsl.market_id = lwug.market_id
and ldsl.incoming_batch = lwug.incoming_batch
where lddd.id = '1704701570896048130'
where lddd.id = #{param.deliveryDetailsId}
GROUP BY lwug.position_code ,lwug.allocation_id,lwug.allocation_title,lwug.num