This commit is contained in:
DEVICE8\12494
2023-04-14 09:54:48 +08:00
parent 51d59218b0
commit 2fc2b6a85e

View File

@@ -22,6 +22,7 @@ namespace Tnb.BasicData
/// <summary> /// <summary>
/// MOM基础数据-工艺管理 /// MOM基础数据-工艺管理
/// </summary> /// </summary>
[ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)] [ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)]
[Route("api/basic/[controller]")] [Route("api/basic/[controller]")]
public class ProcessManageService : IDynamicApiController, ITransient public class ProcessManageService : IDynamicApiController, ITransient
@@ -29,6 +30,7 @@ namespace Tnb.BasicData
private readonly ISqlSugarRepository<BasRoute> _repository; private readonly ISqlSugarRepository<BasRoute> _repository;
private readonly DataBaseManager _dbManager; private readonly DataBaseManager _dbManager;
private readonly IDictionaryDataService _dictionaryDataService; private readonly IDictionaryDataService _dictionaryDataService;
private readonly string _dictionaryTypeId;
public ProcessManageService( public ProcessManageService(
IDictionaryDataService dictionaryDataService, IDictionaryDataService dictionaryDataService,
@@ -38,16 +40,47 @@ namespace Tnb.BasicData
_dictionaryDataService = dictionaryDataService; _dictionaryDataService = dictionaryDataService;
_repository = repository; _repository = repository;
_dbManager = dbManager; _dbManager = dbManager;
_dictionaryTypeId = "24950639717653";
} }
/// <summary> /// <summary>
/// 获取工艺路线树形结构 /// 获取工艺路线树形结构
/// </summary> /// </summary>
/// <returns>工艺路线模版树形结构</returns> /// <returns>工艺路线模版树形结构</returns>
/// <remarks>
///<br/> [{
///<br/> "RouteType": 工艺路线类型,
///<br/> "Name": 工艺路线类型名称,
///<br/> "RouteName": 工艺路线名称,
///<br/> "RouteCode": 工艺路线代码,
///<br/> "Version": 工艺路线版本,
///<br/> "id": "25325800913429",
///<br/> "parentId": null,
///<br/> "hasChildren": true,
///<br/> "children": [{
///<br/> "RouteType": 工艺路线类型,
///<br/> "Name": 工艺路线名称|工艺路线版本,
///<br/> "RouteName": "显示器集成",
///<br/> "RouteCode": 工艺路线代码,
///<br/> "Version": 工艺路线版本,
///<br/> "id": 当前节点Id不用可以忽略,
///<br/> "parentId": "父节点Id,不用可以忽略",
///<br/> "hasChildren": 是否包含子节点,true/false,
///<br/> "children": [{
///<br/> "Version": 工艺路线版本,
///<br/> }
///<br/> ],
///<br/> "num": 子节点数量,不用可以忽略,
///<br/> "isLeaf": 是否页节点,不用可以忽略 true/false
///<br/> }
///<br/> ]
///<br/>}
///<br/>]
/// </remarks>
[HttpGet("route-tree")] [HttpGet("route-tree")]
public async Task<dynamic> GetRouteTreeList() public async Task<dynamic> GetRouteTreeList()
{ {
var result = new List<RouteLineTreeOutput>(); var result = new List<RouteLineTreeOutput>();
var dictaryDataList = await _dictionaryDataService.GetList("24950639717653"); var dictaryDataList = await _dictionaryDataService.GetList(_dictionaryTypeId);
var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName); var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName);
SqlSugarScope sugarClient = null!; SqlSugarScope sugarClient = null!;
var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == "tnb_mom"); var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == "tnb_mom");
@@ -91,8 +124,9 @@ namespace Tnb.BasicData
{ {
id = SnowflakeIdHelper.NextId(), id = SnowflakeIdHelper.NextId(),
parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"], parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"],
Name = x.Version,
Version = x.Version, Version = x.Version,
})) ; }));
} }
} }
} }