fix: refs #6861 itemShelvingSale transaction
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-09-17 13:11:27 +02:00
parent 8620db056e
commit 974827443c
1 changed files with 12 additions and 7 deletions

View File

@ -48,6 +48,13 @@ proc: BEGIN
RESIGNAL;
END;
START TRANSACTION;
SELECT id INTO vSaleFk
FROM sale
WHERE id = vSaleFk
FOR UPDATE;
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
INTO vLastPickingOrder, vOutStanding, vSaleQuantity
FROM sale s
@ -57,7 +64,8 @@ proc: BEGIN
LEFT JOIN parking p ON p.id = sh.parkingFk
WHERE s.id = vSaleFk;
IF vOutStanding <= 0 THEN
IF vOutStanding <= 0 THEN
COMMIT;
LEAVE proc;
END IF;
@ -84,10 +92,8 @@ proc: BEGIN
END IF;
LEAVE l;
END IF;
START TRANSACTION;
SELECT id INTO vItemShelvingFk
SELECT id INTO vItemShelvingFk
FROM itemShelving
WHERE id = vItemShelvingFk
FOR UPDATE;
@ -115,9 +121,8 @@ proc: BEGIN
WHERE id = vItemShelvingFk;
END IF;
COMMIT;
END LOOP;
CLOSE vItemShelvingAvailable;
COMMIT;
END$$
DELIMITER ;