diff --git a/Tnb.BasicData.Entitys/Dto/BasicDataTreeOutput.cs b/Tnb.BasicData.Entitys/Dto/BasicDataTreeOutput.cs
deleted file mode 100644
index 908054f8..00000000
--- a/Tnb.BasicData.Entitys/Dto/BasicDataTreeOutput.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using JNPF.Common.Security;
-
-namespace Tnb.BasicData.Entitys.Dto
-{
- public class BasicDataTreeOutput : TreeModel
- {
-
- }
-}
diff --git a/Tnb.BasicData.Entitys/Dto/ProcessManage/RouteLineTreeOutput.cs b/Tnb.BasicData.Entitys/Dto/ProcessManage/RouteLineTreeOutput.cs
new file mode 100644
index 00000000..d3279972
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Dto/ProcessManage/RouteLineTreeOutput.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Security;
+
+namespace Tnb.BasicData.Entitys.Dto.ProcessManage
+{
+ ///
+ /// 工艺路线模版左侧树输出参数
+ ///
+ public class RouteLineTreeOutput : TreeModel
+ {
+ ///
+ /// 工艺路线类型
+ ///
+ public string RouteType { get; set; }
+ ///
+ /// 工艺路线类型名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 工艺路线名称
+ ///
+ public string RouteName { get; set; }
+
+ ///
+ /// 工艺路线代码
+ ///
+ public string RouteCode { get; set; }
+ ///
+ /// 工艺路线版本
+ ///
+ public string Version { get; set; }
+ }
+}
diff --git a/Tnb.BasicData.Entitys/Mapper/Mapper.cs b/Tnb.BasicData.Entitys/Mapper/Mapper.cs
index e3260080..3c664fd1 100644
--- a/Tnb.BasicData.Entitys/Mapper/Mapper.cs
+++ b/Tnb.BasicData.Entitys/Mapper/Mapper.cs
@@ -1,6 +1,8 @@
using JNPF.Systems.Entitys.System;
using Mapster;
using SqlSugar;
+using Tnb.BasicData.Entitys.Dto.ProcessManage;
+using Tnb.BasicData.Entitys.Entity;
namespace Tnb.BasicData.Entitys.Mapper
{
@@ -8,12 +10,7 @@ namespace Tnb.BasicData.Entitys.Mapper
{
public void Register(TypeAdapterConfig config)
{
- config.ForType()
- .Map(dest => dest.ConnectionString, src => src.DefaultConnection)
- .AfterMapping((src, dest) =>
- {
- dest.ConnectionString = string.Format(src.DefaultConnection, src.Host, src.Port, src.DBName, src.UserName, src.Password);
- });
+ config.ForType();
}
}
}
diff --git a/Tnb.BasicData/ProcessManageService.cs b/Tnb.BasicData/ProcessManageService.cs
new file mode 100644
index 00000000..13ce564a
--- /dev/null
+++ b/Tnb.BasicData/ProcessManageService.cs
@@ -0,0 +1,104 @@
+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 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 : IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly DataBaseManager _dbManager;
+ private readonly IDictionaryDataService _dictionaryDataService;
+
+ public ProcessManageService(
+ IDictionaryDataService dictionaryDataService,
+ ISqlSugarRepository repository,
+ DataBaseManager dbManager)
+ {
+ _dictionaryDataService = dictionaryDataService;
+ _repository = repository;
+ _dbManager = dbManager;
+ }
+ ///
+ /// 获取工艺路线树形结构
+ ///
+ /// 工艺路线模版树形结构
+ [HttpGet("route-tree")]
+ public async Task GetRouteTreeList()
+ {
+ var result = new List();
+ var dictaryDataList = await _dictionaryDataService.GetList("24950639717653");
+ 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}"],
+ Version = x.Version,
+ })) ;
+ }
+ }
+ }
+ }
+ }
+ return new { list = result.ToTree() };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData/RouteTreeService.cs b/Tnb.BasicData/RouteTreeService.cs
deleted file mode 100644
index ba86e629..00000000
--- a/Tnb.BasicData/RouteTreeService.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System.CodeDom;
-using Aspose.Cells;
-using JNPF.Common.Core.Manager;
-using JNPF.DependencyInjection;
-using JNPF.DynamicApiController;
-using JNPF.Systems.Entitys.System;
-using JNPF.Systems.Interfaces.System;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Spire.Presentation;
-using SqlSugar;
-using Tnb.BasicData.Entitys.Entity;
-using Tnb.BasicData.Entitys.Model;
-
-namespace Tnb.BasicData
-{
- ///
- /// MOM基础数据服务
- ///
- [ApiDescriptionSettings(Tag = "BasicData", Name = "RouteLineTemplate", Order = 700)]
- [Route("api/Route/[controller]")]
- public class RouteTreeService : IDynamicApiController, ITransient
- {
- private readonly ISqlSugarRepository _repository;
- private readonly DataBaseManager _dbManager;
- private readonly IDictionaryDataService _dictionaryDataService;
-
- public RouteTreeService(
- IDictionaryDataService dictionaryDataService,
- ISqlSugarRepository repository,
- DataBaseManager dbManager)
- {
- _dictionaryDataService = dictionaryDataService;
- _repository = repository;
- _dbManager = dbManager;
- }
- ///
- /// 返回工艺路线树形结构
- ///
- /// 工艺路线模版树形结构
- [AllowAnonymous]
- [HttpGet("route-tree")]
- public async Task> GetRouteTreeList()
- {
- var dictaryDataList = await _dictionaryDataService.GetList("24950639717653");
- var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName);
- SqlSugarScope sugarClient = null!;
- var result = new List();
- 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);
- foreach (var routeGroup in routeGroups)
- {
- var routeTree = new RouteTree();
- routeTree.RouteType = dictaryData.ContainsKey(routeGroup.Key) ? dictaryData[routeGroup.Key] : "";
- var routeNameGroup = routeGroup.GroupBy(g => new { g.RouteName, g.RouteCode });
-
- routeTree.RouteName = routeNameGroup.Select(x => new RouteName
- {
- Tag = $"{x.Key.RouteName}|{x.Key.RouteCode}",
- RouteVersion = x.Select(t => t.Version).ToList(),
- }).ToList();
- result.Add(routeTree);
- }
- }
- return result;
- }
- }
-}
\ No newline at end of file
diff --git a/system/Tnb.Systems/System/DataBaseService.cs b/system/Tnb.Systems/System/DataBaseService.cs
index 2725f2a3..3663e876 100644
--- a/system/Tnb.Systems/System/DataBaseService.cs
+++ b/system/Tnb.Systems/System/DataBaseService.cs
@@ -332,21 +332,20 @@ public class DataBaseService : IDynamicApiController, ITransient
///
///
[HttpPost("{linkId}/clean-data")]
+ [AllowAnonymous]
public async Task CleanTableData(string linkId, DatabaseTableDataCleanInput input)
{
- SqlSugarScope sugarClient = null!;
+ SqlSugarScope? sugarClient = null!;
if (linkId == "0")
{
- ConnectionStringsOptions options = App.GetConfig("ConnectionStrings", true);
- var connCfg = options.Adapt();
- sugarClient = new SqlSugarScope(connCfg);
+ sugarClient = _repository.AsSugarClient() as SqlSugarScope;
}
else
{
var link = await _dbLinkService.GetInfo(linkId);
sugarClient = _dataBaseManager.ChangeDataBase(link);
}
- return await sugarClient.Deleteable