7631_testToMaster_2426 #2634

Merged
alexm merged 147 commits from 7631_testToMaster_2426 into master 2024-06-25 06:36:59 +00:00
4 changed files with 37 additions and 26 deletions
Showing only changes of commit 239814e6b4 - Show all commits

View File

@ -3,17 +3,23 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "productionConfig"
"table": "productionConfig"
}
},
},
"properties": {
"id": {
"type": "number",
"required": true,
"id": true
},
"sectorFromCode": {
"type": "string"
},
"sectorToCode": {
"type": "string"
},
"backupPrinterNotificationDelay": {
"type": "string"
}
}
}
}

View File

@ -2,8 +2,8 @@
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 sectorFromCode varchar(15) NULL COMMENT 'Sector origen que se revisa ítems más nuevos al parkinear';
ALTER TABLE vn.productionConfig ADD sectorToCode varchar(15) 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;
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK FOREIGN KEY (sectorFromCode) REFERENCES vn.sector(code) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK_1 FOREIGN KEY (sectorToCode) REFERENCES vn.sector(code) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -49,7 +49,7 @@ module.exports = Self => {
JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE is2.shelvingFk = ? AND s.code = c.sectorFromCode
WHERE is2.shelvingFk = ? AND s.code = pc.sectorFromCode
), tItemInSector AS (
SELECT is2.itemFk, is2.created, is2.shelvingFk
FROM vn.itemShelving is2
@ -58,7 +58,7 @@ module.exports = Self => {
JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE is2.shelvingFk <> ?
AND s.code = c.sectorFromCode)
AND s.code = pc.sectorFromCode)
SELECT ti.itemFK, tis.shelvingFk
FROM tItemShelving ti
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk

View File

@ -2,31 +2,36 @@
const {models} = require('vn-loopback/server/server');
describe('itemShelving getListItemNewer()', () => {
fit('should return true because there is an older item', async() => {
it('should return true because there is an older item', async() => {
const shelving = 'NCC';
const parking = 'A-47-1';
const sectorCam = 1;
const sectorCamCode = 'CAMARA SECTOR D';
const sectorCamHigh = 9991;
const sectorCamHighCode = 'NAVE ALGEMESI';
const sectorCamHighCode = 'CAMARA SECTOR D';
const sectorCamCode = 'NAVE ALGEMESI';
const sectorCamCodeHighId = 1;
const sectorCamCodeId = 9991;
const tx = await models.Sector.beginTransaction({});
const myOptions = {transaction: tx};
const filter = {where: {id: sectorCam}};
const filterHigh = {where: {id: sectorCamHigh}};
try {
const sectorCamBefore = await models.Sector.findOne(filter, myOptions);
await sectorCamBefore.updateAttributes({
code: sectorCamCode
}, myOptions);
const sectorCamHighBefore = await models.Sector.findOne(filterHigh, myOptions);
await sectorCamHighBefore.updateAttributes({
const sectorHighCam = await models.Sector.findById(sectorCamCodeHighId, null, myOptions);
await sectorHighCam.updateAttributes({
code: sectorCamHighCode
}, myOptions);
});
const sectorCam = await models.Sector.findById(sectorCamCodeId, null, myOptions);
await sectorCam.updateAttributes({
code: sectorCamCode
});
const config = await models.ProductionConfig.findOne();
await config.updateAttributes({
sectorToCode: sectorCamHighCode,
sectorFromCode: sectorCamCode
});
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);