feat: refs #7683 productionControl
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
1866c16727
commit
8469b2ac3f
|
@ -174,27 +174,30 @@ proc: BEGIN
|
|||
WHERE NOT `lines`;
|
||||
|
||||
-- Lineas por linea de encajado
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemPackingType
|
||||
(PRIMARY KEY(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk;
|
||||
|
||||
UPDATE tmp.productionBuffer pb
|
||||
JOIN (
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk
|
||||
) sub2 ON sub2.ticketFk = pb.ticketFk
|
||||
SET pb.H = sub2.H,
|
||||
pb.V = sub2.V,
|
||||
pb.N = sub2.N;
|
||||
JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
|
||||
SET pb.H = ti.H,
|
||||
pb.V = ti.V,
|
||||
pb.N = ti.N;
|
||||
|
||||
-- Colecciones segun tipo de encajado
|
||||
UPDATE tmp.productionBuffer pb
|
||||
|
|
Loading…
Reference in New Issue