2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost`
|
2024-01-15 11:31:03 +00:00
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`expeditionPallet_Print`
|
2024-04-30 09:48:18 +00:00
|
|
|
AS SELECT `rs2`.`description` AS `truck`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`t`.`routeFk` AS `routeFk`,
|
|
|
|
`r`.`description` AS `zone`,
|
|
|
|
COUNT(`es`.`id`) AS `eti`,
|
|
|
|
`ep`.`id` AS `palletFk`,
|
2024-05-27 07:07:23 +00:00
|
|
|
`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,
|
2024-01-15 11:31:03 +00:00
|
|
|
`t`.`warehouseFk` AS `warehouseFk`,
|
|
|
|
IF(
|
2024-02-15 09:04:15 +00:00
|
|
|
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
|
2024-01-15 11:31:03 +00:00
|
|
|
ucase(dayname(`r`.`created`)),
|
|
|
|
NULL
|
|
|
|
) AS `nombreDia`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
|
|
|
(
|
2024-04-30 10:02:19 +00:00
|
|
|
`vn`.`roadmapStop` `rs`
|
2024-04-30 09:48:18 +00:00
|
|
|
JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`expedition` `e` ON(`e`.`id` = `es`.`expeditionFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `e`.`ticketFk`)
|
|
|
|
)
|
|
|
|
JOIN `vn`.`route` `r` ON(`r`.`id` = `t`.`routeFk`)
|
|
|
|
)
|
2024-01-31 09:35:50 +00:00
|
|
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
2024-05-27 07:07:23 +00:00
|
|
|
LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`roadmapStopFk`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
GROUP BY `ep`.`id`,
|
|
|
|
`t`.`routeFk`
|