7631_testToMaster_2426 #2634

Merged
alexm merged 147 commits from 7631_testToMaster_2426 into master 2024-06-25 06:36:59 +00:00
1 changed files with 5 additions and 6 deletions
Showing only changes of commit 4cf5c0775c - Show all commits

View File

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