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