PIbd-22 Isaeva A.I. Lab work 6 Base #7

Closed
dex_moth wants to merge 5 commits from lab6 into lab5
4 changed files with 9 additions and 12 deletions
Showing only changes of commit 34004cd13f - Show all commits

View File

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

View File

@ -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.Выполняется

View File

@ -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;
}
}

View File

@ -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()