feat itemShelvingSale refs #6861 #2721
|
@ -21,6 +21,7 @@ BEGIN
|
||||||
DECLARE vRemainingQuantity INT;
|
DECLARE vRemainingQuantity INT;
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vTotalQuantity INT;
|
DECLARE vTotalQuantity INT;
|
||||||
|
DECLARE vStateCode VARCHAR(45);
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -32,10 +33,19 @@ BEGIN
|
||||||
CALL util.throw('Reservation completed');
|
CALL util.throw('Reservation completed');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
|
SELECT s.itemFk,
|
||||||
INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity
|
iss.saleFk,
|
||||||
|
iss.itemShelvingFk,
|
||||||
|
SUM(IFNULL(iss.quantity,0)),
|
||||||
|
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
|
||||||
|
INTO vItemFk,
|
||||||
|
vSaleFk,
|
||||||
|
vItemShelvingFk,
|
||||||
|
vReservedQuantity,
|
||||||
|
vStateCode
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN sale s ON s.id = iss.saleFk
|
JOIN sale s ON s.id = 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;
|
||||||
|
|
||||||
|
@ -74,7 +84,7 @@ BEGIN
|
||||||
vTotalQuantity,
|
vTotalQuantity,
|
||||||
`account`.`myUser_getId`(),
|
`account`.`myUser_getId`(),
|
||||||
NULL,
|
NULL,
|
||||||
'PREPARED',
|
vStateCode,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
|
|
Loading…
Reference in New Issue