7773-testToMaster_2430 #2774

Merged
alexm merged 368 commits from 7773-testToMaster_2430 into master 2024-07-23 06:21:03 +00:00
1 changed files with 9 additions and 10 deletions
Showing only changes of commit 29f9fa0ce3 - Show all commits

View File

@ -10,7 +10,7 @@ proc: BEGIN
DECLARE vDateTo DATETIME; DECLARE vDateTo DATETIME;
DECLARE vDateToTomorrow DATETIME; DECLARE vDateToTomorrow DATETIME;
DECLARE vDefaultDayRange INT; DECLARE vDefaultDayRange INT;
DECLARE vCalc INT; DECLARE vCalcFk INT;
IF vDate < util.VN_CURDATE() THEN IF vDate < util.VN_CURDATE() THEN
LEAVE proc; LEAVE proc;
@ -83,19 +83,18 @@ proc: BEGIN
ai.sd = iic.quantity; ai.sd = iic.quantity;
-- Cálculo del visible -- Cálculo del visible
CALL cache.stock_refresh(false); CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
(PRIMARY KEY (item_id)) (PRIMARY KEY (item_id))
ENGINE = MEMORY ENGINE = MEMORY
SELECT item_id, amount stock, amount visible SELECT item_id, visible
FROM cache.stock FROM cache.visible
WHERE warehouse_id = vWarehouseFk; WHERE calc_id = vCalcFk;
CALL item_calcVisible(NULL, vWarehouseFk, vDate);
UPDATE tmp.itemInventory it UPDATE tmp.itemInventory it
JOIN tmp.itemVisible iv ON iv.item_id = it.id JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
SET it.visible = it.visible + iv.visible; SET it.visible = it.visible + ivc.visible;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
@ -168,6 +167,6 @@ proc: BEGIN
tmp.itemCalc, tmp.itemCalc,
tmp.itemAtp, tmp.itemAtp,
tItemInventoryCalc, tItemInventoryCalc,
tmp.itemVisible; tItemVisibleCalc;
END$$ END$$
DELIMITER ; DELIMITER ;