DigitalFactory/Admin.NET/Admin.NET.Application/Service/ReportTable/ReportTableService.cs

487 lines
21 KiB
C#
Raw Normal View History

2024-03-20 02:37:36 +00:00
using Admin.NET.Core.Service;
using Admin.NET.Application.Const;
using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
2024-05-24 10:22:01 +00:00
using Admin.NET.Application.Service.ReportTable.Dto;
2024-05-30 10:18:10 +00:00
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
using Nest;
2024-06-24 10:21:52 +00:00
using Admin.NET.Application.Utils;
2024-07-04 15:34:54 +00:00
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using SkiaSharp;
2024-07-12 16:18:35 +00:00
using AngleSharp.Dom;
2024-05-24 10:22:01 +00:00
2024-03-20 02:37:36 +00:00
namespace Admin.NET.Application;
/// <summary>
/// 汇报单服务
/// </summary>
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
public class ReportTableService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ReportTable> _rep;
2024-05-24 10:22:01 +00:00
private readonly SysUnitService _repUnit;
private readonly SysUnitGroupService _repUnitGroup;
2024-05-25 10:46:26 +00:00
private readonly PrintCodeDetailService _codeDetailService;
2024-06-12 10:10:50 +00:00
//private readonly ReportDetailTableService _reportDetailTable;
2024-05-25 10:46:26 +00:00
private readonly UserManager _userManager;
2024-05-28 10:30:50 +00:00
private readonly PrintDataService _printDataService;
2024-06-26 10:33:33 +00:00
private readonly PrintRecordsService _printRecordsService;
private readonly ProductRetrospectService _productRetrospectService;
2024-05-24 10:22:01 +00:00
public ReportTableService(SqlSugarRepository<ReportTable> rep,
2024-05-25 10:46:26 +00:00
UserManager userManager,
2024-05-24 10:22:01 +00:00
SysUnitService repUnit,
2024-05-25 10:46:26 +00:00
SysUnitGroupService repUnitGroup,
PrintCodeDetailService codeDetailService,
2024-06-26 10:33:33 +00:00
PrintDataService printDataService,
PrintRecordsService printRecordsService,
ProductRetrospectService productRetrospectService)
2024-03-20 02:37:36 +00:00
{
_rep = rep;
2024-05-24 10:22:01 +00:00
_repUnit = repUnit;
_repUnitGroup = repUnitGroup;
2024-05-25 10:46:26 +00:00
_codeDetailService = codeDetailService;
_userManager = userManager;
2024-05-28 10:30:50 +00:00
_printDataService = printDataService;
2024-06-26 10:33:33 +00:00
_printRecordsService = printRecordsService;
_productRetrospectService = productRetrospectService;
2024-03-20 02:37:36 +00:00
}
/// <summary>
/// 分页查询汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<ReportTableOutput>> Page(ReportTableInput input)
{
2024-05-20 10:06:52 +00:00
var query = _rep.AsQueryable().Where(a => !a.IsDelete)
2024-03-20 02:37:36 +00:00
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.OddNumber.Contains(input.SearchKey.Trim())
|| u.ProductType.Contains(input.SearchKey.Trim())
|| u.ProductionLine.Contains(input.SearchKey.Trim())
|| u.CodeNum.Contains(input.SearchKey.Trim())
|| u.SourceNumber.Contains(input.SearchKey.Trim())
|| u.Remarks.Contains(input.SearchKey.Trim())
)
.WhereIF(!string.IsNullOrWhiteSpace(input.OddNumber), u => u.OddNumber.Contains(input.OddNumber.Trim()))
2024-07-04 15:34:54 +00:00
.WhereIF(input.State > 0, u => u.State == input.State)
2024-03-20 02:37:36 +00:00
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductType), u => u.ProductType.Contains(input.ProductType.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProductionLine), u => u.ProductionLine.Contains(input.ProductionLine.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeNum), u => u.CodeNum.Contains(input.CodeNum.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.SourceNumber), u => u.SourceNumber.Contains(input.SourceNumber.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
2024-07-04 15:34:54 +00:00
.LeftJoin<PrintCodeDetail>((u, detail) => u.Id == detail.ReportTableId) // 左连接的条件
.GroupBy((u, detail) => u.Id)
.Select<ReportTableOutput>((u, detail) => new ReportTableOutput
{
Id = u.Id,
OddNumber = u.OddNumber,
StartDate = u.StartDate,
2024-07-06 14:34:20 +00:00
EndDate = u.EndDate,
2024-07-04 15:34:54 +00:00
State = u.State,
ProductType = u.ProductType,
ProductionLine = u.ProductionLine,
CodeNum = u.CodeNum,
SourceNumber = u.SourceNumber,
SourceId = u.SourceId,
MaterialsId = u.MaterialsId,
ProductCount = SqlFunc.AggregateSum(detail.Count),
BaseProductCount = u.BaseProductCount,
Unit = u.Unit,
Batch = u.Batch,
Name = u.Name,
Remarks = u.Remarks,
TenantId = u.TenantId,
CreateTime = u.CreateTime,
UpdateTime = u.UpdateTime,
CreateUserId = u.CreateUserId,
CreateUserName = u.CreateUserName,
UpdateUserId = u.UpdateUserId,
UpdateUserName = u.UpdateUserName,
IsDelete = u.IsDelete
});
if (input.StartDateRange != null && input.StartDateRange.Count >0)
2024-03-20 02:37:36 +00:00
{
DateTime? start= input.StartDateRange[0];
query = query.WhereIF(start.HasValue, u => u.StartDate > start);
if (input.StartDateRange.Count >1 && input.StartDateRange[1].HasValue)
{
var end = input.StartDateRange[1].Value.AddDays(1);
query = query.Where(u => u.StartDate < end);
}
}
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 增加汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task<long> Add(AddReportTableInput input)
{
2024-06-12 10:10:50 +00:00
var entity = input.Adapt<ReportTable>();
if (input.UpdateUserId > 0)
2024-05-30 10:18:10 +00:00
{
2024-06-12 10:10:50 +00:00
entity.SourceId = input.UpdateUserId;
2024-05-30 10:18:10 +00:00
}
2024-06-26 10:33:33 +00:00
var reportId = await _rep.InsertAsync(entity);
2024-06-12 10:10:50 +00:00
if (input.UpdateUserId > 0)
2024-05-30 10:18:10 +00:00
{
2024-06-12 10:10:50 +00:00
var details = await _codeDetailService.List();
if (details == null || details.Count < 1)
{
return 0;
}
var printDetails = details.FindAll(a => a.TempListId == input.UpdateUserId);
2024-06-26 10:33:33 +00:00
if (printDetails.Count < 1)
2024-06-12 10:10:50 +00:00
{
2024-06-26 10:33:33 +00:00
return 0;
}
for (int i = 0; i < printDetails.Count; i++)
{
var item = printDetails[i];
item.ReportTableId = entity.Id;
var ent = item.Adapt<PrintCodeDetail>();
await _codeDetailService.UpdateByEntity(ent);
2024-07-02 03:23:29 +00:00
await _productRetrospectService.AddRetrospect(ent, entity, "汇报单", entity.ProductionLine, entity.Id, null);
2024-06-12 10:10:50 +00:00
}
2024-05-30 10:18:10 +00:00
}
2024-06-12 10:10:50 +00:00
2024-03-20 02:37:36 +00:00
return entity.Id;
}
2024-06-26 10:33:33 +00:00
2024-03-20 02:37:36 +00:00
/// <summary>
/// 删除汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteReportTableInput input)
{
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
await _rep.FakeDeleteAsync(entity); //假删除
//await _rep.DeleteAsync(entity); //真删除
}
/// <summary>
/// 更新汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateReportTableInput input)
{
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<ReportTable> Detail([FromQuery] QueryByIdReportTableInput input)
{
2024-07-02 03:23:29 +00:00
return await _rep.GetFirstAsync(u => u.Id == input.Id || (input.SourceId > 0 && u.SourceId == input.SourceId));
2024-03-20 02:37:36 +00:00
}
2024-06-12 10:10:50 +00:00
/// <summary>
/// 获取汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "GetByCode")]
public async Task<ReportTable> GetByCode([FromQuery] QueryByIdReportTableInput input)
{
var codeModel = await _codeDetailService.GetByProductCode(input.Code);
if (codeModel == null)
{
throw Oops.Oh(ErrorCodeEnum.D1002);
}
return await _rep.GetFirstAsync(u => u.SourceId == codeModel.ReportTableId);
}
/// <summary>
/// 获取汇报单
/// </summary>
/// <param name="sourceId"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "GetBySource")]
public async Task<ReportTable> GetBySource(long? sourceId)
{
return await _rep.GetFirstAsync(u => u.SourceId == sourceId);
}
2024-03-20 02:37:36 +00:00
/// <summary>
/// 获取汇报单列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<ReportTableOutput>> List()
{
2024-05-24 10:22:01 +00:00
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<ReportTableOutput>().ToListAsync();
2024-03-20 02:37:36 +00:00
}
2024-05-24 10:22:01 +00:00
/// <summary>
/// 新增汇报单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "AddReport")]
public async Task AddReport(AddReportContext input)
{
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var unit = units.Find(a => a.Name == input.Name);
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
2024-07-08 16:33:59 +00:00
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
2024-05-24 10:22:01 +00:00
var addReport = await Add(newReport);
2024-06-26 10:33:33 +00:00
var others = units.FindAll(a => a.Rate < unit.Rate);
2024-03-20 02:37:36 +00:00
2024-05-24 10:22:01 +00:00
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
2024-03-20 02:37:36 +00:00
2024-05-25 10:46:26 +00:00
/// <summary>
2024-05-30 10:18:10 +00:00
/// 新增打印详情单
2024-05-25 10:46:26 +00:00
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
2024-05-30 10:18:10 +00:00
[ApiDescriptionSettings(Name = "AddPrintDetail")]
public async Task<List<PrintCodeTreeData>> AddPrintDetail(AddReportContext input)
2024-05-25 10:46:26 +00:00
{
2024-05-28 10:30:50 +00:00
var result = new List<PrintCodeTreeData>();
2024-05-25 10:46:26 +00:00
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
2024-07-02 03:23:29 +00:00
var unit = units.Find(a => a.Name == input.Package);
2024-05-25 10:46:26 +00:00
if (unit == null)
2024-07-02 03:23:29 +00:00
throw new ArgumentNullException(nameof(unit));
2024-05-25 10:46:26 +00:00
2024-06-26 10:33:33 +00:00
var newReport = new AddPrintRecordsInput() { CreateTime = DateTime.Now, Unit = input.Package, Name = input.Name, IsDelete = false, Batch = input.Batch, ProductDate = input.ProductDate, LoseDate = input.LoseDate, ProductCount = input.PrintDatas?.Count, MaterialsId = input.MaterialsId };
var addReport = await _printRecordsService.Add(newReport);
2024-05-25 10:46:26 +00:00
var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList();
2024-05-28 10:30:50 +00:00
others.Reverse();
int toltalCount = unit.Rate.ToInt();
var baseUnit = others.Count > 0 ? others.LastOrDefault().Name : unit.Name;
var userId = _userManager.UserId;
var userName = _userManager.RealName;
List<SysUnitOutput> tempUnits = new List<SysUnitOutput>();
tempUnits.AddRange(others);
2024-05-25 10:46:26 +00:00
foreach (var item in input.PrintDatas)
{
2024-06-26 10:33:33 +00:00
var code = CodeHelper.GetCode(item.BarCode, item.QrCode);
2024-05-25 10:46:26 +00:00
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
2024-06-06 10:22:07 +00:00
var detail = new AddPrintCodeDetailInput()
{
TempListId = addReport,
Code = code,
CodeName = codeType,
ChildCount = unit.ChildUnitCount,
Count = 1,
Unit = unit.Name,
BaseCount = toltalCount,
BaseUnit = baseUnit,
PrintCodeTime = DateTime.Now,
CreateUserId = userId,
2024-07-02 03:23:29 +00:00
MaterialsId = input.MaterialsId,
2024-07-06 14:34:20 +00:00
CreateUserName = userName,
2024-06-06 10:22:07 +00:00
};
2024-05-28 10:30:50 +00:00
var detailId = await _codeDetailService.Add(detail);
var treeData1 = detail.Adapt<PrintCodeTreeData>();
if (others.Count < 1)
2024-05-25 10:46:26 +00:00
{
2024-05-28 10:30:50 +00:00
result.Add(treeData1);
continue;
2024-05-25 10:46:26 +00:00
}
2024-05-28 10:30:50 +00:00
treeData1.Children = new List<PrintCodeTreeData>();
var currUnit = tempUnits.FirstOrDefault();
2024-06-24 10:21:52 +00:00
var printDatas = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit.Name, codeType, unit.ChildUnitCount);
2024-05-28 10:30:50 +00:00
foreach (var dt in printDatas)
2024-05-25 10:46:26 +00:00
{
2024-06-24 10:21:52 +00:00
var code2 = CodeHelper.GetCode(dt.BarCode, dt.QrCode);
2024-07-02 03:23:29 +00:00
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, MaterialsId = input.MaterialsId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
2024-05-28 10:30:50 +00:00
var detailId2 = await _codeDetailService.Add(detail2);
var treeData2 = detail2.Adapt<PrintCodeTreeData>();
if (tempUnits.Count > 1)
2024-05-25 10:46:26 +00:00
{
2024-05-28 10:30:50 +00:00
treeData2.Children = new List<PrintCodeTreeData>();
var currUnit3 = tempUnits[1];
2024-06-24 10:21:52 +00:00
var printDatas3 = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit3.Name, codeType, currUnit.ChildUnitCount);
2024-05-28 10:30:50 +00:00
foreach (var dt3 in printDatas3)
2024-05-25 10:46:26 +00:00
{
2024-06-24 10:21:52 +00:00
var code3 = CodeHelper.GetCode(dt3.BarCode, dt3.QrCode);
2024-07-02 03:23:29 +00:00
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, MaterialsId = input.MaterialsId, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
2024-05-28 10:30:50 +00:00
var detailId3 = await _codeDetailService.Add(detail3);
var treeData3 = detail3.Adapt<PrintCodeTreeData>();
if (tempUnits.Count > 2)
2024-05-25 10:46:26 +00:00
{
2024-05-28 10:30:50 +00:00
treeData3.Children = new List<PrintCodeTreeData>();
var currUnit4 = tempUnits[2];
2024-06-24 10:21:52 +00:00
var printDatas4 = await _printDataService.GetPrintDatas(input.UnitGroupId, currUnit4.Name, codeType, currUnit3.ChildUnitCount);
2024-05-28 10:30:50 +00:00
foreach (var dt4 in printDatas4)
{
2024-06-24 10:21:52 +00:00
var code4 = CodeHelper.GetCode(dt4.BarCode, dt4.QrCode);
2024-07-02 03:23:29 +00:00
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, MaterialsId = input.MaterialsId, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
2024-05-28 10:30:50 +00:00
var treeData4 = detail4.Adapt<PrintCodeTreeData>();
treeData3.Children.Add(treeData4);
}
2024-05-25 10:46:26 +00:00
}
2024-05-28 10:30:50 +00:00
treeData2.Children.Add(treeData3);
2024-05-25 10:46:26 +00:00
}
}
2024-05-28 10:30:50 +00:00
treeData1.Children.Add(treeData2);
2024-05-25 10:46:26 +00:00
}
2024-05-28 10:30:50 +00:00
result.Add(treeData1);
2024-05-25 10:46:26 +00:00
}
2024-05-28 10:30:50 +00:00
return result;
2024-05-25 10:46:26 +00:00
}
2024-05-30 10:18:10 +00:00
/// <summary>
/// 获取打印详情单
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "GetPrintDetail")]
public async Task<List<PrintCodeTreeData>> GetPrintDetail(long? id)
{
var result = new List<PrintCodeTreeData>();
var details = await _codeDetailService.List();
if (details == null || details.Count < 1)
{
return result;
}
var printDetails = details.FindAll(a => a.TempListId == id || a.ReportTableId == id);
if (printDetails.Count<1)
{
return result;
}
var father = printDetails.FindAll(a => a.FatherId == null || a.FatherId == 0);
foreach (var item in father)
{
var treeData1 = item.Adapt<PrintCodeTreeData>();
var list1 = printDetails.FindAll(a => a.FatherId == item.Id);
if (list1.Count > 0)
{
treeData1.Children = new List<PrintCodeTreeData>();
treeData1.HasChildren = false;
foreach (var dt in list1)
{
var list2 = printDetails.FindAll(a => a.FatherId == dt.Id);
var treeData2 = dt.Adapt<PrintCodeTreeData>();
if (list2.Count > 0)
{
treeData2.Children = new List<PrintCodeTreeData>();
treeData2.HasChildren = false;
foreach (var dt3 in list2)
{
var list3 = printDetails.FindAll(a => a.FatherId == dt3.Id);
var treeData3 = dt3.Adapt<PrintCodeTreeData>();
if (list3.Count > 0)
{
treeData3.Children = new List<PrintCodeTreeData>();
treeData3.HasChildren = false;
foreach (var dt4 in list3)
{
var treeData4 = dt4.Adapt<PrintCodeTreeData>();
treeData3.Children.Add(treeData4);
2024-07-16 15:23:00 +00:00
var list4 = printDetails.FindAll(a => a.FatherId == dt4.Id);
foreach (var dt5 in list4)
{
var treeData5 = dt5.Adapt<PrintCodeTreeData>();
if (list4.Count > 0)
{
treeData4.Children = new List<PrintCodeTreeData>();
treeData4.HasChildren = false;
}
treeData4.Children.Add(treeData5);
}
2024-05-30 10:18:10 +00:00
}
}
treeData2.Children.Add(treeData3);
}
}
treeData1.Children.Add(treeData2);
}
}
result.Add(treeData1);
}
return result;
}
2024-07-08 16:33:59 +00:00
/// <summary>
/// 更新状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateState")]
public async Task UpdateState(AddReportContext input)
{
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var unit = units.Find(a => a.Name == input.Name);
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate);
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
2024-03-20 02:37:36 +00:00
}