refactor: refs #7146 Add Route.dated
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Ivan Mas 2024-09-30 19:29:47 +02:00
parent 4f97deb0c9
commit 1b189718c4
36 changed files with 71 additions and 65 deletions

View File

@ -9,7 +9,7 @@
}, },
"vn": { "vn": {
"view": { "view": {
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e" "expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2"
} }
} }
} }

View File

@ -736,15 +736,15 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1'); INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1');
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`) INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`, `dated`)
VALUES VALUES
(1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1), (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1, util.VN_CURDATE()),
(2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9), (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9, util.VN_CURDATE()),
(3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10), (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10, util.VN_CURDATE()),
(4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12), (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12, util.VN_CURDATE()),
(5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13), (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13, util.VN_CURDATE()),
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3), (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3, util.VN_CURDATE()),
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5); (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5, util.VN_CURDATE());
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`) INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`)
VALUES VALUES

View File

@ -19,14 +19,14 @@ BEGIN
bultos) bultos)
SELECT r.id, SELECT r.id,
r.agencyModeFk, r.agencyModeFk,
r.created, r.dated,
SUM(sv.volume / ebv.m3) SUM(sv.volume / ebv.m3)
FROM vn.route r FROM vn.route r
JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
JOIN vn.saleVolume sv ON sv.ticketFk = t.id JOIN vn.saleVolume sv ON sv.ticketFk = t.id
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox' JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND z.isVolumetric AND z.isVolumetric
GROUP BY r.id; GROUP BY r.id;
@ -38,12 +38,12 @@ BEGIN
Bultos) Bultos)
SELECT r.id, SELECT r.id,
r.agencyModeFk, r.agencyModeFk,
r.created, r.dated,
SUM(t.packages) SUM(t.packages)
FROM vn.route r FROM vn.route r
JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND NOT z.isVolumetric AND NOT z.isVolumetric
GROUP BY r.id GROUP BY r.id
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
@ -60,7 +60,7 @@ BEGIN
JOIN vn.component c ON c.id = sc.componentFk JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE ct.code = 'freight' WHERE ct.code = 'freight'
AND r.created BETWEEN vDatedFrom AND vDatedTo AND r.dated BETWEEN vDatedFrom AND vDatedTo
GROUP BY r.id GROUP BY r.id
) sub ON sub.routeFk = r.Id_Ruta ) sub ON sub.routeFk = r.Id_Ruta
SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0); SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0);
@ -77,7 +77,7 @@ BEGIN
JOIN vn.address ad ON ad.id = t.addressFk JOIN vn.address ad ON ad.id = t.addressFk
JOIN vn.client c ON c.id = ad.clientFk JOIN vn.client c ON c.id = ad.clientFk
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND NOT z.isVolumetric AND NOT z.isVolumetric
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk
@ -93,7 +93,7 @@ BEGIN
JOIN vn.saleVolume sf ON sf.ticketFk = t.id JOIN vn.saleVolume sf ON sf.ticketFk = t.id
JOIN vn.client c ON c.id = t.clientFk JOIN vn.client c ON c.id = t.clientFk
JOIN vn.`zone` z ON z.id = t.zoneFk JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND z.isVolumetric AND z.isVolumetric
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk
@ -108,7 +108,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
JOIN vn.greuge g ON g.ticketFk = t.id JOIN vn.greuge g ON g.ticketFk = t.id
JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND gt.code = 'freightDifference' AND gt.code = 'freightDifference'
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk

View File

@ -26,7 +26,7 @@ BEGIN
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
WHERE friendship >= vSignificativeFriendship WHERE friendship >= vSignificativeFriendship
AND zf.zoneFk = vZoneFk AND zf.zoneFk = vZoneFk
AND r.created = vLanded AND r.dated = vLanded
ORDER BY friendship; ORDER BY friendship;
-- Se eliminan aquellas que superan el volumen máximo -- Se eliminan aquellas que superan el volumen máximo

View File

@ -26,7 +26,7 @@ BEGIN
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
WHERE friendship >= vSignificativeFriendship WHERE friendship >= vSignificativeFriendship
AND zf.zoneFk = vZoneFk AND zf.zoneFk = vZoneFk
AND r.created = vLanded AND r.dated = vLanded
ORDER BY friendship; ORDER BY friendship;
-- Se eliminan aquellas que superan el volumen máximo -- Se eliminan aquellas que superan el volumen máximo

