2024-10-17 11:58:21 +00:00
|
|
|
DELIMITER $$
|
2024-10-17 15:01:44 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_sectorCollectionAddPrevOK`(
|
|
|
|
vSectorCollectionFk INT
|
2024-10-17 15:20:21 +00:00
|
|
|
)
|
2024-10-17 11:58:21 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Inserta los registros de sectorCollection con el estado PREVIA OK si la reserva está picked
|
|
|
|
*
|
|
|
|
* @param vSectorCollectionFk Identificador de vn.sectorCollection
|
|
|
|
*/
|
2024-10-17 15:20:21 +00:00
|
|
|
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
|
|
|
|
SELECT sgd.saleFk, TRUE, sc.userFk, s.id
|
2024-10-17 15:01:44 +00:00
|
|
|
FROM 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;
|
2024-10-17 11:58:21 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|