fix: refs #6861 refs#6861 getTickets #3187
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue