refactor: refs #7662 Minor change
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-07-08 14:01:18 +02:00
parent 86859c98e3
commit 32793990ec
2 changed files with 10 additions and 11 deletions

View File

@ -229,7 +229,6 @@ BEGIN
AND ((vTicketVolume + @volume) <= vVolumeLimit OR vVolumeLimit IS NULL) THEN AND ((vTicketVolume + @volume) <= vVolumeLimit OR vVolumeLimit IS NULL) THEN
CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk); CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk);
DROP TEMPORARY TABLE tmp.ticketIPT;
UPDATE tmp.productionBuffer pb UPDATE tmp.productionBuffer pb
JOIN ( JOIN (

View File

@ -10,7 +10,6 @@ BEGIN
* *
* @param vSelf Id ticket * @param vSelf Id ticket
* @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original * @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/ */
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
DECLARE vNewTicketFk INT; DECLARE vNewTicketFk INT;
@ -61,17 +60,17 @@ BEGIN
FROM tSaleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT( CREATE OR REPLACE TEMPORARY TABLE tTicketIPT(
ticketFk INT, ticketFk INT,
itemPackingTypeFk VARCHAR(1) itemPackingTypeFk VARCHAR(1)
) ENGINE = MEMORY; ) ENGINE = MEMORY;
CASE vPackingTypesToSplit CASE vPackingTypesToSplit
WHEN 0 THEN WHEN 0 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
WHEN 1 THEN WHEN 1 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk)
SELECT vSelf, itemPackingTypeFk SELECT vSelf, itemPackingTypeFk
FROM tSaleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
@ -79,7 +78,7 @@ BEGIN
OPEN vSaleGroup; OPEN vSaleGroup;
FETCH vSaleGroup INTO vItemPackingTypeFk; FETCH vSaleGroup INTO vItemPackingTypeFk;
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
l: LOOP l: LOOP
@ -92,7 +91,7 @@ BEGIN
CALL ticket_Clone(vSelf, vNewTicketFk); CALL ticket_Clone(vSelf, vNewTicketFk);
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk)
VALUES(vNewTicketFk, vItemPackingTypeFk); VALUES(vNewTicketFk, vItemPackingTypeFk);
END LOOP; END LOOP;
@ -101,13 +100,13 @@ BEGIN
SELECT s.id SELECT s.id
FROM sale s FROM sale s
JOIN tSale ts ON ts.id = s.id JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk JOIN tTicketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
WHERE s.ticketFk = vSelf WHERE s.ticketFk = vSelf
FOR UPDATE; FOR UPDATE;
UPDATE sale s UPDATE sale s
JOIN tSale ts ON ts.id = s.id JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk JOIN tTicketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
SET s.ticketFk = t.ticketFk; SET s.ticketFk = t.ticketFk;
SELECT itemPackingTypeFk INTO vItemPackingTypeFk SELECT itemPackingTypeFk INTO vItemPackingTypeFk
@ -118,7 +117,7 @@ BEGIN
UPDATE sale s UPDATE sale s
JOIN tSale ts ON ts.id = s.id JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk JOIN tTicketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
SET s.ticketFk = t.ticketFk SET s.ticketFk = t.ticketFk
WHERE ts.itemPackingTypeFk IS NULL; WHERE ts.itemPackingTypeFk IS NULL;
END CASE; END CASE;
@ -127,6 +126,7 @@ BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tSale, tSale,
tSaleGroup; tSaleGroup,
tTicketIPT;
END$$ END$$
DELIMITER ; DELIMITER ;