#6243 generalize cmr section #2406

Merged
jorgep merged 10 commits from 6243-generalizeCmrSection into dev 2024-06-11 07:41:21 +00:00
4 changed files with 9 additions and 28 deletions
Showing only changes of commit 40b2c32a00 - Show all commits

View File

@ -1783,7 +1783,7 @@ INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','emplo
INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (764,'Route','getDeliveryPoint','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (765,'Route','getExternalCmrs','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (765,'Route','cmrs','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (767,'Route','getTickets','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee');

View File

@ -3,8 +3,8 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethod('getExternalCmrs', {
description: 'Returns an array of external cmrs',
Self.remoteMethod('cmrs', {
description: 'Returns an array of cmrs',
accessType: 'READ',
accepts: [
{
@ -53,31 +53,14 @@ module.exports = Self => {
root: true
},
http: {
path: `/getExternalCmrs`,
path: `/cmrs`,
verb: 'GET'
}
});
Self.getExternalCmrs = async(
filter,
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
options
Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options
) => {
const params = {
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
};
const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped};
const conn = Self.dataSource.connector;
let where = buildFilter(params, (param, value) => {
@ -124,8 +107,7 @@ module.exports = Self => {
JOIN dmsType dt ON dt.id = d.dmsTypeFk
WHERE dt.name = 'cmr'
) sub ON sub.ticketFk = t.id
WHERE co.code <> 'ES'
AND am.name <> 'ABONO'
WHERE am.name <> 'ABONO'
AND w.code = 'ALG'
AND t.cmrFk
) sub

View File

@ -15,7 +15,7 @@ module.exports = Self => {
require('../methods/route/sendSms')(Self);
require('../methods/route/downloadZip')(Self);
require('../methods/route/cmr')(Self);
require('../methods/route/getExternalCmrs')(Self);
require('../methods/route/cmrs')(Self);
require('../methods/route/downloadCmrsZip')(Self);
require('../methods/route/cmrEmail')(Self);
require('../methods/route/getExpeditionSummary')(Self);

View File

@ -39,8 +39,7 @@ SELECT c.id cmrFk,
LEFT JOIN supplier s ON s.id = c.supplierFk
LEFT JOIN country cou ON cou.id = s.countryFk
LEFT JOIN company co ON co.id = c.companyFk
LEFT JOIN supplierAccount sa ON sa.id = co.supplierAccountFk
LEFT JOIN supplier s2 ON s2.id = sa.supplierFk
LEFT JOIN supplier s2 ON s2.id = c.companyFk
LEFT JOIN country cou2 ON cou2.id = s2.countryFk
LEFT JOIN `address` a ON a.id = c.addressToFk
LEFT JOIN province p ON p.id = a.provinceFk