2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `srt`.`bufferDayMinute`
|
|
|
|
AS SELECT `b`.`id` AS `bufferFk`,
|
|
|
|
`e`.`id` AS `expeditionFk`,
|
2024-04-30 09:48:18 +00:00
|
|
|
`srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`e`.`position` AS `position`,
|
|
|
|
IFNULL(
|
2024-04-30 09:48:18 +00:00
|
|
|
`rs`.`eta`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) MINUTE
|
|
|
|
) AS `ETD`,
|
|
|
|
`e2`.`ticketFk` AS `ticketFk`,
|
|
|
|
IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`) AS `routeFk`,
|
|
|
|
`z`.`name` AS `zonaTicket`,
|
|
|
|
`es`.`description` AS `expeditionState`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`srt`.`buffer` `b`
|
|
|
|
LEFT JOIN `srt`.`expedition` `e` ON(`b`.`id` = `e`.`bufferFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `srt`.`expeditionState` `es` ON(`es`.`id` = `e`.`stateFk`)
|
|
|
|
)
|
|
|
|
JOIN `srt`.`bufferType` `bt` ON(`bt`.`id` = `b`.`typeFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`expedition` `e2` ON(`e2`.`id` = `e`.`id`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`ticket` `t` ON(`e2`.`ticketFk` = `t`.`id`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
|
|
|
)
|
2024-04-30 09:48:18 +00:00
|
|
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
|
|
|
|
)
|
|
|
|
WHERE `b`.`isActive` <> 0
|