View File

@ -39,6 +39,6 @@ BEGIN
FROM expeditionState es FROM expeditionState es
WHERE expeditionFk = e.id) WHERE expeditionFk = e.id)
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC; ORDER BY r.dated, t.priority DESC;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -27,7 +27,7 @@ BEGIN
rm.ticketFree = 0, rm.ticketFree = 0,
rm.ticketProduction = 0, rm.ticketProduction = 0,
rm.ticketPacked = 0, rm.ticketPacked = 0,
rm.dated = r.created; rm.dated = r.dated;
UPDATE routesMonitor rm UPDATE routesMonitor rm
JOIN ( JOIN (

View File

@ -12,7 +12,7 @@ BEGIN
DECLARE vIsUpdatable, vIsFreelance BOOL DEFAULT 0; DECLARE vIsUpdatable, vIsFreelance BOOL DEFAULT 0;
DECLARE vAgencyModePricePercentage DOUBLE; DECLARE vAgencyModePricePercentage DOUBLE;
SELECT r.created >= rc.cutoffDated INTO vIsUpdatable SELECT r.dated >= rc.cutoffDated INTO vIsUpdatable
FROM route r FROM route r
JOIN routeConfig rc JOIN routeConfig rc
WHERE r.id = vSelf; WHERE r.id = vSelf;

View File

@ -16,7 +16,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND ic.itemFk = NEW.itemFk AND ic.itemFk = NEW.itemFk
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN
CALL mail_insert( CALL mail_insert(

View File

@ -14,7 +14,7 @@ BEGIN
SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk) SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk)
FROM vn.routeConfig r FROM vn.routeConfig r
LEFT JOIN vn.business b ON b.workerFk = vUserFk LEFT JOIN vn.business b ON b.workerFk = vUserFk
AND NEW.created BETWEEN b.started AND IFNULL(b.ended, NEW.created)); AND NEW.dated BETWEEN b.started AND IFNULL(b.ended, NEW.dated));
IF ISNULL(NEW.agencyModeFk) THEN IF ISNULL(NEW.agencyModeFk) THEN
SELECT r.agencyModeFk INTO vDefaultAgencyModeFk SELECT r.agencyModeFk INTO vDefaultAgencyModeFk

View File

@ -23,7 +23,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = NEW.id AND s.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;
END$$ END$$

View File

@ -54,7 +54,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = NEW.id AND s.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;

View File

@ -11,7 +11,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = OLD.id AND s.id = OLD.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;
END$$ END$$

View File

@ -8,7 +8,7 @@ BEGIN
FROM vn.route r FROM vn.route r
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND r.id = OLD.routeFk AND r.id = OLD.routeFk
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
DELETE FROM sale WHERE ticketFk = OLD.id; DELETE FROM sale WHERE ticketFk = OLD.id;

View File

@ -22,7 +22,7 @@ BEGIN
FROM `route` FROM `route`
WHERE NOT isOk WHERE NOT isOk
AND id IN (OLD.routeFk, NEW.routeFk) AND id IN (OLD.routeFk, NEW.routeFk)
AND created >= util.VN_CURDATE() AND dated >= util.VN_CURDATE()
GROUP BY id; GROUP BY id;
END IF; END IF;
@ -45,7 +45,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND t.id = NEW.id AND t.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T');
SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T');

View File

