6276-newWarehouse-salix #2204
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue