feat: refs #6243 Add warehouseFk parameter
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-06-03 16:31:38 +02:00
parent 58053d8286
commit a13581ed97
1 changed files with 9 additions and 3 deletions

View File

@ -47,6 +47,10 @@ module.exports = Self => {
type: 'date', type: 'date',
description: 'The to date filter', description: 'The to date filter',
}, },
{
arg: 'warehouseFk',
type: 'integer',
}
], ],
returns: { returns: {
type: ['object'], type: ['object'],
@ -58,9 +62,10 @@ module.exports = Self => {
} }
}); });
Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options Self.cmrs = async(
filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, warehouseFk, options
) => { ) => {
const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped}; const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, warehouseFk, shipped};
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
let where = buildFilter(params, (param, value) => { let where = buildFilter(params, (param, value) => {
@ -89,7 +94,8 @@ module.exports = Self => {
co.name country, co.name country,
t.clientFk, t.clientFk,
IF(sub.id, TRUE, FALSE) hasCmrDms, IF(sub.id, TRUE, FALSE) hasCmrDms,
DATE(t.shipped) shipped DATE(t.shipped) shipped,
t.warehouseFk
FROM ticket t FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state s ON s.id = ts.stateFk JOIN state s ON s.id = ts.stateFk