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-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;
|
|
|
|
|
private readonly ReportDetailTableService _reportDetailTable;
|
|
|
|
|
private readonly UserManager _userManager;
|
2024-05-28 10:30:50 +00:00
|
|
|
|
private readonly PrintDataService _printDataService;
|
2024-05-25 10:46:26 +00:00
|
|
|
|
|
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-05-28 10:30:50 +00:00
|
|
|
|
ReportDetailTableService reportDetailTable,
|
|
|
|
|
PrintDataService printDataService)
|
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;
|
|
|
|
|
_reportDetailTable = reportDetailTable;
|
|
|
|
|
_userManager = userManager;
|
2024-05-28 10:30:50 +00:00
|
|
|
|
_printDataService = printDataService;
|
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()))
|
|
|
|
|
.WhereIF(input.State>0, u => u.State == input.State)
|
|
|
|
|
.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()))
|
|
|
|
|
.Select<ReportTableOutput>();
|
|
|
|
|
if(input.StartDateRange != null && input.StartDateRange.Count >0)
|
|
|
|
|
{
|
|
|
|
|
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-05-30 10:18:10 +00:00
|
|
|
|
//input.UpdateUserId
|
|
|
|
|
var details = await _codeDetailService.List();
|
|
|
|
|
if (details == null || details.Count < 1)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
var printDetails = details.FindAll(a => a.TempListId == input.UpdateUserId);
|
|
|
|
|
if (printDetails.Count < 1)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-03-20 02:37:36 +00:00
|
|
|
|
var entity = input.Adapt<ReportTable>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
2024-05-30 10:18:10 +00:00
|
|
|
|
for (int i = 0; i < printDetails.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var item = printDetails[i];
|
|
|
|
|
item.ReportTableId = entity.Id;
|
|
|
|
|
await _codeDetailService.Update(item.Adapt<UpdatePrintCodeDetailInput>());
|
|
|
|
|
}
|
2024-03-20 02:37:36 +00:00
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <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)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <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));
|
|
|
|
|
|
|
|
|
|
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 };
|
|
|
|
|
var addReport = await Add(newReport);
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
var unit = units.Find(a => a.Name == input.Name);
|
|
|
|
|
if (unit == null)
|
|
|
|
|
throw new ArgumentNullException(nameof(unitGroup));
|
|
|
|
|
|
2024-05-30 10:18:10 +00:00
|
|
|
|
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0,UpdateUserId = input.MaterialsId };
|
2024-05-25 10:46:26 +00:00
|
|
|
|
var addReport = await Add(newReport);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
var code = string.IsNullOrEmpty(item.BarCode) ? item.QrCode : item.BarCode;
|
|
|
|
|
var codeType = string.IsNullOrEmpty(item.BarCode) ? "二维码" : "条码";
|
2024-05-28 10:30:50 +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, CreateUserName = userName };
|
|
|
|
|
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-05-30 10:18:10 +00:00
|
|
|
|
var printDatas = await _printDataService.GetPrintDatas(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-05-28 10:30:50 +00:00
|
|
|
|
var code2 = string.IsNullOrEmpty(dt.BarCode) ? dt.QrCode : dt.BarCode;
|
|
|
|
|
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
|
|
|
|
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-05-30 10:18:10 +00:00
|
|
|
|
var printDatas3 = await _printDataService.GetPrintDatas(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-05-28 10:30:50 +00:00
|
|
|
|
var code3 = string.IsNullOrEmpty(dt3.BarCode) ? dt3.QrCode : dt3.BarCode;
|
|
|
|
|
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
|
|
|
|
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-05-30 10:18:10 +00:00
|
|
|
|
var printDatas4 = await _printDataService.GetPrintDatas(currUnit4.Name, codeType, currUnit3.ChildUnitCount);
|
2024-05-28 10:30:50 +00:00
|
|
|
|
foreach (var dt4 in printDatas4)
|
|
|
|
|
{
|
|
|
|
|
var code4 = string.IsNullOrEmpty(dt4.BarCode) ? dt4.QrCode : dt4.BarCode;
|
|
|
|
|
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
|
|
|
|
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 report = await Detail(new QueryByIdReportTableInput() { Id = id });
|
|
|
|
|
//if (report==null)
|
|
|
|
|
//{
|
|
|
|
|
// return result;
|
|
|
|
|
//}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
treeData2.Children.Add(treeData3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
treeData1.Children.Add(treeData2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Add(treeData1);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2024-03-20 02:37:36 +00:00
|
|
|
|
}
|
|
|
|
|
|