Правки
This commit is contained in:
parent
b36a85234c
commit
8eb8180321
@ -23,11 +23,13 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
|
|
||||||
private readonly IShopLogic _shopLogic;
|
private readonly IShopLogic _shopLogic;
|
||||||
|
|
||||||
|
private readonly AbstractMailWorker _mailWorker;
|
||||||
|
|
||||||
private readonly IFurnitureStorage _furnitureStorage;
|
private readonly IFurnitureStorage _furnitureStorage;
|
||||||
|
|
||||||
private readonly IClientLogic _clientLogic;
|
private readonly IClientLogic _clientLogic;
|
||||||
|
|
||||||
private readonly AbstractMailWorker _mailWorker;
|
private readonly object locker = new object();
|
||||||
|
|
||||||
// Конструктор
|
// Конструктор
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IFurnitureStorage furnitureStorage, IClientLogic clientLogic, AbstractMailWorker mailWorker)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, IFurnitureStorage furnitureStorage, IClientLogic clientLogic, AbstractMailWorker mailWorker)
|
||||||
@ -60,6 +62,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Вывод конкретного чека
|
||||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -111,9 +114,12 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
lock (locker)
|
||||||
{
|
{
|
||||||
return StatusUpdate(model, OrderStatus.Выполняется);
|
return StatusUpdate(model, OrderStatus.Выполняется);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
public bool FinishOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -157,18 +163,18 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
throw new ArgumentNullException("Некорректный id у изделия", nameof(model.FurnitureId));
|
throw new ArgumentNullException("Некорректный id у изделия", nameof(model.FurnitureId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка на клиента
|
|
||||||
if (model.ClientId < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Некорректный идентификатор у клиента", nameof(model.ClientId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Проверка корректности дат
|
// Проверка корректности дат
|
||||||
if (model.DateCreate > model.DateImplement)
|
if (model.DateCreate > model.DateImplement)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Дата создания должна быть более ранней, нежели дата завершения");
|
throw new InvalidOperationException("Дата создания должна быть более ранней, нежели дата завершения");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Проверка на клиента
|
||||||
|
if (model.ClientId < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Некорректный идентификатор у клиента", nameof(model.ClientId));
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Order. OrderId:{Id}, Sum:{Sum}. FurnitureId:{Id}. Sum:{Sum}", model.Id, model.Sum, model.FurnitureId, model.Sum);
|
_logger.LogInformation("Order. OrderId:{Id}, Sum:{Sum}. FurnitureId:{Id}. Sum:{Sum}", model.Id, model.Sum, model.FurnitureId, model.Sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +198,12 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
|
|
||||||
model.Status = newOrderStatus;
|
model.Status = newOrderStatus;
|
||||||
|
|
||||||
|
// Помещаем id работника, не забываем про него...
|
||||||
|
if (viewModel.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
model.ImplementerId = viewModel.ImplementerId;
|
||||||
|
}
|
||||||
|
|
||||||
// Проверка на выдачу
|
// Проверка на выдачу
|
||||||
if (model.Status == OrderStatus.Готов || viewModel.Status == OrderStatus.Ожидание)
|
if (model.Status == OrderStatus.Готов || viewModel.Status == OrderStatus.Ожидание)
|
||||||
{
|
{
|
||||||
@ -231,7 +243,7 @@ namespace FurnitureAssemblyBusinessLogic.BussinessLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendOrderMessage(result.ClientId, $"Сборка мебели Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
|
SendOrderMessage(result.ClientId, $"Сборка мебели, Заказ №{result.Id}", $"Заказ №{model.Id} изменен статус на {result.Status}");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,8 @@
|
|||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
||||||
<PackageReference Include="MailKit" Version="4.5.0" />
|
<PackageReference Include="MailKit" Version="4.5.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="MigraDocCore.DocumentObjectModel" Version="1.3.63" />
|
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
|
||||||
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
|
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard.DocumentObjectModel" Version="1.51.15" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -114,6 +114,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
var docRun = new Run();
|
var docRun = new Run();
|
||||||
var properties = new RunProperties();
|
var properties = new RunProperties();
|
||||||
|
|
||||||
|
// Задание свойств текста - размер и жирность
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
|
|
||||||
if (run.Item2.Bold)
|
if (run.Item2.Bold)
|
||||||
@ -145,7 +146,7 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.Implements
|
|||||||
// Сохраняем документ
|
// Сохраняем документ
|
||||||
_wordDocument.MainDocumentPart!.Document.Save();
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
|
||||||
_wordDocument.Close();
|
_wordDocument.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateTable(WordParagraph paragraph)
|
protected override void CreateTable(WordParagraph paragraph)
|
||||||
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace FurnitureAssemblyContracts.BusinessLogicsContracts
|
namespace FurnitureAssemblyContracts.BusinessLogicsContracts
|
||||||
{
|
{
|
||||||
// Бизнес-логика для сообщений
|
// Бизнес-логика сообщений
|
||||||
public interface IMessageInfoLogic
|
public interface IMessageInfoLogic
|
||||||
{
|
{
|
||||||
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
|
List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using BlacksmithWorkshopDatabaseImplement.Models;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
Loading…
Reference in New Issue
Block a user