Finaly
This commit is contained in:
parent
f868948d73
commit
1f4b43dd00
@ -103,24 +103,30 @@ namespace DinerBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var runOrder = await Task.Run(() => allOrders.FirstOrDefault(x => x.ImplementerId == implementer.Id && x.Status == OrderStatus.Выполняется));
|
|
||||||
|
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new
|
||||||
|
OrderSearchModel
|
||||||
|
{
|
||||||
|
ImplementerId = implementer.Id,
|
||||||
|
Status = OrderStatus.Выполняется
|
||||||
|
}));
|
||||||
if (runOrder == null)
|
if (runOrder == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}",
|
||||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
implementer.Id, runOrder.Id);
|
||||||
|
// доделываем работу
|
||||||
await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) *
|
||||||
|
runOrder.Count);
|
||||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}",
|
||||||
|
implementer.Id, runOrder.Id);
|
||||||
_orderLogic.FinishOrder(new OrderBindingModel
|
_orderLogic.FinishOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
Id = runOrder.Id
|
Id = runOrder.Id
|
||||||
});
|
});
|
||||||
|
// отдыхаем
|
||||||
await Task.Delay(implementer.Qualification * _rnd.Next(10, 100));
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user