7983-testToMaster_2438 #2977
|
@ -2,29 +2,28 @@ DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vDone BOOL;
|
DECLARE vDone BOOL;
|
||||||
-- Fetch variables
|
|
||||||
DECLARE vTicketFk INT;
|
DECLARE vTicketFk INT;
|
||||||
|
|
||||||
DECLARE cCur CURSOR FOR
|
DECLARE vTickets CURSOR FOR
|
||||||
SELECT ticketFk
|
SELECT ticketFk
|
||||||
FROM vn.ticketCollection
|
FROM ticketCollection
|
||||||
WHERE collectionFk = vCollectionFk;
|
WHERE collectionFk = vCollectionFk;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||||
SET vDone = TRUE;
|
SET vDone = TRUE;
|
||||||
|
|
||||||
OPEN cCur;
|
OPEN vTickets;
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
|
|
||||||
FETCH cCur INTO vTicketFk;
|
FETCH vTickets INTO vTicketFk;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL vn.ticket_mergeSales(vTicketFk);
|
CALL ticket_mergeSales(vTicketFk);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE cCur;
|
CLOSE vTickets;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -12,9 +12,10 @@ BEGIN
|
||||||
DECLARE vWarehouseFk INT;
|
DECLARE vWarehouseFk INT;
|
||||||
DECLARE vWagons INT;
|
DECLARE vWagons INT;
|
||||||
DECLARE vTrainFk INT;
|
DECLARE vTrainFk INT;
|
||||||
DECLARE vLinesLimit INT DEFAULT NULL;
|
DECLARE vLinesLimit INT;
|
||||||
DECLARE vTicketLines INT;
|
DECLARE vTicketLines INT;
|
||||||
DECLARE vVolumeLimit DECIMAL DEFAULT NULL;
|
DECLARE vVolumeLimit DECIMAL;
|
||||||
|
DECLARE vSizeLimit INT;
|
||||||
DECLARE vTicketVolume DECIMAL;
|
DECLARE vTicketVolume DECIMAL;
|
||||||
DECLARE vMaxTickets INT;
|
DECLARE vMaxTickets INT;
|
||||||
DECLARE vStateFk VARCHAR(45);
|
DECLARE vStateFk VARCHAR(45);
|
||||||
|
@ -58,7 +59,8 @@ BEGIN
|
||||||
o.numberOfWagons,
|
o.numberOfWagons,
|
||||||
o.trainFk,
|
o.trainFk,
|
||||||
o.linesLimit,
|
o.linesLimit,
|
||||||
o.volumeLimit
|
o.volumeLimit,
|
||||||
|
o.sizeLimit
|
||||||
INTO vMaxTickets,
|
INTO vMaxTickets,
|
||||||
vHasUniqueCollectionTime,
|
vHasUniqueCollectionTime,
|
||||||
vWorkerCode,
|
vWorkerCode,
|
||||||
|
@ -68,7 +70,8 @@ BEGIN
|
||||||
vWagons,
|
vWagons,
|
||||||
vTrainFk,
|
vTrainFk,
|
||||||
vLinesLimit,
|
vLinesLimit,
|
||||||
vVolumeLimit
|
vVolumeLimit,
|
||||||
|
vSizeLimit
|
||||||
FROM worker w
|
FROM worker w
|
||||||
JOIN operator o ON o.workerFk = w.id
|
JOIN operator o ON o.workerFk = w.id
|
||||||
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
||||||
|
@ -155,8 +158,9 @@ BEGIN
|
||||||
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
|
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
|
||||||
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
|
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
|
||||||
OR LENGTH(pb.problem) > 0
|
OR LENGTH(pb.problem) > 0
|
||||||
OR (pb.lines >= vLinesLimit AND vLinesLimit IS NOT NULL)
|
OR pb.lines > COALESCE(vLinesLimit, pb.lines)
|
||||||
OR (pb.m3 >= vVolumeLimit AND vVolumeLimit IS NOT NULL);
|
OR pb.m3 > COALESCE(vVolumeLimit, pb.m3)
|
||||||
|
OR sub.maxSize > vSizeLimit;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
|
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
|
||||||
|
|
|
@ -51,18 +51,18 @@ BEGIN
|
||||||
|
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH vItemPackingTypes INTO vitemPackingTypeFk;
|
FETCH vItemPackingTypes INTO vItemPackingTypeFk;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL ticket_Clone(vSelf, vNewTicketFk);
|
CALL ticket_Clone(vSelf, vNewTicketFk);
|
||||||
|
|
||||||
UPDATE tmp.salesToMove
|
UPDATE tmp.salesToMove
|
||||||
SET ticketFk = vNewTicketFk
|
SET ticketFk = vNewTicketFk
|
||||||
WHERE itemPackingTypeFk = vItemPackingTypeFk;
|
WHERE itemPackingTypeFk = vItemPackingTypeFk;
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
CLOSE vItemPackingTypes;
|
CLOSE vItemPackingTypes;
|
||||||
|
|
Loading…
Reference in New Issue