fix: refs #7969 fix on collectionNew #2962
|
@ -196,7 +196,8 @@ BEGIN
|
||||||
OR LENGTH(pb.problem) > 0
|
OR LENGTH(pb.problem) > 0
|
||||||
OR pb.lines > vLinesLimit
|
OR pb.lines > vLinesLimit
|
||||||
OR pb.m3 > vVolumeLimit
|
OR pb.m3 > vVolumeLimit
|
||||||
OR sub.maxSize > vSizeLimit;
|
OR sub.maxSize > vSizeLimit
|
||||||
|
OR pb.hasPlantTray;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Es importante que el primer ticket se coja en todos los casos
|
-- Es importante que el primer ticket se coja en todos los casos
|
||||||
|
|
|
@ -211,8 +211,6 @@ proc: BEGIN
|
||||||
salesInParkingCount INT DEFAULT 0)
|
salesInParkingCount INT DEFAULT 0)
|
||||||
ENGINE = MEMORY;
|
ENGINE = MEMORY;
|
||||||
|
|
||||||
-- Insertamos todos los tickets que tienen productos parkineados
|
|
||||||
-- en sectores de previa, segun el sector
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
|
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
|
||||||
(PRIMARY KEY(itemFk, sectorFk))
|
(PRIMARY KEY(itemFk, sectorFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
|
@ -245,7 +243,6 @@ proc: BEGIN
|
||||||
AND s.quantity > 0
|
AND s.quantity > 0
|
||||||
GROUP BY pb.ticketFk;
|
GROUP BY pb.ticketFk;
|
||||||
|
|
||||||
-- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
|
|
||||||
UPDATE tmp.ticketWithPrevia twp
|
UPDATE tmp.ticketWithPrevia twp
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
|
SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
|
||||||
|
@ -259,12 +256,28 @@ proc: BEGIN
|
||||||
) sub ON twp.ticketFk = sub.ticketFk
|
) sub ON twp.ticketFk = sub.ticketFk
|
||||||
SET twp.salesInParkingCount = sub.salesInParkingCount;
|
SET twp.salesInParkingCount = sub.salesInParkingCount;
|
||||||
|
|
||||||
-- Marcamos como pendientes aquellos que no coinciden las cantidades
|
|
||||||
UPDATE tmp.productionBuffer pb
|
UPDATE tmp.productionBuffer pb
|
||||||
JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
|
JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
|
||||||
SET pb.previousWithoutParking = TRUE
|
SET pb.previousWithoutParking = TRUE
|
||||||
WHERE twp.salesCount > twp.salesInParkingCount;
|
WHERE twp.salesCount > twp.salesInParkingCount;
|
||||||
|
|
||||||
|
-- hasPlantTray
|
||||||
|
ALTER TABLE tmp.productionBuffer
|
||||||
|
ADD hasPlantTray BOOL DEFAULT FALSE;
|
||||||
|
|
||||||
|
UPDATE tmp.productionBuffer pb
|
||||||
|
JOIN sale s ON s.ticketFk = pb.ticketFk
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
|
JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk AND lb.item_id = s.itemFk
|
||||||
|
JOIN buy b ON b.id = lb.buy_id
|
||||||
|
JOIN packaging p ON p.id = b.packagingFk
|
||||||
|
JOIN productionConfig pc
|
||||||
|
SET hasPlantTray = TRUE
|
||||||
|
WHERE ic.code = 'plant'
|
||||||
|
AND p.`depth` >= pc.minPlantTrayLength;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.productionTicket,
|
tmp.productionTicket,
|
||||||
tmp.ticket,
|
tmp.ticket,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.productionConfig ADD IF NOT EXISTS minPlantTrayLength INT DEFAULT 53 NOT NULL
|
||||||
|
COMMENT 'minimum length for plant tray restriction. Avoid to make collection of the ticket with this kind of item';
|
Loading…
Reference in New Issue