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
CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk);
DROP TEMPORARY TABLE tmp.ticketIPT;
UPDATE tmp.productionBuffer pb
JOIN (

View File

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