#6243 generalize cmr section #2406
|
@ -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 (762,'Route','filter','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (763,'Route','getByWorker','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 (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 (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (767,'Route','getTickets','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');
|
INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee');
|
||||||
|
|
|
@ -3,8 +3,8 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('getExternalCmrs', {
|
Self.remoteMethod('cmrs', {
|
||||||
description: 'Returns an array of external cmrs',
|
description: 'Returns an array of cmrs',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
|
@ -53,31 +53,14 @@ module.exports = Self => {
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/getExternalCmrs`,
|
path: `/cmrs`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getExternalCmrs = async(
|
Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options
|
||||||
filter,
|
|
||||||
cmrFk,
|
|
||||||
ticketFk,
|
|
||||||
routeFk,
|
|
||||||
country,
|
|
||||||
clientFk,
|
|
||||||
hasCmrDms,
|
|
||||||
shipped,
|
|
||||||
options
|
|
||||||
) => {
|
) => {
|
||||||
const params = {
|
const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped};
|
||||||
cmrFk,
|
|
||||||
ticketFk,
|
|
||||||
routeFk,
|
|
||||||
country,
|
|
||||||
clientFk,
|
|
||||||
hasCmrDms,
|
|
||||||
shipped,
|
|
||||||
};
|
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
|
|
||||||
let where = buildFilter(params, (param, value) => {
|
let where = buildFilter(params, (param, value) => {
|
||||||
|
@ -124,8 +107,7 @@ module.exports = Self => {
|
||||||
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
||||||
WHERE dt.name = 'cmr'
|
WHERE dt.name = 'cmr'
|
||||||
) sub ON sub.ticketFk = t.id
|
) sub ON sub.ticketFk = t.id
|
||||||
WHERE co.code <> 'ES'
|
WHERE am.name <> 'ABONO'
|
||||||
AND am.name <> 'ABONO'
|
|
||||||
AND w.code = 'ALG'
|
AND w.code = 'ALG'
|
||||||
AND t.cmrFk
|
AND t.cmrFk
|
||||||
) sub
|
) sub
|
|
@ -15,7 +15,7 @@ module.exports = Self => {
|
||||||
require('../methods/route/sendSms')(Self);
|
require('../methods/route/sendSms')(Self);
|
||||||
require('../methods/route/downloadZip')(Self);
|
require('../methods/route/downloadZip')(Self);
|
||||||
require('../methods/route/cmr')(Self);
|
require('../methods/route/cmr')(Self);
|
||||||
require('../methods/route/getExternalCmrs')(Self);
|
require('../methods/route/cmrs')(Self);
|
||||||
require('../methods/route/downloadCmrsZip')(Self);
|
require('../methods/route/downloadCmrsZip')(Self);
|
||||||
require('../methods/route/cmrEmail')(Self);
|
require('../methods/route/cmrEmail')(Self);
|
||||||
require('../methods/route/getExpeditionSummary')(Self);
|
require('../methods/route/getExpeditionSummary')(Self);
|
||||||
|
|
|
@ -39,8 +39,7 @@ SELECT c.id cmrFk,
|
||||||
LEFT JOIN supplier s ON s.id = c.supplierFk
|
LEFT JOIN supplier s ON s.id = c.supplierFk
|
||||||
LEFT JOIN country cou ON cou.id = s.countryFk
|
LEFT JOIN country cou ON cou.id = s.countryFk
|
||||||
LEFT JOIN company co ON co.id = c.companyFk
|
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 = c.companyFk
|
||||||
LEFT JOIN supplier s2 ON s2.id = sa.supplierFk
|
|
||||||
LEFT JOIN country cou2 ON cou2.id = s2.countryFk
|
LEFT JOIN country cou2 ON cou2.id = s2.countryFk
|
||||||
LEFT JOIN `address` a ON a.id = c.addressToFk
|
LEFT JOIN `address` a ON a.id = c.addressToFk
|
||||||
LEFT JOIN province p ON p.id = a.provinceFk
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
|
|
Loading…
Reference in New Issue