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