Compare commits

..

No commits in common. "14a78db440bcd8357220f0dce09a4c601b214619" and "9cf5678d12fcecebb1231f9a55ff14b133587617" have entirely different histories.

3 changed files with 11 additions and 32 deletions

View File

@ -58,15 +58,10 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
Id = model.Id
});
model.Status = vm?.Status ?? OrderStatus.Неизвестен;
if ((int)model.Status == (int)newstatus - 1 || model.Status == OrderStatus.Ожидание)
if ((int)model.Status == (int)newstatus - 1)
{
//if (newstatus == OrderStatus.Выдан)
//{
//}
model.Status = newstatus;
if (newstatus == OrderStatus.Готов)
{
if (newstatus == OrderStatus.Выдан)
{
if (vm == null)
{
return false;
@ -77,13 +72,14 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
});
if (manufacture == null || !_storeLogic.FillStore(manufacture, vm.Count))
{
model.Status = OrderStatus.Ожидание;
}
else
{
model.DateImplement = DateTime.Now;
throw new Exception("Не удалось заполнить магазины");
}
}
model.Status = newstatus;
if (newstatus == OrderStatus.Готов)
{
model.DateImplement = DateTime.Now;
}
if (_orderStorage.Update(model) != null)
{
return true;

View File

@ -34,15 +34,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
if (orders == null || orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
orders = _orderLogic.ReadList(new()
{
Status = OrderStatus.Ожидание
});
if (orders == null || orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
return;
}
return;
}
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
foreach (var implementer in implementers)
@ -64,14 +56,6 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
await RunOrderInWork(implementer);
await Task.Run(() =>
{
//сначала отрабатываем заказы в статусе "ожидание"
foreach (var order in orders.Where(x => x.ImplementerId == implementer.Id && x.Status == OrderStatus.Ожидание))
{
_orderLogic.FinishOrder(new OrderBindingModel()
{
Id = order.Id
});
}
foreach (var order in orders)
{
try

View File

@ -6,7 +6,6 @@
Принят = 0,
Выполняется = 1,
Готов = 2,
Выдан = 3,
Ожидание = 4
Выдан = 3
}
}