Compare commits

...

8 Commits

Author SHA1 Message Date
Sergio De la torre 21edc54826 Merge branch '6276-nodifyNewWarehouse' of https://gitea.verdnatura.es/verdnatura/salix into 6276-nodifyNewWarehouse
gitea/salix/pipeline/pr-master Build queued... Details
2024-03-21 09:33:26 +01:00
Sergio De la torre f25dade011 refs #6276 feat:newWarehouse 2024-03-21 09:33:24 +01:00
Sergio De la torre d7b70bea4b Merge branch 'master' into 6276-nodifyNewWarehouse
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-03-21 08:32:43 +00:00
Sergio De la torre 025e53634a refs #6276 feat:newWarehouse
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-03-21 09:32:02 +01:00
Sergio De la torre 6f0cfd421e refs #6276 feat:newWarehouse
gitea/salix/pipeline/pr-test This commit looks good Details
gitea/salix/pipeline/pr-master This commit looks good Details
2024-03-21 07:13:16 +01:00
Sergio De la torre 5e903e9be3 Merge branch 'test' into 6276-nodifyNewWarehouse
gitea/salix/pipeline/pr-test This commit looks good Details
2024-03-20 15:15:17 +00:00
Jorge Penadés 7a06d1217e fix: refs #6276 test & procedure
gitea/salix/pipeline/pr-test Build queued... Details
2024-03-20 15:53:48 +01:00
Sergio De la torre 58b324577a refs #6276 feat:newWarehouse 2024-03-20 14:36:08 +01:00
10 changed files with 25 additions and 26 deletions

View File

@ -20,8 +20,9 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const [,, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
[userId], myOptions);
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');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);

View File

@ -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();

View File

@ -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;

View File

@ -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
};
};
};

View File

@ -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);
});
});

View File

@ -19,8 +19,8 @@ BEGIN
DECLARE vItemFk INT;
SELECT barcodeToItem(vBarcode) INTO vItemFk;
SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1));
SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1));
SET vQuantity = vQuantity * vPacking;

View File

@ -1,7 +1,6 @@
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('Collection', 'assign', 'WRITE', 'ALLOW', 'ROLE', 'production'),
('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'production'),
('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'),
('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'),
('SaleTracking','delete','WRITE','ALLOW','ROLE','production'),
@ -9,4 +8,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
('SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'),
('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'),
('ItemBarcode', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'production');
('ItemBarcode', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'production'),
('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production');

View File

@ -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;

View File

@ -88,17 +88,10 @@ module.exports = Self => {
try {
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');
} finally {
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');
}

View File

@ -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();
}
});