работает
This commit is contained in:
parent
8d048df15b
commit
34004cd13f
@ -42,6 +42,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Update="nlog.config">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="ReportOrders.rdlc">
|
<None Update="ReportOrders.rdlc">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
@ -31,9 +31,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
|
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
|
||||||
var processingOrders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Выполняется });
|
|
||||||
|
|
||||||
if (orders == null || processingOrders == null || (orders.Count == 0 && processingOrders.Count == 0))
|
if (orders == null || orders.Count == 0)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||||
return;
|
return;
|
||||||
@ -78,6 +77,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
Id = order.Id
|
Id = order.Id
|
||||||
});
|
});
|
||||||
|
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||||
}
|
}
|
||||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
@ -91,7 +91,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
// отдыхаем
|
// отдыхаем
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new()
|
||||||
{
|
{
|
||||||
ImplementerId = implementer.Id,
|
ImplementerId = implementer.Id,
|
||||||
Status = OrderStatus.Выполняется
|
Status = OrderStatus.Выполняется
|
||||||
|
@ -56,14 +56,8 @@ namespace FishFactoryDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
using var context = new FishFactoryDatabase();
|
using var context = new FishFactoryDatabase();
|
||||||
|
|
||||||
Id = model.Id;
|
|
||||||
CannedId = model.CannedId;
|
|
||||||
ClientId = model.ClientId;
|
|
||||||
ImplementerId = model.ImplementerId;
|
ImplementerId = model.ImplementerId;
|
||||||
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null;
|
|
||||||
Sum = model.Sum;
|
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
}
|
}
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
|
Loading…
Reference in New Issue
Block a user