fixes: refs #7760 collection problems #2888

Merged
carlosap merged 7 commits from 7760-Refactor-collection_assign into dev 2024-08-28 15:27:16 +00:00
3 changed files with 21 additions and 18 deletions
Showing only changes of commit 3ac2c18da5 - Show all commits

View File

@ -2,29 +2,28 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
-- Fetch variables
DECLARE vTicketFk INT;
carlosap marked this conversation as resolved
Review

??

??
DECLARE cCur CURSOR FOR
DECLARE vTickets CURSOR FOR
SELECT ticketFk
carlosap marked this conversation as resolved
Review
El nombre del cursor no es correcto: https://wiki.verdnatura.es/index.php/Convenciones_SQL#Cursores
FROM vn.ticketCollection
FROM ticketCollection
WHERE collectionFk = vCollectionFk;
carlosap marked this conversation as resolved
Review

Aquí sobre el vn.

Aquí sobre el `vn.`
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
OPEN cCur;
OPEN vTickets;
l: LOOP
SET vDone = FALSE;
FETCH cCur INTO vTicketFk;
FETCH vTickets INTO vTicketFk;
IF vDone THEN
LEAVE l;
END IF;
CALL vn.ticket_mergeSales(vTicketFk);
CALL ticket_mergeSales(vTicketFk);
END LOOP;
carlosap marked this conversation as resolved
Review

Aquí sobre el vn.

Aquí sobre el `vn.`
CLOSE cCur;
CLOSE vTickets;
END$$
DELIMITER ;

View File

@ -12,9 +12,10 @@ BEGIN
DECLARE vWarehouseFk INT;
DECLARE vWagons INT;
DECLARE vTrainFk INT;
DECLARE vLinesLimit INT DEFAULT NULL;
DECLARE vLinesLimit INT;
carlosap marked this conversation as resolved Outdated

Por defecto ya es NULL

Por defecto ya es NULL
DECLARE vTicketLines INT;
DECLARE vVolumeLimit DECIMAL DEFAULT NULL;
DECLARE vVolumeLimit DECIMAL;
carlosap marked this conversation as resolved Outdated

Por defecto ya es NULL

Por defecto ya es NULL
DECLARE vSizeLimit INT;
DECLARE vTicketVolume DECIMAL;
DECLARE vMaxTickets INT;
carlosap marked this conversation as resolved
Review

ja que estem renombra a vStateCode perque no es el id lo que es guarda sino el code, es confus

ja que estem renombra a vStateCode perque no es el id lo que es guarda sino el code, es confus
DECLARE vStateFk VARCHAR(45);
@ -58,7 +59,8 @@ BEGIN
o.numberOfWagons,
o.trainFk,
o.linesLimit,
o.volumeLimit
o.volumeLimit,
o.sizeLimit
INTO vMaxTickets,
vHasUniqueCollectionTime,
vWorkerCode,
@ -68,7 +70,8 @@ BEGIN
vWagons,
vTrainFk,
vLinesLimit,
vVolumeLimit
vVolumeLimit,
vSizeLimit
FROM worker w
JOIN operator o ON o.workerFk = w.id
JOIN state st ON st.`code` = 'ON_PREPARATION'
@ -155,8 +158,9 @@ BEGIN
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) > 0
OR (pb.lines >= vLinesLimit AND vLinesLimit IS NOT NULL)
OR (pb.m3 >= vVolumeLimit AND vVolumeLimit IS NOT NULL);
OR pb.lines > COALESCE(vLinesLimit, pb.lines)
OR pb.m3 > COALESCE(vVolumeLimit, pb.m3)
OR sub.maxSize > vSizeLimit;
END IF;
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede

View File

@ -51,18 +51,18 @@ BEGIN
l: LOOP
SET vDone = FALSE;
FETCH vItemPackingTypes INTO vitemPackingTypeFk;
FETCH vItemPackingTypes INTO vItemPackingTypeFk;
carlosap marked this conversation as resolved Outdated

vItemPackingTypeFk

vItemPackingTypeFk
IF vDone THEN
LEAVE l;
END IF;
CALL ticket_Clone(vSelf, vNewTicketFk);
UPDATE tmp.salesToMove
SET ticketFk = vNewTicketFk
WHERE itemPackingTypeFk = vItemPackingTypeFk;
END LOOP;
CLOSE vItemPackingTypes;