refactor: refs #6494 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-03-04 13:34:42 +01:00
parent 0b63991303
commit a96743c3b9
1 changed files with 12 additions and 21 deletions

View File

@ -15,11 +15,8 @@ BEGIN
* @param vMaxAlertLevel Id nivel de alerta
* @param vWarehouseFk Id de almacén
*/
DECLARE vMidnight DATETIME DEFAULT util.dayEnd(vDated);
DECLARE vEndingDate DATETIME DEFAULT vMidnight + INTERVAL vScopeDays DAY;
DECLARE vEndingDate DATETIME DEFAULT util.dayEnd(vDated) + INTERVAL vScopeDays DAY;
CREATE OR REPLACE TEMPORARY TABLE tConfectionControlSource
ENGINE = MEMORY
SELECT t.shipped,
t.id ticketFk,
s.id saleFk,
@ -73,27 +70,24 @@ BEGIN
AND tls.alertLevel < vMaxAlertLevel
AND wh.hasConfectionTeam
AND t.shipped BETWEEN vDated AND vEndingDate
AND s.quantity > 0;
-- Entradas
INSERT INTO tConfectionControlSource(
shipped,
ticketFk,
quantity,
concept,
category,
nickname,
warehouse,
description
)
AND s.quantity > 0
UNION ALL
SELECT tr.shipped,
e.id,
NULL,
b.quantity,
i.name,
NULL,
i.category,
NULL,
whi.name,
who.name,
ct.description
NULL,
NULL,
NULL,
ct.description,
NULL,
NULL
FROM buy b
JOIN `entry` e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
@ -105,8 +99,5 @@ BEGIN
WHERE who.hasConfectionTeam
AND it.making
AND tr.shipped BETWEEN vDated AND vEndingDate;
SELECT * FROM tConfectionControlSource;
DROP TEMPORARY TABLE tConfectionControlSource;
END$$
DELIMITER ;