062过滤不需要审核科室、063下发自动驳回删除已提交数据、二次分配多余科室删除

parent f6a1f106
...@@ -522,6 +522,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -522,6 +522,7 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> tempSecond = new List<ag_secondallot>(); List<ag_secondallot> tempSecond = new List<ag_secondallot>();
List<ag_secondallot> insSecond = new List<ag_secondallot>(); List<ag_secondallot> insSecond = new List<ag_secondallot>();
List<ag_secondallot> updSecond = new List<ag_secondallot>(); List<ag_secondallot> updSecond = new List<ag_secondallot>();
List<ag_secondallot> delSecond = new List<ag_secondallot>();
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 }; var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
//// 获取医院是否开启后勤二次分配 //// 获取医院是否开启后勤二次分配
...@@ -612,11 +613,37 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -612,11 +613,37 @@ public void GenerateSecondAllot(per_allot allot)
} }
} }
if (secondList != null && secondList.Any())
{
foreach (var item in secondList)
{
var second = tempSecond?.FirstOrDefault(f => f.UnitType == item.UnitType && f.Department == item.Department);
if (second == null)
{
delSecond.Add(item);
}
}
}
if (insSecond.Any()) if (insSecond.Any())
perforAgsecondallotRepository.AddRange(insSecond.ToArray()); perforAgsecondallotRepository.AddRange(insSecond.ToArray());
if (updSecond.Any()) if (updSecond.Any())
{
perforAgsecondallotRepository.UpdateRange(updSecond.ToArray()); perforAgsecondallotRepository.UpdateRange(updSecond.ToArray());
foreach (var item in updSecond.Where(w => w.Status == 4))
{
// 自动驳回,需要清空该科室历史数据
var histories = perforAgcomputeRepository.GetEntities(w => w.SecondId == item.Id);
if (histories != null && histories.Any())
perforAgcomputeRepository.RemoveRange(histories.ToArray());
}
}
if (delSecond.Any())
{
perforAgsecondallotRepository.RemoveRange(delSecond.ToArray());
}
} }
} }
} }
...@@ -1471,7 +1471,13 @@ public List<ag_secondallot> AuditList(int allotId) ...@@ -1471,7 +1471,13 @@ public List<ag_secondallot> AuditList(int allotId)
if (allot == null) if (allot == null)
throw new PerformanceException("所选绩效不存在!"); throw new PerformanceException("所选绩效不存在!");
var accountUnit = resaccountRepository.GetEntities(t => t.AllotID == allotId && !new int[] { (int)UnitType.行政高层, (int)UnitType.行政中层 }.Contains(t.UnitType.Value)); var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
var accountUnit = resaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value));
// 查询需要进行二次分配的行政后勤科室
var xzAccountUnit = resaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是");
if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
var specialunit = resspecialunitRepository.GetEntities(t => t.AllotID == allot.ID); var specialunit = resspecialunitRepository.GetEntities(t => t.AllotID == allot.ID);
return SecondList(allot, accountUnit, specialunit); return SecondList(allot, accountUnit, specialunit);
......
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