работа исполнителя

This commit is contained in:
Мк Игорь 2023-06-12 18:34:54 +04:00
parent 8ea890fba6
commit 14a78db440

View File

@ -34,7 +34,15 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
if (orders == null || orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
return;
orders = _orderLogic.ReadList(new()
{
Status = OrderStatus.Ожидание
});
if (orders == null || orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
return;
}
}
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
foreach (var implementer in implementers)
@ -56,6 +64,14 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
await RunOrderInWork(implementer);
await Task.Run(() =>
{
//сначала отрабатываем заказы в статусе "ожидание"
foreach (var order in orders.Where(x => x.ImplementerId == implementer.Id && x.Status == OrderStatus.Ожидание))
{
_orderLogic.FinishOrder(new OrderBindingModel()
{
Id = order.Id
});
}
foreach (var order in orders)
{
try