Merge pull request 'feat: refs #7296 expeditionTruck to roadmapStop' (!2386) from 7296-expeditionTruck into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2386
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Robert Ferrús 2024-05-15 09:06:47 +00:00
commit 23eea27268
25 changed files with 86 additions and 71 deletions

View File

@ -34,7 +34,7 @@ BEGIN
vPrinterFk, vPrinterFk,
IFNULL(right(`t`.`routeFk`, 3),0), IFNULL(right(`t`.`routeFk`, 3),0),
if (@vVolume := vn.ticketTotalVolume(t.id) > 1.5, @vVolume, IFNULL( rm.beachFk, 0)), if (@vVolume := vn.ticketTotalVolume(t.id) > 1.5, @vVolume, IFNULL( rm.beachFk, 0)),
LEFT(IFNULL(et.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName, LEFT(IFNULL(rs.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName,
t.clientFk , t.clientFk ,
ifnull(c.mobile, ifnull(a.mobile, ifnull(c.phone, a.phone))), ifnull(c.mobile, ifnull(a.mobile, ifnull(c.phone, a.phone))),
LEFT(p.name, 20), LEFT(p.name, 20),
@ -46,7 +46,7 @@ BEGIN
JOIN vn.address a ON a.id = t.addressFk JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk JOIN vn.province p ON p.id = a.provinceFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
LEFT JOIN vn.beach b ON b.code = rm.beachFk LEFT JOIN vn.beach b ON b.code = rm.beachFk
LEFT JOIN vn.`zone`z ON z.id = t.zoneFk LEFT JOIN vn.`zone`z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON t.agencyModeFk = am.id JOIN vn.agencyMode am ON t.agencyModeFk = am.id

View File

@ -15,14 +15,14 @@ BEGIN
DECLARE vDayMinute INT; DECLARE vDayMinute INT;
SELECT HOUR(IFNULL(et.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(et.ETD, z.`hour`)) INTO vDayMinute SELECT HOUR(IFNULL(rs.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(rs.ETD, z.`hour`)) INTO vDayMinute
FROM vn.expedition e FROM vn.expedition e
JOIN vn.ticket t ON e.ticketFk = t.id JOIN vn.ticket t ON e.ticketFk = t.id
JOIN vn.`zone` z ON z.id = t.zoneFk JOIN vn.`zone` z ON z.id = t.zoneFk
LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk
LEFT JOIN vn.expeditionTruck et ON rm.expeditionTruckFk = et.id LEFT JOIN vn.roadmapStop rs ON rm.expeditionTruckFk = rs.id
WHERE e.id = vExpeditionFk; WHERE e.id = vExpeditionFk;
RETURN vDayMinute; RETURN vDayMinute;

View File

@ -296,8 +296,8 @@ BEGIN
SET @dm := (24 * 60) - 10; SET @dm := (24 * 60) - 10;
UPDATE vn.expeditionTruck et UPDATE vn.roadmapStop rs
SET et.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE()) SET rs.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE())
WHERE description LIKE 'PRU%' ; WHERE description LIKE 'PRU%' ;
DELETE FROM srt.movingLog ; DELETE FROM srt.movingLog ;

View File

@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `srt`.`bufferDayMinute` VIEW `srt`.`bufferDayMinute`
AS SELECT `b`.`id` AS `bufferFk`, AS SELECT `b`.`id` AS `bufferFk`,
`e`.`id` AS `expeditionFk`, `e`.`id` AS `expeditionFk`,
`srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`, `srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`,
`e`.`position` AS `position`, `e`.`position` AS `position`,
IFNULL( IFNULL(
`et`.`eta`, `rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) MINUTE `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) MINUTE
) AS `ETD`, ) AS `ETD`,
`e2`.`ticketFk` AS `ticketFk`, `e2`.`ticketFk` AS `ticketFk`,
@ -34,7 +34,7 @@ FROM (
) )
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
) )
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
) )

View File

