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