This commit is contained in:
parent
08cf79b09b
commit
e1b6ba4276
|
@ -1,12 +1,12 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getPalletMatchState', {
|
||||
description: 'Get list of pallet from roadMapStop with true or false if state is matched',
|
||||
description: 'Get list of pallet from truckFk with true or false if state is matched',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'roadMapStopFk',
|
||||
arg: 'truckFk',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The roadmapFk id'
|
||||
description: 'The truckFk id'
|
||||
},
|
||||
{
|
||||
arg: 'state',
|
||||
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getPalletMatchState = async(roadMapStopFk, state, options) => {
|
||||
Self.getPalletMatchState = async(truckFk, state, options) => {
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
LEFT JOIN totalPalletExpedition tpe ON tpe.expedition = t.expedition
|
||||
LEFT JOIN totalPalletExpeditionCode tpec ON tpec.expedition = t.expedition
|
||||
GROUP BY t.pallet;`,
|
||||
[roadMapStopFk, state],
|
||||
[truckFk, state],
|
||||
myOptions);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -3,9 +3,9 @@ const {models} = require('vn-loopback/server/server');
|
|||
|
||||
describe('roadMapStop getPalletMatchState()', () => {
|
||||
it('should return list of pallet with true or false if state is matched', async() => {
|
||||
const roadmapStopFk = 1;
|
||||
const truckFk = 1;
|
||||
const state = 'ON DELIVERY';
|
||||
const result = await models.RoadmapStop.getPalletMatchState(roadmapStopFk, state);
|
||||
const result = await models.RoadmapStop.getPalletMatchState(truckFk, state);
|
||||
|
||||
expect(result[0].hasMatchStateCode).toBe(1);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue