去除引用common.props
This commit is contained in:
@@ -6,7 +6,6 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -24,13 +23,13 @@ namespace Tnb.BasicData
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModelId)]
|
||||
public class BasESopService : IBasESopService,IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
public class BasESopService : IBasESopService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
public const string ModelId = "26919620992277";
|
||||
private readonly ISqlSugarRepository<BasESop> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
|
||||
public BasESopService(
|
||||
IUserManager userManager,
|
||||
ISqlSugarRepository<BasESop> repository)
|
||||
@@ -39,7 +38,7 @@ namespace Tnb.BasicData
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ESOP列表
|
||||
/// </summary>
|
||||
@@ -48,12 +47,12 @@ namespace Tnb.BasicData
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string? code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string? name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string? version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
|
||||
var list = await db.Queryable<BasESop, BasMbom, BasMbomProcess, UserEntity,BasProcess>((a, b, c, d,e) => new object[]
|
||||
string? code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string? name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string? version = queryJson != null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
|
||||
SqlSugarPagedList<ESopListOutput> list = await db.Queryable<BasESop, BasMbom, BasMbomProcess, UserEntity, BasProcess>((a, b, c, d, e) => new object[]
|
||||
{
|
||||
JoinType.Left, a.mbom_id == b.id,
|
||||
JoinType.Left, a.mbom_process_id == c.id,
|
||||
@@ -63,8 +62,8 @@ namespace Tnb.BasicData
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code!))
|
||||
.WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name!))
|
||||
.WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version!))
|
||||
.Where((a,b,c)=>a.enabled==1)
|
||||
.Select((a, b, c, d,e) => new ESopListOutput
|
||||
.Where((a, b, c) => a.enabled == 1)
|
||||
.Select((a, b, c, d, e) => new ESopListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
@@ -72,31 +71,31 @@ namespace Tnb.BasicData
|
||||
mbom_id = b.version!,
|
||||
mbom_process_id = e.process_name!,
|
||||
version = a.version,
|
||||
enabled = a.enabled==1 ? "是" : "否",
|
||||
enabled = a.enabled == 1 ? "是" : "否",
|
||||
attachment = a.attachment,
|
||||
remark = a.remark,
|
||||
create_id = d.RealName,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
mbom_id_id = a.mbom_id,
|
||||
mbom_process_id_id = a.mbom_process_id
|
||||
}).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
}).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||
|
||||
return PageResult<ESopListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetHistoryList(EsopHistoryListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string>? queryJson = new Dictionary<string, string>();
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, string>? queryJson = new();
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input?.queryJson ?? "");
|
||||
}
|
||||
string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
|
||||
var list = await db.Queryable<BasESop, BasMbom, BasMbomProcess, UserEntity,BasProcess>((a, b, c, d,e) => new object[]
|
||||
string code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string version = queryJson != null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
|
||||
SqlSugarPagedList<ESopListOutput> list = await db.Queryable<BasESop, BasMbom, BasMbomProcess, UserEntity, BasProcess>((a, b, c, d, e) => new object[]
|
||||
{
|
||||
JoinType.Left, a.mbom_id == b.id,
|
||||
JoinType.Left, a.mbom_process_id == c.id,
|
||||
@@ -106,8 +105,8 @@ namespace Tnb.BasicData
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
|
||||
.WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name))
|
||||
.WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version))
|
||||
.Where((a,b,c)=>a.mbom_id==input!.mbom_id && a.mbom_process_id==input!.mbom_process_id)
|
||||
.Select((a, b, c, d,e) => new ESopListOutput
|
||||
.Where((a, b, c) => a.mbom_id == input!.mbom_id && a.mbom_process_id == input!.mbom_process_id)
|
||||
.Select((a, b, c, d, e) => new ESopListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
@@ -115,27 +114,24 @@ namespace Tnb.BasicData
|
||||
mbom_id = b.version!,
|
||||
mbom_process_id = e.process_name!,
|
||||
version = a.version,
|
||||
enabled = a.enabled==1 ? "是" : "否",
|
||||
enabled = a.enabled == 1 ? "是" : "否",
|
||||
attachment = a.attachment,
|
||||
remark = a.remark,
|
||||
create_id = d.RealName,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
mbom_id_id = a.mbom_id
|
||||
}).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
}).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||
|
||||
return PageResult<ESopListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEntityByMbomProcessId(Dictionary<string, string> dic)
|
||||
public async Task<dynamic?> GetEntityByMbomProcessId(Dictionary<string, string> dic)
|
||||
{
|
||||
string mbomProcessId = dic["mbomProcessId"];
|
||||
if (!string.IsNullOrEmpty(mbomProcessId))
|
||||
{
|
||||
return await _repository.GetFirstAsync(x => x.mbom_process_id == mbomProcessId && x.enabled == 1);
|
||||
}
|
||||
|
||||
return null!;
|
||||
return !string.IsNullOrEmpty(mbomProcessId)
|
||||
? await _repository.GetFirstAsync(x => x.mbom_process_id == mbomProcessId && x.enabled == 1)
|
||||
: (dynamic)null;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -146,15 +142,15 @@ namespace Tnb.BasicData
|
||||
throw Oops.Bah("已存在该版本");
|
||||
}
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.UpdateAsync(x => new BasESop()
|
||||
_ = await _repository.UpdateAsync(x => new BasESop()
|
||||
{
|
||||
enabled = 0,
|
||||
}, x => x.mbom_id == input.mbom_id && x.mbom_process_id == input.mbom_process_id);
|
||||
|
||||
BasESop basESop = new BasESop()
|
||||
|
||||
BasESop basESop = new()
|
||||
{
|
||||
code = input.code,
|
||||
name = input.name,
|
||||
@@ -169,13 +165,9 @@ namespace Tnb.BasicData
|
||||
enabled = 1,
|
||||
};
|
||||
|
||||
await _repository.InsertAsync(basESop);
|
||||
|
||||
_ = await _repository.InsertAsync(basESop);
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
return result.IsSuccess ? "上传成功" : result.ErrorMessage;
|
||||
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "上传成功" : result.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user