7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
1 changed files with 24 additions and 20 deletions
Showing only changes of commit 0c51a97a17 - Show all commits

View File

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