2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`expeditionCommon`
|
2024-04-30 09:48:18 +00:00
|
|
|
AS SELECT `rs`.`id` AS `truckFk`,
|
|
|
|
`rs`.`eta` AS `eta`,
|
|
|
|
IFNULL(ucase(`rs`.`description`), 'SIN ESCANEAR') AS `description`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`es`.`palletFk` AS `palletFk`,
|
|
|
|
`t`.`routeFk` AS `routeFk`,
|
|
|
|
`es`.`id` AS `scanFk`,
|
|
|
|
`e`.`id` AS `expeditionFk`,
|
|
|
|
`r`.`expeditionTruckFk` AS `expeditionTruckFk`,
|
|
|
|
`t`.`warehouseFk` AS `warehouseFk`,
|
|
|
|
`e`.`created` AS `lastPacked`,
|
|
|
|
`t`.`id` AS `ticketFk`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
2024-04-30 09:48:18 +00:00
|
|
|
`vn`.`roadmapStop` `et`
|
|
|
|
LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`expedition` `e` ON(`t`.`id` = `e`.`ticketFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`expeditionScan` `es` ON(`e`.`id` = `es`.`expeditionFk`)
|
|
|
|
)
|
|
|
|
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`)
|
|
|
|
)
|
2024-04-30 09:48:18 +00:00
|
|
|
WHERE `rs`.`eta` >= `util`.`VN_CURDATE`()
|