feat roadmap refs #7195
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-07-02 08:39:42 +02:00
parent d9742afc9b
commit 08cf79b09b
2 changed files with 6 additions and 7 deletions

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