feat isScannedExpedition refs #7276
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-06-07 09:18:52 +02:00
parent 268c0a984c
commit 7c0fa6dbb9
1 changed files with 7 additions and 1 deletions

View File

@ -15,7 +15,8 @@ BEGIN
t.addressFk,
a.nickname,
sub2.itemPackingTypeConcat,
est.code
est.code,
sub5.isScanned
FROM expedition e
JOIN ticket t ON t.id = e.ticketFk
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
@ -33,6 +34,11 @@ BEGIN
GROUP BY sub.ticketFk
) sub2 ON sub2.ticketFk = t.id
LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk
LEFT JOIN (SELECT es.expeditionFk, isScanned
FROM expeditionState es
JOIN (SELECT expeditionFk, MAX(id) maxId
FROM expeditionState es
GROUP BY expeditionFk)sub4 ON sub4.maxId = es.id)sub5 ON sub5.expeditionFk = e.id
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC;
END$$