7631_testToMaster_2426 #2634
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue