Reviewed-on: #2189 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
25eb6735b0
|
@ -20,7 +20,8 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
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);
|
||||
|
||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||
|
|
|
@ -122,7 +122,7 @@ describe('machineWorker updateInTime()', () => {
|
|||
|
||||
expect(isNotParked.outTime).toBeNull();
|
||||
expect(isParked.outTime).toBeDefined();
|
||||
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||
expect(totalAfter.length).toEqual(totalBefore.length);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
|||
}, 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) {
|
||||
const isHimself = userId == machineWorker.workerFk;
|
||||
|
|
|
@ -40,6 +40,11 @@ module.exports = Self => {
|
|||
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
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,6 +2,8 @@ const {models} = require('vn-loopback/server/server');
|
|||
|
||||
describe('mobileAppVersionControl getVersion()', () => {
|
||||
const appName = 'delivery';
|
||||
const appNameVersion = '9.2';
|
||||
const appNameVersionBeta = '9.7';
|
||||
beforeAll(async() => {
|
||||
ctx = {
|
||||
req: {
|
||||
|
@ -13,17 +15,15 @@ describe('mobileAppVersionControl getVersion()', () => {
|
|||
|
||||
it('should get the version app', async() => {
|
||||
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(versionBeta).toBeUndefined();
|
||||
expect(version).toEqual(appNameVersion);
|
||||
});
|
||||
|
||||
it('should get the beta version app', async() => {
|
||||
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).toBeUndefined();
|
||||
expect(version).toEqual(appNameVersionBeta);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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');
|
|
@ -346,5 +346,6 @@
|
|||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||
"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",
|
||||
"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"
|
||||
}
|
|
@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
|
|||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
// #6276
|
||||
xdescribe('ItemShelving upsertItem()', () => {
|
||||
describe('ItemShelving upsertItem()', () => {
|
||||
const warehouseFk = 1;
|
||||
let ctx;
|
||||
let options;
|
||||
|
@ -30,7 +30,7 @@ xdescribe('ItemShelving upsertItem()', () => {
|
|||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should add two new records', async() => {
|
||||
xit('should add two new records', async() => {
|
||||
const shelvingFk = 'ZPP';
|
||||
const items = [1, 1, 1, 2];
|
||||
|
||||
|
@ -40,7 +40,7 @@ xdescribe('ItemShelving upsertItem()', () => {
|
|||
expect(itemShelvings.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should update the visible items', async() => {
|
||||
xit('should update the visible items', async() => {
|
||||
const shelvingFk = 'GVC';
|
||||
const items = [2, 2];
|
||||
const {visible: itemsBefore} = await models.ItemShelving.findOne({
|
|
@ -89,16 +89,10 @@ module.exports = Self => {
|
|||
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
|
||||
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
|
||||
} catch (e) {
|
||||
throw new UserError('The sale cannot be tracked');
|
||||
if (tx) await tx.commit();
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
if (e.message == 'The sale cannot be tracked') {
|
||||
if (tx) tx.commit();
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (tx) await tx.rollback();
|
||||
throw new UserError('The line could not be marked');
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ describe('saleTracking setPicked()', () => {
|
|||
} catch (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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue