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:11:55 +02:00
parent 32793990ec
commit eaca342777
2 changed files with 10 additions and 10 deletions

View File

@ -229,6 +229,7 @@ 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

@ -60,17 +60,17 @@ BEGIN
FROM tSaleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tTicketIPT( CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
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 tTicketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
WHEN 1 THEN WHEN 1 THEN
INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
SELECT vSelf, itemPackingTypeFk SELECT vSelf, itemPackingTypeFk
FROM tSaleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
@ -78,7 +78,7 @@ BEGIN
OPEN vSaleGroup; OPEN vSaleGroup;
FETCH vSaleGroup INTO vItemPackingTypeFk; FETCH vSaleGroup INTO vItemPackingTypeFk;
INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
l: LOOP l: LOOP
@ -91,7 +91,7 @@ BEGIN
CALL ticket_Clone(vSelf, vNewTicketFk); CALL ticket_Clone(vSelf, vNewTicketFk);
INSERT INTO tTicketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vNewTicketFk, vItemPackingTypeFk); VALUES(vNewTicketFk, vItemPackingTypeFk);
END LOOP; END LOOP;
@ -100,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 tTicketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk JOIN tmp.ticketIPT 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 tTicketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
SET s.ticketFk = t.ticketFk; SET s.ticketFk = t.ticketFk;
SELECT itemPackingTypeFk INTO vItemPackingTypeFk SELECT itemPackingTypeFk INTO vItemPackingTypeFk
@ -117,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 tTicketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk JOIN tmp.ticketIPT 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;
@ -126,7 +126,6 @@ BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tSale, tSale,
tSaleGroup, tSaleGroup;
tTicketIPT;
END$$ END$$
DELIMITER ; DELIMITER ;