2024-01-31 06:11:03 +00:00
|
|
|
DELIMITER $$
|
2024-06-11 10:44:25 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setPicked`(
|
2024-01-31 06:11:03 +00:00
|
|
|
vSaleGroupFk INT(10)
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Gestiona la reserva de un vn.saleGroup actualizando vn.itemShelvingSale.isPicked
|
|
|
|
* y cambiando el estado de la vn.sale
|
|
|
|
*
|
|
|
|
* @param vSaleGroupFk Id saleGroupFk
|
|
|
|
*/
|
|
|
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
|
|
BEGIN
|
|
|
|
ROLLBACK;
|
|
|
|
RESIGNAL;
|
|
|
|
END;
|
|
|
|
|
|
|
|
IF NOT (SELECT COUNT(*) FROM saleGroup WHERE id = vSaleGroupFk) THEN
|
|
|
|
CALL util.throw('Sale group not exists');
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
START TRANSACTION;
|
|
|
|
|
|
|
|
UPDATE itemShelvingSale iss
|
|
|
|
JOIN sale s ON s.id = iss.saleFk
|
|
|
|
JOIN saleGroupDetail sg ON sg.saleFk = s.id
|
|
|
|
SET iss.isPicked = TRUE
|
|
|
|
WHERE sg.saleGroupFk = vSaleGroupFk;
|
|
|
|
|
|
|
|
CALL saleTracking_addPreparedSaleGroup(vSaleGroupFk);
|
|
|
|
|
|
|
|
COMMIT;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|