@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `e`.`id` AS `expeditionFk`, AS SELECT `e`.`id` AS `expeditionFk`,
`e`.`bufferFk` AS `bufferFk`, `e`.`bufferFk` AS `bufferFk`,
`e`.`position` AS `position`, `e`.`position` AS `position`,
`srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`, `srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`,
IFNULL( IFNULL(
`et`.`eta`, `rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE
) AS `eta`, ) AS `eta`,
`ve`.`ticketFk` AS `ticketFk`, `ve`.`ticketFk` AS `ticketFk`,
IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`) AS `routeFk`, IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`) AS `routeFk`,
`z`.`name` AS `zonaTicket`, `z`.`name` AS `zonaTicket`,
`et`.`description` AS `truck`, `rs`.`description` AS `truck`,
`es`.`description` AS `expeditionState`, `es`.`description` AS `expeditionState`,
`b`.`hasWorkerWaiting` AS `hasWorkerWaiting`, `b`.`hasWorkerWaiting` AS `hasWorkerWaiting`,
`b`.`isActive` AS `isActive`, `b`.`isActive` AS `isActive`,
IF( IF(
`et`.`id` IS NULL, `rs`.`id` IS NULL,
`c`.`bufferDefault`, `c`.`bufferDefault`,
`et`.`bufferFk` `rs`.`bufferFk`
) AS `bufferTruck`, ) AS `bufferTruck`,
`bt`.`typeName` AS `typeName`, `bt`.`typeName` AS `typeName`,
`rm`.`bufferFk` AS `routeBuffer` `rm`.`bufferFk` AS `routeBuffer`
@ -45,7 +45,7 @@ FROM (
) )
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
) )
JOIN `srt`.`config` `c` JOIN `srt`.`config` `c`
) )

View File

@ -4,13 +4,13 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `e`.`id` AS `expeditionFk`, AS SELECT `e`.`id` AS `expeditionFk`,
`e`.`id` MOD 10000 AS `expedition`, `e`.`id` MOD 10000 AS `expedition`,
IFNULL( IFNULL(
`et`.`eta`, `rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE `util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE
) AS `ETD`, ) AS `ETD`,
`ve`.`ticketFk` AS `ticketFk`, `ve`.`ticketFk` AS `ticketFk`,
right(IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`), 3) AS `routeFk`, right(IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`), 3) AS `routeFk`,
`z`.`name` AS `zonaTicket`, `z`.`name` AS `zonaTicket`,
`et`.`description` AS `truck`, `rs`.`description` AS `truck`,
`epo`.`workerCode` AS `worker`, `epo`.`workerCode` AS `worker`,
`p`.`name` AS `labeler`, `p`.`name` AS `labeler`,
`ve`.`counter` AS `expeditionCounter`, `ve`.`counter` AS `expeditionCounter`,
@ -32,7 +32,7 @@ FROM (
) )
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
) )
JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`) JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`)
) )

View File

@ -86,7 +86,7 @@ BEGIN
WHERE cs.description = 'Anulado' WHERE cs.description = 'Anulado'
AND c.created < v2Months; AND c.created < v2Months;
DELETE FROM expeditionTruck WHERE eta < v3Months; DELETE FROM roadmapStop WHERE eta < v3Months;
DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL; DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL;
-- Borrar travels sin entradas -- Borrar travels sin entradas

View File

@ -24,7 +24,7 @@ BEGIN
10 * p.height as height, 10 * p.height as height,
IFNULL(t.routeFk,am.agencyFk) routeFk, IFNULL(t.routeFk,am.agencyFk) routeFk,
hour(e.created) * 60 + minute(e.created), hour(e.created) * 60 + minute(e.created),
IFNULL(et.description , a.name), IFNULL(rs.description , a.name),
IFNULL(t.routeFk,am.agencyFk) criterion, IFNULL(t.routeFk,am.agencyFk) criterion,
IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass)
FROM vn.expedition e FROM vn.expedition e
@ -34,7 +34,7 @@ BEGIN
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.agency a ON a.id = am.agencyFk LEFT JOIN vn.agency a ON a.id = am.agencyFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
JOIN vn.packagingConfig pc JOIN vn.packagingConfig pc
WHERE t.warehouseFk IN (60,1,44) WHERE t.warehouseFk IN (60,1,44)
AND e.created BETWEEN vStarted AND vEnded AND e.created BETWEEN vStarted AND vEnded

View File

@ -2,7 +2,7 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45))
BEGIN BEGIN
INSERT INTO vn.expeditionTruck(eta,description) INSERT INTO vn.roadmapStop(eta,description)
VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription); VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription);
END$$ END$$

View File

@ -4,9 +4,9 @@ BEGIN
SELECT id truckFk, SELECT id truckFk,
eta, eta,
description Destino description Destino
FROM expeditionTruck FROM roadmapStop
WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
ORDER BY eta; ORDER BY eta;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -53,8 +53,8 @@ BEGIN
am.name zonaRuta, am.name zonaRuta,
t.routeFk ruta, t.routeFk ruta,
rm.beachFk ubicacion, rm.beachFk ubicacion,
et.eta , rs.eta ,
et.description camion, rs.description camion,
vTicketsPendientes AS ticketsPendientes, vTicketsPendientes AS ticketsPendientes,
vEtiquetasTotales AS etiquetasTotales, vEtiquetasTotales AS etiquetasTotales,
vEtiquetasEscaneadas AS etiquetasEscaneadas, vEtiquetasEscaneadas AS etiquetasEscaneadas,
@ -67,7 +67,7 @@ BEGIN
LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE e.id = vExpeditionFk; WHERE e.id = vExpeditionFk;
END$$ END$$

View File

@ -37,8 +37,8 @@ BEGIN
am.name zonaRuta, am.name zonaRuta,
t.routeFk ruta, t.routeFk ruta,
rm.beachFk ubicacion, rm.beachFk ubicacion,
et.eta , rs.eta ,
et.description camion, rs.description camion,
vTicketsPendientes AS ticketsPendientes, vTicketsPendientes AS ticketsPendientes,
vEtiquetasTotales AS etiquetasTotales, vEtiquetasTotales AS etiquetasTotales,
vEtiquetasEscaneadas AS etiquetasEscaneadas vEtiquetasEscaneadas AS etiquetasEscaneadas
@ -50,7 +50,7 @@ BEGIN
LEFT JOIN vn.route r ON r.id = t.routeFk LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE e.id = vExpeditionFk; WHERE e.id = vExpeditionFk;
END$$ END$$

View File

@ -20,7 +20,7 @@ BEGIN
CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color,
CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.level) levelV, CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.level) levelV,
tc.ticketFk, tc.ticketFk,
LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription, LEFT(COALESCE(rs.description, zo.name, am.name),12) agencyDescription,
am.name, am.name,
t.clientFk, t.clientFk,
CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 , CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 ,
@ -47,7 +47,7 @@ BEGIN
LEFT JOIN ticketTrolley tt ON tt.ticket = t.id LEFT JOIN ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN zone zo ON t.zoneFk = zo.id LEFT JOIN zone zo ON t.zoneFk = zo.id
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam) WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
GROUP BY t.id GROUP BY t.id
ORDER BY cc.code; ORDER BY cc.code;

View File

@ -106,8 +106,8 @@ BEGIN
SET rm.m3boxes = sub.m3boxes; SET rm.m3boxes = sub.m3boxes;
UPDATE routesMonitor rm UPDATE routesMonitor rm
JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
SET rm.etd = et.eta; SET rm.etd = rs.eta;
DROP TEMPORARY TABLE tmp.routesMonitor; DROP TEMPORARY TABLE tmp.routesMonitor;
END$$ END$$

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `vn`.`expeditionCommon` VIEW `vn`.`expeditionCommon`
AS SELECT `et`.`id` AS `truckFk`, AS SELECT `rs`.`id` AS `truckFk`,
`et`.`eta` AS `eta`, `rs`.`eta` AS `eta`,
IFNULL(ucase(`et`.`description`), 'SIN ESCANEAR') AS `description`, IFNULL(ucase(`rs`.`description`), 'SIN ESCANEAR') AS `description`,
`es`.`palletFk` AS `palletFk`, `es`.`palletFk` AS `palletFk`,
`t`.`routeFk` AS `routeFk`, `t`.`routeFk` AS `routeFk`,
`es`.`id` AS `scanFk`, `es`.`id` AS `scanFk`,
@ -17,8 +17,8 @@ FROM (
( (
( (
( (
`vn`.`expeditionTruck` `et` `vn`.`roadmapStop` `rs`
LEFT JOIN `vn`.`routesMonitor` `r` ON(`et`.`id` = `r`.`expeditionTruckFk`) LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`)
) )
LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`) LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`)
) )
@ -28,4 +28,4 @@ FROM (
) )
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`)
) )
WHERE `et`.`eta` >= `util`.`VN_CURDATE`() WHERE `rs`.`eta` >= `util`.`VN_CURDATE`()

View File

@ -1,12 +1,12 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `vn`.`expeditionPallet_Print` VIEW `vn`.`expeditionPallet_Print`
AS SELECT `et2`.`description` AS `truck`, AS SELECT `rs2`.`description` AS `truck`,
`t`.`routeFk` AS `routeFk`, `t`.`routeFk` AS `routeFk`,
`r`.`description` AS `zone`, `r`.`description` AS `zone`,
COUNT(`es`.`id`) AS `eti`, COUNT(`es`.`id`) AS `eti`,
`ep`.`id` AS `palletFk`, `ep`.`id` AS `palletFk`,
`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`, `rs`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,
`t`.`warehouseFk` AS `warehouseFk`, `t`.`warehouseFk` AS `warehouseFk`,
IF( IF(
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, `r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
@ -20,8 +20,8 @@ FROM (
( (
( (
( (
`vn`.`expeditionTruck` `et` `vn`.`roadmapStop` `rs`
JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`) JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`)
) )
JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`)
) )
@ -33,7 +33,7 @@ FROM (
) )
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`) LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`expeditionTruckFk`)
) )
GROUP BY `ep`.`id`, GROUP BY `ep`.`id`,
`t`.`routeFk` `t`.`routeFk`

