This commit is contained in:
parent
76415e507d
commit
989b68c33a
|
@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ
|
||||||
vItemShelvingSaleFk INT(10),
|
vItemShelvingSaleFk INT(10),
|
||||||
vQuantity DECIMAL(10,0),
|
vQuantity DECIMAL(10,0),
|
||||||
vIsItemShelvingSaleEmpty BOOLEAN,
|
vIsItemShelvingSaleEmpty BOOLEAN,
|
||||||
vSectorFk INT
|
vSectorFk INT,
|
||||||
|
vShelvingFk VARCHAR(10)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +25,7 @@ BEGIN
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vTotalQuantity INT;
|
DECLARE vTotalQuantity INT;
|
||||||
DECLARE vStateCode VARCHAR(45);
|
DECLARE vStateCode VARCHAR(45);
|
||||||
|
DECLARE vCurrentShelvingFk VARCHAR(10);
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -45,18 +47,25 @@ BEGIN
|
||||||
iss.saleFk,
|
iss.saleFk,
|
||||||
iss.itemShelvingFk,
|
iss.itemShelvingFk,
|
||||||
SUM(IFNULL(iss.quantity,0)),
|
SUM(IFNULL(iss.quantity,0)),
|
||||||
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
|
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'),
|
||||||
|
ish.shelvingFk
|
||||||
INTO vItemFk,
|
INTO vItemFk,
|
||||||
vSaleFk,
|
vSaleFk,
|
||||||
vItemShelvingFk,
|
vItemShelvingFk,
|
||||||
vReservedQuantity,
|
vReservedQuantity,
|
||||||
vStateCode
|
vStateCode,
|
||||||
|
vCurrentShelvingFk
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN sale s ON s.id = iss.saleFk
|
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
|
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
||||||
WHERE iss.id = vItemShelvingSaleFk
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
AND NOT iss.isPicked;
|
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
|
IF vQuantity > vReservedQuantity
|
||||||
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
||||||
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
||||||
|
|
Loading…
Reference in New Issue