Изучить и возможно поправить!
This commit is contained in:
parent
fc9315f390
commit
701512a324
@ -77,6 +77,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
return false;
|
||||
}
|
||||
model.Status = modelNew.Status;
|
||||
model.ImplementerId = modelNew.ImplementerId;
|
||||
if (!ChangeStatus(model, OrderStatus.Готов))
|
||||
{
|
||||
_logger.LogWarning("Order's status is wrong");
|
||||
|
@ -39,7 +39,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||
foreach (var implementer in implementers)
|
||||
{
|
||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -73,9 +73,10 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order{ Order} ", implementer.Id, order.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id,
|
||||
ImplementerId = implementer.Id
|
||||
});
|
||||
Id = order.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
@ -87,9 +88,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
{
|
||||
_logger.LogError(ex, "Error while do work");
|
||||
throw;
|
||||
}
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -124,8 +123,7 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
implementer.Id, runOrder.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = runOrder.Id,
|
||||
ImplementerId = implementer.Id
|
||||
Id = runOrder.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
|
@ -14,7 +14,7 @@ namespace FurnitureAssemblyDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=zhu\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user