View File

@ -15,7 +15,7 @@ FROM (
`vn`.`route` `r` `vn`.`route` `r`
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
) )
JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`) JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`)
) )

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `vn`.`expeditionScan_Monitor` VIEW `vn`.`expeditionScan_Monitor`
AS SELECT `et`.`id` AS `truckFk`, AS SELECT `rs`.`id` AS `truckFk`,
`et`.`eta` AS `ETD`, `rs`.`eta` AS `ETD`,
`et`.`description` AS `description`, `rs`.`description` AS `description`,
`ep`.`id` AS `palletFk`, `ep`.`id` AS `palletFk`,
`ep`.`position` AS `position`, `ep`.`position` AS `position`,
`ep`.`built` AS `built`, `ep`.`built` AS `built`,
@ -12,8 +12,8 @@ AS SELECT `et`.`id` AS `truckFk`,
`es`.`scanned` AS `scanned` `es`.`scanned` AS `scanned`
FROM ( FROM (
( (
`vn`.`expeditionTruck` `et` `vn`.`roadmapStop` `rs`
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`)
) )
LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`)
) )

View File

@ -14,7 +14,7 @@ AS SELECT `e`.`id` AS `expeditionFk`,
IF( IF(
`t`.`routeFk`, `t`.`routeFk`,
IFNULL( IFNULL(
`et`.`description`, `rs`.`description`,
REPLACE(`am`.`name`, 'ZONA ', 'Z') REPLACE(`am`.`name`, 'ZONA ', 'Z')
), ),
`z`.`name` `z`.`name`
@ -45,7 +45,7 @@ FROM (
) )
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`) LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
) )
LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`) LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`)
) )

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `t`.`id` AS `ticketFk`, AS SELECT `t`.`id` AS `ticketFk`,
`t`.`warehouseFk` AS `warehouseFk`, `t`.`warehouseFk` AS `warehouseFk`,
`t`.`routeFk` AS `routeFk`, `t`.`routeFk` AS `routeFk`,
`et`.`description` AS `description` `rs`.`description` AS `description`
FROM ( FROM (
( (
( (
@ -13,7 +13,7 @@ FROM (
) )
JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`) JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
) )
JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`) JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
) )
WHERE `e`.`id` IS NULL WHERE `e`.`id` IS NULL
AND `et`.`eta` > `util`.`VN_CURDATE`() AND `rs`.`eta` > `util`.`VN_CURDATE`()

View File

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

View File

@ -6,8 +6,8 @@ AS SELECT `t`.`routeFk` AS `routeFk`,
COUNT(`es`.`id`) AS `scanned`, COUNT(`es`.`id`) AS `scanned`,
COUNT(DISTINCT `es`.`palletFk`) AS `pallets`, COUNT(DISTINCT `es`.`palletFk`) AS `pallets`,
max(`es`.`scanned`) AS `lastScanned`, max(`es`.`scanned`) AS `lastScanned`,
max(`et`.`description`) AS `description`, max(`rs`.`description`) AS `description`,
max(`et`.`eta`) AS `eta` max(`rs`.`eta`) AS `eta`
FROM ( FROM (
( (
( (
@ -19,9 +19,9 @@ FROM (
) )
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`id` = `es`.`palletFk`) LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`id` = `es`.`palletFk`)
) )
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `ep`.`truckFk`) LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `ep`.`truckFk`)
) )
WHERE `t`.`shipped` >= `util`.`VN_CURDATE`() WHERE `t`.`shipped` >= `util`.`VN_CURDATE`()
AND `t`.`routeFk` <> 0 AND `t`.`routeFk` <> 0
GROUP BY `t`.`routeFk` GROUP BY `t`.`routeFk`
ORDER BY max(`et`.`eta`) ORDER BY max(`rs`.`eta`)

View File

@ -0,0 +1,15 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn.expeditionTruck RENAME vn.roadmapStop;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTruck`
AS SELECT `rs`.`id` AS `id`,
`rs`.`roadmapFk` AS `roadmapFk`,
`rs`.`warehouseFk` AS `warehouseFk`,
`rs`.`eta` AS `eta`,
`rs`.`description` AS `description`,
`rs`.`bufferFk` AS `bufferFk`,
`rs`.`created` AS `created`,
`rs`.`userFk` AS `userFk`
FROM `vn`.`roadmapStop` `rs`;

