con addressFk
This commit is contained in:
parent
a52b9b6d2e
commit
0e5a15dd4e
|
@ -1747,8 +1747,8 @@ INSERT INTO `ACL` VALUES (688,'ClientSms','create','WRITE','ALLOW','ROLE','emplo
|
|||
INSERT INTO `ACL` VALUES (689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss');
|
||||
INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss');
|
||||
INSERT INTO `ACL` VALUES (692,'ExpeditionTruck','*','*','ALLOW','ROLE','production');
|
||||
INSERT INTO `ACL` VALUES (693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss');
|
||||
INSERT INTO `ACL` VALUES (692,'roadmapStop','*','*','ALLOW','ROLE','production');
|
||||
INSERT INTO `ACL` VALUES (693,'roadmapStop','*','*','ALLOW','ROLE','productionBoss');
|
||||
INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative');
|
||||
|
|
|
@ -2670,13 +2670,20 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`)
|
|||
(3, 6, 5),
|
||||
(4, 7, 1);
|
||||
|
||||
INSERT INTO `vn`.`roadmapAddress` (`addressFk`)
|
||||
VALUES
|
||||
(1),
|
||||
(2),
|
||||
(3),
|
||||
(4);
|
||||
|
||||
INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`)
|
||||
VALUES
|
||||
(1, 'val-algemesi', 'RE-001', 'PO-001', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'),
|
||||
(2, 'alg-valencia', 'RE-002', 'PO-002', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'),
|
||||
(3, 'alz-algemesi', 'RE-003', 'PO-003', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman');
|
||||
(1, 'val-algemesi', '1234-BCD', '9876-BCD', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'),
|
||||
(2, 'alg-valencia', '2345-CDF', '8765-BCD', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'),
|
||||
(3, 'alz-algemesi', '3456-DFG', '7654-BCD', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman');
|
||||
|
||||
INSERT INTO `vn`.`expeditionTruck` (`id`, `roadmapFk`, `warehouseFk`, `eta`, `description`, `userFk`)
|
||||
INSERT INTO `vn`.`roadmapStop` (`id`, `roadmapFk`, `addressFk`, `eta`, `description`, `userFk`)
|
||||
VALUES
|
||||
(1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1),
|
||||
(2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1),
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45))
|
||||
BEGIN
|
||||
|
||||
INSERT INTO vn.roadmapStop(eta,description)
|
||||
VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription);
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,12 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_List`()
|
||||
BEGIN
|
||||
|
||||
SELECT id truckFk,
|
||||
eta,
|
||||
description Destino
|
||||
FROM roadmapStop
|
||||
WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||
ORDER BY eta;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,19 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`expeditionTruck_Control`
|
||||
AS SELECT `e`.`truckFk` AS `id`,
|
||||
`e`.`eta` AS `ETD`,
|
||||
`e`.`description` AS `description`,
|
||||
COUNT(
|
||||
DISTINCT IF(`e`.`expeditionFk` IS NULL, `e`.`ticketFk`, NULL)
|
||||
) AS `ticketsSinBultos`,
|
||||
COUNT(DISTINCT `e`.`palletFk`) AS `pallets`,
|
||||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
COUNT(DISTINCT `e`.`expeditionFk`) AS `expeditions`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM `vn`.`expeditionCommon` `e`
|
||||
GROUP BY `e`.`truckFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`eta`
|
|
@ -1,18 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`expeditionTruck_Control_Detail`
|
||||
AS SELECT `e`.`truckFk` AS `id`,
|
||||
`e`.`eta` AS `eta`,
|
||||
`e`.`description` AS `destino`,
|
||||
`e`.`palletFk` AS `pallet`,
|
||||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
COUNT(DISTINCT `e`.`expeditionTruckFk`) AS `destinos`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM `vn`.`expeditionCommon` `e`
|
||||
GROUP BY `e`.`truckFk`,
|
||||
`e`.`palletFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`eta`,
|
||||
`e`.`truckFk`
|
|
@ -1,22 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`expeditionTruck_Control_Detail_Pallet`
|
||||
AS SELECT `e`.`truckFk` AS `id`,
|
||||
`e`.`eta` AS `eta`,
|
||||
`e`.`description` AS `destino`,
|
||||
`e`.`palletFk` AS `pallet`,
|
||||
`e`.`routeFk` AS `route`,
|
||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||
`rs`.`description` AS `destinos`,
|
||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
||||
`e`.`expeditionTruckFk` AS `expeditionTruckFk`,
|
||||
max(`e`.`lastPacked`) AS `lastPacked`
|
||||
FROM (
|
||||
`vn`.`expeditionCommon` `e`
|
||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`)
|
||||
)
|
||||
GROUP BY `e`.`truckFk`,
|
||||
`e`.`palletFk`,
|
||||
`e`.`routeFk`
|
||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
||||
`e`.`palletFk`
|
|
@ -0,0 +1,8 @@
|
|||
CREATE TABLE `vn`.`roadmapAddress` (
|
||||
addressFk int(11) NULL,
|
||||
isActive TINYINT DEFAULT 1 NULL,
|
||||
PRIMARY KEY (addressFk)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Direcciones de los troncales';
|
||||
|
||||
ALTER TABLE vn.roadmapAddress
|
||||
ADD CONSTRAINT roadmapAddress_address_FK FOREIGN KEY (addressFk) REFERENCES vn.address(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE vn.roadmapStop DROP FOREIGN KEY expeditionTruck_FK_1;
|
||||
ALTER TABLE vn.roadmapStop DROP COLUMN warehouseFk;
|
||||
ALTER TABLE vn.roadmapStop ADD addressFk int(11) NULL;
|
||||
ALTER TABLE vn.roadmapStop CHANGE addressFk addressFk int(11) DEFAULT NULL NULL AFTER roadmapFk;
|
||||
|
||||
ALTER TABLE vn.roadmapStop
|
||||
ADD CONSTRAINT roadmapStop_roadmapAddress_FK FOREIGN KEY (addressFk) REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,11 @@
|
|||
DELETE FROM salix.ACL
|
||||
WHERE model in ('expeditionTruck', 'Roadmap', 'roadmapStop', 'roadmapAddress');
|
||||
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('roadmapAddress', '*', 'WRITE', 'ALLOW', 'ROLE', 'palletizerBoss'),
|
||||
('roadmapAddress', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
|
||||
('Roadmap', '*', 'WRITE', 'ALLOW', 'ROLE', 'palletizerBoss'),
|
||||
('Roadmap', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
|
||||
('RoadmapStop', '*', 'WRITE', 'ALLOW', 'ROLE', 'palletizerBoss'),
|
||||
('RoadmapStop', '*', 'READ', 'ALLOW', 'ROLE', 'production');
|
|
@ -13,7 +13,7 @@ columns:
|
|||
m3: m3
|
||||
priority: priority
|
||||
etd: etd
|
||||
expeditionTruckFk: truck
|
||||
roadmapStopFk: truck
|
||||
m3boxes: m3 boxes
|
||||
bufferFk: buffer
|
||||
isPickingAllowed: is picking allowed
|
|
@ -13,7 +13,7 @@ columns:
|
|||
m3: m3
|
||||
priority: prioridad
|
||||
etd: etd
|
||||
expeditionTruckFk: camión
|
||||
roadmapStopFk: camión
|
||||
m3boxes: m3 cajas
|
||||
bufferFk: buffer
|
||||
isPickingAllowed: está permitido recoger
|
|
@ -37,17 +37,12 @@ module.exports = Self => {
|
|||
fields: [
|
||||
'id',
|
||||
'name',
|
||||
'tractorPlate',
|
||||
'trailerPlate',
|
||||
'phone',
|
||||
'supplierFk',
|
||||
'etd',
|
||||
'observations',
|
||||
'price'],
|
||||
'etd'],
|
||||
include: [{
|
||||
relation: 'expeditionTruck',
|
||||
relation: 'roadmapStop',
|
||||
scope: {
|
||||
fields: ['roadmapFk', 'warehouseFk', 'eta', 'description']
|
||||
fields: ['roadmapFk', 'addressFk', 'eta', 'description']
|
||||
}
|
||||
}]
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"DeliveryPoint": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"RoadmapAddress": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"RoadmapStop": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "RoadmapAddress",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "roadmapAddress"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"addressFk": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"address": {
|
||||
"type": "belongsTo",
|
||||
"model": "Address",
|
||||
"foreignKey": "addressFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
"roadmapFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"warehouseFk": {
|
||||
"addressFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"eta": {
|
||||
|
@ -34,10 +34,10 @@
|
|||
"model": "Roadmap",
|
||||
"foreignKey": "roadmapFk"
|
||||
},
|
||||
"warehouse": {
|
||||
"address": {
|
||||
"type": "belongsTo",
|
||||
"model": "Warehouse",
|
||||
"foreignKey": "warehouseFk"
|
||||
"model": "RoadmapAddress",
|
||||
"foreignKey": "addressFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue