refs #6861 feat:reserveWithReservation
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-04-25 16:15:53 +02:00
parent ad13ad856b
commit 611f907ef0
1 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,8 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_addWithReservation`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_addWithReservation`(
vItemFk INT, vItemFk INT,
vQuantity INT, vQuantity INT,
vTicketFk INT vTicketFk INT,
vSaleGroupFk INT
) )
BEGIN BEGIN
/** /**
@ -12,7 +13,9 @@ BEGIN
* @param vItemFk id of item * @param vItemFk id of item
* @param vQuantity quantity to be added to the ticket * @param vQuantity quantity to be added to the ticket
* @param vTicketFk ticket to which the sales line is added * @param vTicketFk ticket to which the sales line is added
* @param vSaleGroupFk saleGroupFk id to add saleGroupDetail
*/ */
DECLARE vWarehouseFk INT; DECLARE vWarehouseFk INT;
DECLARE vCacheAvailableFk INT; DECLARE vCacheAvailableFk INT;
DECLARE vAvailable INT; DECLARE vAvailable INT;
@ -72,7 +75,7 @@ BEGIN
CALL sale_calculateComponent(vSaleFk, NULL); CALL sale_calculateComponent(vSaleFk, NULL);
CALL itemShelvingSale_addBySale(vSaleFk); CALL itemShelvingSale_addBySale(vSaleFk);
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
SET vHasThrow = TRUE; SET vHasThrow = TRUE;
END IF; END IF;
@ -81,6 +84,10 @@ BEGIN
IF vHasThrow THEN IF vHasThrow THEN
CALL util.throw("No hay disponibilidad para el artículo seleccionado"); CALL util.throw("No hay disponibilidad para el artículo seleccionado");
ELSE ELSE
IF vSaleGroupFk THEN
INSERT INTO saleGroupDetail
SET saleFk = vSaleFk,
saleGroupFk = vSaleGroupFk,
COMMIT; COMMIT;
END IF; END IF;
END$$ END$$