工艺参数列表重写

This commit is contained in:
2024-09-29 09:28:28 +08:00
parent 36268bf1da
commit cd06d414bc
3 changed files with 84 additions and 2 deletions

View File

@@ -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; }
}
}

View File

@@ -53,7 +53,7 @@ namespace Tnb.PerMgr
label_point = a.label_point, label_point = a.label_point,
}), }),
children = SqlFunc.Subqueryable<PerProcessParam>() children = SqlFunc.Subqueryable<PerProcessParam>()
.LeftJoin<PerToleranceCategory>((y, z) => y.tolerance_category_id == z.id) .InnerJoin<PerToleranceCategory>((y, z) => y.tolerance_category_id == z.id)
.Where(y => y.process_param_type_id == x.id) .Where(y => y.process_param_type_id == x.id)
.OrderBy((y, z) => y.ordinal) .OrderBy((y, z) => y.ordinal)
.ToList<ProcessParamTypeChildrenOutput>((y, z) => new ProcessParamTypeChildrenOutput .ToList<ProcessParamTypeChildrenOutput>((y, z) => new ProcessParamTypeChildrenOutput

View File

@@ -1,11 +1,16 @@
using JNPF.Common.Configuration; using JNPF.Common.Configuration;
using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Manager.Files; using JNPF.Common.Core.Manager.Files;
using JNPF.Common.Filter;
using JNPF.Common.Models; using JNPF.Common.Models;
using JNPF.DependencyInjection; using JNPF.DependencyInjection;
using JNPF.DynamicApiController; using JNPF.DynamicApiController;
using JNPF.FriendlyException; using JNPF.FriendlyException;
using JNPF.Systems.Common; 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.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel; using NPOI.HSSF.UserModel;
@@ -15,6 +20,11 @@ using NPOI.XSSF.UserModel;
using SqlSugar; using SqlSugar;
using Tnb.PerMgr.Entities; using Tnb.PerMgr.Entities;
using Tnb.PerMgr.Interfaces; 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 namespace Tnb.PerMgr
{ {
@@ -23,22 +33,72 @@ namespace Tnb.PerMgr
/// </summary> /// </summary>
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")] [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<PerProcessStandardsH> _repository; private readonly ISqlSugarRepository<PerProcessStandardsH> _repository;
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
private readonly FileManager _fileManager; private readonly FileManager _fileManager;
private readonly FileService _fileService; private readonly FileService _fileService;
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public PerProcessStandardsService(ISqlSugarRepository<PerProcessStandardsH> repository, public PerProcessStandardsService(ISqlSugarRepository<PerProcessStandardsH> repository,
FileService fileService, FileService fileService,
FileManager fileManager, FileManager fileManager,
IRunService runService,
IVisualDevService visualDevService,
IUserManager userManager) IUserManager userManager)
{ {
_userManager = userManager; _userManager = userManager;
_repository = repository; _repository = repository;
_fileManager = fileManager; _fileManager = fileManager;
_fileService = fileService; _fileService = fileService;
_runService = runService;
_visualDevService = visualDevService;
OverideFuncs.GetListAsync = GetList;
}
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
{
ISqlSugarClient db = _repository.AsSugarClient();
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
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<PerProcessStandardListOutput> result = await db.Queryable<PerProcessStandardsH>()
.LeftJoin<BasMaterial>((a, b) => a.output_material_id == b.id)
.LeftJoin<ToolMolds>((a,b,c)=>a.molds_id==c.id)
.LeftJoin<EqpEquipment>((a,b,c,d)=>a.equip_id==d.id)
.LeftJoin<DictionaryTypeEntity>((a,b,c,d,e) =>e.EnCode == "ProcrssType")
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e,f) => f.DictionaryTypeId==e.Id && f.EnCode==a.process_type)
.LeftJoin<UserEntity>((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<PerProcessStandardListOutput>.SqlSugarPageResult(result);
} }
[AllowAnonymous] [AllowAnonymous]