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

This commit is contained in:
Sergio De la torre 2024-07-11 18:09:00 +02:00
parent 741360cd63
commit 69bcad9ce0
1 changed files with 5 additions and 3 deletions

View File

@ -21,6 +21,7 @@ BEGIN
DECLARE vRemainingQuantity INT;
DECLARE vItemFk INT;
DECLARE vTotalQuantity INT;
DECLARE vStateCode VARCHAR(45);
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
@ -32,10 +33,11 @@ BEGIN
CALL util.throw('Reservation completed');
END IF;
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0)), IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED') vStateCode
INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity, vStateCode
FROM itemShelvingSale iss
JOIN sale s ON s.id = iss.saleFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
WHERE iss.id = vItemShelvingSaleFk
AND NOT iss.isPicked;
@ -74,7 +76,7 @@ BEGIN
vTotalQuantity,
`account`.`myUser_getId`(),
NULL,
'PREPARED',
vStateCode,
TRUE);
UPDATE sale s