备注及带出上次人员系数、职称系数

parent 056d7873
...@@ -158,6 +158,9 @@ public HandsonTableBase GetHandsonTable(ComputeMode computeMode, List<TitleValue ...@@ -158,6 +158,9 @@ public HandsonTableBase GetHandsonTable(ComputeMode computeMode, List<TitleValue
/// <returns></returns> /// <returns></returns>
public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode computeMode, per_allot allot, ag_secondallot second, List<TitleValue<string, decimal?>> loads, List<SecondWorkLoadDto> workloadGroups = null) public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode computeMode, per_allot allot, ag_secondallot second, List<TitleValue<string, decimal?>> loads, List<SecondWorkLoadDto> workloadGroups = null)
{ {
/*
此处数据需要额外注意,前端显示规则:通过isTrue=true显示,显示名称为label
*/
var maps = new List<SecondColumnDictionary>() var maps = new List<SecondColumnDictionary>()
{ {
new SecondColumnDictionary("人员工号",nameof(ag_bodysource.WorkNumber),true,100), new SecondColumnDictionary("人员工号",nameof(ag_bodysource.WorkNumber),true,100),
...@@ -177,7 +180,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -177,7 +180,7 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
new SecondColumnDictionary("可分配绩效",nameof(ag_bodysource.DistPerformance),true,500 ), new SecondColumnDictionary("可分配绩效",nameof(ag_bodysource.DistPerformance),true,500 ),
new SecondColumnDictionary("医院其他绩效",nameof(ag_bodysource.OtherPerformance),true,501 ), new SecondColumnDictionary("医院其他绩效",nameof(ag_bodysource.OtherPerformance),true,501 ),
new SecondColumnDictionary("夜班工作量绩效",nameof(ag_bodysource.NightWorkPerformance),true,502 ), new SecondColumnDictionary("医院发放夜班绩效",nameof(ag_bodysource.NightWorkPerformance),true,502 ),
//new SecondColumnDictionary("预留比例",nameof(ag_bodysource.ReservedRatio),false,601 ), //new SecondColumnDictionary("预留比例",nameof(ag_bodysource.ReservedRatio),false,601 ),
//new SecondColumnDictionary("预留金额",nameof(ag_bodysource.ReservedAmount),false,602 ), //new SecondColumnDictionary("预留金额",nameof(ag_bodysource.ReservedAmount),false,602 ),
...@@ -282,6 +285,10 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -282,6 +285,10 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
/// <returns></returns> /// <returns></returns>
private Dictionary<string, object> LoadHead(ComputeMode computeMode, per_allot allot, ag_secondallot second) private Dictionary<string, object> LoadHead(ComputeMode computeMode, per_allot allot, ag_secondallot second)
{ {
/*
此处数据需要额外注意,前端显示规则:接口返回则显示
避免额外返回造成前端错误显示
*/
var head = new Dictionary<string, object>(); var head = new Dictionary<string, object>();
// 公共顶部信息 // 公共顶部信息
head.AddOrUpdate(nameof(second.Department), second.Department); head.AddOrUpdate(nameof(second.Department), second.Department);
...@@ -355,7 +362,8 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second ...@@ -355,7 +362,8 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second
if (saveDatas != null) if (saveDatas != null)
return saveDatas; return saveDatas;
List<string> numbers = LoadEmployees_PrevSecondAllot(allot, second); var prevSecond = LoadEmployees_PrevSecondAllot(allot, second);
List<string> numbers = prevSecond?.Where(w => !string.IsNullOrEmpty(w.WorkNumber)).Select(w => w.WorkNumber).ToList() ?? new List<string>();
// 如果行政工勤科室没有保存数据,则默认从EXCEL中带出数据 // 如果行政工勤科室没有保存数据,则默认从EXCEL中带出数据
if (UnitTypeUtil.IsOffice(second.UnitType) && (numbers == null || numbers.Count == 0)) if (UnitTypeUtil.IsOffice(second.UnitType) && (numbers == null || numbers.Count == 0))
...@@ -364,14 +372,16 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second ...@@ -364,14 +372,16 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second
if (numbers == null || numbers.Count == 0) if (numbers == null || numbers.Count == 0)
numbers = LoadEmployees_EmployeeDict(second, employees); numbers = LoadEmployees_EmployeeDict(second, employees);
return LoadEmployeeByDictionary(second, employees, numbers); return LoadEmployeeByDictionary(second, employees, numbers, prevSecond);
} }
// 用户指定加载 // 用户指定加载
else else
{ {
var prevSecond = LoadEmployees_PrevSecondAllot(allot, second);
List<string> numbers = new List<string>(); List<string> numbers = new List<string>();
if (mode == EmployeeSource.PrevSecondAllot) if (mode == EmployeeSource.PrevSecondAllot)
numbers = LoadEmployees_PrevSecondAllot(allot, second); numbers = prevSecond?.Where(w => !string.IsNullOrEmpty(w.WorkNumber)).Select(w => w.WorkNumber).ToList() ?? new List<string>();
// 如果行政工勤科室则默认从EXCEL中带出数据 // 如果行政工勤科室则默认从EXCEL中带出数据
else if (mode == EmployeeSource.EmployeeDict && UnitTypeUtil.IsOffice(second.UnitType)) else if (mode == EmployeeSource.EmployeeDict && UnitTypeUtil.IsOffice(second.UnitType))
numbers = LoadEmployees_OfficeExcel(second); numbers = LoadEmployees_OfficeExcel(second);
...@@ -381,11 +391,19 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second ...@@ -381,11 +391,19 @@ private List<ag_bodysource> LoadEmployees(per_allot allot, ag_secondallot second
if (numbers == null || numbers.Count == 0) if (numbers == null || numbers.Count == 0)
return new List<ag_bodysource>(); return new List<ag_bodysource>();
return LoadEmployeeByDictionary(second, employees, numbers); return LoadEmployeeByDictionary(second, employees, numbers, prevSecond);
} }
} }
List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_employee> employees, List<string> numbers) /// <summary>
/// 补全信息,带出上次系数
/// </summary>
/// <param name="second"></param>
/// <param name="employees"></param>
/// <param name="numbers"></param>
/// <param name="prevSecond"></param>
/// <returns></returns>
List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_employee> employees, List<string> numbers, List<ag_bodysource> prevSecond = null)
{ {
List<ag_bodysource> loadDatas = new List<ag_bodysource>(); List<ag_bodysource> loadDatas = new List<ag_bodysource>();
foreach (var personnelNumber in numbers) foreach (var personnelNumber in numbers)
...@@ -394,7 +412,7 @@ List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_emp ...@@ -394,7 +412,7 @@ List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_emp
if (existEmp == null) if (existEmp == null)
continue; continue;
loadDatas.Add(new ag_bodysource var data = new ag_bodysource
{ {
SecondId = second.Id, SecondId = second.Id,
Department = existEmp.AccountingUnit, Department = existEmp.AccountingUnit,
...@@ -403,14 +421,28 @@ List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_emp ...@@ -403,14 +421,28 @@ List<ag_bodysource> LoadEmployeeByDictionary(ag_secondallot second, List<per_emp
JobTitle = existEmp.JobTitle, JobTitle = existEmp.JobTitle,
ReservedRatio = existEmp.ReservedRatio, ReservedRatio = existEmp.ReservedRatio,
Post = "", Post = "",
}); };
// 带出上次 人员系数、职称系数
if (prevSecond != null)
{
data.StaffCoefficient = prevSecond.FirstOrDefault(w => w.WorkNumber == data.WorkNumber)?.StaffCoefficient ?? data.StaffCoefficient;
data.TitleCoefficient = prevSecond.FirstOrDefault(w => w.WorkNumber == data.WorkNumber)?.TitleCoefficient ?? data.TitleCoefficient;
}
loadDatas.Add(data);
} }
return loadDatas; return loadDatas;
} }
private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondallot second) /// <summary>
/// 上次绩效数据
/// </summary>
/// <param name="allot"></param>
/// <param name="second"></param>
/// <returns></returns>
private List<ag_bodysource> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondallot second)
{ {
List<string> numbers = new List<string>(); List<ag_bodysource> numbers = new List<ag_bodysource>();
// 上次二次分配分三种情况,1.其他来源 2.单工作量 3.多工作量 // 上次二次分配分三种情况,1.其他来源 2.单工作量 3.多工作量
var prevSecondAllot = _secondAllotDetails.GetPreviousSecondAllot(allot.HospitalId, second); var prevSecondAllot = _secondAllotDetails.GetPreviousSecondAllot(allot.HospitalId, second);
var status = new int[] { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit }; var status = new int[] { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit };
...@@ -421,8 +453,8 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall ...@@ -421,8 +453,8 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall
var prevDatas = _agothersourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id); var prevDatas = _agothersourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id);
numbers = prevDatas numbers = prevDatas
?.Where(pre => !string.IsNullOrEmpty(pre.WorkNumber?.Trim())) ?.Where(pre => !string.IsNullOrEmpty(pre.WorkNumber?.Trim()))
.Select(pre => pre.WorkNumber?.Trim()) .Select(pre => new ag_bodysource { WorkNumber = pre.WorkNumber?.Trim() })
.Distinct().ToList() ?? new List<string>(); .Distinct().ToList() ?? new List<ag_bodysource>();
} }
else if (prevSecondAllot.UseTempId == 7 || prevSecondAllot.UseTempId == 8) else if (prevSecondAllot.UseTempId == 7 || prevSecondAllot.UseTempId == 8)
{ {
...@@ -431,9 +463,14 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall ...@@ -431,9 +463,14 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall
numbers = prevDatas numbers = prevDatas
?.GroupBy(w => w.RowNumber.Value) ?.GroupBy(w => w.RowNumber.Value)
.Select(row => row.FirstOrDefault(w => w.ItemName == "人员工号")?.ItemValue) .Select(row =>
.Where(w => !string.IsNullOrEmpty(w?.Trim())) new ag_bodysource
.Distinct().ToList() ?? new List<string>(); {
WorkNumber = row.FirstOrDefault(w => w.ItemName == "人员工号")?.ItemValue,
TitleCoefficient = ConvertHelper.To<decimal?>(row.FirstOrDefault(w => w.ItemName == "职称系数")?.ItemValue),
StaffCoefficient = ConvertHelper.To<decimal?>(row.FirstOrDefault(w => w.ItemName == "人员系数")?.ItemValue),
})
.Distinct().ToList() ?? new List<ag_bodysource>();
} }
else else
...@@ -441,13 +478,25 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall ...@@ -441,13 +478,25 @@ private List<string> LoadEmployees_PrevSecondAllot(per_allot allot, ag_secondall
var prevDatas = _agbodysourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id); var prevDatas = _agbodysourceRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id);
numbers = prevDatas numbers = prevDatas
?.Where(pre => !string.IsNullOrEmpty(pre.WorkNumber?.Trim())) ?.Where(pre => !string.IsNullOrEmpty(pre.WorkNumber?.Trim()))
.Select(pre => pre.WorkNumber?.Trim()) .Select(pre =>
.Distinct().ToList() ?? new List<string>(); new ag_bodysource
{
WorkNumber = pre.WorkNumber,
TitleCoefficient = pre.TitleCoefficient,
StaffCoefficient = pre.StaffCoefficient
})
.Distinct().ToList() ?? new List<ag_bodysource>();
} }
} }
return numbers; return numbers;
} }
/// <summary>
/// 从人员字典带出
/// </summary>
/// <param name="second"></param>
/// <param name="dicEmployees"></param>
/// <returns></returns>
private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_employee> dicEmployees) private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_employee> dicEmployees)
{ {
var employees = dicEmployees var employees = dicEmployees
...@@ -457,6 +506,11 @@ private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_ ...@@ -457,6 +506,11 @@ private List<string> LoadEmployees_EmployeeDict(ag_secondallot second, List<per_
return employees; return employees;
} }
/// <summary>
/// 从测算表带出
/// </summary>
/// <param name="second"></param>
/// <returns></returns>
private List<string> LoadEmployees_OfficeExcel(ag_secondallot second) private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
{ {
List<string> numbers = new List<string>(); List<string> numbers = new List<string>();
......
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