二次分配实发金额BUG修复

parent 5b4f2155
...@@ -547,14 +547,14 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -547,14 +547,14 @@ public void GenerateSecondAllot(per_allot allot)
Status = 1, Status = 1,
}); });
} }
else if (Math.Round((second.RealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m) else
{ {
second.RealGiveFee = item.RealGiveFee; if (Math.Round((second.RealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m && second.Status > 1)
if (second.Status > 1)
{ {
second.Status = 4; second.Status = 4;
second.Remark = "科室绩效结果发生变更,需要重新提交"; second.Remark = "科室绩效结果发生变更,需要重新提交";
} }
second.RealGiveFee = item.RealGiveFee;
updSecond.Add(second); updSecond.Add(second);
} }
} }
......
...@@ -117,101 +117,6 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -117,101 +117,6 @@ public List<SecondListResponse> GetSecondList(int userId)
exp = exp.And(t => t.UnitType == UnitType.行政后勤.ToString()); exp = exp.And(t => t.UnitType == UnitType.行政后勤.ToString());
var secondList = perforAgsecondallotRepository.GetEntities(exp); var secondList = perforAgsecondallotRepository.GetEntities(exp);
//各科室绩效分配结果
var accountList = perforResaccountRepository.GetEntities(t => allotListId.Contains(t.AllotID.Value) && t.AccountingUnit == user.Department);
//取得未生成二次绩效的绩效id
var exceptListId = secondList == null ? allotListId : allotListId.Except(secondList.Select(t => t.AllotId.Value));
var specialList = resspecialunitRepository.GetEntities(t => allotListId.Contains(t.AllotID.Value) && t.AccountingUnit == user.Department);
#region 初始化二次绩效
List<ag_secondallot> newSecond = new List<ag_secondallot>();
foreach (var item in exceptListId)
{
var allot = allotList.FirstOrDefault(t => t.ID == item);
if (allot == null) continue;
res_account account = null;
res_specialunit special = null;
if (role.Type == application.DirectorRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && (t.UnitType == (int)UnitType.医生组 || t.UnitType == (int)UnitType.医技组));
else if (role.Type == application.NurseRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组);
else if (role.Type == application.SpecialRole)
special = specialList?.FirstOrDefault(t => t.AllotID == item);
else if (role.Type == application.OfficeRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.行政后勤);
if (account == null && special == null) continue;
// 医生组护理组特殊核算组
var realGiveFee = role.Type == application.SpecialRole ? special.RealGiveFee : account.RealGiveFee;
// 行政后勤则取考核前绩效
if (role.Type == application.OfficeRole)
realGiveFee = account.PerforTotal;
var second = new ag_secondallot
{
AllotId = item,
Year = allot.Year,
Month = allot.Month,
Department = user.Department,
UnitType = role.Type == application.SpecialRole ? UnitType.特殊核算组.ToString() : ((UnitType)account.UnitType).ToString(),
RealGiveFee = realGiveFee,
Status = 1
};
newSecond.Add(second);
}
if (secondList != null && secondList.Any())
{
var fixatitems = new List<ag_fixatitem>();
foreach (var item in secondList.Select(t => t.AllotId.Value))
{
var allot = allotList.FirstOrDefault(t => t.ID == item);
if (allot == null) continue;
res_account account = null;
res_specialunit special = null;
if (role.Type == application.DirectorRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && (t.UnitType == (int)UnitType.医生组 || t.UnitType == (int)UnitType.医技组));
else if (role.Type == application.NurseRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组);
else if (role.Type == application.SpecialRole)
special = specialList?.FirstOrDefault(t => t.AllotID == item);
else if (role.Type == application.OfficeRole)
account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.行政后勤);
if (account == null && special == null) continue;
// 医生组护理组特殊核算组
var realGiveFee = role.Type == application.SpecialRole ? special.RealGiveFee : account.RealGiveFee;
// 行政后勤则取考核前绩效
if (role.Type == application.OfficeRole)
realGiveFee = account.PerforTotal;
var second = secondList.FirstOrDefault(t => t.AllotId == item);
second.RealGiveFee = realGiveFee;
var fixatitem = perforAgfixatitemRepository.GetEntity(t => t.SecondId == second.Id && t.AllotId == second.AllotId && t.RowNumber == -1 && t.ItemName == "可分配绩效");
if (fixatitem != null)
{
fixatitem.ItemValue = realGiveFee.ToString();
fixatitems.Add(fixatitem);
}
}
perforAgsecondallotRepository.UpdateRange(secondList.ToArray());
perforAgfixatitemRepository.UpdateRange(fixatitems.ToArray());
}
#endregion
if (newSecond.Count > 0)
{
perforAgsecondallotRepository.AddRange(newSecond.ToArray());
if (secondList == null)
secondList = newSecond;
else
secondList.AddRange(newSecond);
}
var list = Mapper.Map<List<SecondListResponse>>(secondList); var list = Mapper.Map<List<SecondListResponse>>(secondList);
list?.ForEach(t => t.IsArchive = allotList.FirstOrDefault(a => a.ID == t.AllotId).States == 8 ? 1 : 0); list?.ForEach(t => t.IsArchive = allotList.FirstOrDefault(a => a.ID == t.AllotId).States == 8 ? 1 : 0);
return list; return list;
......
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