二次分配提交数据带出

parent 14ad2de1
...@@ -148,9 +148,8 @@ public ApiResponse GetAttendanceVacationHandsonTable(int allotId) ...@@ -148,9 +148,8 @@ public ApiResponse GetAttendanceVacationHandsonTable(int allotId)
/// 查询考勤记录 /// 查询考勤记录
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("Vacation/{allotId},{hospitalId}")] [HttpGet("Vacation/{allotId}")]
public ApiResponse<List<RecordAttendcance>> GetAttendanceVacation(int allotId) public ApiResponse<List<RecordAttendcance>> GetAttendanceVacation(int allotId)
{ {
return _attendanceService.GetAttendanceVacation(allotId); return _attendanceService.GetAttendanceVacation(allotId);
......
...@@ -633,7 +633,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -633,7 +633,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
...@@ -702,7 +702,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request) ...@@ -702,7 +702,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
...@@ -771,7 +771,7 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -771,7 +771,7 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads);
...@@ -833,7 +833,7 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -833,7 +833,7 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
if (!new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 }.Contains(allot.States)) if (!new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 }.Contains(allot.States))
throw new PerformanceException("绩效未下发,无法提交!"); throw new PerformanceException("绩效未下发,无法提交!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
...@@ -932,7 +932,7 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request) ...@@ -932,7 +932,7 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 返回信息 // 返回信息
......
...@@ -384,7 +384,6 @@ ...@@ -384,7 +384,6 @@
查询考勤记录 查询考勤记录
</summary> </summary>
<param name="allotId"></param> <param name="allotId"></param>
<param name="hospitalId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AttendanceController.AttendanceBatch(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)"> <member name="M:Performance.Api.Controllers.AttendanceController.AttendanceBatch(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)">
......
...@@ -100,7 +100,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc ...@@ -100,7 +100,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
// 填报模板带出 行政工勤 绩效 // 填报模板带出 行政工勤 绩效
var computes = _rescomputeRepository.GetEntities(w => w.AllotID == allot.ID && UnitTypeUtil.Office.Contains(w.AccountType)); var computes = _rescomputeRepository.GetEntities(w => w.AllotID == allot.ID && UnitTypeUtil.Office.Contains(w.AccountType));
var loads = GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = GetWorkLoads(allot, second);
var employees = _peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId); var employees = _peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId);
HandsonTableBase handson = GetHandsonTable(allot, computeMode, loads); HandsonTableBase handson = GetHandsonTable(allot, computeMode, loads);
...@@ -277,7 +277,10 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute ...@@ -277,7 +277,10 @@ public List<SecondColumnDictionary> GetTableHeaderDictionary(ComputeMode compute
if (second.Status.HasValue && status.Contains(second.Status.Value)) if (second.Status.HasValue && status.Contains(second.Status.Value))
{ {
var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == second.Id) ?? new List<ag_worktype_source>(); var headDynamic = _agworktypesourceRepository.GetEntities(t => t.SecondId == second.Id) ?? new List<ag_worktype_source>();
foreach (var item in headDynamic.OrderBy(t => t.Id)) var groupDatas = headDynamic
.GroupBy(w => new { w.WorkTypeId, w.SecondId, w.FieldId, w.FieldName })
.Select(w => w.OrderByDescending(w => w.Id).FirstOrDefault());
foreach (var item in groupDatas.OrderBy(t => t.Id))
{ {
maps.Add(new SecondColumnDictionary(item.FieldName, item.FieldId, true, 1, "Top", isNumber: true)); maps.Add(new SecondColumnDictionary(item.FieldName, item.FieldId, true, 1, "Top", isNumber: true));
} }
...@@ -430,7 +433,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -430,7 +433,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
head.AddOrUpdate(nameof(second.UnitType), second.UnitType); head.AddOrUpdate(nameof(second.UnitType), second.UnitType);
head.AddOrUpdate(nameof(ComputeMode), computeMode); head.AddOrUpdate(nameof(ComputeMode), computeMode);
head.AddOrUpdate("ComputeModeDescription", EnumHelper.GetDescription(computeMode)); head.AddOrUpdate("ComputeModeDescription", EnumHelper.GetDescription(computeMode));
var allotStates = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }; var allotStates = new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 };
head.AddOrUpdate(nameof(ag_headsource.SecondId), second.Id); head.AddOrUpdate(nameof(ag_headsource.SecondId), second.Id);
head.AddOrUpdate(nameof(ag_headsource.PaymentOfTheMonth), $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月"); head.AddOrUpdate(nameof(ag_headsource.PaymentOfTheMonth), $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月");
head.AddOrUpdate(nameof(ag_headsource.TotalDistPerformance), allotStates.Contains(allot.States) ? (second.RealGiveFee ?? 0) : 1000); head.AddOrUpdate(nameof(ag_headsource.TotalDistPerformance), allotStates.Contains(allot.States) ? (second.RealGiveFee ?? 0) : 1000);
...@@ -742,19 +745,34 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second) ...@@ -742,19 +745,34 @@ private List<string> LoadEmployees_OfficeExcel(ag_secondallot second)
/// <summary> /// <summary>
/// 获取工作量及单项奖励 /// 获取工作量及单项奖励
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="allot"></param>
/// <param name="unitType"></param> /// <param name="second"></param>
/// <param name="accountingUnit"></param>
/// <returns></returns> /// <returns></returns>
public List<TitleValue<string, decimal?>> GetWorkLoads(int hospitalId, string unitType, string accountingUnit) public List<TitleValue<string, decimal?>> GetWorkLoads(per_allot allot, ag_secondallot second)
{ {
var workloads = _agworkloadRepository.GetEntities(t => t.HospitalId == hospitalId && t.Department == accountingUnit && t.UnitType == unitType) ?? new List<ag_workload>(); var status = (new int[] { (int)SecondAllotStatus.WaitReview, (int)SecondAllotStatus.PassAudit });
var loads = workloads // 已提交
.OrderBy(t => t.WorkTypeId).ThenBy(t => t.Sort) if (second.Status.HasValue && status.Contains(second.Status.Value))
.Select(t => new TitleValue<string, decimal?> { Title = t.ItemId, Value = t.ItemName, State = t.FactorValue }) {
.ToList(); var bodys = _agbodysourceRepository.GetEntities(w => w.SecondId == second.Id);
var ids = bodys.Select(w => w.Id).ToList();
return loads; var sources = _agworkloadsourceRepository.GetEntities(w => ids.Contains(w.BodyId)) ?? new List<ag_workload_source>();
var loads = sources
.OrderBy(t => t.WorkTypeId).ThenBy(t => t.Sort)
.GroupBy(w => new { w.ItemId, w.ItemName })
.Select(t => new TitleValue<string, decimal?> { Title = t.Key.ItemId, Value = t.Key.ItemName, State = t.FirstOrDefault()?.FactorValue ?? 0 })
.ToList();
return loads;
}
else
{
var workloads = _agworkloadRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Department == second.Department && t.UnitType == second.UnitType) ?? new List<ag_workload>();
var loads = workloads
.OrderBy(t => t.WorkTypeId).ThenBy(t => t.Sort)
.Select(t => new TitleValue<string, decimal?> { Title = t.ItemId, Value = t.ItemName, State = t.FactorValue })
.ToList();
return loads;
}
} }
#endregion #endregion
...@@ -1579,7 +1597,7 @@ public object RedistributionEmployee(SecondEmployeeDto request) ...@@ -1579,7 +1597,7 @@ public object RedistributionEmployee(SecondEmployeeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 当前二次分配配置工作量 // 当前二次分配配置工作量
var loads = GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = GetWorkLoads(allot, second);
Expression<Func<per_employee, bool>> exp = t => t.AllotId == second.AllotId; Expression<Func<per_employee, bool>> exp = t => t.AllotId == second.AllotId;
......
...@@ -1675,8 +1675,7 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount) ...@@ -1675,8 +1675,7 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
return agsecondallotRepository.Update(second); return agsecondallotRepository.Update(second);
} }
} }
} }
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
} }
/// <summary> /// <summary>
......
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