Merge branch 'dev' into 7144-diagnoseProductionFailure
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
0cdfbcb7ee
|
@ -1,3 +1,5 @@
|
|||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('sendCheckingPresence', {
|
||||
description: 'Creates a message in the chat model checking the user status',
|
||||
|
@ -37,7 +39,7 @@ module.exports = Self => {
|
|||
if (!recipient)
|
||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
if (!isProduction())
|
||||
message = `[Test:Environment to user ${userId}] ` + message;
|
||||
|
||||
const chat = await models.Chat.create({
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
const axios = require('axios');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('sendQueued', {
|
||||
description: 'Send a RocketChat message',
|
||||
|
@ -94,7 +96,7 @@ module.exports = Self => {
|
|||
* @return {Promise} - The request promise
|
||||
*/
|
||||
Self.sendMessage = async function sendMessage(senderFk, recipient, message) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!isProduction(false)) {
|
||||
return new Promise(resolve => {
|
||||
return resolve({
|
||||
statusCode: 200,
|
||||
|
@ -149,7 +151,7 @@ module.exports = Self => {
|
|||
* @return {Promise} - The request promise
|
||||
*/
|
||||
Self.getUserStatus = async function getUserStatus(username) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!isProduction(false)) {
|
||||
return new Promise(resolve => {
|
||||
return resolve({
|
||||
data: {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('deleteTrashFiles', {
|
||||
|
@ -22,7 +23,7 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
if (!isProduction())
|
||||
throw new UserError(`Action not allowed on the test environment`);
|
||||
|
||||
const models = Self.app.models;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const axios = require('axios');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('upload', {
|
||||
|
@ -119,7 +120,7 @@ module.exports = Self => {
|
|||
]
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV != 'production')
|
||||
if (!isProduction(false))
|
||||
throw new UserError('Action not allowed on the test environment');
|
||||
|
||||
// delete old
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('scrub', {
|
||||
|
@ -43,8 +44,7 @@ module.exports = Self => {
|
|||
Self.scrub = async function(collection, remove, limit, dryRun, skipLock) {
|
||||
const $ = Self.app.models;
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
dryRun = dryRun || (env && env !== 'production');
|
||||
dryRun = dryRun || !isProduction(false);
|
||||
|
||||
const instance = await $.ImageCollection.findOne({
|
||||
fields: ['id'],
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('upload', {
|
||||
|
@ -41,7 +42,7 @@ module.exports = Self => {
|
|||
if (!hasWriteRole)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
if (!isProduction())
|
||||
throw new UserError(`Action not allowed on the test environment`);
|
||||
|
||||
// Upload file to temporary path
|
||||
|
|
|
@ -39,8 +39,6 @@ module.exports = Self => {
|
|||
const xmlString = response.data;
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
const [resultElement] = xmlDoc.getElementsByTagName('Mensaje');
|
||||
|
||||
return resultElement.textContent;
|
||||
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -42,7 +42,8 @@ module.exports = Self => {
|
|||
throw new UserError(`Some mrwConfig parameters are not set`);
|
||||
|
||||
const query =
|
||||
`SELECT CASE co.code
|
||||
`SELECT
|
||||
CASE co.code
|
||||
WHEN 'ES' THEN a.postalCode
|
||||
WHEN 'PT' THEN LEFT(a.postalCode, 4)
|
||||
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
|
||||
|
@ -89,14 +90,9 @@ module.exports = Self => {
|
|||
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
|
||||
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
|
||||
|
||||
try {
|
||||
await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions);
|
||||
if (tx) await tx.commit();
|
||||
} catch (error) {
|
||||
if (tx) await tx.rollback();
|
||||
throw error;
|
||||
}
|
||||
return file;
|
||||
|
||||
return {shipmentId, file};
|
||||
};
|
||||
|
||||
function getTextByTag(xmlDoc, tag) {
|
||||
|
|
|
@ -81,9 +81,9 @@ describe('MRWConfig createShipment()', () => {
|
|||
|
||||
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
|
||||
|
||||
const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||
const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||
|
||||
expect(base64Binary).toEqual(mockBase64Binary);
|
||||
expect(file).toEqual(mockBase64Binary);
|
||||
});
|
||||
|
||||
it('should fail if mrwConfig has no data', async() => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const {Email} = require('vn-print');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('send', {
|
||||
|
@ -70,7 +71,7 @@ module.exports = Self => {
|
|||
const newParams = Object.assign({}, queueParams, sendParams);
|
||||
const email = new Email(queueName, newParams);
|
||||
|
||||
if (process.env.NODE_ENV != 'test')
|
||||
if (isProduction())
|
||||
await email.send();
|
||||
|
||||
await queue.updateAttribute('status', statusSent);
|
||||
|
|
|
@ -186,5 +186,8 @@
|
|||
},
|
||||
"AgencyWorkCenter": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"RouteConfig": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "RouteConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "routeConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"kmMax": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"vn": {
|
||||
"view": {
|
||||
"expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb"
|
||||
"expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,22 +23,19 @@ BEGIN
|
|||
DECLARE vXtraLongAgj INT;
|
||||
DECLARE vDefaultKlo INT;
|
||||
|
||||
SELECT
|
||||
ec.usefulAuctionLeftSegmentLength,
|
||||
ec.standardBarcodeLength,
|
||||
ec.floridayBarcodeLength,
|
||||
ec.floramondoBarcodeLength,
|
||||
ec.defaultKlo
|
||||
INTO
|
||||
vUsefulAuctionLeftSegmentLength,
|
||||
SELECT usefulAuctionLeftSegmentLength,
|
||||
standardBarcodeLength,
|
||||
floridayBarcodeLength,
|
||||
floramondoBarcodeLength,
|
||||
defaultKlo
|
||||
INTO vUsefulAuctionLeftSegmentLength,
|
||||
vStandardBarcodeLength,
|
||||
vFloridayBarcodeLength,
|
||||
vFloramondoBarcodeLength,
|
||||
vDefaultKlo
|
||||
FROM edi.ektConfig ec;
|
||||
FROM ektConfig;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ekt;
|
||||
CREATE TEMPORARY TABLE tmp.ekt
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ekt
|
||||
ENGINE = MEMORY
|
||||
SELECT id ektFk FROM ekt LIMIT 0;
|
||||
|
||||
|
@ -46,14 +43,14 @@ BEGIN
|
|||
WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM edi.ektRecent e
|
||||
FROM ektRecent e
|
||||
WHERE e.cps = vBarcode
|
||||
OR e.batchNumber = vBarcode;
|
||||
|
||||
WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT e.id
|
||||
FROM edi.ektRecent e
|
||||
FROM ektRecent e
|
||||
WHERE e.pro = MID(vBarcode,2,6)
|
||||
AND CAST(e.ptd AS SIGNED) = MID(vBarcode, 8, 5);
|
||||
|
||||
|
@ -74,13 +71,15 @@ BEGIN
|
|||
SELECT id
|
||||
FROM ekt
|
||||
WHERE fec >= vFec - INTERVAL 1 DAY
|
||||
AND ((
|
||||
vKlo = vDefaultKlo
|
||||
AND (
|
||||
(vKlo = vDefaultKlo
|
||||
AND (klo = vKlo OR klo IS NULL OR klo = 0)
|
||||
AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj))
|
||||
OR (klo = vKlo
|
||||
AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj)
|
||||
) OR (
|
||||
klo = vKlo
|
||||
AND auction = vAuction
|
||||
AND agj = vShortAgj)
|
||||
AND agj = vShortAgj
|
||||
)
|
||||
)
|
||||
ORDER BY agj DESC, fec DESC
|
||||
LIMIT 1;
|
||||
|
@ -91,9 +90,11 @@ BEGIN
|
|||
IF NOT vIsFound THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM edi.ektRecent e
|
||||
WHERE e.batchNumber
|
||||
= LEFT(vBarcode,vUsefulAuctionLeftSegmentLength)
|
||||
FROM ektRecent e
|
||||
WHERE e.batchNumber = LEFT(
|
||||
vBarcode,
|
||||
vUsefulAuctionLeftSegmentLength
|
||||
)
|
||||
AND e.batchNumber > 0;
|
||||
|
||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||
|
@ -103,7 +104,7 @@ BEGIN
|
|||
IF NOT vIsFound THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM edi.ektRecent e
|
||||
FROM ektRecent e
|
||||
WHERE e.putOrderFk = vBarcode;
|
||||
|
||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||
|
@ -113,13 +114,23 @@ BEGIN
|
|||
IF NOT vIsFound THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM edi.ektRecent e
|
||||
WHERE e.deliveryNumber
|
||||
= MID(vBarcode, 4, 13)
|
||||
FROM ektRecent e
|
||||
WHERE e.deliveryNumber = MID(vBarcode, 4, 13)
|
||||
AND e.deliveryNumber > 0;
|
||||
|
||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||
END IF;
|
||||
|
||||
-- Solo campo agj
|
||||
IF NOT vIsFound THEN
|
||||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM ektRecent
|
||||
WHERE agj = vShortAgj;
|
||||
|
||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||
END IF;
|
||||
|
||||
END CASE;
|
||||
|
||||
IF vIsFound THEN
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_userDisable`
|
||||
ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS '2023-06-01 00:00:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO CALL client_userDisable()$$
|
||||
DELIMITER ;
|
|
@ -1,25 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
|
||||
ON SCHEDULE EVERY 1 MONTH
|
||||
STARTS '2023-06-01 00:00:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO BEGIN
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
LEFT JOIN account.account a ON a.id = u.id
|
||||
SET u.active = FALSE
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND a.id IS NULL
|
||||
AND u.active
|
||||
AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
LEFT JOIN ticket t ON t.clientFk = c.id
|
||||
WHERE c.salesPersonFk IS NOT NULL
|
||||
OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH
|
||||
);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -19,7 +19,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
|
@ -41,7 +40,6 @@ BEGIN
|
|||
b.packing,
|
||||
b.`grouping`,
|
||||
b.groupingMode,
|
||||
b.containerFk,
|
||||
b.comissionValue,
|
||||
b.packageValue,
|
||||
b.price1,
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_userDisable`()
|
||||
BEGIN
|
||||
/**
|
||||
* Desactiva los clientes inactivos en los últimos X meses.
|
||||
*/
|
||||
DECLARE vMonths INT;
|
||||
|
||||
SELECT monthsToDisableUser INTO vMonths
|
||||
FROM clientConfig;
|
||||
|
||||
IF vMonths IS NULL THEN
|
||||
CALL util.throw('Config parameter not set');
|
||||
END IF;
|
||||
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
LEFT JOIN account.account a ON a.id = u.id
|
||||
SET u.active = FALSE
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND a.id IS NULL
|
||||
AND u.active
|
||||
AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
LEFT JOIN ticket t ON t.clientFk = c.id
|
||||
WHERE c.salesPersonFk IS NOT NULL
|
||||
OR t.created > util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
OR shipped > util.VN_CURDATE() - INTERVAL vMonths MONTH
|
||||
);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -26,7 +26,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
@ -46,7 +45,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
|
|
@ -56,7 +56,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
packagingFk,
|
||||
|
@ -77,7 +76,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
packagingFk,
|
||||
|
@ -114,7 +112,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
@ -133,7 +130,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
|
|
@ -76,7 +76,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
@ -103,7 +102,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
location,
|
||||
|
|
|
@ -18,11 +18,12 @@ BEGIN
|
|||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
||||
WHERE sc.id = vSectorFk
|
||||
AND ish.visible > 0
|
||||
WHERE ish.visible > 0
|
||||
AND ish.itemFk = vItemFk
|
||||
GROUP BY ish.id
|
||||
ORDER BY sh.priority DESC,
|
||||
ORDER BY
|
||||
(sc.id = vSectorFk) DESC,
|
||||
sh.priority DESC,
|
||||
ish.created,
|
||||
p.pickingOrder;
|
||||
END$$
|
||||
|
|
|
@ -319,7 +319,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
|
@ -341,7 +340,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
|
@ -366,7 +364,6 @@ BEGIN
|
|||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
|
|
|
@ -151,8 +151,8 @@ BEGIN
|
|||
supplier,
|
||||
entryFk,
|
||||
landed,
|
||||
`in`,
|
||||
`out`,
|
||||
CAST(`in` AS DECIMAL(10,0)) `in`,
|
||||
CAST(`out` AS DECIMAL(10,0)) `out`,
|
||||
warehouse,
|
||||
buyingValue,
|
||||
balance
|
||||
|
|
|
@ -27,7 +27,10 @@ BEGIN
|
|||
SELECT DISTINCT clientFk
|
||||
FROM (
|
||||
SELECT clientFk, SUM(quantity) totalQuantity
|
||||
FROM tmp.packagingToInvoice
|
||||
FROM tmp.packagingToInvoice tpi
|
||||
JOIN client c ON c.id = tpi.clientFk
|
||||
LEFT JOIN supplier s ON s.nif = c.fi
|
||||
WHERE s.id IS NULL
|
||||
GROUP BY itemFk, clientFk
|
||||
HAVING totalQuantity > 0)sub;
|
||||
|
||||
|
|
|
@ -28,6 +28,5 @@ AS SELECT `c`.`id` AS `Id_Compra`,
|
|||
`c`.`workerFk` AS `Id_Trabajador`,
|
||||
`c`.`weight` AS `weight`,
|
||||
`c`.`dispatched` AS `dispatched`,
|
||||
`c`.`containerFk` AS `container_id`,
|
||||
`c`.`itemOriginalFk` AS `itemOriginalFk`
|
||||
FROM `vn`.`buy` `c`
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE vn.clientConfig
|
||||
ADD monthsToDisableUser int(10) unsigned DEFAULT NULL NULL;
|
||||
|
||||
UPDATE IGNORE vn.clientConfig
|
||||
SET monthsToDisableUser = 12;
|
|
@ -0,0 +1,26 @@
|
|||
DROP TABLE IF EXISTS vn2008.scanTree__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_source__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan__;
|
||||
DROP TABLE IF EXISTS vn2008.scan_line__;
|
||||
DROP TABLE IF EXISTS vn2008.Familias__;
|
||||
DROP TABLE IF EXISTS vn2008.language__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_dits__;
|
||||
DROP TABLE IF EXISTS vn2008.unary_scan_line_expedition__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_group__;
|
||||
DROP TABLE IF EXISTS vn2008.Espionajes__;
|
||||
DROP TABLE IF EXISTS vn2008.jerarquia__;
|
||||
DROP TABLE IF EXISTS vn2008.wks__;
|
||||
DROP TABLE IF EXISTS vn2008.Proveedores_comunicados__;
|
||||
DROP TABLE IF EXISTS vn2008.integra2_escala__;
|
||||
DROP TABLE IF EXISTS vn2008.cp__;
|
||||
DROP TABLE IF EXISTS vn2008.unary__;
|
||||
DROP TABLE IF EXISTS vn2008.Estados__;
|
||||
DROP TABLE IF EXISTS vn2008.agency_hour__;
|
||||
DROP TABLE IF EXISTS vn2008.Reservas__;
|
||||
DROP TABLE IF EXISTS vn2008.cyc_declaration__;
|
||||
DROP TABLE IF EXISTS vn2008.route__;
|
||||
DROP TABLE IF EXISTS vn2008.Proveedores_escritos__;
|
||||
DROP TABLE IF EXISTS vn2008.config__;
|
|
@ -0,0 +1,41 @@
|
|||
DROP TABLE IF EXISTS vn2008.form_query__;
|
||||
DROP TABLE IF EXISTS vn2008.filtros__;
|
||||
DROP TABLE IF EXISTS vn2008.Objetivos__;
|
||||
UPDATE IGNORE vn.province
|
||||
SET zoneFk = NULL
|
||||
WHERE zoneFk IN (
|
||||
SELECT zoneFk
|
||||
FROM vn.province
|
||||
WHERE zoneFk IS NOT NULL AND zoneFk NOT IN (SELECT id FROM vn.`zone`)
|
||||
);
|
||||
ALTER TABLE vn.province DROP FOREIGN KEY province_zone_fk;
|
||||
ALTER TABLE vn.province MODIFY COLUMN zoneFk int(11) DEFAULT NULL NULL;
|
||||
ALTER TABLE vn.province ADD CONSTRAINT
|
||||
province_zone_FK FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
DROP TABLE IF EXISTS vn2008.zones__;
|
||||
DROP TABLE IF EXISTS vn2008.rec_translator__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_joined__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_filtro__;
|
||||
DROP TABLE IF EXISTS vn2008.viaxpress__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_que__;
|
||||
DROP TABLE IF EXISTS vn2008.Recibos_recorded__;
|
||||
RENAME TABLE vn.coolerPathDetail TO vn.coolerPathDetail__;
|
||||
ALTER TABLE vn.coolerPathDetail__ DROP FOREIGN KEY coolerPathDetail_FK;
|
||||
DROP TABLE IF EXISTS vn2008.cooler_path__;
|
||||
DROP TABLE IF EXISTS vn2008.payrroll_apEmpresarial__;
|
||||
DROP TABLE IF EXISTS vn2008.Compres_ok__;
|
||||
DROP TABLE IF EXISTS vn2008.Movimientos_avisar__;
|
||||
DROP TABLE IF EXISTS vn2008.Clases__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_basess__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_tipobasess__;
|
||||
DROP TABLE IF EXISTS vn2008.guillen__;
|
||||
DROP TABLE IF EXISTS vn2008.guillen_carry__;
|
||||
DROP TABLE IF EXISTS vn2008.Series__;
|
||||
DROP TABLE IF EXISTS vn2008.Permisos__;
|
||||
ALTER TABLE vn.buy DROP FOREIGN KEY buy_FK_1;
|
||||
DROP TABLE IF EXISTS vn2008.container__;
|
||||
DROP TABLE IF EXISTS vn2008.travel_reserve__;
|
||||
DROP TABLE IF EXISTS vn2008.tmpNEWTARIFAS__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_potenciales__;
|
||||
DROP TABLE IF EXISTS vn2008.duaDismissed__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_pet__;
|
|
@ -0,0 +1,27 @@
|
|||
DROP TABLE IF EXISTS vn2008.expeditions_deleted__;
|
||||
DROP TABLE IF EXISTS vn2008.Tipos_f11__;
|
||||
DROP TABLE IF EXISTS vn2008.commission__;
|
||||
DROP TABLE IF EXISTS vn2008.Movimientos_revisar__;
|
||||
DROP TABLE IF EXISTS vn2008.recibida_agricola__;
|
||||
DROP TABLE IF EXISTS vn2008.tipsa__;
|
||||
DROP TABLE IF EXISTS vn2008.rounding__;
|
||||
DROP TABLE IF EXISTS vn2008.Informes__;
|
||||
DROP TABLE IF EXISTS vn2008.Monitoring__;
|
||||
DROP TABLE IF EXISTS vn2008.Forms__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_event__;
|
||||
DROP TABLE IF EXISTS vn2008.wh_selection__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_component__;
|
||||
DROP TABLE IF EXISTS vn2008.Agencias_province__;
|
||||
DROP TABLE IF EXISTS vn2008.travel_pattern__;
|
||||
DROP TABLE IF EXISTS vn2008.sort_merge_results_ernesto__;
|
||||
DROP TABLE IF EXISTS vn2008.Conteo__;
|
||||
DROP TABLE IF EXISTS vn2008.Consignatarios_devices__;
|
||||
DROP TABLE IF EXISTS vn2008.link__;
|
||||
DROP TABLE IF EXISTS vn2008.agency_warehouse__;
|
||||
DROP TABLE IF EXISTS vn2008.warehouse_lc__;
|
||||
DROP TABLE IF EXISTS vn2008.emp_day_pay__;
|
||||
DROP TABLE IF EXISTS vn2008.Entradas_kop__;
|
||||
DROP TABLE IF EXISTS vn2008.dock__;
|
||||
DROP TABLE IF EXISTS vn2008.unaryScanFilter__;
|
||||
DROP TABLE IF EXISTS vn2008.Grupos__;
|
||||
DROP TABLE IF EXISTS vn2008.nichos__;
|
|
@ -0,0 +1,26 @@
|
|||
DROP TABLE IF EXISTS vn2008.preparation_exception__;
|
||||
DROP TABLE IF EXISTS vn2008.Clientes_empresa__;
|
||||
DROP TABLE IF EXISTS vn2008.call_information__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_price__;
|
||||
DROP TABLE IF EXISTS vn2008.invoice_observation__;
|
||||
DROP TABLE IF EXISTS vn2008.edi_testigos__;
|
||||
DROP TABLE IF EXISTS vn2008.cl_dep__;
|
||||
DROP TABLE IF EXISTS vn2008.agencia_descuadre__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_datos__;
|
||||
DROP TABLE IF EXISTS vn2008.tblIVA__;
|
||||
DROP TABLE IF EXISTS vn2008.cyc__;
|
||||
DROP TABLE IF EXISTS vn2008.Tickets_stack__;
|
||||
DROP TABLE IF EXISTS vn2008.config_host_forms__;
|
||||
DROP TABLE IF EXISTS vn2008.template_bionic_lot__;
|
||||
DROP TABLE IF EXISTS vn2008.payroll_bonificaciones__;
|
||||
DROP TABLE IF EXISTS vn2008.widget__;
|
||||
DROP TABLE IF EXISTS vn2008.accion_dits__;
|
||||
DROP TABLE IF EXISTS vn2008.credit_card__;
|
||||
DROP TABLE IF EXISTS vn2008.Brasa__;
|
||||
DROP TABLE IF EXISTS vn2008.Jefes__;
|
||||
DROP TABLE IF EXISTS vn2008.call_option__;
|
||||
DROP TABLE IF EXISTS vn2008.expeditions_pictures__;
|
||||
DROP TABLE IF EXISTS vn2008.scan__;
|
||||
DROP TABLE IF EXISTS vn2008.trolley__;
|
||||
DROP TABLE IF EXISTS vn2008.transport__;
|
||||
DROP TABLE IF EXISTS vn2008.Baldas__;
|
|
@ -0,0 +1,2 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE floranet.`order` ADD IF NOT EXISTS observations TEXT NULL;
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('RouteConfig','*','READ','ALLOW','ROLE','employee');
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.buy CHANGE containerFk containerFk__ smallint(5) unsigned DEFAULT NULL NULL;
|
|
@ -1,41 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker pda path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.accessToSearchResult('employeeNick');
|
||||
await page.accessToSection('worker.card.pda');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should check if worker has already a PDA allocated', async() => {
|
||||
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber1');
|
||||
});
|
||||
|
||||
it('should deallocate the PDA', async() => {
|
||||
await page.waitToClick(selectors.workerPda.delete);
|
||||
let message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('PDA deallocated');
|
||||
});
|
||||
|
||||
it('should allocate a new PDA', async() => {
|
||||
await page.autocompleteSearch(selectors.workerPda.newPDA, 'serialNumber2');
|
||||
await page.waitToClick(selectors.workerPda.submit);
|
||||
let message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('PDA allocated');
|
||||
});
|
||||
|
||||
it('should check if a new PDA has been allocated', async() => {
|
||||
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber2');
|
||||
});
|
||||
});
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/application/status')(Self);
|
||||
require('../methods/application/post')(Self);
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (localAsProduction = true) => {
|
||||
return (!process.env.NODE_ENV && localAsProduction) || process.env.NODE_ENV == 'production';
|
||||
};
|
|
@ -3,9 +3,10 @@ const app = require('vn-loopback/server/server');
|
|||
const ldap = require('../util/ldapjs-extra');
|
||||
const crypto = require('crypto');
|
||||
const nthash = require('smbhash').nthash;
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
const shouldSync = process.env.NODE_ENV !== 'test';
|
||||
const shouldSync = isProduction();
|
||||
|
||||
Self.getLinker = async function() {
|
||||
return await Self.findOne({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
const ldap = require('../util/ldapjs-extra');
|
||||
const execFile = require('child_process').execFile;
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
/**
|
||||
* Summary of userAccountControl flags:
|
||||
|
@ -12,7 +13,7 @@ const UserAccountControlFlags = {
|
|||
};
|
||||
|
||||
module.exports = Self => {
|
||||
const shouldSync = process.env.NODE_ENV !== 'test';
|
||||
const shouldSync = isProduction();
|
||||
|
||||
Self.getLinker = async function() {
|
||||
return await Self.findOne({
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const got = require('got');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('send', {
|
||||
|
@ -47,7 +48,7 @@ module.exports = Self => {
|
|||
|
||||
let response;
|
||||
try {
|
||||
if (process.env.NODE_ENV !== 'production')
|
||||
if (!isProduction(false))
|
||||
response = {result: [{status: 'ok'}]};
|
||||
else {
|
||||
const jsonTest = {
|
||||
|
|
|
@ -76,7 +76,6 @@ module.exports = Self => {
|
|||
packing: buyUltimate.packing,
|
||||
grouping: buyUltimate.grouping,
|
||||
groupingMode: buyUltimate.groupingMode,
|
||||
containerFk: buyUltimate.containerFk,
|
||||
comissionValue: buyUltimate.comissionValue,
|
||||
packageValue: buyUltimate.packageValue,
|
||||
location: buyUltimate.location,
|
||||
|
|
|
@ -63,9 +63,6 @@
|
|||
"isIgnored": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"containerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"location": {
|
||||
"type": "number"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('download', {
|
||||
|
@ -66,7 +67,7 @@ module.exports = Self => {
|
|||
console.error(err);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV == 'test') {
|
||||
if (!isProduction()) {
|
||||
try {
|
||||
await fs.access(file.path);
|
||||
} catch (error) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const print = require('vn-print');
|
||||
const path = require('path');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/invoiceOut/filter')(Self);
|
||||
|
@ -59,7 +60,7 @@ module.exports = Self => {
|
|||
hasPdf: true
|
||||
}, options);
|
||||
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
if (isProduction()) {
|
||||
await print.storage.write(buffer, {
|
||||
type: 'invoice',
|
||||
path: pdfFile.path,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('upload', {
|
||||
|
@ -111,7 +112,7 @@ module.exports = Self => {
|
|||
const destinationFile = path.join(
|
||||
accessContainer.client.root, accessContainer.name, appName, `${toVersion}.7z`);
|
||||
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
if (!isProduction())
|
||||
await fs.unlink(srcFile);
|
||||
else {
|
||||
await fs.move(srcFile, destinationFile, {
|
||||
|
|
|
@ -62,12 +62,12 @@ module.exports = Self => {
|
|||
|
||||
const clone = await models.Roadmap.create(roadmap, options);
|
||||
|
||||
const expeditionTrucks = roadmap.expeditionTruck();
|
||||
expeditionTrucks.map(expeditionTruck => {
|
||||
expeditionTruck.roadmapFk = clone.id;
|
||||
return expeditionTruck;
|
||||
const roadmapStops = roadmap.roadmapStop();
|
||||
roadmapStops.map(roadmapStop => {
|
||||
roadmapStop.roadmapFk = clone.id;
|
||||
return roadmapStop;
|
||||
});
|
||||
await models.ExpeditionTruck.create(expeditionTrucks, options);
|
||||
await models.RoadmapStop.create(roadmapStops, options);
|
||||
}
|
||||
|
||||
await tx.commit();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"DeliveryPoint": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ExpeditionTruck": {
|
||||
"RoadmapStop": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Roadmap": {
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
"type": "hasMany",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "roadmapFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name": "ExpeditionTruck",
|
||||
"name": "RoadmapStop",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "expeditionTruck"
|
||||
"table": "roadmapStop"
|
||||
}
|
||||
},
|
||||
"properties": {
|
|
@ -1,22 +1,22 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="ExpeditionTrucks"
|
||||
url="RoadmapStops"
|
||||
where="{roadmapFk: $ctrl.$params.id}"
|
||||
order="eta ASC"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
data="$ctrl.roadmapStops"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="expeditionTruck in $ctrl.expeditionTrucks">
|
||||
<vn-horizontal ng-repeat="roadmapStop in $ctrl.roadmapStops">
|
||||
<vn-autocomplete vn-one
|
||||
label="Warehouse"
|
||||
ng-model="expeditionTruck.warehouseFk"
|
||||
ng-model="roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -25,18 +25,18 @@
|
|||
</vn-autocomplete>
|
||||
<vn-date-picker vn-one
|
||||
label="ETA date"
|
||||
ng-model="expeditionTruck.eta"
|
||||
ng-model="roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
label="ETA hour"
|
||||
ng-model="expeditionTruck.eta">
|
||||
ng-model="roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
<vn-textArea
|
||||
vn-one
|
||||
label="Description"
|
||||
ng-model="expeditionTruck.description"
|
||||
ng-model="roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
<vn-none>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
vn-bind="+"
|
||||
vn-tooltip="Add stop"
|
||||
icon="add_circle"
|
||||
vn-click-stop="addExpeditionTruck.show()">
|
||||
vn-click-stop="addRoadmapStop.show()">
|
||||
</vn-icon-button>
|
||||
</a>
|
||||
</h4>
|
||||
|
@ -61,9 +61,9 @@
|
|||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="expeditionTruck in summary.expeditionTruck">
|
||||
<vn-td>{{expeditionTruck.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-tr ng-repeat="roadmapStop in summary.roadmapStop">
|
||||
<vn-td>{{roadmapStop.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{roadmapStop.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
@ -75,14 +75,14 @@
|
|||
</vn-supplier-descriptor-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="addExpeditionTruck"
|
||||
vn-id="addRoadmapStop"
|
||||
on-open="$ctrl.getETD()"
|
||||
on-accept="$ctrl.onAddAccept()">
|
||||
<tpl-body>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Warehouse"
|
||||
ng-model="$ctrl.expeditionTruck.warehouseFk"
|
||||
ng-model="$ctrl.roadmapStop.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -93,18 +93,18 @@
|
|||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
label="ETA date"
|
||||
ng-model="$ctrl.expeditionTruck.eta"
|
||||
ng-model="$ctrl.roadmapStop.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
label="ETA hour"
|
||||
ng-model="$ctrl.expeditionTruck.eta">
|
||||
ng-model="$ctrl.roadmapStop.eta">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textArea
|
||||
label="Description"
|
||||
ng-model="$ctrl.expeditionTruck.description"
|
||||
ng-model="$ctrl.roadmapStop.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -20,7 +20,7 @@ class Controller extends Component {
|
|||
include: [
|
||||
{relation: 'supplier'},
|
||||
{relation: 'worker'},
|
||||
{relation: 'expeditionTruck',
|
||||
{relation: 'roadmapStop',
|
||||
scope: {
|
||||
include: [
|
||||
{relation: 'warehouse'}
|
||||
|
@ -36,19 +36,19 @@ class Controller extends Component {
|
|||
const eta = new Date(this.roadmap.etd);
|
||||
eta.setDate(eta.getDate() + 1);
|
||||
|
||||
this.expeditionTruck = {eta: eta};
|
||||
this.roadmapStop = {eta: eta};
|
||||
}
|
||||
|
||||
onAddAccept() {
|
||||
try {
|
||||
const data = {
|
||||
roadmapFk: this.roadmap.id,
|
||||
warehouseFk: this.expeditionTruck.warehouseFk,
|
||||
eta: this.expeditionTruck.eta,
|
||||
description: this.expeditionTruck.description
|
||||
warehouseFk: this.roadmapStop.warehouseFk,
|
||||
eta: this.roadmapStop.eta,
|
||||
description: this.roadmapStop.description
|
||||
};
|
||||
|
||||
this.$http.post(`ExpeditionTrucks`, data)
|
||||
this.$http.post(`RoadmapStops`, data)
|
||||
.then(() => {
|
||||
this.loadData();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
|
|
|
@ -138,9 +138,12 @@ module.exports = Self => {
|
|||
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
||||
SET t.routeFk = NULL
|
||||
WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||
AND al.code NOT IN ('DELIVERED', 'PACKED')
|
||||
AND NOT t.packages
|
||||
AND tob.id IS NULL
|
||||
AND t.routeFk`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
||||
|
||||
return {
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
}
|
||||
},
|
||||
"relations": {
|
||||
"expeditionTruck": {
|
||||
"roadmapStop": {
|
||||
"type": "belongsTo",
|
||||
"model": "ExpeditionTruck",
|
||||
"model": "RoadmapStop",
|
||||
"foreignKey": "truckFk"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<div class="vn-w-md" ng-show="$ctrl.currentPDA">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Current PDA"
|
||||
ng-model="$ctrl.currentPDA.description"
|
||||
disabled="true">
|
||||
<append>
|
||||
<vn-icon-button
|
||||
icon="delete"
|
||||
vn-tooltip="Deallocate PDA"
|
||||
ng-click="$ctrl.deallocatePDA()"
|
||||
vn-acl="hr, productionAssi">
|
||||
</vn-icon-button>
|
||||
</append>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
</div>
|
||||
<form name="form" ng-show="!$ctrl.currentPDA" ng-submit="$ctrl.allocatePDA()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-acl="hr, productionAssi"
|
||||
ng-model="$ctrl.newPDA"
|
||||
url="DeviceProductions"
|
||||
fields="['id', 'modelFk', 'serialNumber']"
|
||||
where="{'stateFk': 'idle'}"
|
||||
label="New PDA"
|
||||
order="id"
|
||||
value-field="id"
|
||||
show-field="serialNumber">
|
||||
<tpl-item>
|
||||
<div>
|
||||
ID: {{id}}
|
||||
</div>
|
||||
<div class="text-caption text-grey">
|
||||
{{modelFk}}, {{serialNumber}}
|
||||
</div>
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!$ctrl.newPDA"
|
||||
label="Assign">
|
||||
</vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -1,53 +1,18 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
const filter = {
|
||||
where: {userFk: this.$params.id},
|
||||
include: {relation: 'deviceProduction'}
|
||||
};
|
||||
this.$http.get('DeviceProductionUsers', {filter}).
|
||||
then(res => {
|
||||
if (res.data && res.data.length > 0)
|
||||
this.setCurrentPDA(res.data[0]);
|
||||
});
|
||||
}
|
||||
|
||||
deallocatePDA() {
|
||||
this.$http.post(`Workers/${this.$params.id}/deallocatePDA`, {pda: this.currentPDA.deviceProductionFk})
|
||||
.then(() => {
|
||||
this.vnApp.showSuccess(this.$t('PDA deallocated'));
|
||||
delete this.currentPDA;
|
||||
});
|
||||
}
|
||||
|
||||
allocatePDA() {
|
||||
this.$http.post(`Workers/${this.$params.id}/allocatePDA`, {pda: this.newPDA})
|
||||
.then(res => {
|
||||
if (res.data)
|
||||
this.setCurrentPDA(res.data);
|
||||
|
||||
this.vnApp.showSuccess(this.$t('PDA allocated'));
|
||||
delete this.newPDA;
|
||||
});
|
||||
}
|
||||
|
||||
setCurrentPDA(data) {
|
||||
this.currentPDA = data;
|
||||
this.currentPDA.description = [];
|
||||
this.currentPDA.description.push(`ID: ${this.currentPDA.deviceProductionFk}`);
|
||||
this.currentPDA.description.push(`${this.$t('Model')}: ${this.currentPDA.deviceProduction.modelFk}`);
|
||||
this.currentPDA.description.push(`${this.$t('Serial Number')}: ${this.currentPDA.deviceProduction.serialNumber}`);
|
||||
this.currentPDA.description = this.currentPDA.description.join(' ');
|
||||
async $onInit() {
|
||||
const url = await this.vnApp.getUrl(`worker/${this.$params.id}/pda`);
|
||||
this.$state.go('worker.card.summary', {id: this.$params.id});
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnWorkerPda', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
import './index';
|
||||
|
||||
describe('Worker', () => {
|
||||
describe('Component vnWorkerPda', () => {
|
||||
let $httpBackend;
|
||||
let $scope;
|
||||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('worker'));
|
||||
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element('<vn-worker-pda></vn-worker-pda>');
|
||||
controller = $componentController('vnWorkerPda', {$element, $scope});
|
||||
$httpBackend.expectGET(`DeviceProductionUsers`).respond();
|
||||
}));
|
||||
|
||||
describe('deallocatePDA()', () => {
|
||||
it('should make an HTTP Post query to deallocatePDA', () => {
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
controller.currentPDA = {deviceProductionFk: 1};
|
||||
controller.$params.id = 1;
|
||||
|
||||
$httpBackend
|
||||
.expectPOST(`Workers/${controller.$params.id}/deallocatePDA`,
|
||||
{pda: controller.currentPDA.deviceProductionFk})
|
||||
.respond();
|
||||
controller.deallocatePDA();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
expect(controller.currentPDA).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('allocatePDA()', () => {
|
||||
it('should make an HTTP Post query to allocatePDA', () => {
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
controller.newPDA = 4;
|
||||
controller.$params.id = 1;
|
||||
|
||||
$httpBackend
|
||||
.expectPOST(`Workers/${controller.$params.id}/allocatePDA`,
|
||||
{pda: controller.newPDA})
|
||||
.respond();
|
||||
controller.allocatePDA();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
expect(controller.newPDA).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('setCurrentPDA()', () => {
|
||||
it('should set CurrentPDA', () => {
|
||||
const data = {
|
||||
deviceProductionFk: 1,
|
||||
deviceProduction: {
|
||||
modelFk: 1,
|
||||
serialNumber: 1
|
||||
}
|
||||
};
|
||||
controller.setCurrentPDA(data);
|
||||
|
||||
expect(controller.currentPDA).toBeDefined();
|
||||
expect(controller.currentPDA.description).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,6 +0,0 @@
|
|||
@import "./variables";
|
||||
|
||||
.text-grey {
|
||||
color: $color-font-light;
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ localFixtures:
|
|||
- expeditionScan
|
||||
- expeditionState
|
||||
- expeditionStateType
|
||||
- expeditionTruck
|
||||
- roadmapStop
|
||||
- expense
|
||||
- genus
|
||||
- greuge
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.22.0",
|
||||
"version": "24.24.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue