готова

This commit is contained in:
Shtyrkin_Egor 2024-02-07 09:25:10 +04:00
parent 0332135213
commit 30f244c552
3 changed files with 10 additions and 5 deletions

View File

@ -65,7 +65,6 @@ namespace FishFactory.Forms
form.ShowDialog(); form.ShowDialog();
} }
} }
private void buttonCreateOrder_Click(object sender, EventArgs e) private void buttonCreateOrder_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
@ -84,7 +83,9 @@ namespace FishFactory.Forms
try try
{ {
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
{ Id = id }); {
Id = id,
});
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");

View File

@ -5,7 +5,7 @@
autoReload="true" internalLogLevel="Info"> autoReload="true" internalLogLevel="Info">
<targets> <targets>
<target xsi:type="File" name="tofile" fileName="${basedir}/Logs/log-${shortdate}.log" /> <target xsi:type="File" name="tofile" fileName="${basedir}/log-${shortdate}.log" />
</targets> </targets>
<rules> <rules>

View File

@ -75,7 +75,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus) public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus)
{ {
CheckModel(model); CheckModel(model, false);
var element = _orderStorage.GetElement(new OrderSearchModel() var element = _orderStorage.GetElement(new OrderSearchModel()
{ {
Id = model.Id Id = model.Id
@ -131,7 +131,11 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{ {
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum)); throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
} }
_logger.LogInformation("Canned. CannedId:{CannedId}.Count:{Count}.Sum:{Sum}Id:{Id}", model.CannedId, model.Count, model.Sum, model.Id); if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
{
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} должна быть позже даты его создания {model.DateCreate}");
}
_logger.LogInformation("Canned. CannedId:{CannedId}.Count:{Count}.Sum:{Sum}Id:{Id}", model.CannedId, model.Count, model.Sum, model.Id);
} }
} }
} }