@ -9,8 +9,8 @@ AS SELECT `rs2`.`description` AS `truck`,
`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`, `rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,
`t`.`warehouseFk` AS `warehouseFk`, `t`.`warehouseFk` AS `warehouseFk`,
IF( IF(
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, `r`.`dated` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
ucase(dayname(`r`.`created`)), ucase(dayname(`r`.`dated`)),
NULL NULL
) AS `nombreDia` ) AS `nombreDia`
FROM ( FROM (

View File

@ -6,7 +6,7 @@ AS SELECT `r`.`id` AS `routeFk`,
COUNT(DISTINCT `e`.`id`) AS `expeditions`, COUNT(DISTINCT `e`.`id`) AS `expeditions`,
COUNT(DISTINCT `es`.`id`) AS `scanned`, COUNT(DISTINCT `es`.`id`) AS `scanned`,
max(`e`.`created`) AS `lastPacked`, max(`e`.`created`) AS `lastPacked`,
`r`.`created` AS `created` `r`.`dated` AS `created`
FROM ( FROM (
( (
( (
@ -23,5 +23,5 @@ FROM (
) )
LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`)
) )
WHERE `r`.`created` >= `util`.`yesterday`() WHERE `r`.`dated` >= `util`.`yesterday`()
GROUP BY `r`.`id` GROUP BY `r`.`id`

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `vn2008`.`Rutas` VIEW `vn2008`.`Rutas`
AS SELECT `r`.`id` AS `Id_Ruta`, AS SELECT `r`.`id` AS `Id_Ruta`,
`r`.`workerFk` AS `Id_Trabajador`, `r`.`workerFk` AS `Id_Trabajador`,
`r`.`created` AS `Fecha`, `r`.`dated` AS `Fecha`,
`r`.`vehicleFk` AS `Id_Vehiculo`, `r`.`vehicleFk` AS `Id_Vehiculo`,
`r`.`agencyModeFk` AS `Id_Agencia`, `r`.`agencyModeFk` AS `Id_Agencia`,
`r`.`time` AS `Hora`, `r`.`time` AS `Hora`,

View File

@ -0,0 +1 @@
ALTER TABLE vn.route ADD dated DATE;

View File

@ -0,0 +1 @@
UPDATE vn.route SET dated = created;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.route
MODIFY COLUMN dated DATE NOT NULL;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.route
MODIFY COLUMN created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;

View File

