master #2200

Merged
sergiodt merged 11 commits from master into test 2024-03-25 07:49:52 +00:00
11 changed files with 382 additions and 371 deletions

View File

@ -20,7 +20,8 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const [,, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk', const [, , [{collectionFk}]] =
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
[userId], myOptions); [userId], myOptions);
if (!collectionFk) throw new UserError('There are not picking tickets'); if (!collectionFk) throw new UserError('There are not picking tickets');

View File

@ -122,7 +122,7 @@ describe('machineWorker updateInTime()', () => {
expect(isNotParked.outTime).toBeNull(); expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined(); expect(isParked.outTime).toBeDefined();
expect(totalAfter.length).toEqual(totalBefore.length + 1); expect(totalAfter.length).toEqual(totalBefore.length);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();

View File

@ -48,7 +48,7 @@ module.exports = Self => {
}, myOptions); }, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); const hoursDifference = (Date.vnNow() - machineWorker?.inTimed?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) { if (machineWorker) {
const isHimself = userId == machineWorker.workerFk; const isHimself = userId == machineWorker.workerFk;

View File

@ -40,6 +40,11 @@ module.exports = Self => {
fields, fields,
}; };
return Self.findOne(filter); const result = await Self.findOne(filter);
return {
isVersionCritical: result?.isVersionBetaCritical ?? result?.isVersionCritical,
version: result?.versionBeta ?? result?.version,
url: result?.urlBeta ?? result?.urlProduction
};
}; };
}; };

View File

@ -2,6 +2,8 @@ const {models} = require('vn-loopback/server/server');
describe('mobileAppVersionControl getVersion()', () => { describe('mobileAppVersionControl getVersion()', () => {
const appName = 'delivery'; const appName = 'delivery';
const appNameVersion = '9.2';
const appNameVersionBeta = '9.7';
beforeAll(async() => { beforeAll(async() => {
ctx = { ctx = {
req: { req: {
@ -13,17 +15,15 @@ describe('mobileAppVersionControl getVersion()', () => {
it('should get the version app', async() => { it('should get the version app', async() => {
ctx.req.accessToken.userId = 9; ctx.req.accessToken.userId = 9;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(version).toEqual('9.2'); expect(version).toEqual(appNameVersion);
expect(versionBeta).toBeUndefined();
}); });
it('should get the beta version app', async() => { it('should get the beta version app', async() => {
ctx.req.accessToken.userId = 66; ctx.req.accessToken.userId = 66;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(versionBeta).toBeDefined(); expect(version).toEqual(appNameVersionBeta);
expect(version).toBeUndefined();
}); });
}); });

View File

@ -21,6 +21,8 @@ BEGIN
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para ver si ya no sucede el cuelgue de db
SET vShowType = TRUE;
WITH itemTags AS ( WITH itemTags AS (
SELECT i.id, SELECT i.id,
@ -87,6 +89,7 @@ BEGIN
(i.tag7 = its.tag7) DESC, (i.tag7 = its.tag7) DESC,
match7 DESC, match7 DESC,
(i.tag8 = its.tag8) DESC, (i.tag8 = its.tag8) DESC,
match8 DESC; match8 DESC
LIMIT 100;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,7 @@
-- Place your SQL code here
USE vn;
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production');

View File

@ -346,5 +346,6 @@
"CountryFK cannot be empty": "El país no puede estar vacío", "CountryFK cannot be empty": "El país no puede estar vacío",
"Cmr file does not exist": "El archivo del cmr no existe", "Cmr file does not exist": "El archivo del cmr no existe",
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas" "The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
"The line could not be marked": "La linea no puede ser marcada"
} }

View File

@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context'); const LoopBackContext = require('loopback-context');
// #6276 // #6276
xdescribe('ItemShelving upsertItem()', () => { describe('ItemShelving upsertItem()', () => {
const warehouseFk = 1; const warehouseFk = 1;
let ctx; let ctx;
let options; let options;
@ -30,7 +30,7 @@ xdescribe('ItemShelving upsertItem()', () => {
await tx.rollback(); await tx.rollback();
}); });
it('should add two new records', async() => { xit('should add two new records', async() => {
const shelvingFk = 'ZPP'; const shelvingFk = 'ZPP';
const items = [1, 1, 1, 2]; const items = [1, 1, 1, 2];
@ -40,7 +40,7 @@ xdescribe('ItemShelving upsertItem()', () => {
expect(itemShelvings.length).toEqual(2); expect(itemShelvings.length).toEqual(2);
}); });
it('should update the visible items', async() => { xit('should update the visible items', async() => {
const shelvingFk = 'GVC'; const shelvingFk = 'GVC';
const items = [2, 2]; const items = [2, 2];
const {visible: itemsBefore} = await models.ItemShelving.findOne({ const {visible: itemsBefore} = await models.ItemShelving.findOne({

View File

@ -89,16 +89,10 @@ module.exports = Self => {
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions); const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
} catch (e) { } catch (e) {
throw new UserError('The sale cannot be tracked'); if (tx) await tx.commit();
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
} catch (e) { } catch (e) {
if (e.message == 'The sale cannot be tracked') {
if (tx) tx.commit();
throw e;
}
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw new UserError('The line could not be marked'); throw new UserError('The line could not be marked');
} }

View File

@ -79,7 +79,7 @@ describe('saleTracking setPicked()', () => {
} catch (e) { } catch (e) {
const error = e; const error = e;
expect(error.message).toEqual('The sale cannot be tracked'); expect(error.message).toEqual('The line could not be marked');
await tx.rollback(); await tx.rollback();
} }
}); });