二次分配保存,带出上次,加载科室字典BUG修复

parent d66b10dc
...@@ -143,7 +143,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc ...@@ -143,7 +143,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
} }
} }
var head = LoadHead(computeMode, allot, second, overrideMode); var head = LoadHead(computeMode, allot, second, prevSecondAllot, overrideMode);
var dic = GetTableHeaderDictionary(computeMode, allot, second, loads, isAttachFactor: false); var dic = GetTableHeaderDictionary(computeMode, allot, second, loads, isAttachFactor: false);
return new SecondDetailDto { Head = head, Body = handson, Dic = dic }; return new SecondDetailDto { Head = head, Body = handson, Dic = dic };
} }
...@@ -430,7 +430,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -430,7 +430,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
/// <param name="second"></param> /// <param name="second"></param>
/// <param name="allot"></param> /// <param name="allot"></param>
/// <returns></returns> /// <returns></returns>
private Dictionary<string, object> LoadHead(ComputeMode computeMode, per_allot allot, ag_secondallot second, EmployeeSource overrideMode = 0) private Dictionary<string, object> LoadHead(ComputeMode computeMode, per_allot allot, ag_secondallot second, ag_secondallot prevSecondAllot = null, EmployeeSource overrideMode = 0)
{ {
/* /*
此处数据需要额外注意,前端显示规则:接口返回则显示 此处数据需要额外注意,前端显示规则:接口返回则显示
...@@ -480,6 +480,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -480,6 +480,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == secondId) ?? new List<ag_worktype_source>(); var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == secondId) ?? new List<ag_worktype_source>();
// 已提交 // 已提交
if (second.Status.HasValue && status.Contains(second.Status.Value)) if (second.Status.HasValue && status.Contains(second.Status.Value))
{ {
...@@ -500,6 +501,11 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -500,6 +501,11 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
var tempWorkloadTypes = _agworkloadtypeRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Department == second.Department) ?? new List<ag_workload_type>(); var tempWorkloadTypes = _agworkloadtypeRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Department == second.Department) ?? new List<ag_workload_type>();
var workloadTypes = tempWorkloadTypes.Where(t => UnitTypeUtil.Is(t.UnitType, second.UnitType)); var workloadTypes = tempWorkloadTypes.Where(t => UnitTypeUtil.Is(t.UnitType, second.UnitType));
// 前二次绩效
if (headDynamic.Count == 0 && prevSecondAllot != null)
{
headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == prevSecondAllot.Id) ?? new List<ag_worktype_source>();
}
foreach (var workitem in workloadTypes) foreach (var workitem in workloadTypes)
{ {
var name = $"Workload_Ratio_{workitem.Id}"; var name = $"Workload_Ratio_{workitem.Id}";
......
...@@ -90,7 +90,8 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId, ...@@ -90,7 +90,8 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId,
var prevSecondAllot = GetPreviousSecondAllot(hospitalId, secondAllot); var prevSecondAllot = GetPreviousSecondAllot(hospitalId, secondAllot);
int tempId = (int)Temp.other; int tempId = (int)Temp.other;
var userTemp = agusetempRepository.GetEntity(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType); var temp = agusetempRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department);
var userTemp = temp.FirstOrDefault(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, secondAllot.UnitType));
if (userTemp != null) tempId = userTemp.UseTempId ?? (int)Temp.other; if (userTemp != null) tempId = userTemp.UseTempId ?? (int)Temp.other;
if (new int[] { 2, 3 }.Contains(secondAllot.Status ?? 1)) //纪录被提交后,根据提交时的模板获取对应的数据 if (new int[] { 2, 3 }.Contains(secondAllot.Status ?? 1)) //纪录被提交后,根据提交时的模板获取对应的数据
...@@ -133,7 +134,8 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se ...@@ -133,7 +134,8 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se
var fixedHeaders = agtempitemRepository.GetEntities(w => w.TempId == tempId); var fixedHeaders = agtempitemRepository.GetEntities(w => w.TempId == tempId);
// 用户自定义的工作量、单项奖励 // 用户自定义的工作量、单项奖励
var configHeaders = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType); var temp = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department);
var configHeaders = temp.Where(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, secondAllot.UnitType));
if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any()) if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any())
configHeaders = configHeaders?.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList(); configHeaders = configHeaders?.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList();
...@@ -548,7 +550,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo ...@@ -548,7 +550,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo
{ {
if (employeeList.Any(t => t.PersonnelNumber == item.PersonnelNumber) if (employeeList.Any(t => t.PersonnelNumber == item.PersonnelNumber)
&& employeeList.FirstOrDefault(t => t.PersonnelNumber == item.PersonnelNumber) is per_employee employee && employeeList.FirstOrDefault(t => t.PersonnelNumber == item.PersonnelNumber) is per_employee employee
&& employee.UnitType == secondAllot.UnitType) && UnitTypeUtil.IsEqualsUnitType(employee.UnitType, secondAllot.UnitType))
{ {
var headItem = otherShowColumns.FirstOrDefault(w => w.FiledName == column.Item1 && w.FiledId == column.Item2 && w.Type == (int)TempColumnType.TableFixedColumns); var headItem = otherShowColumns.FirstOrDefault(w => w.FiledName == column.Item1 && w.FiledId == column.Item2 && w.Type == (int)TempColumnType.TableFixedColumns);
if (headItem == null) continue; if (headItem == null) continue;
...@@ -597,7 +599,8 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se ...@@ -597,7 +599,8 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
var headerItems = new List<HeadItem>(); var headerItems = new List<HeadItem>();
var unit = secondAllot.UnitType == UnitType.医技组.ToString() ? UnitType.医生组.ToString() : secondAllot.UnitType; var unit = secondAllot.UnitType == UnitType.医技组.ToString() ? UnitType.医生组.ToString() : secondAllot.UnitType;
var deptHeader = agworkloadtypeRepository.GetEntities(t => t.HospitalId == hospitalId && t.Department == secondAllot.Department && t.UnitType == unit); var temp = agworkloadtypeRepository.GetEntities(t => t.HospitalId == hospitalId && t.Department == secondAllot.Department);
var deptHeader = temp.Where(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, unit));
if (deptHeader != null && deptHeader.Any()) if (deptHeader != null && deptHeader.Any())
{ {
int sortindex = 1; int sortindex = 1;
...@@ -734,7 +737,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -734,7 +737,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
if (isArchive == 1 || new List<int> { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit }.Contains(secondAllot.Status ?? (int)SecondAllotStatus.Uncommitted)) if (isArchive == 1 || new List<int> { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit }.Contains(secondAllot.Status ?? (int)SecondAllotStatus.Uncommitted))
employeeSource = (int)EmployeeSource.Initial; employeeSource = (int)EmployeeSource.Initial;
var employees = personService.GetPersons(secondAllot.AllotId.Value, userId)?.Where(t => t.UnitType == secondAllot.UnitType).ToList(); var employees = personService.GetPersons(secondAllot.AllotId.Value, userId)?.Where(t => UnitTypeUtil.IsEqualsUnitType(t.UnitType, secondAllot.UnitType)).ToList();
var role = _userService.GetUserFirstRole(userId); var role = _userService.GetUserFirstRole(userId);
//行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表 //行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表
...@@ -889,7 +892,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -889,7 +892,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
{ {
if (employees != null && employees.Any(t => t.PersonnelNumber == item.WorkNumber) if (employees != null && employees.Any(t => t.PersonnelNumber == item.WorkNumber)
&& employees.FirstOrDefault(t => t.PersonnelNumber == item.WorkNumber) is per_employee employee && employees.FirstOrDefault(t => t.PersonnelNumber == item.WorkNumber) is per_employee employee
&& employee.UnitType == second.UnitType) && UnitTypeUtil.IsEqualsUnitType(employee.UnitType, second.UnitType))
{ {
item.ReservedRatio = employee.ReservedRatio; item.ReservedRatio = employee.ReservedRatio;
item.Department = employee.AccountingUnit; item.Department = employee.AccountingUnit;
...@@ -944,7 +947,8 @@ public ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot seco ...@@ -944,7 +947,8 @@ public ag_secondallot GetPreviousSecondAllot(int hospitalId, ag_secondallot seco
if (index == 0) return null; if (index == 0) return null;
var prevAllot = allotList[index - 1]; var prevAllot = allotList[index - 1];
var prevSecondAllot = agsecondallotRepository.GetEntity(w => w.AllotId == prevAllot.ID && w.UnitType == secondAllot.UnitType && w.Department == secondAllot.Department); var temp = agsecondallotRepository.GetEntities(w => w.AllotId == prevAllot.ID && w.Department == secondAllot.Department);
var prevSecondAllot = temp.FirstOrDefault(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, secondAllot.UnitType));
return prevSecondAllot; return prevSecondAllot;
} }
......
...@@ -587,7 +587,8 @@ public void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dynam ...@@ -587,7 +587,8 @@ public void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dynam
} }
if (body == null || !((IEnumerable<dynamic>)body).Any()) return; if (body == null || !((IEnumerable<dynamic>)body).Any()) return;
var workloads = agworkloadRepository.GetEntities(t => t.HospitalId == hospitalId && t.Department == second.Department && t.UnitType == second.UnitType)?.ToList() ?? new List<ag_workload>(); var temp = agworkloadRepository.GetEntities(t => t.HospitalId == hospitalId && t.Department == second.Department);
var workloads = temp?.Where(w => UnitTypeUtil.IsEqualsUnitType(w.UnitType, second.UnitType))?.ToList() ?? new List<ag_workload>();
string[] prefix = new string[] { "WorkloadScore_", "AssessmentScore_", "WorkPerformance_", $"{AgWorkloadType.SingleAwards}_", $"{AgWorkloadType.Workload}_", $"{AgWorkloadType.PreAccountingReward}_" }; string[] prefix = new string[] { "WorkloadScore_", "AssessmentScore_", "WorkPerformance_", $"{AgWorkloadType.SingleAwards}_", $"{AgWorkloadType.Workload}_", $"{AgWorkloadType.PreAccountingReward}_" };
List<ag_workload_source> workloadSources = new List<ag_workload_source>(); List<ag_workload_source> workloadSources = new List<ag_workload_source>();
......
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