8004-liliumStyleRemake #3257
|
@ -24,12 +24,13 @@ module.exports = Self => {
|
|||
|
||||
Self.cancelShipment = async expeditionFk => {
|
||||
const models = Self.app.models;
|
||||
|
||||
const mrw = await models.MrwConfig.findOne();
|
||||
const {externalId} = await models.Expedition.findById(expeditionFk);
|
||||
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
||||
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
||||
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
||||
|
||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]);
|
||||
const response = await axios.post(mrw.url, renderedXml, {
|
||||
headers: {
|
||||
'Content-Type': 'application/soap+xml; charset=utf-8'
|
||||
|
@ -37,12 +38,11 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
const xmlString = response.data;
|
||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]);
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
|
||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
|
||||
|
||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||
return result.toLowerCase().includes('se ha cancelado correctamente');
|
||||
return ['no se ha encontrado', 'se ha cancelado correctamente'].some(res => result.toLowerCase().includes(res));
|
||||
};
|
||||
};
|
||||
|
|
|
@ -130,9 +130,15 @@
|
|||
"Payment": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"PbxConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Postcode": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Prefix": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ReferenceRate": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "PbxConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "pbx.config"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"defaultPrefix": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"property": "*",
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "employee",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "Prefix",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "pbx.prefix"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"country": {
|
||||
"type": "string",
|
||||
"id": true
|
||||
},
|
||||
"prefix": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"property": "*",
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "employee",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"vn": {
|
||||
"view": {
|
||||
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e"
|
||||
"expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -745,15 +745,15 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
|||
|
||||
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
|
||||
(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),
|
||||
(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),
|
||||
(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),
|
||||
(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),
|
||||
(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),
|
||||
(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),
|
||||
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
|
||||
(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, 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, 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, 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, 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, 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, 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`)
|
||||
VALUES
|
||||
|
@ -2040,7 +2040,7 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC
|
|||
INSERT INTO `pbx`.`config` (id,defaultPrefix)
|
||||
VALUES (1,'0034');
|
||||
|
||||
INSERT INTO `pbx`.`prefix` (country, prefix)
|
||||
INSERT IGNORE INTO `pbx`.`prefix` (country, prefix)
|
||||
VALUES
|
||||
('es', '0034'),
|
||||
('fr', '0033'),
|
||||
|
@ -4026,10 +4026,11 @@ INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, c
|
|||
|
||||
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
||||
VALUES (19, '1169'),
|
||||
(8, '1183');
|
||||
(8, '1183'),
|
||||
(1, '1320');
|
||||
|
||||
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||
VALUES ('saysimle-url-mock', 1320);
|
||||
VALUES ('saysimle-url-mock', '1819');
|
||||
|
||||
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
||||
VALUES (1106,'26493101E','2019-09-20');
|
||||
|
|
|
@ -19,14 +19,14 @@ BEGIN
|
|||
bultos)
|
||||
SELECT r.id,
|
||||
r.agencyModeFk,
|
||||
r.created,
|
||||
r.dated,
|
||||
SUM(sv.volume / ebv.m3)
|
||||
FROM vn.route r
|
||||
JOIN vn.ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||
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
|
||||
GROUP BY r.id;
|
||||
|
||||
|
@ -38,12 +38,12 @@ BEGIN
|
|||
Bultos)
|
||||
SELECT r.id,
|
||||
r.agencyModeFk,
|
||||
r.created,
|
||||
r.dated,
|
||||
SUM(t.packages)
|
||||
FROM vn.route r
|
||||
JOIN vn.ticket t ON t.routeFk = r.id
|
||||
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
|
||||
GROUP BY r.id
|
||||
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
|
||||
|
@ -60,7 +60,7 @@ BEGIN
|
|||
JOIN vn.component c ON c.id = sc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
WHERE ct.code = 'freight'
|
||||
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND r.dated BETWEEN vDatedFrom AND vDatedTo
|
||||
GROUP BY r.id
|
||||
) sub ON sub.routeFk = r.Id_Ruta
|
||||
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.client c ON c.id = ad.clientFk
|
||||
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
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
@ -93,7 +93,7 @@ BEGIN
|
|||
JOIN vn.saleVolume sf ON sf.ticketFk = t.id
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
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
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
@ -108,7 +108,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
JOIN vn.greuge g ON g.ticketFk = t.id
|
||||
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'
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWithoutInventory`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk INT
|
||||
)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Retorna la última compra que no sea inventario.
|
||||
*
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vWarehouseFk Id del almacén
|
||||
* @return Id de compra
|
||||
*/
|
||||
DECLARE vBuyFk INT;
|
||||
|
||||
SELECT b.id INTO vBuyFk
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE e.id <> (SELECT defaultEntry FROM entryConfig)
|
||||
AND e.supplierFk <> (SELECT supplierFk FROM inventoryConfig)
|
||||
AND e.typeFk <> 'inventory'
|
||||
AND b.itemFk = vItemFk
|
||||
AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL)
|
||||
ORDER BY ABS(DATEDIFF(util.VN_CURDATE(), t.landed)), e.created DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vBuyFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
|
||||
WHERE friendship >= vSignificativeFriendship
|
||||
AND zf.zoneFk = vZoneFk
|
||||
AND r.created = vLanded
|
||||
AND r.dated = vLanded
|
||||
ORDER BY friendship;
|
||||
|
||||
-- Se eliminan aquellas que superan el volumen máximo
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
|
||||
WHERE friendship >= vSignificativeFriendship
|
||||
AND zf.zoneFk = vZoneFk
|
||||
AND r.created = vLanded
|
||||
AND r.dated = vLanded
|
||||
ORDER BY friendship;
|
||||
|
||||
-- Se eliminan aquellas que superan el volumen máximo
|
||||
|
|
|
@ -41,6 +41,6 @@ BEGIN
|
|||
WHERE expeditionFk = e.id)
|
||||
LEFT JOIN expeditionState es2 ON es2.id = es.id
|
||||
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||
ORDER BY r.created, t.priority DESC;
|
||||
ORDER BY r.dated, t.priority DESC;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -54,7 +54,9 @@ proc:BEGIN
|
|||
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
||||
AND clientFk = vClientFk
|
||||
AND addressFk = vAddressFk
|
||||
AND warehouseFk = vWarehouseFk;
|
||||
AND warehouseFk = vWarehouseFk
|
||||
AND nickname = 'CAJAS AUTOCONSUMO'
|
||||
LIMIT 1;
|
||||
|
||||
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
||||
|
|
|
@ -27,7 +27,7 @@ BEGIN
|
|||
rm.ticketFree = 0,
|
||||
rm.ticketProduction = 0,
|
||||
rm.ticketPacked = 0,
|
||||
rm.dated = r.created;
|
||||
rm.dated = r.dated;
|
||||
|
||||
UPDATE routesMonitor rm
|
||||
JOIN (
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
DECLARE vIsKmTruckRate BOOL;
|
||||
DECLARE vCountryFk INT;
|
||||
|
||||
SELECT r.created >= rc.cutoffDated INTO vIsUpdatable
|
||||
SELECT r.dated >= rc.cutoffDated INTO vIsUpdatable
|
||||
FROM route r
|
||||
JOIN routeConfig rc
|
||||
WHERE r.id = vSelf;
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
WHERE r.isOk = FALSE
|
||||
AND ic.itemFk = NEW.itemFk
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN
|
||||
CALL mail_insert(
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk)
|
||||
FROM vn.routeConfig r
|
||||
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
|
||||
SELECT r.agencyModeFk INTO vDefaultAgencyModeFk
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
WHERE r.isOk = FALSE
|
||||
AND s.id = NEW.id
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -54,7 +54,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
WHERE r.isOk = FALSE
|
||||
AND s.id = NEW.id
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
END IF;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
WHERE r.isOk = FALSE
|
||||
AND s.id = OLD.id
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
|||
FROM vn.route r
|
||||
WHERE r.isOk = FALSE
|
||||
AND r.id = OLD.routeFk
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
|
||||
DELETE FROM sale WHERE ticketFk = OLD.id;
|
||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
|||
FROM `route`
|
||||
WHERE NOT isOk
|
||||
AND id IN (OLD.routeFk, NEW.routeFk)
|
||||
AND created >= util.VN_CURDATE()
|
||||
AND dated >= util.VN_CURDATE()
|
||||
GROUP BY id;
|
||||
END IF;
|
||||
|
||||
|
@ -45,7 +45,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
WHERE r.isOk = FALSE
|
||||
AND t.id = NEW.id
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
AND r.dated >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T');
|
||||
SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T');
|
||||
|
|
|
@ -9,8 +9,8 @@ AS SELECT `rs2`.`description` AS `truck`,
|
|||
`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,
|
||||
`t`.`warehouseFk` AS `warehouseFk`,
|
||||
IF(
|
||||
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
|
||||
ucase(dayname(`r`.`created`)),
|
||||
`r`.`dated` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
|
||||
ucase(dayname(`r`.`dated`)),
|
||||
NULL
|
||||
) AS `nombreDia`
|
||||
FROM (
|
||||
|
|
|
@ -6,7 +6,7 @@ AS SELECT `r`.`id` AS `routeFk`,
|
|||
COUNT(DISTINCT `e`.`id`) AS `expeditions`,
|
||||
COUNT(DISTINCT `es`.`id`) AS `scanned`,
|
||||
max(`e`.`created`) AS `lastPacked`,
|
||||
`r`.`created` AS `created`
|
||||
`r`.`dated` AS `created`
|
||||
FROM (
|
||||
(
|
||||
(
|
||||
|
@ -23,5 +23,5 @@ FROM (
|
|||
)
|
||||
LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`)
|
||||
)
|
||||
WHERE `r`.`created` >= `util`.`yesterday`()
|
||||
WHERE `r`.`dated` >= `util`.`yesterday`()
|
||||
GROUP BY `r`.`id`
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
VIEW `vn2008`.`Rutas`
|
||||
AS SELECT `r`.`id` AS `Id_Ruta`,
|
||||
`r`.`workerFk` AS `Id_Trabajador`,
|
||||
`r`.`created` AS `Fecha`,
|
||||
`r`.`dated` AS `Fecha`,
|
||||
`r`.`vehicleFk` AS `Id_Vehiculo`,
|
||||
`r`.`agencyModeFk` AS `Id_Agencia`,
|
||||
`r`.`time` AS `Hora`,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE;
|
||||
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique;
|
||||
ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique
|
||||
UNIQUE KEY (invoiceInFk);
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.route ADD dated DATE;
|
|
@ -0,0 +1 @@
|
|||
UPDATE vn.route SET dated = created;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.route
|
||||
MODIFY COLUMN dated DATE NOT NULL;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.route
|
||||
MODIFY COLUMN created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
@ -0,0 +1,107 @@
|
|||
INSERT IGNORE INTO vn.saySimpleCountry
|
||||
SET countryFk = 1,
|
||||
channel = '1320';
|
||||
|
||||
UPDATE vn.saySimpleConfig
|
||||
SET defaultChannel = '1819';
|
||||
|
||||
INSERT IGNORE INTO pbx.prefix (country, prefix) VALUES
|
||||
('ES', '0034'),
|
||||
('IT', '0039'),
|
||||
('DE', '0049'),
|
||||
('RO', '0040'),
|
||||
('NL', '0031'),
|
||||
('BE', '0032'),
|
||||
('RU', '007'),
|
||||
('PT', '00351'),
|
||||
('LT', '00370'),
|
||||
('UA', '00380'),
|
||||
('CO', '0057'),
|
||||
('FI', '00358'),
|
||||
('EC', '00593'),
|
||||
('LB', '00961'),
|
||||
('IL', '00972'),
|
||||
('TH', '0066'),
|
||||
('PA', '00507'),
|
||||
('GB', '0044'),
|
||||
('FR', '0033'),
|
||||
('PL', '0048'),
|
||||
('MX', '0052'),
|
||||
('MA', '00212'),
|
||||
('AI', '001268'),
|
||||
('GH', '00233'),
|
||||
('SE', '0046'),
|
||||
('AE', '00971'),
|
||||
('KE', '00254'),
|
||||
('AD', '00376'),
|
||||
('AO', '00244'),
|
||||
('LU', '00352'),
|
||||
('BY', '00375'),
|
||||
('MD', '00373'),
|
||||
('DK', '0045'),
|
||||
('ET', '00251'),
|
||||
('AU', '0061'),
|
||||
('CA', '0001'),
|
||||
('CL', '0056'),
|
||||
('CN', '0086'),
|
||||
('CR', '00506'),
|
||||
('GT', '00502'),
|
||||
('CI', '00225'),
|
||||
('PE', '0051'),
|
||||
('LK', '0094'),
|
||||
('ZA', '0027'),
|
||||
('TR', '0090'),
|
||||
('ZW', '00263'),
|
||||
('MY', '0060'),
|
||||
('NZ', '0064'),
|
||||
('IE', '00353'),
|
||||
('MN', '00976'),
|
||||
('SV', '00503'),
|
||||
('ZM', '00260'),
|
||||
('JP', '0081'),
|
||||
('RW', '00250'),
|
||||
('AL', '00355'),
|
||||
('KW', '00965'),
|
||||
('SG', '0065'),
|
||||
('SR', '00597'),
|
||||
('KR', '0082'),
|
||||
('US', '0001'),
|
||||
('RS', '00381'),
|
||||
('AT', '0043'),
|
||||
('EG', '0020'),
|
||||
('LV', '00371'),
|
||||
('CY', '00357'),
|
||||
('CZ', '00420'),
|
||||
('BB', '001246'),
|
||||
('SK', '00421'),
|
||||
('IN', '0091'),
|
||||
('DZ', '00213'),
|
||||
('BR', '0055'),
|
||||
('GR', '0030'),
|
||||
('MC', '00377'),
|
||||
('SI', '00386'),
|
||||
('GP', '00590'),
|
||||
('NO', '0047'),
|
||||
('CH', '0041'),
|
||||
('AR', '0054'),
|
||||
('CU', '0053'),
|
||||
('GQ', '00240'),
|
||||
('GN', '00224'),
|
||||
('HN', '00504'),
|
||||
('ML', '00223'),
|
||||
('NI', '00505'),
|
||||
('PK', '0092'),
|
||||
('PY', '00595'),
|
||||
('SN', '00221'),
|
||||
('UY', '00598'),
|
||||
('VE', '0058'),
|
||||
('BG', '00359'),
|
||||
('GE', '00995'),
|
||||
('EE', '00372'),
|
||||
('SA', '00966'),
|
||||
('RN', '00234'),
|
||||
('HK', '00852'),
|
||||
('GI', '00350'),
|
||||
('CM', '00237'),
|
||||
('HU', '0036'),
|
||||
('AM', '00374');
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.ticket DROP FOREIGN KEY tickets_zone_fk;
|
||||
ALTER TABLE vn.ticket ADD CONSTRAINT tickets_zone_fk FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@ -791,7 +791,7 @@ export default {
|
|||
},
|
||||
createRouteView: {
|
||||
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"]',
|
||||
agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
||||
description: 'vn-route-create [ng-model="$ctrl.route.description"]',
|
||||
|
|
|
@ -246,5 +246,6 @@
|
|||
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
||||
"The raid information is not correct": "The raid information is not correct",
|
||||
"Payment method is required": "Payment method is required",
|
||||
"Sales already moved": "Sales already moved"
|
||||
"Sales already moved": "Sales already moved",
|
||||
"There are tickets to be invoiced": "There are tickets to be invoiced for this zone, please delete them first"
|
||||
}
|
||||
|
|
|
@ -389,6 +389,7 @@
|
|||
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
||||
"The web user's email already exists": "El correo del usuario web ya existe",
|
||||
"Sales already moved": "Ya han sido transferidas",
|
||||
"The raid information is not correct": "La información de la redada no es correcta"
|
||||
"The raid information is not correct": "La información de la redada no es correcta",
|
||||
"There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero"
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
fields: ['id', 'name', 'code'],
|
||||
include: {
|
||||
relation: 'saySimpleCountry',
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ module.exports = Self => {
|
|||
JOIN vn.productionConfig pc
|
||||
WHERE sh.code = ? AND s.code = pc.sectorFromCode
|
||||
), tItemInSector AS (
|
||||
SELECT is2.itemFk, is2.created, is2.shelvingFk
|
||||
SELECT is2.itemFk, is2.created, sh.code
|
||||
FROM vn.itemShelving is2
|
||||
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
|
@ -59,7 +59,7 @@ module.exports = Self => {
|
|||
JOIN vn.productionConfig pc
|
||||
WHERE sh.code <> ?
|
||||
AND s.code = pc.sectorFromCode)
|
||||
SELECT ti.itemFK, tis.shelvingFk
|
||||
SELECT ti.itemFK, tis.code shelvingFk
|
||||
FROM tItemShelving ti
|
||||
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
||||
JOIN vn.productionConfig pc
|
||||
|
|
|
@ -66,9 +66,9 @@ module.exports = Self => {
|
|||
case 'agencyFk':
|
||||
return {'agencyFk': value};
|
||||
case 'from':
|
||||
return {'created': {gte: value}};
|
||||
return {'dated': {gte: value}};
|
||||
case 'to':
|
||||
return {'created': {lte: value}};
|
||||
return {'dated': {lte: value}};
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -81,7 +81,7 @@ module.exports = Self => {
|
|||
`SELECT *
|
||||
FROM (
|
||||
SELECT r.id routeFk,
|
||||
r.created,
|
||||
r.dated,
|
||||
r.agencyModeFk,
|
||||
am.name agencyModeName,
|
||||
am.agencyFk,
|
||||
|
@ -103,7 +103,7 @@ module.exports = Self => {
|
|||
LEFT JOIN vn.ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id
|
||||
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
|
||||
) a`
|
||||
, [date]);
|
||||
|
|
|
@ -10,10 +10,10 @@ module.exports = Self => {
|
|||
description: 'The routes ids to clone'
|
||||
},
|
||||
{
|
||||
arg: 'created',
|
||||
arg: 'dated',
|
||||
type: 'date',
|
||||
required: true,
|
||||
description: 'The created date for all routes'
|
||||
description: 'The date for all routes'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -26,7 +26,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.clone = async(ids, created) => {
|
||||
Self.clone = async(ids, dated) => {
|
||||
const tx = await Self.beginTransaction({});
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
throw new Error(`The amount of routes found don't match`);
|
||||
|
||||
const routes = originalRoutes.map(route => {
|
||||
route.created = created;
|
||||
route.dated = dated;
|
||||
return route;
|
||||
});
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ module.exports = Self => {
|
|||
case 'search':
|
||||
return {'id': value};
|
||||
case 'from':
|
||||
return {'created': {gte: value}};
|
||||
return {'dated': {gte: value}};
|
||||
case 'to':
|
||||
return {'created': {lte: value}};
|
||||
return {'dated': {lte: value}};
|
||||
case 'description':
|
||||
return {'description': {like: `%${value}%`}};
|
||||
case 'isOk':
|
||||
|
@ -119,7 +119,7 @@ module.exports = Self => {
|
|||
SELECT
|
||||
r.id,
|
||||
r.workerFk,
|
||||
r.created,
|
||||
r.dated,
|
||||
r.vehicleFk,
|
||||
r.agencyModeFk,
|
||||
r.time,
|
||||
|
|
|
@ -46,14 +46,14 @@ module.exports = Self => {
|
|||
and: [
|
||||
{
|
||||
or: [
|
||||
{'created': currentDate},
|
||||
{'created': nextDay}
|
||||
{'dated': currentDate},
|
||||
{'dated': nextDay}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
order: [
|
||||
'created ASC',
|
||||
'dated ASC',
|
||||
'time ASC',
|
||||
'agencyName ASC'
|
||||
]
|
||||
|
|
|
@ -43,10 +43,10 @@ module.exports = Self => {
|
|||
for (let zoneAgencyMode of zoneAgencyModes)
|
||||
zoneIds.push(zoneAgencyMode.zoneFk);
|
||||
|
||||
const minDate = new Date(route.created);
|
||||
const minDate = new Date(route.dated);
|
||||
minDate.setHours(0, 0, 0, 0);
|
||||
|
||||
const maxDate = new Date(route.created);
|
||||
const maxDate = new Date(route.dated);
|
||||
maxDate.setHours(23, 59, 59, 59);
|
||||
|
||||
let tickets = await Self.app.models.Ticket.find({
|
||||
|
|
|
@ -42,10 +42,10 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
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);
|
||||
|
||||
const maxDate = new Date(route.created);
|
||||
const maxDate = new Date(route.dated);
|
||||
maxDate.setHours(23, 59, 59, 59);
|
||||
const ticket = await models.Ticket.findOne({
|
||||
where: {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"created": {
|
||||
"dated": {
|
||||
"type": "date"
|
||||
},
|
||||
"time": {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<div class="attributes">
|
||||
<vn-label-value
|
||||
label="Date"
|
||||
value="{{$ctrl.route.created | date: 'dd/MM/yyyy'}}">
|
||||
value="{{$ctrl.route.dated | date: 'dd/MM/yyyy'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Agency"
|
||||
|
|
|
@ -48,7 +48,7 @@ class Controller extends Descriptor {
|
|||
'id',
|
||||
'workerFk',
|
||||
'agencyModeFk',
|
||||
'created',
|
||||
'dated',
|
||||
'm3',
|
||||
'warehouseFk',
|
||||
'description',
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
value="{{$ctrl.summary.route.id}}">
|
||||
</vn-label-value>
|
||||
<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 label="Agency"
|
||||
value="{{$ctrl.summary.route.agencyMode.name}}">
|
||||
|
|
|
@ -52,7 +52,8 @@ module.exports = Self => {
|
|||
|
||||
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
|
||||
deletedExpeditions.push(deletedExpedition);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
console.error('error: ', error);
|
||||
notDeletedExpeditions.push(expeditionId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,10 +387,10 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
newOrderFromTicket() {
|
||||
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => {
|
||||
const path = this.$state.href('order.card.catalog', {id: res.data});
|
||||
window.open(path, '_blank');
|
||||
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => {
|
||||
const path = await this.vnApp.getUrl(`order/${res.data}/catalog`);
|
||||
|
||||
window.open(path, '_blank');
|
||||
this.vnApp.showSuccess(this.$t('Order created'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -567,14 +567,10 @@ describe('Ticket', () => {
|
|||
const expectedResponse = {id: 123};
|
||||
|
||||
window.open = jasmine.createSpy('open');
|
||||
controller.$state.href = jasmine.createSpy('href')
|
||||
.and.returnValue('/somePath');
|
||||
|
||||
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
|
||||
controller.newOrderFromTicket();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith('/somePath', '_blank');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ module.exports = Self => {
|
|||
};
|
||||
|
||||
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||
|
||||
if (ticketList.length > 0)
|
||||
throw new UserError('There are tickets for this area, delete them first');
|
||||
const hasRefFk = ticketList.some(ticket => ticket.refFk);
|
||||
if (hasRefFk)
|
||||
throw new UserError('There are tickets to be invoiced');
|
||||
|
||||
await models.Zone.destroyById(id, myOptions);
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ describe('zone deletezone()', () => {
|
|||
__: value => value
|
||||
};
|
||||
const ctx = {req: activeCtx};
|
||||
const zoneId = 4;
|
||||
const zoneId2 = 3;
|
||||
let ticketIDs;
|
||||
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
const zoneId = 4;
|
||||
const originalTickets = await models.Ticket.find({
|
||||
where: {
|
||||
zoneFk: zoneId
|
||||
|
@ -29,7 +29,7 @@ describe('zone deletezone()', () => {
|
|||
|
||||
it('should delete a zone and update their tickets', async() => {
|
||||
const tx = await models.Zone.beginTransaction({});
|
||||
|
||||
const zoneId = 4;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||
|
@ -47,17 +47,18 @@ describe('zone deletezone()', () => {
|
|||
|
||||
it('should not delete the zone if it has tickets', async() => {
|
||||
const tx = await models.Zone.beginTransaction({});
|
||||
const zoneId = 1;
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Zone.deleteZone(ctx, zoneId2, options);
|
||||
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error).toEqual('There are tickets for this area, delete them first');
|
||||
expect(error).toEqual('There are tickets to be invoiced');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.50.0",
|
||||
"version": "24.52.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
|
@ -33,7 +33,9 @@ td {
|
|||
font-size: 26px;
|
||||
}
|
||||
.lg-txt {
|
||||
font-size: 32px;
|
||||
font-size: 40px;
|
||||
padding: 0px;
|
||||
line-height: 1;
|
||||
}
|
||||
.xl-txt {
|
||||
font-size: 50px;
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lg-txt xl-width bold center">
|
||||
<td class="bold center lg-txt xl-width">
|
||||
<div class="overflow-line">
|
||||
{{formatNumber(buy.itemFk)}}
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="2" class="md-txt md-width center">
|
||||
<td colspan="2" class="center md-txt md-width">
|
||||
<div class="overflow-line">
|
||||
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
|
||||
</div>
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
xmlDocument: document,
|
||||
format: 'code128',
|
||||
displayValue: false,
|
||||
width: 3.8,
|
||||
width: 3.5,
|
||||
height: 75,
|
||||
margin: 0
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SELECT r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
r.dated,
|
||||
r.time,
|
||||
u.nickName userNickName,
|
||||
v.tradeMark vehicleTradeMark,
|
||||
|
|
|
@ -4,7 +4,7 @@ SELECT ep.id palletFk,
|
|||
r.description `zone`,
|
||||
COUNT(es.id) labels,
|
||||
t.warehouseFk warehouseFk,
|
||||
dayname(r.created) `dayName`,
|
||||
dayname(r.dated) `dayName`,
|
||||
rs.id <=> rm.roadmapStopFk isMatch
|
||||
FROM vn.roadmapStop rs
|
||||
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
|
||||
|
|
Loading…
Reference in New Issue