带出上个月工作量年资系数分隔比例

parent ec0984b8
......@@ -147,6 +147,17 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
if (headItems == null || !headItems.Any()) return bodyItems;
var otherShowColumns = headItems.Where(w => w.Type != (int)TempColumnType.TopFixedColumns)?.ToList();
if (otherShowColumns != null && employeeSource == (int)EmployeeSource.Initial)
{
// 保存过数据,从保存的数据中心带出信息
// 未保存过数据,带入初始数据(首次填写二次绩效,人员信息来自人员字典,有历史二次绩效记录时,人员信息来自上次二次绩效填写记录)
if (savedDataList == null || !savedDataList.Any())
{
employeeSource = prevSecondAllot == null ? (int)EmployeeSource.EmployeeDict : (int)EmployeeSource.PrevSecondAllot;
}
}
var topFixedColumns = headItems.Where(w => w.Type == (int)TempColumnType.TopFixedColumns)?.ToList();
if (topFixedColumns != null)
{
......@@ -162,22 +173,12 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
topFixedData.RowNumber = -1;
topFixedDataList.Add(topFixedData);
}
SupplementFixedData(secondAllot, topFixedDataList);
SupplementFixedData(secondAllot, topFixedDataList, prevSecondAllot, employeeSource);
bodyItems.AddRange(topFixedDataList);
}
var otherShowColumns = headItems.Where(w => w.Type != (int)TempColumnType.TopFixedColumns)?.ToList();
if (otherShowColumns != null)
{
if (employeeSource == (int)EmployeeSource.Initial)
{
// 保存过数据,从保存的数据中心带出信息
// 未保存过数据,带入初始数据(首次填写二次绩效,人员信息来自人员字典,有历史二次绩效记录时,人员信息来自上次二次绩效填写记录)
if (savedDataList == null || !savedDataList.Any())
{
employeeSource = prevSecondAllot == null ? (int)EmployeeSource.EmployeeDict : (int)EmployeeSource.PrevSecondAllot;
}
}
var tableFixedDataList = GetBodyItemsByEmployeeSource(userId, employeeSource, secondAllot, prevSecondAllot, savedDataList, otherShowColumns);
bodyItems.AddRange(tableFixedDataList);
}
......@@ -370,7 +371,7 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
/// </summary>
/// <param name="secondAllot"></param>
/// <param name="bodyItems"></param>
private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> bodyItems)
private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> bodyItems, ag_secondallot prevSecondAllot, int employeeSource)
{
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber == -1)) return;
......@@ -381,19 +382,36 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body
{ "满勤天数", DateTime.DaysInMonth(secondAllot.Year.Value, secondAllot.Month.Value).ToString() },
};
var configs = cofagainRepository.GetEntities(t => t.AllotID == secondAllot.AllotId);
if (configs != null && configs.Any())
var pairs = new Dictionary<string, string>
{
var pairs = new Dictionary<string, string>
{
{ "职称绩效", "年资职称绩效占比" },
{ "工作量绩效", "工作量绩效占比" },
};
{ "职称绩效", "年资职称绩效占比" },
{ "工作量绩效", "工作量绩效占比" },
};
foreach (var config in configs)
if (employeeSource == (int)EmployeeSource.PrevSecondAllot)
{
var savedDataList = agfixatitemRepository.GetEntities(w => w.SecondId == prevSecondAllot.Id && w.RowNumber.HasValue && w.RowNumber == -1);
if (savedDataList != null && savedDataList.Any())
{
var key = pairs.ContainsKey(config.TypeName) ? pairs[config.TypeName] : config.TypeName;
if (!keyValue.Keys.Contains(key)) keyValue.Add(key, config.Value.ToString());
foreach (var item in pairs)
{
var savedData = savedDataList.FirstOrDefault(w => w.Type == (int)TempColumnType.TopFixedColumns && w.ItemName == item.Value);
if (!string.IsNullOrEmpty(savedData?.ItemValue) && !keyValue.Keys.Contains(item.Value))
keyValue.Add(item.Value, savedData.ItemValue);
}
}
}
else
{
var configs = cofagainRepository.GetEntities(t => t.AllotID == secondAllot.AllotId);
if (configs != null && configs.Any())
{
foreach (var config in configs)
{
var key = pairs.ContainsKey(config.TypeName) ? pairs[config.TypeName] : config.TypeName;
if (!keyValue.Keys.Contains(key))
keyValue.Add(key, config.Value.ToString());
}
}
}
......
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