7773-testToMaster_2430 #2774

Merged
alexm merged 368 commits from 7773-testToMaster_2430 into master 2024-07-23 06:21:03 +00:00
2 changed files with 6 additions and 7 deletions
Showing only changes of commit 08cf79b09b - Show all commits

View File

@ -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

View File

@ -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);
});
});