2700 - Closure by multiple agencies
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-01-04 09:22:32 +01:00
parent a521ad4262
commit 1353a0987d
1 changed files with 5 additions and 4 deletions

View File

@ -73,7 +73,7 @@ module.exports = app => {
}
});
app.get('/api/closure/by-agency', async function(req, res) {
app.get('/api/closure/by-agency', async function(req, res, next) {
try {
const reqArgs = req.args;
if (!reqArgs.agencyModeId)
@ -89,6 +89,7 @@ module.exports = app => {
message: 'Task executed successfully'
});
const agenciesId = reqArgs.agencyModeId.split(',');
const tickets = await db.rawSql(`
SELECT
t.id
@ -97,12 +98,12 @@ module.exports = app => {
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN alertLevel al ON al.alertLevel = ts.alertLevel
WHERE al.code = 'PACKED'
AND t.agencyModeFk = :agencyModeId
AND t.agencyModeFk IN(:agencyModeId)
AND t.warehouseFk = :warehouseId
AND DATE(t.shipped) BETWEEN DATE_ADD(:to, INTERVAL -2 DAY) AND :to
AND t.refFk IS NULL
GROUP BY e.ticketFk`, {
agencyModeId: reqArgs.agencyModeId,
agencyModeId: agenciesId,
warehouseId: reqArgs.warehouseId,
to: reqArgs.to
});
@ -114,7 +115,7 @@ module.exports = app => {
}
});
app.get('/api/closure/by-route', async function(req, res) {
app.get('/api/closure/by-route', async function(req, res, next) {
try {
const reqArgs = req.args;
if (!reqArgs.routeId)