feat hasItemOlder refs#6964
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-06-17 19:50:51 +02:00
parent dc777b2d7a
commit eedcdb54fa
2 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
USE vn;
ALTER TABLE vn.productionConfig ADD sectorFromCode varchar(11) NULL COMMENT 'Sector origen que se revisa ítems más nuevos al parkinear';
ALTER TABLE vn.productionConfig ADD sectorToCode varchar(11) NULL COMMENT 'Sector destino que se revisa ítems más nuevos al parkinear';
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK FOREIGN KEY (sectorFromCode) REFERENCES vn.sector(code) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK_1 FOREIGN KEY (sectorToCode) REFERENCES vn.sector(code) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -35,7 +35,8 @@ module.exports = Self => {
SELECT COUNT(p.id) parkingToReview SELECT COUNT(p.id) parkingToReview
FROM vn.parking p FROM vn.parking p
JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.sector s ON s.id = p.sectorFk
WHERE p.code = ? AND s.code = "CAMARA SECTOR D";`, JOIN vn.productionConfig pc
WHERE p.code = ? AND s.code = pc.sectorToCode;`,
[parking], myOptions); [parking], myOptions);
if (isParkingToReview[0]['parkingToReview'] > 0) { if (isParkingToReview[0]['parkingToReview'] > 0) {
@ -46,15 +47,17 @@ module.exports = Self => {
JOIN vn.shelving sh ON sh.code = is2.shelvingFk JOIN vn.shelving sh ON sh.code = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.sector s ON s.id = p.sectorFk
WHERE is2.shelvingFk = ? AND s.code = "NAVE ALGEMESI" JOIN vn.productionConfig pc
WHERE is2.shelvingFk = ? AND s.code = c.sectorFromCode
), tItemInSector AS ( ), tItemInSector AS (
SELECT is2.itemFk, is2.created, is2.shelvingFk SELECT is2.itemFk, is2.created, is2.shelvingFk
FROM vn.itemShelving is2 FROM vn.itemShelving is2
JOIN vn.shelving sh ON sh.code = is2.shelvingFk JOIN vn.shelving sh ON sh.code = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE is2.shelvingFk <> ? WHERE is2.shelvingFk <> ?
AND s.code = "NAVE ALGEMESI") AND s.code = c.sectorFromCode)
SELECT ti.itemFK, tis.shelvingFk SELECT ti.itemFK, tis.shelvingFk
FROM tItemShelving ti FROM tItemShelving ti
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk JOIN tItemInSector tis ON tis.itemFk = ti.itemFk