维修管理
This commit is contained in:
118
EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
Normal file
118
EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修延期
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpRepairApplyService : IEqpRepairApplyService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpRepairApply> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Repeal(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.REPEAL
|
||||
}, x => x.id == id);
|
||||
return "作废成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Close(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.CLOSE
|
||||
}, x => x.id == id);
|
||||
return "关闭成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Assign(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
string repairerId = dic["repairerId"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
repairer_id = repairerId,
|
||||
status = RepairApplyStatus.TOBERECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "指派成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Receive(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.RECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "接收成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Refuse(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.REFUSE,
|
||||
}, x => x.id == id);
|
||||
return "拒绝成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpRepairApply> GetInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyRegisterInput input)
|
||||
{
|
||||
string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
fault_id = input.fault_id,
|
||||
is_complete = input.is_complete,
|
||||
complete_time = input.complete_time,
|
||||
repair_take_time = input.repair_take_time,
|
||||
is_halt = input.is_halt,
|
||||
halt_take_time = input.halt_take_time,
|
||||
repair_description = input.repair_description,
|
||||
attachment = input.attachment,
|
||||
is_out_apply = input.is_out_apply,
|
||||
status = status,
|
||||
}, x => x.id == input.id);
|
||||
|
||||
return "登记成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user