fix: refs #6861 saleTrackingAdd
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-10-17 13:58:21 +02:00
parent 926982d5e0
commit cb53962405
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_sectorCollectionAddPrevOK`(vSectorCollectionFk INT)
BEGIN
/**
* Inserta los registros de sectorCollection con el estado PREVIA OK si la reserva está picked
*
* @param vSectorCollectionFk Identificador de vn.sectorCollection
*/
REPLACE saleTracking(
saleFk,
isChecked,
workerFk,
stateFk
)
SELECT sgd.saleFk,
TRUE,
sc.userFk,
s.id
FROM vn.sectorCollection sc
JOIN sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
JOIN saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
JOIN state s ON s.code = 'OK PREVIOUS'
JOIN itemShelvingSale iss ON iss.saleFk = sgd.saleFk
WHERE sc.id = vSectorCollectionFk AND iss.isPicked;
END$$
DELIMITER ;