Merge pull request '6276-newWarehouse-salix' (!2204) from 6276-newWarehouse-salix into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2204
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Sergio De la torre 2024-03-25 16:46:27 +00:00
commit 5411433e52
3 changed files with 4 additions and 4 deletions

View File

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

View File

@ -38,7 +38,7 @@ module.exports = Self => {
}, myOptions);
if (!machine)
throw new Error($t('the plate does not exist', {plate}));
throw new UserError($t('the plate does not exist', {plate}));
const machineWorker = await Self.findOne({
where: {
@ -48,7 +48,7 @@ module.exports = Self => {
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker?.inTimed?.getTime() ?? 0) / (60 * 60 * 1000);
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;

View File

@ -89,7 +89,7 @@ module.exports = Self => {
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
} catch (e) {
if (tx) await tx.commit();
if (tx) return tx.commit();
}
if (tx) await tx.commit();
} catch (e) {