feat: refs #7296 roadmapStopFk

This commit is contained in:
Robert Ferrús 2024-05-27 09:41:28 +02:00
parent eb503238d7
commit aaea0c95f7
4 changed files with 9 additions and 8 deletions

View File

@ -11,9 +11,9 @@ AS SELECT `e`.`truckFk` AS `id`,
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
COUNT(DISTINCT `e`.`expeditionFk`) AS `expeditions`,
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
max(`e`.`lastPacked`) AS `lastPacked`
FROM `vn`.`expeditionCommon` `e`
GROUP BY `e`.`truckFk`
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
`e`.`eta`

View File

@ -7,12 +7,12 @@ AS SELECT `e`.`truckFk` AS `id`,
`e`.`palletFk` AS `pallet`,
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
COUNT(DISTINCT `e`.`roadmapStopFk`) AS `destinos`,
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
COUNT(DISTINCT `e`.`expeditionTruckFk`) AS `destinos`,
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
max(`e`.`lastPacked`) AS `lastPacked`
FROM `vn`.`expeditionCommon` `e`
GROUP BY `e`.`truckFk`,
`e`.`palletFk`
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
`e`.`eta`,
`e`.`truckFk`

View File

@ -8,15 +8,15 @@ AS SELECT `e`.`truckFk` AS `id`,
`e`.`routeFk` AS `route`,
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
`rs`.`description` AS `destinos`,
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
`e`.`expeditionTruckFk` AS `expeditionTruckFk`,
max(`e`.`lastPacked`) AS `lastPacked`
FROM (
`vn`.`expeditionCommon` `e`
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`roadmapStopFk`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`)
)
GROUP BY `e`.`truckFk`,
`e`.`palletFk`,
`e`.`routeFk`
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
`e`.`palletFk`

View File

@ -0,0 +1 @@
ALTER TABLE vn.routesMonitor CHANGE expeditionTruckFk roadmapStopFk int(11) DEFAULT NULL NULL;