refactor: refs #7640 multipleInventoryFix #2689

Merged
guillermo merged 4 commits from 7640-multipleInventoryFix into master 2024-07-08 05:52:52 +00:00
1 changed files with 9 additions and 6 deletions
Showing only changes of commit 55f0e90771 - Show all commits

View File

@ -75,6 +75,13 @@ proc: BEGIN
) sub ) sub
GROUP BY itemFk; GROUP BY itemFk;
UPDATE tmp.itemInventory ai
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
SET ai.inventory = iic.quantity,
ai.visible = iic.visible,
ai.avalaible = iic.quantity,
ai.sd = iic.quantity;
-- Cálculo del visible -- Cálculo del visible
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
(PRIMARY KEY (itemFk)) (PRIMARY KEY (itemFk))
@ -118,12 +125,8 @@ proc: BEGIN
GROUP BY itemFk; GROUP BY itemFk;
UPDATE tmp.itemInventory ai UPDATE tmp.itemInventory ai
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id JOIN tItemVisibleCalc ivc ON ivc.itemFk = ai.id
LEFT JOIN tItemVisibleCalc ivc ON ivc.itemFk = iic.itemFk SET ai.visible = ai.visible + ivc.visible;
SET ai.inventory = iic.quantity,
ai.visible = iic.visible + IFNULL(ivc.visible, 0),
ai.avalaible = iic.quantity,
ai.sd = iic.quantity;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc