From 14a78db440bcd8357220f0dce09a4c601b214619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Mon, 12 Jun 2023 18:34:54 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/WorkModeling.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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