diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs new file mode 100644 index 00000000..532f18c3 --- /dev/null +++ b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs @@ -0,0 +1,84 @@ +namespace Tnb.BasicData.Entitys.Dto +{ + public class EbomTreeOutput + { + /// + /// 物料名称 + /// + public string material_id { get; set; } + /// + /// 规格描述 + /// + public string material_id_extras { get; set; } + /// + /// 物料id + /// + public string material_id_id { get; set; } + /// + /// 最小包装 + /// + public decimal? material_id_minpacking { get; set; } + /// + /// 备注 + /// + public string material_id_remark { get; set; } + /// + /// 单位 + /// + public string material_id_unitid { get; set; } + /// + /// 是否有下级 + /// + public bool hasChildren { get; set; } + + /// + /// Desc:投料管控 + /// Default:NULL::character varying + /// Nullable:True + /// + public string feeding_control {get;set;} + + /// + /// Desc:损耗率 + /// Default:NULL::character varying + /// Nullable:True + /// + public string loss_rate {get;set;} + + /// + /// Desc:数量 + /// Default:NULL::character varying + /// Nullable:True + /// + public string quantity {get;set;} + + /// + /// Desc:需要称量 + /// Default:NULL::character varying + /// Nullable:True + /// + public string require_weight {get;set;} + + /// + /// Desc:替代物料 + /// Default:NULL::character varying + /// Nullable:True + /// + public string substitute_material {get;set;} + + /// + /// Desc:工艺路线 + /// Default:NULL::character varying + /// Nullable:True + /// + public string routing {get;set;} + + /// + /// Desc:版本号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string version {get;set;} + + } +} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs similarity index 72% rename from BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs rename to BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs index ca9d6a46..9c4dfea5 100644 --- a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs @@ -1,11 +1,11 @@ namespace Tnb.BasicData.Entitys.Dto { - public class ParentMaterialTreeQueryInput + public class EbomTreeQueryInput { /// /// 物料清单id /// - public string parentMaterialId { get; set; } + public string ebomId { get; set; } /// /// 物料id /// diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs deleted file mode 100644 index dc5dbd4d..00000000 --- a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Tnb.BasicData.Entitys.Dto -{ - public class ParentMaterialTreeOutput - { - /// - /// 物料名称 - /// - public string material_id { get; set; } - /// - /// 规格描述 - /// - public string material_id_extras { get; set; } - /// - /// 物料id - /// - public string material_id_id { get; set; } - /// - /// 最小包装 - /// - public decimal? material_id_minpacking { get; set; } - /// - /// 备注 - /// - public string material_id_remark { get; set; } - /// - /// 单位 - /// - public string material_id_unitid { get; set; } - /// - /// 是否有下级 - /// - public bool hasChildren { get; set; } - - - - } -} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs similarity index 92% rename from BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs rename to BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs index d3d7cc48..f1f9510a 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs @@ -6,10 +6,10 @@ namespace Tnb.BasicData.Entitys.Entity /// ///物料清单子表 /// - [SugarTable("bas_parent_material_items")] - public class BasParentMaterialItems : BaseEntity + [SugarTable("bas_ebom_d")] + public class BasEbomD : BaseEntity { - public BasParentMaterialItems(){ + public BasEbomD(){ } @@ -34,8 +34,8 @@ namespace Tnb.BasicData.Entitys.Entity /// Default:NULL::character varying /// Nullable:True /// - [SugarColumn(ColumnName="parent_material_id")] - public string ParentMaterialId {get;set;} + [SugarColumn(ColumnName="ebom_id")] + public string EbomId {get;set;} /// /// Desc:物料编号/名称 diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs similarity index 96% rename from BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs rename to BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs index d62c9140..92d97646 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs @@ -6,10 +6,10 @@ namespace Tnb.BasicData.Entitys.Entity /// ///物料清单父表 /// - [SugarTable("bas_parent_material")] - public class BasParentMaterial : BaseEntity + [SugarTable("bas_ebom_h")] + public class BasEbomH : BaseEntity { - public BasParentMaterial(){ + public BasEbomH(){ } diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs index 64c0d56a..cf1ccfba 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs @@ -7,82 +7,119 @@ using Tnb.Common.Contracts; namespace Tnb.BasicData.Entitys.Entity { - /// - /// 工艺路线资料 + /// + ///工艺路线 /// [SugarTable("bas_route")] public class BasRoute : BaseEntity { - /// - /// 工艺路线代码 - /// - [SugarColumn(ColumnName = "route_code")] - public string RouteCode { get; set; } - /// - /// 工艺路线名称 - /// - [SugarColumn(ColumnName = "route_name")] - public string RouteName { get; set; } - /// - /// 工艺路线版本 - /// - [SugarColumn(ColumnName = "version")] - public string Version { get; set; } - /// - /// 工艺路线类型: 标准途程:Standard 返工途程:Rework 试制途程:Trial 返修途程:RMA - /// - [SugarColumn(ColumnName = "route_type")] - public string RouteType { get; set; } - /// - /// 创建时间 - /// - [SugarColumn(ColumnName = "create_time")] - public DateTime CreateTime { get; set; } - /// - /// 修改时间 - /// - [SugarColumn(ColumnName = "modify_time")] - public DateTime? ModifyTime { get; set; } - /// - /// 扩展字段 - /// - [SugarColumn(ColumnName = "extras")] - public string? Extras { get; set; } - /// - /// 租户ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "tenant_id")] - public string? TenantId { get; set; } - /// - /// 所属组织ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "org_id")] - public string? OrgId { get; set; } - /// - /// 备注 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "remark")] - public string? Remark { get; set; } - /// - /// 时间戳(用于并发控制) - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "timestamp")] - public string? Timestamp { get; set; } - /// - /// 创建用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "create_id")] - public string? CreateId { get; set; } - /// - /// 修改用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "modify_id")] - public string? ModifyId { get; set; } + public BasRoute(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true,ColumnName="id")] + public string Id {get;set;} + + /// + /// Desc:编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="code")] + public string Code {get;set;} + + /// + /// Desc:名称 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="name")] + public string Name {get;set;} + + /// + /// Desc:有效开始时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="start_time")] + public DateTime? StartTime {get;set;} + + /// + /// Desc:有效结束时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="end_time")] + public DateTime? EndTime {get;set;} + + /// + /// Desc:0 未发布 1 已发布 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="status")] + public string Status {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_time")] + public DateTime? CreateTime {get;set;} + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="modify_time")] + public DateTime? ModifyTime {get;set;} + + /// + /// Desc:是否永远有效 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="is_always_valid")] + public int IsAlwaysValid {get;set;} + + /// + /// Desc:所属组织ID + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="org_id")] + public string OrgId {get;set;} + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="create_id")] + public string CreateId {get;set;} + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="modify_id")] + public string ModifyId {get;set;} + + /// + /// Desc:备注 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="remark")] + public string Remark {get;set;} + } } diff --git a/BasicData/Tnb.BasicData/ParentMaterialService.cs b/BasicData/Tnb.BasicData/EbomService.cs similarity index 52% rename from BasicData/Tnb.BasicData/ParentMaterialService.cs rename to BasicData/Tnb.BasicData/EbomService.cs index 9bc16c38..8ec1efd0 100644 --- a/BasicData/Tnb.BasicData/ParentMaterialService.cs +++ b/BasicData/Tnb.BasicData/EbomService.cs @@ -14,15 +14,15 @@ namespace Tnb.BasicData /// /// 物料清单 /// - [ApiDescriptionSettings(Tag = "BasicData", Name = "ParentMaterial", Order = 701)] + [ApiDescriptionSettings(Tag = "BasicData", Name = "Ebom", Order = 701)] [Route("api/basic/[controller]")] - public class ParentMaterialService : IDynamicApiController, ITransient + public class EbomService : IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; - public ParentMaterialService( + public EbomService( ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) { _repository = repository; @@ -36,7 +36,7 @@ namespace Tnb.BasicData /// 获取物料清单树. /// [HttpPost("[action]")] - public async Task GetTree(ParentMaterialTreeQueryInput queryInput) + public async Task GetTree(EbomTreeQueryInput queryInput) { var db = _repository.AsSugarClient(); var dic = await _dictionaryDataService.GetDicByKey(DicTypeKey.MeasurementUnit); @@ -49,11 +49,12 @@ namespace Tnb.BasicData if (string.IsNullOrEmpty(queryInput.materialId)) { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ParentMaterialId==b.Id) + var data = await db.Queryable() + .LeftJoin((a,b)=>a.EbomId==b.Id) .LeftJoin((a,b,c)=>a.MaterialId==c.Id) - .Where((a,b,c)=>a.ParentMaterialId==queryInput.parentMaterialId) - .Select((a,b,c)=>new ParentMaterialTreeOutput + .LeftJoin((a,b,c,d)=>a.MaterialId==d.MaterialId) + .Where((a,b,c)=>a.EbomId==queryInput.ebomId) + .Select((a,b,c,d)=>new EbomTreeOutput { material_id = c.MaterialName, material_id_extras = c.Extras, @@ -61,7 +62,14 @@ namespace Tnb.BasicData material_id_minpacking = c.Minpacking, material_id_remark = c.Remark, material_id_unitid = c.Unitid, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), + feeding_control = a.FeedingControl, + loss_rate = a.LossRate, + quantity = a.Quantity, + require_weight = a.RequireWeight, + substitute_material = a.SubstituteMaterial, + routing = d.Routing, + version = d.Version, + hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), }).Mapper(it => { it.material_id_unitid = dic[it.material_id_unitid].ToString(); @@ -70,11 +78,12 @@ namespace Tnb.BasicData } else { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ParentMaterialId==b.Id) + var data = await db.Queryable() + .LeftJoin((a,b)=>a.EbomId==b.Id) .LeftJoin((a,b,c)=>a.MaterialId==c.Id) - .Where((a,b,c)=>b.MaterialId==queryInput.materialId && a.ParentMaterialId==b.Id) - .Select((a,b,c)=>new ParentMaterialTreeOutput + .LeftJoin((a,b,c,d)=>a.MaterialId==d.MaterialId) + .Where((a,b,c)=>b.MaterialId==queryInput.materialId && a.EbomId==b.Id) + .Select((a,b,c,d)=>new EbomTreeOutput { material_id = c.MaterialName, material_id_extras = c.Extras, @@ -82,7 +91,14 @@ namespace Tnb.BasicData material_id_minpacking = c.Minpacking, material_id_remark = c.Remark, material_id_unitid = c.Unitid, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), + feeding_control = a.FeedingControl, + loss_rate = a.LossRate, + quantity = a.Quantity, + require_weight = a.RequireWeight, + substitute_material = a.SubstituteMaterial, + routing = d.Routing, + version = d.Version, + hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), }).Mapper(it => { it.material_id_unitid = dic[it.material_id_unitid].ToString(); @@ -92,5 +108,32 @@ namespace Tnb.BasicData } + + [HttpPost("[action]")] + public async Task> GetEbomVersionAndRouteName(string materialId) + { + var db = _repository.AsSugarClient(); + + var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == DbName.TNBMON); + if (momDbLink != null) + { + db = _dbManager.ChangeDataBase(momDbLink); + } + + var ebom = await db.Queryable() + .LeftJoin((a,b)=>a.Routing==b.Id) + .Where((a,b) => a.MaterialId == materialId) + .Select((a,b)=>new + { + a.Version, + b.Name, + }).SingleAsync(); + return new Dictionary() + { + ["version"] = ebom?.Version, + ["routeName"] = ebom?.Name + , + }; + } } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData/ProcessManageService.cs b/BasicData/Tnb.BasicData/ProcessManageService.cs index 0ea22015..791773c5 100644 --- a/BasicData/Tnb.BasicData/ProcessManageService.cs +++ b/BasicData/Tnb.BasicData/ProcessManageService.cs @@ -1,142 +1,142 @@ -using System.CodeDom; -using Aop.Api.Domain; -using Aop.Api.Request; -using Aspose.Cells; -using JNPF.Common.Core.Manager; -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula.Functions; -using Spire.Presentation; -using SqlSugar; -using Tnb.BasicData.Entitys.Dto.ProcessManage; -using Tnb.BasicData.Entitys.Entity; -using Tnb.BasicData.Entitys.Model; - -namespace Tnb.BasicData -{ - /// - /// MOM基础数据-工艺管理 - /// - - [ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)] - [Route("api/basic/[controller]")] - public class ProcessManageService : IOverideVisualDevService, IDynamicApiController, ITransient - { - private readonly ISqlSugarRepository _repository; - private readonly DataBaseManager _dbManager; - private readonly IDictionaryDataService _dictionaryDataService; - private readonly string _dictionaryTypeId; - - public ProcessManageService( - IDictionaryDataService dictionaryDataService, - ISqlSugarRepository repository, - DataBaseManager dbManager) - { - _dictionaryDataService = dictionaryDataService; - _repository = repository; - _dbManager = dbManager; - _dictionaryTypeId = "24950639717653"; - } - - public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc(); - - /// - /// 获取工艺路线树形结构 - /// - /// 工艺路线模版树形结构 - /// - ///
[{ - ///
"RouteType": 工艺路线类型, - ///
"Name": 工艺路线类型名称, - ///
"RouteName": 工艺路线名称, - ///
"RouteCode": 工艺路线代码, - ///
"Version": 工艺路线版本, - ///
"id": "25325800913429", - ///
"parentId": null, - ///
"hasChildren": true, - ///
"children": [{ - ///
"RouteType": 工艺路线类型, - ///
"Name": 工艺路线名称|工艺路线版本, - ///
"RouteName": "显示器集成", - ///
"RouteCode": 工艺路线代码, - ///
"Version": 工艺路线版本, - ///
"id": 当前节点Id,不用可以忽略, - ///
"parentId": "父节点Id,不用可以忽略", - ///
"hasChildren": 是否包含子节点,true/false, - ///
"children": [{ - ///
"Version": 工艺路线版本, - ///
} - ///
], - ///
"num": 子节点数量,不用可以忽略, - ///
"isLeaf": 是否页节点,不用可以忽略 true/false - ///
} - ///
] - ///
} - ///
] - ///
- [HttpGet("route-tree")] - public async Task GetRouteTreeList() - { - var result = new List(); - var dictaryDataList = await _dictionaryDataService.GetList(_dictionaryTypeId); - var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName); - SqlSugarScope sugarClient = null!; - var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == "tnb_mom"); - if (momDbLink != null) - { - sugarClient = _dbManager.ChangeDataBase(momDbLink); - } - var list = await sugarClient.Queryable().ToListAsync(); - if (list?.Count > 0) - { - var routeGroups = list.GroupBy(g => g.RouteType); - var dic1 = routeGroups.ToDictionary(x => x.Key, x => Tuple.Create(new RouteLineTreeOutput - { - id = SnowflakeIdHelper.NextId(), - RouteType = x.Key, - Name = dictaryData.ContainsKey(x.Key) ? dictaryData[x.Key] : string.Empty - }, x.GroupBy(g => new { g.RouteName, g.RouteCode }))); - result.AddRange(dic1.Values.Select(t => t.Item1)); - foreach (var routeGroup in routeGroups) - { - if (dic1.ContainsKey(routeGroup.Key)) - { - var nodes = new List(); - foreach (var item in dic1[routeGroup.Key].Item2) - { - var node = new RouteLineTreeOutput(); - node.id = SnowflakeIdHelper.NextId(); - node.parentId = dic1[routeGroup.Key].Item1.id; - node.Name = $"{item.Key.RouteName}|{item.Key.RouteCode}"; - node.RouteName = item.Key.RouteName; - node.RouteCode = item.Key.RouteCode; - nodes.Add(node); - } - result.AddRange(nodes); - var dic2 = nodes.ToDictionary(x => x.Name, x => x.id); - foreach (var item in dic1[routeGroup.Key].Item2) - { - if (dic2.ContainsKey($"{item.Key.RouteName}|{item.Key.RouteCode}")) - { - result.AddRange(item.Select(x => new RouteLineTreeOutput - { - id = SnowflakeIdHelper.NextId(), - parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"], - Name = x.Version, - Version = x.Version, - })); - } - } - } - } - } - return new { list = result.ToTree() }; - } - } -} \ No newline at end of file +// using System.CodeDom; +// using Aop.Api.Domain; +// using Aop.Api.Request; +// using Aspose.Cells; +// using JNPF.Common.Core.Manager; +// using JNPF.Common.Security; +// using JNPF.DependencyInjection; +// using JNPF.DynamicApiController; +// using JNPF.Systems.Entitys.System; +// using JNPF.Systems.Interfaces.System; +// using JNPF.VisualDev; +// using Microsoft.AspNetCore.Authorization; +// using Microsoft.AspNetCore.Mvc; +// using NPOI.SS.Formula.Functions; +// using Spire.Presentation; +// using SqlSugar; +// using Tnb.BasicData.Entitys.Dto.ProcessManage; +// using Tnb.BasicData.Entitys.Entity; +// using Tnb.BasicData.Entitys.Model; +// +// namespace Tnb.BasicData +// { +// /// +// /// MOM基础数据-工艺管理 +// /// +// +// [ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)] +// [Route("api/basic/[controller]")] +// public class ProcessManageService : IOverideVisualDevService, IDynamicApiController, ITransient +// { +// private readonly ISqlSugarRepository _repository; +// private readonly DataBaseManager _dbManager; +// private readonly IDictionaryDataService _dictionaryDataService; +// private readonly string _dictionaryTypeId; +// +// public ProcessManageService( +// IDictionaryDataService dictionaryDataService, +// ISqlSugarRepository repository, +// DataBaseManager dbManager) +// { +// _dictionaryDataService = dictionaryDataService; +// _repository = repository; +// _dbManager = dbManager; +// _dictionaryTypeId = "24950639717653"; +// } +// +// public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc(); +// +// /// +// /// 获取工艺路线树形结构 +// /// +// /// 工艺路线模版树形结构 +// /// +// ///
[{ +// ///
"RouteType": 工艺路线类型, +// ///
"Name": 工艺路线类型名称, +// ///
"RouteName": 工艺路线名称, +// ///
"RouteCode": 工艺路线代码, +// ///
"Version": 工艺路线版本, +// ///
"id": "25325800913429", +// ///
"parentId": null, +// ///
"hasChildren": true, +// ///
"children": [{ +// ///
"RouteType": 工艺路线类型, +// ///
"Name": 工艺路线名称|工艺路线版本, +// ///
"RouteName": "显示器集成", +// ///
"RouteCode": 工艺路线代码, +// ///
"Version": 工艺路线版本, +// ///
"id": 当前节点Id,不用可以忽略, +// ///
"parentId": "父节点Id,不用可以忽略", +// ///
"hasChildren": 是否包含子节点,true/false, +// ///
"children": [{ +// ///
"Version": 工艺路线版本, +// ///
} +// ///
], +// ///
"num": 子节点数量,不用可以忽略, +// ///
"isLeaf": 是否页节点,不用可以忽略 true/false +// ///
} +// ///
] +// ///
} +// ///
] +// ///
+// [HttpGet("route-tree")] +// public async Task GetRouteTreeList() +// { +// var result = new List(); +// var dictaryDataList = await _dictionaryDataService.GetList(_dictionaryTypeId); +// var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName); +// SqlSugarScope sugarClient = null!; +// var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == "tnb_mom"); +// if (momDbLink != null) +// { +// sugarClient = _dbManager.ChangeDataBase(momDbLink); +// } +// var list = await sugarClient.Queryable().ToListAsync(); +// if (list?.Count > 0) +// { +// var routeGroups = list.GroupBy(g => g.RouteType); +// var dic1 = routeGroups.ToDictionary(x => x.Key, x => Tuple.Create(new RouteLineTreeOutput +// { +// id = SnowflakeIdHelper.NextId(), +// RouteType = x.Key, +// Name = dictaryData.ContainsKey(x.Key) ? dictaryData[x.Key] : string.Empty +// }, x.GroupBy(g => new { g.RouteName, g.RouteCode }))); +// result.AddRange(dic1.Values.Select(t => t.Item1)); +// foreach (var routeGroup in routeGroups) +// { +// if (dic1.ContainsKey(routeGroup.Key)) +// { +// var nodes = new List(); +// foreach (var item in dic1[routeGroup.Key].Item2) +// { +// var node = new RouteLineTreeOutput(); +// node.id = SnowflakeIdHelper.NextId(); +// node.parentId = dic1[routeGroup.Key].Item1.id; +// node.Name = $"{item.Key.RouteName}|{item.Key.RouteCode}"; +// node.RouteName = item.Key.RouteName; +// node.RouteCode = item.Key.RouteCode; +// nodes.Add(node); +// } +// result.AddRange(nodes); +// var dic2 = nodes.ToDictionary(x => x.Name, x => x.id); +// foreach (var item in dic1[routeGroup.Key].Item2) +// { +// if (dic2.ContainsKey($"{item.Key.RouteName}|{item.Key.RouteCode}")) +// { +// result.AddRange(item.Select(x => new RouteLineTreeOutput +// { +// id = SnowflakeIdHelper.NextId(), +// parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"], +// Name = x.Version, +// Version = x.Version, +// })); +// } +// } +// } +// } +// } +// return new { list = result.ToTree() }; +// } +// } +// } \ No newline at end of file