View File

@ -3,7 +3,7 @@ SELECT c.itemPackingTypeFk code,
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
tc.`level`, tc.`level`,
t.id ticketFk, t.id ticketFk,
COALESCE(et.description, zo.name, am.name) agencyDescription, COALESCE(rs.description, zo.name, am.name) agencyDescription,
cc.code color, cc.code color,
t.clientFk, t.clientFk,
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
@ -35,7 +35,7 @@ SELECT c.itemPackingTypeFk code,
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
JOIN vn.productionConfig pc JOIN vn.productionConfig pc
WHERE t.id IN (?) WHERE t.id IN (?)

View File

@ -1,19 +1,19 @@
SELECT ep.id palletFk, SELECT ep.id palletFk,
t.routeFk, t.routeFk,
et2.description truck, rs2.description truck,
r.description `zone`, r.description `zone`,
COUNT(es.id) labels, COUNT(es.id) labels,
t.warehouseFk warehouseFk, t.warehouseFk warehouseFk,
dayname(r.created) `dayName`, dayname(r.created) `dayName`,
et.id <=> rm.expeditionTruckFk isMatch rs.id <=> rm.expeditionTruckFk isMatch
FROM vn.expeditionTruck et FROM vn.roadmapStop rs
JOIN vn.expeditionPallet ep ON ep.truckFk = et.id JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
JOIN vn.expeditionScan es ON es.palletFk = ep.id JOIN vn.expeditionScan es ON es.palletFk = ep.id
JOIN vn.expedition e ON e.id = es.expeditionFk JOIN vn.expedition e ON e.id = es.expeditionFk
JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.ticket t ON t.id = e.ticketFk
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.expeditionTruckFk
WHERE ep.id = ? WHERE ep.id = ?
GROUP BY ep.id, t.routeFk GROUP BY ep.id, t.routeFk
ORDER BY t.routeFk ORDER BY t.routeFk