refs #6964 feat: hasItemOlder
This commit is contained in:
parent
a52b9b6d2e
commit
49fed4e51e
|
@ -0,0 +1,6 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
ALTER TABLE vn.sector ADD hasItemOlderReview BIGINT DEFAULT false NULL COMMENT 'Indica si el sector se revisa para comprobar si tiene ítems más viejos';
|
||||||
|
ALTER TABLE vn.productionConfig ADD itemOlderReviewHours int(11) NULL COMMENT 'Horas que se tienen en cuenta para comprobar si un ítem es más viejo.';
|
|
@ -49,14 +49,19 @@ module.exports = Self => {
|
||||||
SELECT ish.itemFk, created, shelvingFk
|
SELECT ish.itemFk, created, shelvingFk
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
JOIN vn.shelving s ON ish.shelvingFk = s.code
|
JOIN vn.shelving s ON ish.shelvingFk = s.code
|
||||||
|
LEFT JOIN vn.parking p2 ON p2.id = s.parkingFk
|
||||||
WHERE ish.shelvingFk = ?
|
WHERE ish.shelvingFk = ?
|
||||||
)sub ON sub.itemFK = ish.itemFk
|
)sub ON sub.itemFK = ish.itemFk
|
||||||
JOIN vn.shelving s ON s.code = ish.shelvingFk
|
JOIN vn.shelving s ON s.code = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = s.parkingFk
|
JOIN vn.parking p ON p.id = s.parkingFk
|
||||||
WHERE sub.created > ish.created
|
JOIN vn.sector s2 ON s2.id = p.sectorFk
|
||||||
|
JOIN vn.productionConfig pc ON pc.itemOlderReviewHours
|
||||||
|
WHERE ish.created + INTERVAL pc.itemOlderReviewHours HOUR < sub.created
|
||||||
AND (p.code <> ? OR ? IS NULL)
|
AND (p.code <> ? OR ? IS NULL)
|
||||||
AND (ish.shelvingFk <> ? OR ? IS NULL)
|
AND (ish.shelvingFk <> ? OR ? IS NULL)
|
||||||
AND (ish.itemFk <> ? OR ? IS NULL)`,
|
AND (ish.itemFk = ? OR ? IS NULL)
|
||||||
|
AND (p.pickingOrder < sub.pickingOrder OR sub.pickingOrder IS NULL)
|
||||||
|
AND (s2.hasItemOlderReview)`,
|
||||||
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions);
|
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions);
|
||||||
return result[0]['countItemOlder'] > 0;
|
return result[0]['countItemOlder'] > 0;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue