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