#6273 register freelance #2403
|
@ -1772,8 +1772,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 (689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss');
|
INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss');
|
||||||
INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss');
|
INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss');
|
||||||
INSERT INTO `ACL` VALUES (692,'ExpeditionTruck','*','*','ALLOW','ROLE','production');
|
INSERT INTO `ACL` VALUES (692,'RoadmapStop','*','*','ALLOW','ROLE','production');
|
||||||
INSERT INTO `ACL` VALUES (693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss');
|
INSERT INTO `ACL` VALUES (693,'RoadmapStop','*','*','ALLOW','ROLE','productionBoss');
|
||||||
INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee');
|
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 (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative');
|
INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative');
|
||||||
|
|
|
@ -2687,13 +2687,20 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`)
|
||||||
(3, 6, 5),
|
(3, 6, 5),
|
||||||
(4, 7, 1);
|
(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`)
|
INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'val-algemesi', 'RE-001', 'PO-001', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'),
|
(1, 'val-algemesi', '1234-BCD', '9876-BCD', '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'),
|
(2, 'alg-valencia', '2345-CDF', '8765-BCD', '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');
|
(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
|
VALUES
|
||||||
(1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1),
|
(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),
|
(2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`midnight`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`midnight`()
|
||||||
RETURNS datetime
|
RETURNS datetime
|
||||||
NOT DETERMINISTIC
|
DETERMINISTIC
|
||||||
READS SQL DATA
|
READS SQL DATA
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
||||||
DECLARE vIsTooLittle TINYINT(1);
|
DECLARE vIsTooLittle TINYINT(1);
|
||||||
|
|
||||||
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
||||||
OR IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
|
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
|
||||||
JOIN volumeConfig vc
|
JOIN volumeConfig vc
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_afterUpsert`(vSelf INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_afterUpsert`(
|
||||||
|
vSelf INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Triggered actions when a buy is updated or inserted.
|
* Triggered actions when a buy is updated or inserted.
|
||||||
|
@ -16,7 +18,7 @@ BEGIN
|
||||||
DECLARE vIsFeedStock BOOL;
|
DECLARE vIsFeedStock BOOL;
|
||||||
DECLARE vWeight DECIMAL(10,2);
|
DECLARE vWeight DECIMAL(10,2);
|
||||||
DECLARE vPacking INT;
|
DECLARE vPacking INT;
|
||||||
|
|
||||||
SELECT b.entryFk,
|
SELECT b.entryFk,
|
||||||
b.itemFk,
|
b.itemFk,
|
||||||
i.packingOut,
|
i.packingOut,
|
||||||
|
@ -47,8 +49,11 @@ BEGIN
|
||||||
WHERE e.id = vEntryFk;
|
WHERE e.id = vEntryFk;
|
||||||
|
|
||||||
IF vIsMerchandise THEN
|
IF vIsMerchandise THEN
|
||||||
|
IF vWarehouse IS NULL THEN
|
||||||
|
CALL util.throw('The entry does not have travel');
|
||||||
|
END IF;
|
||||||
|
|
||||||
REPLACE itemCost SET
|
REPLACE itemCost SET
|
||||||
itemFk = vItemFk,
|
itemFk = vItemFk,
|
||||||
warehouseFk = vWarehouse,
|
warehouseFk = vWarehouse,
|
||||||
cm3 = buy_getUnitVolume(vSelf),
|
cm3 = buy_getUnitVolume(vSelf),
|
||||||
|
@ -74,7 +79,7 @@ BEGIN
|
||||||
WHERE b.id = vSelf;
|
WHERE b.id = vSelf;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||||
SELECT vSelf id;
|
SELECT vSelf id;
|
||||||
CALL buy_checkItem();
|
CALL buy_checkItem();
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -49,7 +49,10 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
IF vLockName IS NOT NULL THEN
|
IF vLockName IS NOT NULL THEN
|
||||||
DO RELEASE_LOCK(vLockName);
|
DO RELEASE_LOCK(vLockName);
|
||||||
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
|
CALL util.debugAdd(JSON_OBJECT(
|
||||||
|
'type', 'releaseLock',
|
||||||
|
'userFk', vUserFk
|
||||||
|
), vLockName); -- Tmp
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
|
|
|
@ -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 ;
|
|
|
@ -146,13 +146,19 @@ proc: BEGIN
|
||||||
-- Líneas y volumen por ticket
|
-- Líneas y volumen por ticket
|
||||||
UPDATE tmp.productionBuffer pb
|
UPDATE tmp.productionBuffer pb
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT tt.ticketFk,
|
SELECT tt.ticketFk,
|
||||||
COUNT(*) `lines`,
|
COUNT(*) `lines`,
|
||||||
SUM(sv.volume) m3,
|
SUM(s.quantity * ic.cm3delivery / 1000000) m3,
|
||||||
IFNULL(SUM(IF(sv.isPicked, sv.volume, 0)) / SUM(sv.volume), 0) rate
|
IFNULL(SUM(IF(s.isPicked,
|
||||||
FROM tmp.productionTicket tt
|
(s.quantity * ic.cm3delivery / 1000000),
|
||||||
JOIN saleVolume sv ON sv.ticketFk = tt.ticketFk
|
0)) / SUM(s.quantity * ic.cm3delivery / 1000000),
|
||||||
GROUP BY tt.ticketFk
|
0) rate
|
||||||
|
FROM tmp.productionTicket tt
|
||||||
|
JOIN sale s ON s.ticketFk = tt.ticketFk
|
||||||
|
AND s.quantity > 0
|
||||||
|
JOIN itemCost ic ON ic.itemFk = s.itemFk
|
||||||
|
AND ic.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY tt.ticketFk
|
||||||
) m ON m.ticketFk = pb.ticketFk
|
) m ON m.ticketFk = pb.ticketFk
|
||||||
SET pb.`lines` = m.`lines`,
|
SET pb.`lines` = m.`lines`,
|
||||||
pb.m3 = m.m3,
|
pb.m3 = m.m3,
|
||||||
|
@ -219,6 +225,8 @@ proc: BEGIN
|
||||||
AND ish.visible
|
AND ish.visible
|
||||||
GROUP BY ish.itemFk, p.sectorFk;
|
GROUP BY ish.itemFk, p.sectorFk;
|
||||||
|
|
||||||
|
CREATE INDEX idxItem ON tItemShelvingStock (itemFk);
|
||||||
|
|
||||||
INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount)
|
INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount)
|
||||||
SELECT pb.ticketFk, COUNT(DISTINCT s.id)
|
SELECT pb.ticketFk, COUNT(DISTINCT s.id)
|
||||||
FROM tmp.productionBuffer pb
|
FROM tmp.productionBuffer pb
|
||||||
|
|
|
@ -64,10 +64,15 @@ BEGIN
|
||||||
FROM tmp.sale_getProblems tp
|
FROM tmp.sale_getProblems tp
|
||||||
JOIN ticket t ON t.id = tp.ticketFk
|
JOIN ticket t ON t.id = tp.ticketFk
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat
|
SELECT t.addressFk,
|
||||||
|
SUM(ROUND(`ic`.`cm3delivery` * `s`.`quantity` / 1000, 0)) litros,
|
||||||
|
t.totalWithoutVat
|
||||||
FROM tmp.ticket_list tl
|
FROM tmp.ticket_list tl
|
||||||
JOIN saleVolume sv ON sv.ticketFk = tl.ticketFk
|
|
||||||
JOIN ticket t ON t.id = tl.ticketFk
|
JOIN ticket t ON t.id = tl.ticketFk
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
AND s.quantity > 0
|
||||||
|
JOIN itemCost ic ON ic.itemFk = s.itemFk
|
||||||
|
AND ic.warehouseFk = t.warehouseFk
|
||||||
JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
|
JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
|
||||||
AND zc.dated = util.VN_CURDATE()
|
AND zc.dated = util.VN_CURDATE()
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
@ -95,12 +100,12 @@ BEGIN
|
||||||
FROM (
|
FROM (
|
||||||
SELECT COUNT(s.id) nComp, tl.ticketFk, s.id saleFk
|
SELECT COUNT(s.id) nComp, tl.ticketFk, s.id saleFk
|
||||||
FROM tmp.ticket_list tl
|
FROM tmp.ticket_list tl
|
||||||
JOIN vn.sale s ON s.ticketFk = tl.ticketFk
|
JOIN sale s ON s.ticketFk = tl.ticketFk
|
||||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired
|
LEFT JOIN component c ON c.id = sc.componentFk AND c.isRequired
|
||||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
JOIN ticket t ON t.id = tl.ticketFk
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
|
WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
|
||||||
AND s.quantity > 0
|
AND s.quantity > 0
|
||||||
GROUP BY s.id
|
GROUP BY s.id
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
|
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
|
||||||
GROUP BY s.id) sub;
|
GROUP BY s.id) sub;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk, FALSE hasProblem
|
SELECT t.id ticketFk, FALSE hasProblem
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
||||||
|
|
||||||
UPDATE tmp.ticket t
|
UPDATE tmp.ticket t
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk, FALSE hasProblem
|
SELECT t.id ticketFk, FALSE hasProblem
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (vSelf IS NULL OR t.id = vSelf);
|
AND (vSelf IS NULL OR t.id = vSelf);
|
||||||
|
|
||||||
UPDATE tmp.ticket t
|
UPDATE tmp.ticket t
|
||||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
||||||
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (c.id = vClientFk OR vClientFk IS NULL);
|
AND (c.id = vClientFk OR vClientFk IS NULL);
|
||||||
|
|
||||||
CALL ticket_setProblem('isTaxDataChecked');
|
CALL ticket_setProblem('isTaxDataChecked');
|
||||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
||||||
SELECT t.id ticketFk
|
SELECT t.id ticketFk
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
WHERE t.shipped >= util.midnight()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
|
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
|
||||||
|
|
|
@ -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`.`roadmapStopFk`) AS `fallos`,
|
|
||||||
max(`e`.`lastPacked`) AS `lastPacked`
|
|
||||||
FROM `vn`.`expeditionCommon` `e`
|
|
||||||
GROUP BY `e`.`truckFk`
|
|
||||||
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) 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`.`roadmapStopFk`) AS `destinos`,
|
|
||||||
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
|
||||||
max(`e`.`lastPacked`) AS `lastPacked`
|
|
||||||
FROM `vn`.`expeditionCommon` `e`
|
|
||||||
GROUP BY `e`.`truckFk`,
|
|
||||||
`e`.`palletFk`
|
|
||||||
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) 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`.`roadmapStopFk`) AS `fallos`,
|
|
||||||
`e`.`roadmapStopFk` AS `roadmapStopFk`,
|
|
||||||
MAX(`e`.`lastPacked`) AS `lastPacked`
|
|
||||||
FROM (
|
|
||||||
`vn`.`expeditionCommon` `e`
|
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`roadmapStopFk`)
|
|
||||||
)
|
|
||||||
GROUP BY `e`.`truckFk`,
|
|
||||||
`e`.`palletFk`,
|
|
||||||
`e`.`routeFk`
|
|
||||||
ORDER BY SUM(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
|
||||||
`e`.`palletFk`
|
|
|
@ -20,7 +20,7 @@ FROM (
|
||||||
`vn`.`saleGroup` `sg`
|
`vn`.`saleGroup` `sg`
|
||||||
JOIN `vn`.`saleGroupDetail` `sgd` ON(`sgd`.`saleGroupFk` = `sg`.`id`)
|
JOIN `vn`.`saleGroupDetail` `sgd` ON(`sgd`.`saleGroupFk` = `sg`.`id`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`sale` `s` ON(`s`.`id` = `sgd`.`saleFk`)
|
JOIN `vn`.`sale` `s` FORCE INDEX (PRIMARY) ON(`s`.`id` = `sgd`.`saleFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`ticketState` `tls` ON(`tls`.`ticketFk` = `s`.`ticketFk`)
|
JOIN `vn`.`ticketState` `tls` ON(`tls`.`ticketFk` = `s`.`ticketFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -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,6 @@ columns:
|
||||||
m3: m3
|
m3: m3
|
||||||
priority: priority
|
priority: priority
|
||||||
etd: etd
|
etd: etd
|
||||||
expeditionTruckFk: truck
|
|
||||||
m3boxes: m3 boxes
|
m3boxes: m3 boxes
|
||||||
bufferFk: buffer
|
bufferFk: buffer
|
||||||
isPickingAllowed: is picking allowed
|
isPickingAllowed: is picking allowed
|
||||||
|
|
|
@ -13,7 +13,6 @@ columns:
|
||||||
m3: m3
|
m3: m3
|
||||||
priority: prioridad
|
priority: prioridad
|
||||||
etd: etd
|
etd: etd
|
||||||
expeditionTruckFk: camión
|
|
||||||
m3boxes: m3 cajas
|
m3boxes: m3 cajas
|
||||||
bufferFk: buffer
|
bufferFk: buffer
|
||||||
isPickingAllowed: está permitido recoger
|
isPickingAllowed: está permitido recoger
|
||||||
|
|
|
@ -37,17 +37,12 @@ module.exports = Self => {
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
'tractorPlate',
|
|
||||||
'trailerPlate',
|
|
||||||
'phone',
|
|
||||||
'supplierFk',
|
'supplierFk',
|
||||||
'etd',
|
'etd'],
|
||||||
'observations',
|
|
||||||
'price'],
|
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'expeditionTruck',
|
relation: 'roadmapStop',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['roadmapFk', 'warehouseFk', 'eta', 'description']
|
fields: ['roadmapFk', 'addressFk', 'eta', 'description']
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
"DeliveryPoint": {
|
"DeliveryPoint": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"RoadmapAddress": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"RoadmapStop": {
|
"RoadmapStop": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -25,8 +28,5 @@
|
||||||
},
|
},
|
||||||
"RoutesMonitor": {
|
"RoutesMonitor": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
|
||||||
"ExpeditionTruck": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ExpeditionTruck",
|
|
||||||
"base": "RoadmapStop",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "expeditionTruck"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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": {
|
"roadmapFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"warehouseFk": {
|
"addressFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"eta": {
|
"eta": {
|
||||||
|
@ -34,10 +34,10 @@
|
||||||
"model": "Roadmap",
|
"model": "Roadmap",
|
||||||
"foreignKey": "roadmapFk"
|
"foreignKey": "roadmapFk"
|
||||||
},
|
},
|
||||||
"warehouse": {
|
"address": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Warehouse",
|
"model": "Address",
|
||||||
"foreignKey": "warehouseFk"
|
"foreignKey": "addressFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,6 @@
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"expeditionTruckFk": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"m3boxes": {
|
"m3boxes": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue