设备外修登记 流程还不支持退回
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class RepairApplyOutRegisterInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际维修供应商id
|
||||
/// </summary>
|
||||
public string? real_supplier_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 费用
|
||||
/// </summary>
|
||||
public decimal? cost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修复时间
|
||||
/// </summary>
|
||||
public DateTime? repair_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修耗时
|
||||
/// </summary>
|
||||
public decimal? repair_take_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修备注
|
||||
/// </summary>
|
||||
public string? repair_remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报修申请id
|
||||
/// </summary>
|
||||
public string repair_apply_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public partial class EqpRepairApply : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 设备ID
|
||||
/// </summary>
|
||||
public string? equip_id { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请用户ID
|
||||
|
||||
@@ -113,5 +113,27 @@ public partial class EqpRepairOutApply : BaseEntity<string>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际维修供应商
|
||||
/// </summary>
|
||||
public string? real_supplier_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "f_flowid")]
|
||||
public string? flow_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程任务id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "f_flowtaskid")]
|
||||
public string? flow_task_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public partial class EqpSpotInsItem : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 单位id
|
||||
/// </summary>
|
||||
public string unit_id { get; set; } = string.Empty;
|
||||
public string? unit_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 点巡检方法
|
||||
|
||||
@@ -6,11 +6,23 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
public interface IEqpRepairOutApplyService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取外修申请信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<EqpRepairOutApply> GetInfo(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 外修申请
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> OutApply(RepairOutApplyInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 外修登记
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Register(RepairApplyOutRegisterInput input);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Models.WorkFlow;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.WorkFlow.Interfaces.Service;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -21,36 +24,50 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpRepairOutApply> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IFlowTaskService _flowTaskService;
|
||||
private const string flowId = "26299060075302";
|
||||
|
||||
public EqpRepairOutApplyService(ISqlSugarRepository<EqpRepairOutApply> repository,
|
||||
IFlowTaskService flowTaskService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_flowTaskService = flowTaskService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpRepairOutApply> GetInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x => x.id == id);
|
||||
return await _repository.GetSingleAsync(x => x.repair_apply_id==eqpRepairApply.id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> OutApply(RepairOutApplyInput input)
|
||||
{
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id;
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
await _repository.InsertAsync(new EqpRepairOutApply
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
repair_apply_id = input.repair_apply_id,
|
||||
equip_id = input.equip_id,
|
||||
supplier_id = input.supplier_id,
|
||||
estimated_cost = input.estimated_cost,
|
||||
construction_period_requirement = input.construction_period_requirement,
|
||||
out_apply_reason = input.out_apply_reason,
|
||||
remark = input.remark,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
});
|
||||
// await _repository.InsertAsync(new EqpRepairOutApply
|
||||
// {
|
||||
// id = id,
|
||||
// repair_apply_id = input.repair_apply_id,
|
||||
// equip_id = input.equip_id,
|
||||
// supplier_id = input.supplier_id,
|
||||
// estimated_cost = input.estimated_cost,
|
||||
// construction_period_requirement = input.construction_period_requirement,
|
||||
// out_apply_reason = input.out_apply_reason,
|
||||
// remark = input.remark,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now,
|
||||
// approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
// });
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,10 +90,62 @@ namespace Tnb.EquipMgr
|
||||
.SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
|
||||
.Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
//todo 退回流程
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
_flowTaskService.Create(new FlowTaskSubmitModel()
|
||||
{
|
||||
flowId = flowId,
|
||||
parentId = "0",
|
||||
formData = new JObject()
|
||||
{
|
||||
{"id",id},
|
||||
{"repair_apply_id",input.repair_apply_id},
|
||||
{"equip_id",input.equip_id},
|
||||
{"create_id",_userManager.UserId},
|
||||
{"supplier_id",input.supplier_id},
|
||||
{"estimated_cost",input.estimated_cost},
|
||||
{"construction_period_requirement",input.construction_period_requirement},
|
||||
{"out_apply_reason",input.out_apply_reason},
|
||||
{"remark",input.remark},
|
||||
{"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyOutRegisterInput input)
|
||||
{
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpRepairOutApply()
|
||||
{
|
||||
real_supplier_id = input.real_supplier_id,
|
||||
cost = input.cost,
|
||||
repair_time = input.repair_time,
|
||||
repair_take_time = input.repair_take_time,
|
||||
repair_remark = input.repair_remark,
|
||||
attachment = input.attachment,
|
||||
}, x => x.id == input.id);
|
||||
|
||||
await db.Updateable<EqpRepairApply>().SetColumns(x => x.status == RepairApplyStatus.COMPLETED)
|
||||
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
return result.IsSuccess ? "登记成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
repeat_result = input.repeat_result,
|
||||
repeat_remark = input.repeat_remark,
|
||||
repeat_post_info_user_id = _userManager.UserId,
|
||||
repeat_user_id = _userManager.UserId,
|
||||
repeat_time = DateTime.Now,
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED
|
||||
}, x => x.id == input.id);
|
||||
|
||||
@@ -193,7 +193,18 @@ public class UserManager : IUserManager, IScoped
|
||||
/// </summary>
|
||||
public string UserOrigin
|
||||
{
|
||||
get => _httpContext?.Request.Headers["jnpf-origin"];
|
||||
//modifyby zhoukeda 调用发起工作流接口取不到pc还是app 改成默认pc
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return _httpContext?.Request.Headers["jnpf-origin"] ?? "pc";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return "pc";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,6 +6,7 @@ using JNPF.FriendlyException;
|
||||
using JNPF.WorkFlow.Entitys.Model;
|
||||
using JNPF.WorkFlow.Interfaces.Manager;
|
||||
using JNPF.WorkFlow.Interfaces.Service;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace JNPF.WorkFlow.Service;
|
||||
|
||||
Reference in New Issue
Block a user