去除引用common.props
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
@@ -10,9 +8,7 @@ using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
@@ -37,7 +33,7 @@ namespace Tnb.EquipMgr
|
||||
private readonly IRunService _runService;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||
@@ -53,45 +49,50 @@ namespace Tnb.EquipMgr
|
||||
_billRuleService = billRullService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
if (!input.data.ContainsKey("create_time"))
|
||||
{
|
||||
input.data.Add("create_time",DateTime.Now);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["create_time"]))
|
||||
input.data.Add("create_time", DateTime.Now);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["create_time"]))
|
||||
{
|
||||
input.data["create_time"] = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("create_id"))
|
||||
{
|
||||
input.data.Add("create_id",_userManager.UserId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["create_id"]))
|
||||
input.data.Add("create_id", _userManager.UserId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["create_id"]))
|
||||
{
|
||||
input.data["create_id"] = _userManager.UserId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("apply_user_id"))
|
||||
{
|
||||
input.data.Add("apply_user_id",_userManager.UserId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["apply_user_id"]))
|
||||
input.data.Add("apply_user_id", _userManager.UserId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["apply_user_id"]))
|
||||
{
|
||||
input.data["apply_user_id"] = _userManager.UserId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("org_id"))
|
||||
{
|
||||
input.data.Add("org_id",_userManager.GetUserInfo().Result.organizeId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["org_id"]))
|
||||
input.data.Add("org_id", _userManager.GetUserInfo().Result.organizeId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["org_id"]))
|
||||
{
|
||||
input.data["org_id"] = _userManager.GetUserInfo().Result.organizeId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("code"))
|
||||
{
|
||||
input.data.Add("code",await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE));
|
||||
}else if (string.IsNullOrEmpty((string)input.data["code"]))
|
||||
input.data.Add("code", await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE));
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["code"]))
|
||||
{
|
||||
input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE);
|
||||
}
|
||||
@@ -100,7 +101,7 @@ namespace Tnb.EquipMgr
|
||||
eqpRepairApply.code = (string)input.data["code"];
|
||||
eqpRepairApply.name = (string)input.data["name"];
|
||||
eqpRepairApply.equip_id = (string)input.data["equip_id"];
|
||||
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"]!=null && input.data["expect_complete_time"].ToString()!="" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null;
|
||||
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null;
|
||||
eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"];
|
||||
eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null;
|
||||
eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"];
|
||||
@@ -111,7 +112,7 @@ namespace Tnb.EquipMgr
|
||||
eqpRepairApply.description = (string)input.data["description"];
|
||||
eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED;
|
||||
await _repository.InsertAsync(eqpRepairApply);
|
||||
|
||||
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
// await _runService.Create(templateEntity, input);
|
||||
return await Task.FromResult(true);
|
||||
@@ -144,7 +145,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
string id = dic["id"];
|
||||
string repairerId = dic["repairerId"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED ||
|
||||
eqpRepairApply.status == RepairApplyStatus.REFUSE)
|
||||
{
|
||||
@@ -159,14 +160,14 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Receive(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
@@ -196,7 +197,7 @@ namespace Tnb.EquipMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
@@ -224,9 +225,9 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return "拒绝成功";
|
||||
}
|
||||
|
||||
@@ -236,17 +237,17 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyRegisterInput input)
|
||||
{
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.RECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
{
|
||||
string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
fault_id = input.fault_id,
|
||||
@@ -272,7 +273,7 @@ namespace Tnb.EquipMgr
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -281,7 +282,7 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable<EqpRepairOutApply>().FirstAsync(x=>x.repair_apply_id==id);
|
||||
EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable<EqpRepairOutApply>().FirstAsync(x => x.repair_apply_id == id);
|
||||
|
||||
return new RepairApplyDetailOutput()
|
||||
{
|
||||
@@ -300,21 +301,21 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a,b,c) => new EquipRepairRecordQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.apply_user_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.repairer_id == c.Id)
|
||||
.Where(a => a.equip_id == input.equip_id)
|
||||
.OrderByDescending(a => a.create_time)
|
||||
.Select((a, b, c) => new EquipRepairRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
apply_user_id = b.RealName,
|
||||
is_ugent = a.is_ugent == 1 ? "是" : "否",
|
||||
description = a.description,
|
||||
repair_description = a.repair_description,
|
||||
complete_time = a.complete_time==null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM),
|
||||
complete_time = a.complete_time == null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM),
|
||||
repairer_id = c.RealName
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -332,11 +333,11 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
switch (input.status)
|
||||
{
|
||||
case "1" :
|
||||
case "1":
|
||||
statusList.Add(RepairApplyStatus.TOBEEXECUTED);
|
||||
statusList.Add(RepairApplyStatus.REFUSE);
|
||||
break;
|
||||
case "2" :
|
||||
case "2":
|
||||
statusList.Add(RepairApplyStatus.TOBERECEIVED);
|
||||
statusList.Add(RepairApplyStatus.RECEIVED);
|
||||
statusList.Add(RepairApplyStatus.OUTAPPLYAPPROVE);
|
||||
@@ -344,14 +345,14 @@ namespace Tnb.EquipMgr
|
||||
statusList.Add(RepairApplyStatus.APPROVENOTPASS);
|
||||
statusList.Add(RepairApplyStatus.TOBEOUTAPPLY);
|
||||
break;
|
||||
case "3" :
|
||||
case "3":
|
||||
statusList.Add(RepairApplyStatus.COMPLETED);
|
||||
statusList.Add(RepairApplyStatus.CLOSE);
|
||||
statusList.Add(RepairApplyStatus.REPEAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
@@ -361,40 +362,40 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d)=>a.equip_id==d.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c,d,e)=>e.EnCode==DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e,f)=>e.Id==f.DictionaryTypeId && a.status==f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info),(a,b,c,d)=>d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status),(a,b,c,d)=>statusList.Contains(a.status))
|
||||
.WhereIF(input.status=="3" && start_time!=null,a=>a.complete_time!=null && a.complete_time>=start_time)
|
||||
.WhereIF(input.status=="3" && end_time!=null,a=>a.complete_time!=null && a.complete_time<=end_time)
|
||||
.LeftJoin<UserEntity>((a, b) => a.apply_user_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.repairer_id == c.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c, d, e) => e.EnCode == DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => e.Id == f.DictionaryTypeId && a.status == f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info), (a, b, c, d) => d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status), (a, b, c, d) => statusList.Contains(a.status))
|
||||
.WhereIF(input.status == "3" && start_time != null, a => a.complete_time != null && a.complete_time >= start_time)
|
||||
.WhereIF(input.status == "3" && end_time != null, a => a.complete_time != null && a.complete_time <= end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a,b,c,d,e,f) => new PadRepairListOutput
|
||||
.Select((a, b, c, d, e, f) => new PadRepairListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = d.code+"/"+d.name,
|
||||
equip_id = d.code + "/" + d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
apply_user_id_id =b.Id,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
apply_user_id = b.RealName,
|
||||
apply_user_id_id = b.Id,
|
||||
is_ugent = a.is_ugent == 1 ? "是" : "否",
|
||||
description = a.description,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
complete_time = a.complete_time==null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
complete_time = a.complete_time == null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
repairer_id = c.RealName,
|
||||
repairer_id_id = c.Id,
|
||||
remark = a.remark,
|
||||
status = f.FullName
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||
|
||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user