2018-06-28 13:24:27 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('getFirstShipped', {
|
|
|
|
description: 'Returns the first shipped and landed possible for params',
|
|
|
|
accessType: '',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'params',
|
|
|
|
type: 'object',
|
|
|
|
required: true,
|
|
|
|
description: 'agencyModeFk, addressFk, warehouseFk'
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
type: 'object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/getFirstShipped`,
|
|
|
|
verb: 'get'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.getFirstShipped = async params => {
|
2019-03-13 15:09:00 +00:00
|
|
|
let query = `CALL vn.zoneGetFirstShipped(?, ?, ?)`;
|
2018-06-28 13:24:27 +00:00
|
|
|
let [result] = await Self.rawSql(query, [params.agencyModeFk, params.addressFk, params.warehouseFk]);
|
|
|
|
|
|
|
|
return result[0];
|
|
|
|
};
|
|
|
|
};
|