二次分配提交后验证数据正确性

parent 839c34c7
......@@ -837,8 +837,11 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
// 重算部分数据
_redistributionService.RedistributionCompute((ComputeMode)request.ComputeMode, request.Head, cleanDatas);
var saveResult = secondAllotService.RedistributionSave(allot, second, request.Head, cleanDatas);
var res = _redistributionService.ValidationData(second);
if (!string.IsNullOrEmpty(res))
return new ApiResponse(ResponseType.Fail, $"提交数据中存在无效数据,已经被删除,确认正确后请重新提交;删除工号清单如下:{res}");
if (saveResult)
{
var userid = claimService.GetUserId();
......
......@@ -1542,5 +1542,20 @@ private IEnumerable<view_second_workload_result> GetSecondWorkloadByValue(int al
{
return _perallotRepository.GetSecondWorkload(allotid, unittype, accountingunit);
}
// 验证数据正确性
public string ValidationData(ag_secondallot second)
{
var datas = _agbodysourceRepository.GetEntities(w => w.SecondId == second.Id);
var invalid = datas.Where(w => !w.DistPerformance.HasValue);
string removeEmp = "";
if (invalid != null && invalid.Count() > 0)
{
removeEmp = string.Join(",", invalid.Select(w => w.WorkNumber).ToArray());
_agbodysourceRepository.RemoveRange(invalid.ToArray());
}
return removeEmp;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment