2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `srt`.`upperStickers`
|
|
|
|
AS SELECT `e`.`id` AS `expeditionFk`,
|
|
|
|
`e`.`id` MOD 10000 AS `expedition`,
|
|
|
|
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`) + 120 MINUTE
|
|
|
|
) AS `ETD`,
|
|
|
|
`ve`.`ticketFk` AS `ticketFk`,
|
|
|
|
right(IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`), 3) AS `routeFk`,
|
|
|
|
`z`.`name` AS `zonaTicket`,
|
2024-04-30 09:48:18 +00:00
|
|
|
`rs`.`description` AS `truck`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`epo`.`workerCode` AS `worker`,
|
|
|
|
`p`.`name` AS `labeler`,
|
|
|
|
`ve`.`counter` AS `expeditionCounter`,
|
|
|
|
`vn`.`ticketTotalVolume`(`t`.`id`) AS `m3`,
|
|
|
|
`t`.`clientFk` AS `clientFk`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
`srt`.`expedition` `e`
|
|
|
|
LEFT JOIN `vn`.`expedition` `ve` ON(`ve`.`id` = `e`.`id`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ve`.`ticketFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
|
|
|
|
)
|
|
|
|
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
|
|
|
)
|
|
|
|
JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`printer` `p` ON(`p`.`id` = `epo`.`printerFk`)
|
|
|
|
)
|