feat: previas con sitema de reservas refs #6861
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-03-18 17:51:35 +01:00
parent 3aa81d27e7
commit c20747434e
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE
`vn`.`itemShelvingSale_reserveBySectorCollection`(vSectorCollectionFk INT(11))
BEGIN
/**
* Reserva cantidades con ubicaciones para el contenido de una preparación previa
* de la cual ya tiene generada la asociación del saleGroup con sectorCollection
*
* @param vSectorCollectionFk Identificador de sectorCollection
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(INDEX(saleFk))
ENGINE = MEMORY
SELECT s.id
FROM sectorCollectionSaleGroup sc
JOIN saleGroupDetail sg ON sg.saleGroupFk = sc.saleGroupFk
JOIN sale s ON sg.saleFk = s.id
JOIN saleTracking str ON str.saleFk = s.id
JOIN `state` st ON st.id = str.stateFk
AND st.code = 'PREVIOUS_PREPARATION'
WHERE sc.sectorCollectionFk = vSectorCollectionFk
AND str.workerFk = account.myUser_getId();
CALL itemShelvingSale_reserve();
END$$
DELIMITER ;