казначеева сдала
This commit is contained in:
parent
471ad04dec
commit
ab6b3d0d15
@ -28,6 +28,8 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
/// </summary>
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
static readonly object locker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -109,10 +111,14 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
return StatusUpdate(model, OrderStatus.Выполняется);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Смена статуса заказа (Выдан)
|
||||
/// </summary>
|
||||
|
@ -78,12 +78,15 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
}
|
||||
|
||||
// делаем работу
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(500, 1000) * order.Count);
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||
_orderLogic.DeliveryOrder(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id
|
||||
});
|
||||
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 20));
|
||||
}
|
||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
@ -97,8 +100,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
throw;
|
||||
}
|
||||
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user