2700 - Closure by multiple agencies
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a521ad4262
commit
1353a0987d
|
@ -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 {
|
try {
|
||||||
const reqArgs = req.args;
|
const reqArgs = req.args;
|
||||||
if (!reqArgs.agencyModeId)
|
if (!reqArgs.agencyModeId)
|
||||||
|
@ -89,6 +89,7 @@ module.exports = app => {
|
||||||
message: 'Task executed successfully'
|
message: 'Task executed successfully'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const agenciesId = reqArgs.agencyModeId.split(',');
|
||||||
const tickets = await db.rawSql(`
|
const tickets = await db.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
t.id
|
t.id
|
||||||
|
@ -97,12 +98,12 @@ module.exports = app => {
|
||||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN alertLevel al ON al.alertLevel = ts.alertLevel
|
JOIN alertLevel al ON al.alertLevel = ts.alertLevel
|
||||||
WHERE al.code = 'PACKED'
|
WHERE al.code = 'PACKED'
|
||||||
AND t.agencyModeFk = :agencyModeId
|
AND t.agencyModeFk IN(:agencyModeId)
|
||||||
AND t.warehouseFk = :warehouseId
|
AND t.warehouseFk = :warehouseId
|
||||||
AND DATE(t.shipped) BETWEEN DATE_ADD(:to, INTERVAL -2 DAY) AND :to
|
AND DATE(t.shipped) BETWEEN DATE_ADD(:to, INTERVAL -2 DAY) AND :to
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
GROUP BY e.ticketFk`, {
|
GROUP BY e.ticketFk`, {
|
||||||
agencyModeId: reqArgs.agencyModeId,
|
agencyModeId: agenciesId,
|
||||||
warehouseId: reqArgs.warehouseId,
|
warehouseId: reqArgs.warehouseId,
|
||||||
to: reqArgs.to
|
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 {
|
try {
|
||||||
const reqArgs = req.args;
|
const reqArgs = req.args;
|
||||||
if (!reqArgs.routeId)
|
if (!reqArgs.routeId)
|
||||||
|
|
Loading…
Reference in New Issue