6276-newWarehouse-salix #2204
|
@ -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);
|
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (!machine)
|
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({
|
const machineWorker = await Self.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
@ -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?.inTimed?.getTime() ?? 0) / (60 * 60 * 1000);
|
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
|
||||||
|
|
||||||
if (machineWorker) {
|
if (machineWorker) {
|
||||||
const isHimself = userId == machineWorker.workerFk;
|
const isHimself = userId == machineWorker.workerFk;
|
||||||
|
|
|
@ -89,7 +89,7 @@ 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) {
|
||||||
if (tx) await tx.commit();
|
if (tx) return tx.commit();
|
||||||
}
|
}
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue