fix: refs #6861 itemShelvingSale transaction #2983
|
@ -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 ;
|
Loading…
Reference in New Issue