From 8ea890fba66deb5fe7df3d57c1ffe2b26f1d7df7 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 17:47:31 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0?= =?UTF-8?q?=20"=D0=BE=D0=B6=D0=B8=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/OrderLogic.cs | 22 +++++++++++-------- .../Enums/OrderStatus.cs | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs index 3cd3f38..ae2010a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/OrderLogic.cs @@ -58,10 +58,15 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics Id = model.Id }); model.Status = vm?.Status ?? OrderStatus.Неизвестен; - if ((int)model.Status == (int)newstatus - 1) + if ((int)model.Status == (int)newstatus - 1 || model.Status == OrderStatus.Ожидание) { - if (newstatus == OrderStatus.Выдан) - { + //if (newstatus == OrderStatus.Выдан) + //{ + + //} + model.Status = newstatus; + if (newstatus == OrderStatus.Готов) + { if (vm == null) { return false; @@ -72,14 +77,13 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics }); if (manufacture == null || !_storeLogic.FillStore(manufacture, vm.Count)) { - throw new Exception("Не удалось заполнить магазины"); + model.Status = OrderStatus.Ожидание; + } + else + { + model.DateImplement = DateTime.Now; } } - model.Status = newstatus; - if (newstatus == OrderStatus.Готов) - { - model.DateImplement = DateTime.Now; - } if (_orderStorage.Update(model) != null) { return true; diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Enums/OrderStatus.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Enums/OrderStatus.cs index cbdd815..d8f7db2 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Enums/OrderStatus.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Enums/OrderStatus.cs @@ -6,6 +6,7 @@ Принят = 0, Выполняется = 1, Готов = 2, - Выдан = 3 + Выдан = 3, + Ожидание = 4 } } \ No newline at end of file