работает

This commit is contained in:
dex_moth 2024-06-21 20:59:30 +04:00
parent 8d048df15b
commit 34004cd13f
4 changed files with 9 additions and 12 deletions

View File

@ -42,6 +42,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportOrders.rdlc"> <None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

View File

@ -31,9 +31,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
return; return;
} }
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят }); 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"); _logger.LogWarning("DoWork. Orders is null or empty");
return; return;
@ -78,7 +77,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{ {
Id = order.Id Id = order.Id
}); });
} Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
// кто-то мог уже перехватить заказ, игнорируем ошибку // кто-то мог уже перехватить заказ, игнорируем ошибку
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {
@ -91,7 +91,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
throw; throw;
} }
// отдыхаем // отдыхаем
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
} }
}); });
} }
@ -104,7 +104,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
} }
try try
{ {
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel var runOrder = await Task.Run(() => _orderLogic.ReadElement(new()
{ {
ImplementerId = implementer.Id, ImplementerId = implementer.Id,
Status = OrderStatus.Выполняется Status = OrderStatus.Выполняется

View File

@ -4,7 +4,7 @@ namespace FishFactoryContracts.SearchModels
public class ImplementerSearchModel public class ImplementerSearchModel
{ {
public int? Id { get; set; } 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; public string? Password { get; set; } = string.Empty;
} }
} }

View File

@ -56,14 +56,8 @@ namespace FishFactoryDatabaseImplement.Models
} }
using var context = new FishFactoryDatabase(); using var context = new FishFactoryDatabase();
Id = model.Id;
CannedId = model.CannedId;
ClientId = model.ClientId;
ImplementerId = model.ImplementerId; ImplementerId = model.ImplementerId;
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null;
Sum = model.Sum;
Status = model.Status; Status = model.Status;
DateCreate = model.DateCreate;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()