|
|
|
@ -52,7 +52,7 @@
|
|
|
|
|
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid is null ) |
|
|
|
|
ELSE (select sum(l.quantity_stock) |
|
|
|
|
from logpm_distribution_stock_list l |
|
|
|
|
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid is not null ) |
|
|
|
|
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) |
|
|
|
@ -64,7 +64,7 @@
|
|
|
|
|
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 not null)) |
|
|
|
|
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) |
|
|
|
@ -72,7 +72,7 @@
|
|
|
|
|
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id AND l.pid is null) |
|
|
|
|
else (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 not null) |
|
|
|
|
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 'outboundQuantity', |
|
|
|
|
ldsi.brand_name brandName,ldsi.market_name marketName,ldsi.store_name storeName,ldsi.warehouse_name warehouseName,ldsi.cargo_unit cargoUnit, |
|
|
|
|
CASE WHEN ldsi.pid is null THEN |
|
|
|
@ -85,7 +85,7 @@
|
|
|
|
|
from logpm_distribution_stock_list lds |
|
|
|
|
where lds.pid 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 not null )) |
|
|
|
|
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 |
|
|
|
|
from logpm_distribution_stock_list ldsi |
|
|
|
|