fix: refs #7931 Immediately discount order lines from available
gitea/salix/pipeline/pr-test This commit looks good
Details
gitea/salix/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
a2a5630d17
commit
a7bc58a5bc
|
@ -1,5 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
|
||||
OUT `vCalc` INT,
|
||||
`vRefresh` INT,
|
||||
`vWarehouse` INT,
|
||||
`vDated` DATE
|
||||
)
|
||||
proc: BEGIN
|
||||
DECLARE vStartDate DATE;
|
||||
DECLARE vReserveDate DATETIME;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
|
||||
`vItem` INT,
|
||||
`vWarehouse` INT,
|
||||
`vDated` DATE,
|
||||
`vQuantity` INT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE vCalc INT;
|
||||
|
||||
SELECT id INTO vCalc FROM cache_calc
|
||||
WHERE cacheName = 'available'
|
||||
AND params = CONCAT_WS('/', vWarehouse, vDated)
|
||||
AND last_refresh <= NOW();
|
||||
|
||||
IF vCalc IS NOT NULL THEN
|
||||
UPDATE available
|
||||
SET available = available - vQuantity
|
||||
WHERE calc_id = vCalc
|
||||
AND item_id = vItem;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -102,6 +102,8 @@ BEGIN
|
|||
amount = vAdd,
|
||||
price = vPrice;
|
||||
|
||||
CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
|
||||
|
||||
SET vRow = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO orderRowComponent (rowFk, componentFk, price)
|
||||
|
|
Loading…
Reference in New Issue