feat: refs #7264 Minor change

This commit is contained in:
Guillermo Bonet 2024-05-15 14:05:35 +02:00
parent 53fa78894c
commit 9134e0ff65
1 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ BEGIN
CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
IF hasFatherSector THEN
CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT *
@ -97,7 +97,7 @@ BEGIN
SELECT ishr.*,
CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho,
CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente
FROM tmp.itemShelvingRadar ishr
FROM tItemShelvingRadar ishr
JOIN item i ON i.id = ishr.itemFk
LEFT JOIN (
SELECT s.itemFk, SUM(s.quantity) notPickedYed
@ -111,7 +111,7 @@ BEGIN
) sub ON sub.itemFk = ishr.itemFk
ORDER BY i.typeFk, i.longName;
ELSE
CREATE OR REPLACE TEMPORARY TABLE tmp.itemShelvingRadar
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT iss.itemFk,
@ -158,7 +158,7 @@ BEGIN
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`,
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes`
FROM itemTicketOut `io`
JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk
JOIN tItemShelvingRadar isr ON isr.itemFk = io.itemFk
JOIN ticket t ON t.id= io.ticketFk
JOIN ticketState ts ON ts.ticketFk = io.ticketFk
JOIN `state` s ON s.id = ts.stateFk
@ -178,14 +178,14 @@ BEGIN
) sub
GROUP BY itemFk, `hours`, `minutes`;
INSERT INTO tmp.itemShelvingRadar (itemFk)
INSERT INTO tItemShelvingRadar (itemFk)
SELECT itemFk FROM tmp.itemOutTime
ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity,
firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity),
`hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0),
`minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0);
UPDATE tmp.itemShelvingRadar isr
UPDATE tItemShelvingRadar isr
JOIN (
SELECT s.itemFk, SUM(s.quantity) amount
FROM sale s
@ -198,10 +198,10 @@ BEGIN
SET isr.dayEndVisible = dayEndVisible + sub.amount,
firstNegative = firstNegative + sub.amount;
SELECT * FROM tmp.itemShelvingRadar;
SELECT * FROM tItemShelvingRadar;
END IF;
DROP TEMPORARY TABLE tmp.itemShelvingRadar;
DROP TEMPORARY TABLE tItemShelvingRadar;
END$$
DELIMITER ;