feat: refs #8301 refs#8301 deprecatedBack #3333
|
@ -12,12 +12,6 @@
|
||||||
"required": true,
|
"required": true,
|
||||||
"id": true
|
"id": true
|
||||||
},
|
},
|
||||||
"sectorFromCode": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"sectorToCode": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"backupPrinterNotificationDelay": {
|
"backupPrinterNotificationDelay": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
DELETE FROM salix.ACL
|
||||||
|
WHERE property ='hasItemOlder';
|
||||||
|
|
||||||
|
ALTER TABLE vn.productionConfig DROP FOREIGN KEY productionConfig_sector_FK;
|
||||||
|
ALTER TABLE vn.productionConfig DROP FOREIGN KEY productionConfig_sector_FK_1;
|
||||||
|
|
||||||
|
ALTER TABLE vn.productionConfig DROP COLUMN sectorToCode;
|
||||||
|
ALTER TABLE vn.productionConfig DROP COLUMN sectorFromCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethod('getListItemNewer', {
|
|
||||||
description:
|
|
||||||
'Get boolean if any or specific item of the shelving has older created in another shelving or parking',
|
|
||||||
accessType: 'READ',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'shelvingFk',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: 'Shelving code'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'parking',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: 'Parking code'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
returns: {
|
|
||||||
type: 'Array',
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
path: `/getListItemNewer`,
|
|
||||||
verb: 'GET'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.getListItemNewer = async(shelvingFk, parking, options) => {
|
|
||||||
const myOptions = {};
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
const [isParkingToReview] = await Self.rawSql(`
|
|
||||||
SELECT COUNT(p.id) parkingToReview
|
|
||||||
FROM vn.parking p
|
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
|
||||||
JOIN vn.productionConfig pc
|
|
||||||
WHERE p.code = ? AND s.code = pc.sectorToCode;`,
|
|
||||||
[parking], myOptions);
|
|
||||||
|
|
||||||
if (isParkingToReview['parkingToReview'] < 1) return [];
|
|
||||||
|
|
||||||
const result = await Self.rawSql(`
|
|
||||||
WITH tItemShelving AS(
|
|
||||||
SELECT is2.itemFk, is2.created, p.sectorFK, is2.id
|
|
||||||
FROM vn.itemShelving is2
|
|
||||||
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
|
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
|
||||||
JOIN vn.productionConfig pc
|
|
||||||
WHERE sh.code = ? AND s.code = pc.sectorFromCode
|
|
||||||
), tItemInSector AS (
|
|
||||||
SELECT is2.itemFk, is2.created, sh.code
|
|
||||||
FROM vn.itemShelving is2
|
|
||||||
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
|
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
|
||||||
JOIN vn.productionConfig pc
|
|
||||||
WHERE sh.code <> ?
|
|
||||||
AND s.code = pc.sectorFromCode)
|
|
||||||
SELECT ti.itemFK, tis.code shelvingFk
|
|
||||||
FROM tItemShelving ti
|
|
||||||
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
|
||||||
JOIN vn.productionConfig pc
|
|
||||||
WHERE ti.created + INTERVAL pc.itemOlderReviewHours HOUR < tis.created;`,
|
|
||||||
[shelvingFk, shelvingFk], myOptions);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,32 +0,0 @@
|
||||||
|
|
||||||
const {models} = require('vn-loopback/server/server');
|
|
||||||
|
|
||||||
describe('itemShelving getListItemNewer()', () => {
|
|
||||||
it('should return true because there is an older item', async() => {
|
|
||||||
const shelving = 'NBB';
|
|
||||||
const parking = '700-01';
|
|
||||||
|
|
||||||
const sectorCamHighCode = 'FIRST';
|
|
||||||
const sectorCamCode = 'NS';
|
|
||||||
|
|
||||||
const tx = await models.Sector.beginTransaction({});
|
|
||||||
const myOptions = {transaction: tx};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const config = await models.ProductionConfig.findOne();
|
|
||||||
|
|
||||||
await config.updateAttributes({
|
|
||||||
sectorToCode: sectorCamHighCode,
|
|
||||||
sectorFromCode: sectorCamCode
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
|
|
||||||
|
|
||||||
expect(result.length).toEqual(3);
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -4,6 +4,5 @@ module.exports = Self => {
|
||||||
require('../methods/item-shelving/getInventory')(Self);
|
require('../methods/item-shelving/getInventory')(Self);
|
||||||
require('../methods/item-shelving/getAlternative')(Self);
|
require('../methods/item-shelving/getAlternative')(Self);
|
||||||
require('../methods/item-shelving/updateFromSale')(Self);
|
require('../methods/item-shelving/updateFromSale')(Self);
|
||||||
require('../methods/item-shelving/getListItemNewer')(Self);
|
|
||||||
require('../methods/item-shelving/getItemsByReviewOrder')(Self);
|
require('../methods/item-shelving/getItemsByReviewOrder')(Self);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue