lab-6-hard

This commit is contained in:
Zakharov_Rostislav 2024-05-07 22:27:51 +04:00
parent 45ca52198f
commit 94ca959be1

View File

@ -82,20 +82,20 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogics
_logger.LogWarning("Read operation failed");
return false;
}
if (!(element.Status == status - 1 || model.Status == OrderStatus.Готов))
if (!(element.Status == status - 1 || element.Status == OrderStatus.Готов))
{
_logger.LogWarning("Status change operation failed");
throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный");
}
if (element.Status == OrderStatus.Готов || element.Status == OrderStatus.Ожидает)
{
var manufacture = _manufactureStorage.GetElement(new ManufactureSearchModel() { Id = model.ManufactureId });
var manufacture = _manufactureStorage.GetElement(new ManufactureSearchModel() { Id = element.ManufactureId });
if (manufacture == null)
{
_logger.LogWarning("Status update to " + status.ToString() + " operation failed. Document not found.");
return false;
}
if (CheckSupply(manufacture, model.Count) == false)
if (CheckSupply(manufacture, element.Count) == false)
{
_logger.LogWarning("Status update to " + status.ToString() + " operation failed. Shop supply error.");
status = OrderStatus.Ожидает;