From 69bcad9ce006687604c8ecfdbebcc543e31cfcc0 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 11 Jul 2024 18:09:00 +0200 Subject: [PATCH 1/2] feat itemShelvingSale refs #6861 --- .../vn/procedures/itemShelvingSale_setQuantity.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql index 42f915ead..93927d417 100644 --- a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql +++ b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql @@ -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 From 21987011b6392f4277c4ba1da3719e1533dfee38 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 12 Jul 2024 09:06:05 +0200 Subject: [PATCH 2/2] feat itemShelvingSale refs #6861 --- .../vn/procedures/itemShelvingSale_setQuantity.sql | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql index 93927d417..85f56ee68 100644 --- a/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql +++ b/db/routines/vn/procedures/itemShelvingSale_setQuantity.sql @@ -33,8 +33,16 @@ BEGIN CALL util.throw('Reservation completed'); END IF; - 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 + SELECT s.itemFk, + iss.saleFk, + iss.itemShelvingFk, + SUM(IFNULL(iss.quantity,0)), + IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED') + 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