Commit 99a0d356 by ruyun.zhang

工作量显示修改

parent 5e1d10de
......@@ -27,9 +27,10 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null) throw new PerformanceException("绩效月信息错误");
var account = perforResaccountRepository.GetEntity(t => t.UnitType == (int)unitType && t.AccountingUnit == accountingUnit);
var account = perforResaccountRepository.GetEntity(t => t.AllotID == allotId && t.UnitType == (int)unitType && t.AccountingUnit == accountingUnit);
account ??= new res_account
{
AllotID = allotId,
UnitType = (int)unitType,
AccountingUnit = accountingUnit,
Number = 0,
......@@ -46,9 +47,9 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
};
var ignore = new string[] { "合计", "汇总", "总计" };
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == account.AllotID) ?? new List<per_sheet>();
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID) ?? new List<im_header>();
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit) ?? new List<im_data>();
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == allotId) ?? new List<per_sheet>();
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == allotId) ?? new List<im_header>();
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == accountingUnit) ?? new List<im_data>();
var response = new UniteDeptDetailResponse
{
......@@ -64,7 +65,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
#region 补全行政工勤人员明细
{
var items = new List<Dictionary<string, object>>();
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountType == AccountUnitType.行政工勤.ToString() && t.AccountingUnit == account.AccountingUnit) ?? new List<res_compute>();
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == AccountUnitType.行政工勤.ToString() && t.AccountingUnit == accountingUnit) ?? new List<res_compute>();
foreach (var item in computes)
{
items.Add(new Dictionary<string, object>
......@@ -216,7 +217,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
var type = TypeConversion(account.UnitType);
var workitems = cofworkitemRepository.GetEntities(t => t.AllotID == account.AllotID);
var workitems = cofworkitemRepository.GetEntities(t => t.AllotID == allotId);
var medicineFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadMedicineProp);
var cmiFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadCMI);
var inclineFactor = GetFactors(persheet, basicData, type, SheetType.WorkloadIncline);
......@@ -233,38 +234,51 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
{
if (ignore.Contains(post.Key.TypeName)) continue;
var row = new Dictionary<string, object>();
row.Add("项目", post.Key.TypeName);
row.Add("数量", ValueFormating(post.Sum(group => group.CellValue), ""));
row.Add("系数", ValueFormating(post.FirstOrDefault().FactorValue, ""));
var itemValue = post.Sum(group => group.IsFactor == 1 ? (group.CellValue * (group.FactorValue ?? 0)) : group.CellValue);
itemValue = itemValue * (medicineFactor ?? 1) * (cmiFactor ?? 1) * (inclineFactor ?? 1);
var row = new Dictionary<string, object>
{
{ "项目", post.Key.TypeName },
{ "数量", ValueFormating(post.Sum(group => group.CellValue), "") },
{ "系数", ValueFormating(post.FirstOrDefault().FactorValue, "") },
{ "药占比系数", "" },
{ "CMI系数", "" },
{ "工作量倾斜", "" },
{ "金额", ValueFormating(itemValue, "") }
};
if (workitems != null && workitems.Any(a => a.Type == 1 && a.Item == post.Key.TypeName) && medicineFactor != null)
row.Add("药占比系数", ValueFormating(medicineFactor, ""));
row.AddOrUpdate("药占比系数", ValueFormating(medicineFactor, ""));
if (workitems != null && workitems.Any(a => a.Type == 2 && a.Item == post.Key.TypeName) && cmiFactor != null)
row.Add("CMI系数", ValueFormating(cmiFactor, ""));
row.AddOrUpdate("CMI系数", ValueFormating(cmiFactor, ""));
if (workitems != null && workitems.Any(a => a.Type == 3 && a.Item == post.Key.TypeName) && inclineFactor != null)
row.Add("工作量倾斜", ValueFormating(inclineFactor, ""));
row.AddOrUpdate("工作量倾斜", ValueFormating(inclineFactor, ""));
var itemValue = post.Sum(group => group.IsFactor == 1 ? (group.CellValue * (group.FactorValue ?? 0)) : group.CellValue);
itemValue = itemValue * (medicineFactor ?? 1) * (cmiFactor ?? 1) * (inclineFactor ?? 1);
row.Add("金额", ValueFormating(itemValue, ""));
items.Add(row);
}
items.Add(new Dictionary<string, object>
{
{ "项目", "核算分值合计"},
{ "数量", "" },
{ "系数", "" },
{ "药占比系数", "" },
{ "CMI系数", "" },
{ "工作量倾斜", "" },
{ "金额", ValueFormating(postDatas.Sum(w => w.IsFactor == 1 ? (w.CellValue * (w.FactorValue ?? 0)) : w.CellValue),"") },
});
// 保证Key数量一致
var keys = items.SelectMany(dict => dict.Keys).Distinct();
foreach (var k in keys)
{
var values = items.SelectMany(dict => dict.Where(kvp => kvp.Key == k).Select(kvp => kvp.Value));
if (!values.Any(w => !string.IsNullOrEmpty(w?.ToString())))
{
foreach (var item in items)
{
if (!item.ContainsKey(k))
item.Add(k, "");
item.Remove(k);
}
}
}
items.Add(new Dictionary<string, object>
{
{ "项目", "核算分值合计"},
{ "金额", postDatas.Sum(w => w.IsFactor == 1 ? (w.CellValue * (w.FactorValue ?? 0)) : w.CellValue) },
});
var amount = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal != 1)?.Sum(t => t.IsFactor == 1 ? t.CellValue * (t.FactorValue ?? 0) : t.CellValue) ?? 0;
detailItemWorkloads.Add(new DeptDetailItem { Title = sheetName, Total = amount, Items = items });
......
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