|
|
|
@ -55,18 +55,6 @@
|
|
|
|
|
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid = ldsi.pid and l.pid is not null ) |
|
|
|
|
END 'quantityStock', |
|
|
|
|
CASE WHEN ldsi.pid is null THEN |
|
|
|
|
(select count(ldrs.reservation_num) |
|
|
|
|
FROM logpm_distribution_reservation_stocklist ldrs |
|
|
|
|
where ldrs.stocklist_id in (select l.id |
|
|
|
|
from logpm_distribution_stock_list l |
|
|
|
|
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid is null)) |
|
|
|
|
ELSE (select count(ldrs.reservation_num) |
|
|
|
|
FROM logpm_distribution_reservation_stocklist ldrs |
|
|
|
|
where ldrs.stocklist_id in (select l.id |
|
|
|
|
from logpm_distribution_stock_list l |
|
|
|
|
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid = ldsi.pid and l.pid is not null)) |
|
|
|
|
END 'quantityOccupied', |
|
|
|
|
CASE WHEN ldsi.pid is null THEN |
|
|
|
|
(select sum(l.outbound_quantity) |
|
|
|
|
from logpm_distribution_stock_list l |
|
|
|
|
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id AND l.pid is null) |
|
|
|
@ -87,7 +75,7 @@
|
|
|
|
|
from logpm_distribution_stock_list l |
|
|
|
|
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid = ldsi.pid and l.pid is not null )) |
|
|
|
|
END 'unpack', |
|
|
|
|
ldsi.market_id marketId,ldsi.store_id storeId,ldsi.material_id materialId,ldsi.id,ldsi.unpacking_quantity unpackingQuantity |
|
|
|
|
ldsi.market_id marketId,ldsi.store_id storeId,ldsi.material_id materialId,ldsi.id,ldsi.unpacking_quantity unpackingQuantity,ldsi.quantity_occupied quantityOccupied |
|
|
|
|
from logpm_distribution_stock_list ldsi |
|
|
|
|
<where> |
|
|
|
|
ldsi.is_deleted = 0 |
|
|
|
|