点巡检复核
This commit is contained in:
@@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -39,24 +40,20 @@ namespace Tnb.EquipMgr
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
public async Task<dynamic> ExecuteSpotIns(string id,[FromBody]VisualDevModelDataUpInput input)
|
||||
/// <summary>
|
||||
/// 执行点巡检
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExecuteSpotIns(SpotInsRecordExecuteInput input)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
//string attachment = JsonConvert.SerializeObject(input.data["attachment"]);
|
||||
// _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
// {
|
||||
// result = (int)input.data["result"],
|
||||
// attachment = attachment,
|
||||
// result_remark = input.data["result_remark"].ToString(),
|
||||
// }, x => x.id == input.data["id"]);
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Update(id,templateEntity, input);
|
||||
|
||||
EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.data["id"].ToString());
|
||||
EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id);
|
||||
string status = "";
|
||||
if (eqpSpotInsRecordH.is_repeat == "1")
|
||||
{
|
||||
@@ -66,17 +63,68 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED;
|
||||
}
|
||||
_repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
{
|
||||
status = status,
|
||||
spot_record_date_time = DateTime.Now,
|
||||
spot_record_user_id = _userManager.UserId
|
||||
}, x => x.id == input.data["id"]);
|
||||
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
{
|
||||
result = input.result,
|
||||
attachment = input.attachment,
|
||||
result_remark = input.result_remark,
|
||||
status = status,
|
||||
spot_record_date_time = DateTime.Now,
|
||||
spot_record_user_id = _userManager.UserId
|
||||
}, x => x.id == input.id);
|
||||
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpSpotInsRecordD>().
|
||||
SetColumns(x=>x.result==item["result"])
|
||||
.SetColumnsIF(item["judge_type"]=="1",x=>x.real_value==Convert.ToDouble(item["real_value"]))
|
||||
.Where(x=>x.id==item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "执行成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取点巡检复核信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<SpotInsRecordRepeatOutput> GetSpotInsRecordRepeatInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||
List<EqpSpotInsRecordD> eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable<EqpSpotInsRecordD>()
|
||||
.Where(x => x.spot_ins_record_id == id).ToListAsync();
|
||||
SpotInsRecordRepeatOutput output = new SpotInsRecordRepeatOutput()
|
||||
{
|
||||
model = eqpSpotInsRecordH,
|
||||
details = eqpSpotInsRecordDs,
|
||||
};
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复核点巡检
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RepeatSpotIns(SpotInsRecordRepeatInput input)
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
{
|
||||
repeat_result = input.repeat_result,
|
||||
repeat_remark = input.repeat_remark,
|
||||
repeat_post_info_user_id = _userManager.UserId,
|
||||
repeat_time = DateTime.Now,
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED
|
||||
}, x => x.id == input.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user