Compare commits

...

3 Commits

Author SHA1 Message Date
Sergio De la torre 38f2421de0 Merge pull request 'fix: refs #6861 setQuantity' (!3119) from 6861-itemShelvingSetQuantity into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3119
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-11-19 05:58:59 +00:00
Sergio De la torre 2335ef754a Merge branch 'master' into 6861-itemShelvingSetQuantity
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-19 05:55:45 +00:00
Sergio De la torre 989b68c33a fix: refs #6861 setQuantity
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-17 12:44:05 +02:00
1 changed files with 12 additions and 3 deletions

View File

@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ
vItemShelvingSaleFk INT(10),
vQuantity DECIMAL(10,0),
vIsItemShelvingSaleEmpty BOOLEAN,
vSectorFk INT
vSectorFk INT,
vShelvingFk VARCHAR(10)
)
BEGIN
/**
@ -24,6 +25,7 @@ BEGIN
DECLARE vItemFk INT;
DECLARE vTotalQuantity INT;
DECLARE vStateCode VARCHAR(45);
DECLARE vCurrentShelvingFk VARCHAR(10);
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
@ -45,18 +47,25 @@ BEGIN
iss.saleFk,
iss.itemShelvingFk,
SUM(IFNULL(iss.quantity,0)),
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'),
ish.shelvingFk
INTO vItemFk,
vSaleFk,
vItemShelvingFk,
vReservedQuantity,
vStateCode
vStateCode,
vCurrentShelvingFk
FROM itemShelvingSale iss
JOIN sale s ON s.id = iss.saleFk
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
WHERE iss.id = vItemShelvingSaleFk
AND NOT iss.isPicked;
IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN
CALL util.throw('The shelving can not be different from the shelving reserved');
END IF;
IF vQuantity > vReservedQuantity
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN