人员字典修改工号重复验证修改

parent a8de2e6c
...@@ -306,27 +306,6 @@ public ApiResponse CreatePerson(PerEmployeeResponse request) ...@@ -306,27 +306,6 @@ public ApiResponse CreatePerson(PerEmployeeResponse request)
/// <returns></returns> /// <returns></returns>
public ApiResponse UpdatePerson(PerEmployeeResponse request) public ApiResponse UpdatePerson(PerEmployeeResponse request)
{ {
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var oldEmployees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId);
for (int i = 0; i < oldEmployees.Count; i++)
{
if (oldEmployees.Count(w => w.PersonnelNumber == oldEmployees[i].PersonnelNumber) > 1)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", oldEmployees[i].PersonnelNumber??"" },
{ "姓名", oldEmployees[i].DoctorName??"" },
{ "错误原因", "“人员工号”重复" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
if (string.IsNullOrEmpty(request.UnitType?.Trim()) if (string.IsNullOrEmpty(request.UnitType?.Trim())
|| string.IsNullOrEmpty(request.Department?.Trim()) || string.IsNullOrEmpty(request.Department?.Trim())
|| string.IsNullOrEmpty(request.AccountingUnit?.Trim()) || string.IsNullOrEmpty(request.AccountingUnit?.Trim())
...@@ -382,6 +361,29 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request) ...@@ -382,6 +361,29 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
allot.IsModifyConfig = 1; allot.IsModifyConfig = 1;
perallotRepository.Update(allot); perallotRepository.Update(allot);
#region 修改成功,但存在其他问题请及时处理
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var oldEmployees = peremployeeRepository.GetEntities(t => t.AllotId == request.AllotId);
for (int i = 0; i < oldEmployees.Count; i++)
{
if (oldEmployees.Count(w => w.PersonnelNumber == oldEmployees[i].PersonnelNumber) > 1)
{
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "人员工号", oldEmployees[i].PersonnelNumber??"" },
{ "姓名", oldEmployees[i].DoctorName??"" },
{ "错误原因", "“人员工号”重复" },
});
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "修改成功,但存在其他问题请及时处理", error);
#endregion
return new ApiResponse(ResponseType.OK, "修改成功"); return new ApiResponse(ResponseType.OK, "修改成功");
} }
......
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