@ -791,7 +791,7 @@ export default {
}, },
createRouteView: { createRouteView: {
worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]', worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]',
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.dated"]',
vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
description: 'vn-route-create [ng-model="$ctrl.route.description"]', description: 'vn-route-create [ng-model="$ctrl.route.description"]',

View File

@ -66,9 +66,9 @@ module.exports = Self => {
case 'agencyFk': case 'agencyFk':
return {'agencyFk': value}; return {'agencyFk': value};
case 'from': case 'from':
return {'created': {gte: value}}; return {'dated': {gte: value}};
case 'to': case 'to':
return {'created': {lte: value}}; return {'dated': {lte: value}};
} }
}); });
@ -81,7 +81,7 @@ module.exports = Self => {
`SELECT * `SELECT *
FROM ( FROM (
SELECT r.id routeFk, SELECT r.id routeFk,
r.created, r.dated,
r.agencyModeFk, r.agencyModeFk,
am.name agencyModeName, am.name agencyModeName,
am.agencyFk, am.agencyFk,
@ -103,7 +103,7 @@ module.exports = Self => {
LEFT JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id
LEFT JOIN vn.supplier s ON s.id = sat.supplierFk LEFT JOIN vn.supplier s ON s.id = sat.supplierFk
WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL WHERE r.dated > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL
GROUP BY r.id GROUP BY r.id
) a` ) a`
, [date]); , [date]);

View File

@ -10,10 +10,10 @@ module.exports = Self => {
description: 'The routes ids to clone' description: 'The routes ids to clone'
}, },
{ {
arg: 'created', arg: 'dated',
type: 'date', type: 'date',
required: true, required: true,
description: 'The created date for all routes' description: 'The date for all routes'
} }
], ],
returns: { returns: {
@ -26,7 +26,7 @@ module.exports = Self => {
} }
}); });
Self.clone = async(ids, created) => { Self.clone = async(ids, dated) => {
const tx = await Self.beginTransaction({}); const tx = await Self.beginTransaction({});
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
@ -39,7 +39,7 @@ module.exports = Self => {
throw new Error(`The amount of routes found don't match`); throw new Error(`The amount of routes found don't match`);
const routes = originalRoutes.map(route => { const routes = originalRoutes.map(route => {
route.created = created; route.dated = dated;
return route; return route;
}); });

View File

@ -93,9 +93,9 @@ module.exports = Self => {
case 'search': case 'search':
return {'id': value}; return {'id': value};
case 'from': case 'from':
return {'created': {gte: value}}; return {'dated': {gte: value}};
case 'to': case 'to':
return {'created': {lte: value}}; return {'dated': {lte: value}};
case 'description': case 'description':
return {'description': {like: `%${value}%`}}; return {'description': {like: `%${value}%`}};
case 'isOk': case 'isOk':
@ -119,7 +119,7 @@ module.exports = Self => {
SELECT SELECT
r.id, r.id,
r.workerFk, r.workerFk,
r.created, r.dated,
r.vehicleFk, r.vehicleFk,
r.agencyModeFk, r.agencyModeFk,
r.time, r.time,

View File

@ -46,14 +46,14 @@ module.exports = Self => {
and: [ and: [
{ {
or: [ or: [
{'created': currentDate}, {'dated': currentDate},
{'created': nextDay} {'dated': nextDay}
] ]
} }
] ]
}, },
order: [ order: [
'created ASC', 'dated ASC',
'time ASC', 'time ASC',
'agencyName ASC' 'agencyName ASC'
] ]

View File

@ -43,10 +43,10 @@ module.exports = Self => {
for (let zoneAgencyMode of zoneAgencyModes) for (let zoneAgencyMode of zoneAgencyModes)
zoneIds.push(zoneAgencyMode.zoneFk); zoneIds.push(zoneAgencyMode.zoneFk);
const minDate = new Date(route.created); const minDate = new Date(route.dated);
minDate.setHours(0, 0, 0, 0); minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created); const maxDate = new Date(route.dated);
maxDate.setHours(23, 59, 59, 59); maxDate.setHours(23, 59, 59, 59);
let tickets = await Self.app.models.Ticket.find({ let tickets = await Self.app.models.Ticket.find({

View File

@ -42,10 +42,10 @@ module.exports = Self => {
try { try {
const route = await models.Route.findById(routeId, null, myOptions); const route = await models.Route.findById(routeId, null, myOptions);
const minDate = new Date(route.created); const minDate = new Date(route.dated);
minDate.setHours(0, 0, 0, 0); minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created); const maxDate = new Date(route.dated);
maxDate.setHours(23, 59, 59, 59); maxDate.setHours(23, 59, 59, 59);
const ticket = await models.Ticket.findOne({ const ticket = await models.Ticket.findOne({
where: { where: {

View File

@ -15,7 +15,7 @@
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"created": { "dated": {
"type": "date" "type": "date"
}, },
"time": { "time": {

View File

@ -32,7 +32,7 @@
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
label="Date" label="Date"
value="{{$ctrl.route.created | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.route.dated | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Agency" label="Agency"

View File

@ -48,7 +48,7 @@ class Controller extends Descriptor {
'id', 'id',
'workerFk', 'workerFk',
'agencyModeFk', 'agencyModeFk',
'created', 'dated',
'm3', 'm3',
'warehouseFk', 'warehouseFk',
'description', 'description',

View File

@ -14,7 +14,7 @@
value="{{$ctrl.summary.route.id}}"> value="{{$ctrl.summary.route.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Date" <vn-label-value label="Date"
value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.summary.route.dated | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.summary.route.agencyMode.name}}"> value="{{$ctrl.summary.route.agencyMode.name}}">

View File

@ -16,7 +16,7 @@
</tr> </tr>
<tr> <tr>
<th class="font gray align-right">{{$t('date')}}</th> <th class="font gray align-right">{{$t('date')}}</th>
<td>{{formatDate(route.created, '%d-%m-%Y')}}</td> <td>{{formatDate(route.dated, '%d-%m-%Y')}}</td>
<th class="font gray align-right">{{$t('vehicle')}}</th> <th class="font gray align-right">{{$t('vehicle')}}</th>
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td> <td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
</tr> </tr>

View File

@ -1,6 +1,6 @@
SELECT r.id, SELECT r.id,
r.m3, r.m3,
r.created, r.dated,
r.time, r.time,
u.nickName userNickName, u.nickName userNickName,
v.tradeMark vehicleTradeMark, v.tradeMark vehicleTradeMark,

View File

@ -4,7 +4,7 @@ SELECT ep.id palletFk,
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.dated) `dayName`,
rs.id <=> rm.roadmapStopFk isMatch rs.id <=> rm.roadmapStopFk isMatch
FROM vn.roadmapStop rs FROM vn.roadmapStop rs
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id