LEFT JOIN logpm_distribution_stock_list ldsl on lddd.stock_list_id = ldsl.id
LEFT JOIN logpm_distribution_stock_list ldsl on lddd.stock_list_id = ldsl.id
LEFT JOIN logpm_warehouse_updown_goods lwug
LEFT JOIN ( SELECT association_value,warehouse_id, GROUP_CONCAT( DISTINCT ( allocation_id )) AS allocation_ids FROM logpm_warehouse_updown_goods WHERE association_type = 4 GROUP BY association_value,warehouse_id ) AS t2 ON ldsl.cargo_number = t2.association_value and ldsl.warehouse_id=t2.warehouse_id
on lwug.association_id = ldsl.material_id and lwug.association_type = '4'
LEFT JOIN ( SELECT
and ldsl.market_id = lwug.market_id and ldsl.incoming_batch = lwug.incoming_batch and
ldpl.material_code,
ldsl.warehouse_id = lwug.warehouse_id
ldpl.warehouse_id,
GROUP_CONCAT( DISTINCT ( lwug.allocation_id ) ) AS allocation_ids
FROM
logpm_warehouse_updown_goods lwug
LEFT JOIN logpm_distribution_parcel_list ldpl ON ldpl.id = lwug.association_id
WHERE
lwug.association_type != 4
AND ldpl.conditions = 2
GROUP BY ldpl.material_code,ldpl.warehouse_id ) AS t1 ON ldsl.cargo_number = t1.material_code and ldsl.warehouse_id=t1.warehouse_id
where lddd.bill_lading_id = #{reservationId}
where lddd.bill_lading_id = #{reservationId}
GROUP BY lddd.stock_list_id, ldsl.description_goods, ldsl.sku, ldsl.cargo_norms, lddd.quantity, ldsl.cargo_unit,
GROUP BY lddd.stock_list_id, ldsl.description_goods, ldsl.sku, ldsl.cargo_norms, lddd.quantity, ldsl.cargo_unit,