8179-testToMaster #3176

Merged
alexm merged 407 commits from 8179-testToMaster into master 2024-11-12 06:41:52 +00:00
1 changed files with 26 additions and 0 deletions
Showing only changes of commit 03ea7580d8 - Show all commits

View File

@ -0,0 +1,26 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `hedera`.`orderRow_updateOverstocking`(
vWarehouseFk INT
)
BEGIN
/**
* Set amount = 0 to avoid overbooking sales
*
* @param vWarehouseFk vn.warehouse.id
*/
DECLARE vCalcFk INT;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, CURDATE());
UPDATE orderRow r
JOIN `order` o ON o.id = r.orderFk
JOIN orderConfig oc
JOIN cache.available a ON a.calc_id = vCalcFk AND a.item_id = r.itemFk
SET r.amount = 0
WHERE ADDTIME(o.rowUpdated, oc.reserveTime) < NOW()
AND a.available <= 0
AND r.shipment BETWEEN CURDATE() AND util.dayEnd(CURDATE())
AND NOT o.confirmed
AND r.warehouseFk = vWarehouseFk;
END$$
DELIMITER ;