Commit 0533f446 by 李承祥

二次绩效基础配置copy修改

parent 1827f5d5
......@@ -108,7 +108,6 @@ public ApiResponse Import([FromForm] IFormCollection form)
if (!againAllotService.Update(allot, againid))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
configService.ClearAgain(againid);
configService.CopyAgain(allot.ID);
}
return new ApiResponse(ResponseType.OK);
......
......@@ -337,6 +337,14 @@ public void Copy(per_allot allot)
newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = 1 });
_workyearRepository.AddRange(newWorkyears.ToArray());
}
var data = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (data == null || data.Count == 0)
{
var again = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
var newAgains = again.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, TypeName = t.TypeName, Value = t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
}
#endregion
......@@ -408,35 +416,5 @@ public void ClearAgain(int againId)
var count = _directorRepository.DelAgain(againId);
logdbug.Add(againId, "清除二次绩效中无效数据", $"受影响行数:{count}");
}
#region CopyAgain
/// <summary>
/// 复制报表基础配置
/// </summary>
/// <param name="iD"></param>
public void CopyAgain(int allotId)
{
var allot = perforPerAllotRepository.GetEntity(t => t.ID == allotId);
if (allot == null)
throw new PerformanceException("绩效不存在");
var list = perforPerAllotRepository.GetEntities(t => t.HospitalId == allot.HospitalId)
.OrderBy(t => t.Year).ThenBy(t => t.Month).ToList();
for (int i = 0; i < list.Count; i++)
{
if (list[i].ID == allot.ID && (i - 1) >= 0)
allot = list[i - 1];
}
List<cof_again> record = new List<cof_again>();
//根据上月绩效获取二次绩效信息
var data = _againRepository.GetEntities(t => t.AllotID == allotId);
if (data == null || data.Count == 0)
{
var again = _againRepository.GetEntities(t => t.AllotID == allot.ID) ?? _againRepository.GetEntities(t => t.AllotID == -1);
var newAgains = again.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, TypeName = t.TypeName, Value = t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
}
#endregion
}
}
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