временное зафиксирование
This commit is contained in:
parent
a410427c9b
commit
1149a8fe88
@ -30,24 +30,18 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("DoWork. Implementers is null");
|
||||
return;
|
||||
}
|
||||
List<OrderViewModel>? orders = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Принят });
|
||||
List<OrderViewModel>? ordersInWork = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Выполняется });
|
||||
List<OrderViewModel>? ordersInWaiting = _orderLogic.ReadList(new OrderSearchModel { OrderStatus = OrderStatus.Ожидание });
|
||||
if (orders == null || ordersInWork == null || ordersInWaiting == null)
|
||||
|
||||
var orders = _orderLogic.ReadList(new OrderSearchModel
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders are null");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
orders.AddRange(ordersInWork);
|
||||
orders.AddRange(ordersInWaiting);
|
||||
}
|
||||
if (orders.Count == 0)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders are empty");
|
||||
OrderStatus = OrderStatus.Принят
|
||||
});
|
||||
|
||||
if (orders == null)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||
foreach (var implementer in implementers)
|
||||
{
|
||||
@ -169,23 +163,26 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
||||
}
|
||||
try
|
||||
{
|
||||
var order = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
||||
var orders = await Task.Run(() => _orderLogic.ReadList(new OrderSearchModel
|
||||
{
|
||||
ImplementerId = implementer.Id,
|
||||
OrderStatus = OrderStatus.Ожидание
|
||||
}));
|
||||
if (order == null)
|
||||
if (orders == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// доделываем работу
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
foreach (var order in orders)
|
||||
{
|
||||
Id = order.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace SushiBarDatabaseImplement
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
// D8KMQQU comp JC256C6 nout
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-D8KMQQU\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-JC256C6\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user