feat: refs #7646 delete scannableCodeType #2782
|
@ -139,8 +139,9 @@ proc: BEGIN
|
|||
CALL item_getAtp(vDate);
|
||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||
|
||||
UPDATE tmp.itemInventory ai
|
||||
JOIN (
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT it.itemFk,
|
||||
SUM(it.quantity) quantity,
|
||||
im.quantity minQuantity
|
||||
|
@ -152,18 +153,21 @@ proc: BEGIN
|
|||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||
t.landing,
|
||||
vDateToTomorrow)
|
||||
GROUP BY it.itemFk
|
||||
) sub ON sub.itemFk = ai.id
|
||||
SET ai.avalaible = IF(sub.minQuantity > 0,
|
||||
ai.avalaible,
|
||||
ai.avalaible + sub.minQuantity),
|
||||
ai.sd = ai.inventory + sub.quantity;
|
||||
GROUP BY it.itemFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
|
||||
SET it.avalaible = IF(iac.minQuantity > 0,
|
||||
it.avalaible,
|
||||
it.avalaible + iac.minQuantity),
|
||||
it.sd = it.inventory + iac.quantity;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.itemTravel,
|
||||
tmp.itemCalc,
|
||||
tmp.itemAtp,
|
||||
tItemInventoryCalc,
|
||||
tItemVisibleCalc;
|
||||
tItemVisibleCalc,
|
||||
tItemAvailableCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue