Commit e1f5161f by lcx

二次绩效其他模板数据保存

parent 934df22c
...@@ -570,7 +570,8 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in ...@@ -570,7 +570,8 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
var result = new HandsonTable((int)SheetType.Unidentifiable, OtherTemp.Select(t => t.Value).ToArray(), OtherTemp.Select(t => new collect_permission var result = new HandsonTable((int)SheetType.Unidentifiable, OtherTemp.Select(t => t.Value).ToArray(), OtherTemp.Select(t => new collect_permission
{ {
HeadName = t.Value, HeadName = t.Value,
Visible = 1 Visible = 1,
Readnoly = new string[] { "可分配绩效", "医院其他绩效", "预留比例", "预留金额", "实发绩效工资金额" }.Contains(t.Value) ? 1 : 0
}).ToList()); }).ToList());
var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource); var details = GetOtherTempDetails(userId, secondId, isArchive, employeeSource);
...@@ -587,6 +588,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in ...@@ -587,6 +588,7 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
var cells = (from conf in OtherTemp var cells = (from conf in OtherTemp
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList(); select new HandsonCellData(conf.Value, fst.Value)).ToList();
cells.Add(new HandsonCellData(nameof(ag_othersource.Id), item.Id));
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
...@@ -636,14 +638,14 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -636,14 +638,14 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var types = new string[] { "行政后勤", "行政工勤" }; var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department); var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department);
result = (logistics ?? new List<im_employee_logistics>()) result = (logistics ?? new List<im_employee_logistics>())
.OrderBy(t=>Convert.ToInt32(t.PersonnelNumber)).Select(w => new ag_othersource .OrderBy(t => Convert.ToInt32(t.PersonnelNumber)).Select(w => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
WorkNumber = w.PersonnelNumber, WorkNumber = w.PersonnelNumber,
Name = w.DoctorName, Name = w.DoctorName,
Department = w.AccountingUnit, Department = w.AccountingUnit,
WorkPost = w.JobTitle, WorkPost = w.JobTitle,
}).ToDistinct().ToList(); }).ToDistinct().ToList();
} }
} }
//非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载 //非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载
...@@ -652,12 +654,12 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -652,12 +654,12 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
switch (employeeSource) switch (employeeSource)
{ {
case (int)EmployeeSource.Initial: case (int)EmployeeSource.Initial:
result = savedDataList.OrderBy(t => Convert.ToInt32(t.WorkNumber)).ToList(); result = savedDataList.OrderBy(t => t.WorkNumber).ToList();
break; break;
case (int)EmployeeSource.EmployeeDict: case (int)EmployeeSource.EmployeeDict:
if (employees == null || !employees.Any()) return new List<ag_othersource>(); if (employees == null || !employees.Any()) return new List<ag_othersource>();
result = employees.OrderBy(t=>Convert.ToInt32(t.PersonnelNumber)).Select(t => new ag_othersource result = employees.OrderBy(t => t.PersonnelNumber).Select(t => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
WorkNumber = t.PersonnelNumber, WorkNumber = t.PersonnelNumber,
...@@ -672,7 +674,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -672,7 +674,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
isSupplementTitlePerformance = prevSavedDataList == null || !prevSavedDataList.Any(); isSupplementTitlePerformance = prevSavedDataList == null || !prevSavedDataList.Any();
if (prevSavedDataList != null && prevSavedDataList.Any()) if (prevSavedDataList != null && prevSavedDataList.Any())
{ {
result = prevSavedDataList.OrderBy(t => Convert.ToInt32(t.WorkNumber)) result = prevSavedDataList.OrderBy(t => t.WorkNumber)
.Select(t => new ag_othersource .Select(t => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
......
...@@ -1708,6 +1708,17 @@ public void OtherSave(int secondId, SaveCollectData collectData) ...@@ -1708,6 +1708,17 @@ public void OtherSave(int secondId, SaveCollectData collectData)
josn.Add($"{{{string.Join(",", itemList)}}}"); josn.Add($"{{{string.Join(",", itemList)}}}");
} }
var data = JsonHelper.Deserialize<List<ag_othersource>>($"[{string.Join(",", josn)}]"); var data = JsonHelper.Deserialize<List<ag_othersource>>($"[{string.Join(",", josn)}]");
data = data.Where(t => !string.IsNullOrEmpty(t.WorkNumber) || !string.IsNullOrEmpty(t.Name))?.ToList();
if (data == null || !data.Any()) return;
var existEntities = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (existEntities != null && existEntities.Any())
{
perforAgothersourceRepository.RemoveRange(existEntities.ToArray());
}
data.ForEach(t => t.SecondId = secondId);
perforAgothersourceRepository.AddRange(data.ToArray());
} }
#endregion 二次绩效其他来源 #endregion 二次绩效其他来源
......
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