fix: refs #7931 Merge available fix into master #2936
|
@ -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 ;
|
|
@ -1,8 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
|
||||
vSelf INT,
|
||||
vWarehouse INT,
|
||||
vItem INT,
|
||||
vWarehouse INT,
|
||||
vItem INT,
|
||||
vAmount INT)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -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)
|
||||
|
@ -121,6 +123,6 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
COMMIT;
|
||||
CALL vn.ticketCalculatePurge;
|
||||
CALL vn.ticketCalculatePurge;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue