diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/WorkModeling.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/WorkModeling.cs index 46f7f9a..4e7f647 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/WorkModeling.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/WorkModeling.cs @@ -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