7773-testToMaster_2430 #2774
|
@ -1,6 +1,6 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getPalletMatchState', {
|
||||
description: 'Get pallet',
|
||||
description: 'Get list of pallet from roadMapStop with true or false if state is matched',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'roadMapStopFk',
|
||||
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
|
||||
const result = await Self.rawSql(`
|
||||
WITH tPallet AS(
|
||||
SELECT ep.truckFk roadMapStop,ep.id pallet, e.id expedition, e.stateTypeFk
|
||||
SELECT ep.id pallet, e.id expedition, e.stateTypeFk
|
||||
FROM vn.expeditionPallet ep
|
||||
JOIN vn.expeditionScan es ON es.palletFk = ep.id
|
||||
JOIN expedition e ON e.id = es.expeditionFk
|
||||
|
@ -48,9 +48,8 @@ module.exports = Self => {
|
|||
WHERE code = ?
|
||||
GROUP BY expedition
|
||||
)
|
||||
SELECT t.roadMapStop,
|
||||
t.pallet,
|
||||
IF (tpe.totalPalletExpedition = tpec.totalPalletExpeditionCode, 'TRUE', 'FALSE') hasMatchStateCode
|
||||
SELECT t.pallet,
|
||||
tpe.totalPalletExpedition = tpec.totalPalletExpeditionCode hasMatchStateCode
|
||||
FROM tPallet t
|
||||
LEFT JOIN totalPalletExpedition tpe ON tpe.expedition = t.expedition
|
||||
LEFT JOIN totalPalletExpeditionCode tpec ON tpec.expedition = t.expedition
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('roadMapStop getPalletMatchState()', () => {
|
||||
fit('should return list of pallet with true or false if state is matched', async() => {
|
||||
it('should return list of pallet with true or false if state is matched', async() => {
|
||||
const roadmapStopFk = 1;
|
||||
const state = 'ON DELIVERY';
|
||||
const result = await models.RoadmapStop.getPalletMatchState(roadmapStopFk, state);
|
||||
|
||||
expect(result[0].hasMatchStateCode).toBe('TRUE');
|
||||
expect(result[0].hasMatchStateCode).toBe(1);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue