diff --git a/FishFactory/FishFactory.csproj b/FishFactory/FishFactory.csproj index d2c10da..f36cb40 100644 --- a/FishFactory/FishFactory.csproj +++ b/FishFactory/FishFactory.csproj @@ -42,6 +42,9 @@ + + Always + Always diff --git a/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs b/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs index 73eada3..1a59259 100644 --- a/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs +++ b/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs @@ -31,9 +31,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic return; } var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят }); - var processingOrders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Выполняется }); - if (orders == null || processingOrders == null || (orders.Count == 0 && processingOrders.Count == 0)) + if (orders == null || orders.Count == 0) { _logger.LogWarning("DoWork. Orders is null or empty"); return; @@ -78,7 +77,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic { Id = order.Id }); - } + Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + } // кто-то мог уже перехватить заказ, игнорируем ошибку catch (InvalidOperationException ex) { @@ -91,7 +91,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic throw; } // отдыхаем - Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + } }); } @@ -104,7 +104,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic } try { - var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel + var runOrder = await Task.Run(() => _orderLogic.ReadElement(new() { ImplementerId = implementer.Id, Status = OrderStatus.Выполняется diff --git a/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs b/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs index 2420ab5..ec31f76 100644 --- a/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs +++ b/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs @@ -4,7 +4,7 @@ namespace FishFactoryContracts.SearchModels public class ImplementerSearchModel { public int? Id { get; set; } - public string? ImplementerFIO { get; set; } = string.Empty; + public string? ImplementerFIO { get; set; } = string.Empty; public string? Password { get; set; } = string.Empty; } } diff --git a/FishFactoryDatabaseImplement/Models/Order.cs b/FishFactoryDatabaseImplement/Models/Order.cs index a079ca2..10d329b 100644 --- a/FishFactoryDatabaseImplement/Models/Order.cs +++ b/FishFactoryDatabaseImplement/Models/Order.cs @@ -56,14 +56,8 @@ namespace FishFactoryDatabaseImplement.Models } using var context = new FishFactoryDatabase(); - Id = model.Id; - CannedId = model.CannedId; - ClientId = model.ClientId; ImplementerId = model.ImplementerId; - Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null; - Sum = model.Sum; Status = model.Status; - DateCreate = model.DateCreate; DateImplement = model.DateImplement; } public OrderViewModel GetViewModel => new()