diff --git a/PerMgr/Tnb.PerMgr.Entities/Dto/PerProcessStandardListOutput.cs b/PerMgr/Tnb.PerMgr.Entities/Dto/PerProcessStandardListOutput.cs new file mode 100644 index 00000000..e71fc40f --- /dev/null +++ b/PerMgr/Tnb.PerMgr.Entities/Dto/PerProcessStandardListOutput.cs @@ -0,0 +1,22 @@ +namespace Tnb.PerMgr.Entities.Dto +{ + public class PerProcessStandardListOutput + { + public string id { get; set; } + public string code { get; set; } + public string process_type { get; set; } + public string molds_id { get; set; } + public string equip_id { get; set; } + public string equip_id_id { get; set; } + public string output_material_id { get; set; } + public decimal? moulding_cycle { get; set; } + public string version { get; set; } + public string enabled { get; set; } + public string remark { get; set; } + public string create_id { get; set; } + public string create_id_id { get; set; } + public string create_time { get; set; } + public string molds_id_id { get; set; } + public string output_material_id_id { get; set; } + } +} \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs b/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs index 0be2d9e4..1051e0e1 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs @@ -53,7 +53,7 @@ namespace Tnb.PerMgr label_point = a.label_point, }), children = SqlFunc.Subqueryable() - .LeftJoin((y, z) => y.tolerance_category_id == z.id) + .InnerJoin((y, z) => y.tolerance_category_id == z.id) .Where(y => y.process_param_type_id == x.id) .OrderBy((y, z) => y.ordinal) .ToList((y, z) => new ProcessParamTypeChildrenOutput diff --git a/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs index 4ba4afdc..0d08bafc 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs @@ -1,11 +1,16 @@ using JNPF.Common.Configuration; using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager.Files; +using JNPF.Common.Filter; using JNPF.Common.Models; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Common; +using JNPF.Systems.Entitys.Permission; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NPOI.HSSF.UserModel; @@ -15,6 +20,11 @@ using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.PerMgr.Entities; using Tnb.PerMgr.Interfaces; +using Tnb.PerMgr.Entities.Dto; +using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; +using JNPF.Systems.Entitys.System; +using Tnb.BasicData; namespace Tnb.PerMgr { @@ -23,22 +33,72 @@ namespace Tnb.PerMgr /// [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] - public class PerProcessStandardsService : IPerProcessStandardsService, IDynamicApiController, ITransient + [OverideVisualDev(ModuleId)] + public class PerProcessStandardsService : IPerProcessStandardsService,IOverideVisualDevService, IDynamicApiController, ITransient { + private const string ModuleId = "26498481456149"; private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; private readonly FileManager _fileManager; private readonly FileService _fileService; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public PerProcessStandardsService(ISqlSugarRepository repository, FileService fileService, FileManager fileManager, + IRunService runService, + IVisualDevService visualDevService, IUserManager userManager) { _userManager = userManager; _repository = repository; _fileManager = fileManager; _fileService = fileService; + _runService = runService; + _visualDevService = visualDevService; + OverideFuncs.GetListAsync = GetList; + } + + private async Task GetList(VisualDevModelListQueryInput input) + { + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string processType = queryJson.ContainsKey("process_type") ? queryJson["process_type"].ToString() : ""; + string equipId = queryJson.ContainsKey("equip_id") ? queryJson["equip_id"].ToString() : ""; + SqlSugarPagedList result = await db.Queryable() + .LeftJoin((a, b) => a.output_material_id == b.id) + .LeftJoin((a,b,c)=>a.molds_id==c.id) + .LeftJoin((a,b,c,d)=>a.equip_id==d.id) + .LeftJoin((a,b,c,d,e) =>e.EnCode == "ProcrssType") + .LeftJoin((a,b,c,d,e,f) => f.DictionaryTypeId==e.Id && f.EnCode==a.process_type) + .LeftJoin((a,b,c,d,e,f,g)=>a.create_id==g.Id) + .WhereIF(!string.IsNullOrEmpty(code),a=>a.code.Contains(code)) + .WhereIF(!string.IsNullOrEmpty(processType),a=>a.process_type==processType) + .WhereIF(!string.IsNullOrEmpty(equipId),a=>a.equip_id==equipId) + .Select((a, b, c, d,e,f,g) => new PerProcessStandardListOutput + { + id = a.id, + code = a.code, + process_type = f.FullName, + molds_id = c.mold_name, + molds_id_id = a.molds_id, + equip_id = d.name, + equip_id_id = a.equip_id, + output_material_id = b.code+"/" +b.name, + output_material_id_id = a.output_material_id, + moulding_cycle = a.moulding_cycle, + version = a.version, + enabled = a.enabled==1 ? "是" : "否", + remark = a.remark, + create_time = a.create_time.Value.ToString(DbTimeFormat.SS), + create_id = g.RealName, + create_id_id = a.create_id + }).OrderByDescending(a => a.code).ToPagedListAsync(input.currentPage, input.pageSize); + return PageResult.SqlSugarPageResult(result); } [AllowAnonymous]