From fe0b7dd9bce188cf0427a33813a6db2a2045ab43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=8F=D1=80=20=D0=90=D0=B3=D0=BB?= =?UTF-8?q?=D0=B8=D1=83=D0=BB=D0=BB=D0=BE=D0=B2?= Date: Mon, 6 Mar 2023 20:34:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D1=81=D1=8C=20=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=BF=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D1=83=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=B4=D0=B5=D0=BB=D0=B8=D0=B9=20=D0=B2=20=D0=BC=D0=B0?= =?UTF-8?q?=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryBusinessLogic/OrderLogic.cs | 4 ++-- ConfectionaryBusinessLogic/WorkModeling.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ConfectionaryBusinessLogic/OrderLogic.cs b/ConfectionaryBusinessLogic/OrderLogic.cs index 260c988..0b1950b 100644 --- a/ConfectionaryBusinessLogic/OrderLogic.cs +++ b/ConfectionaryBusinessLogic/OrderLogic.cs @@ -92,14 +92,14 @@ namespace ConfectioneryBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - if ((int)vmodel.Status + 1 != (int)orderStatus || vmodel.Status == OrderStatus.Ожидается && orderStatus == OrderStatus.Готов) + if ((int)vmodel.Status + 1 != (int)orderStatus && !(vmodel.Status == OrderStatus.Ожидается && orderStatus == OrderStatus.Готов)) { throw new InvalidOperationException($"Попытка перевести заказ не в следующий статус: " + $"Текущий статус: {vmodel.Status} \n" + $"Планируемый статус: {orderStatus} \n" + $"Доступный статус: {(OrderStatus)((int)vmodel.Status + 1)}"); } - if (orderStatus == OrderStatus.Готов && orderStatus == OrderStatus.Ожидается) + if (orderStatus == OrderStatus.Готов || orderStatus == OrderStatus.Ожидается) { var vpastry = _pastryStorage.GetElement(new() { Id = vmodel.PastryId }); diff --git a/ConfectionaryBusinessLogic/WorkModeling.cs b/ConfectionaryBusinessLogic/WorkModeling.cs index b67e64c..73ea98e 100644 --- a/ConfectionaryBusinessLogic/WorkModeling.cs +++ b/ConfectionaryBusinessLogic/WorkModeling.cs @@ -37,7 +37,7 @@ namespace ConfectioneryBusinessLogic } // Поскольку у нас могут быть заказы в работе мы не дожны заканчивать работы, если нет Принятых заказов // Поэтому находим заказы в работе и продолжаем работу, если они есть - var orders = _orderLogic.ReadList(new OrderSearchModel { Statusses = new() { OrderStatus.Принят, OrderStatus.Выполняется } }); + var orders = _orderLogic.ReadList(new OrderSearchModel { Statusses = new() { OrderStatus.Принят, OrderStatus.Выполняется, OrderStatus.Ожидается } }); if (orders == null || orders.Count == 0) { _logger.LogWarning("DoWork. Orders is null or empty");