Commit 05a7ff0c by ruyun.zhang@suvalue.com

Merge branch 'v2020morge-graphql' into v2020morge-rename

parents 7c42fee2 01029872
...@@ -1175,7 +1175,7 @@ ...@@ -1175,7 +1175,7 @@
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitType"> <member name="P:Performance.EntityModels.ag_secondallot.SubmitType">
<summary> <summary>
提交类型 1使用模板 2 其他类型数据 提交类型 1 使用模板 2 其他类型数据
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitTime"> <member name="P:Performance.EntityModels.ag_secondallot.SubmitTime">
...@@ -1423,6 +1423,11 @@ ...@@ -1423,6 +1423,11 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_workload_source.WorkTypeId">
<summary>
1、单项奖励 2、工作量占比 ..(自定义占比)
</summary>
</member>
<member name="T:Performance.EntityModels.ag_workload_type"> <member name="T:Performance.EntityModels.ag_workload_type">
<summary> <summary>
......
...@@ -82,7 +82,7 @@ public class ag_secondallot ...@@ -82,7 +82,7 @@ public class ag_secondallot
public Nullable<int> Status { get; set; } public Nullable<int> Status { get; set; }
/// <summary> /// <summary>
/// 提交类型 1使用模板 2 其他类型数据 /// 提交类型 1 使用模板 2 其他类型数据
/// </summary> /// </summary>
public Nullable<int> SubmitType { get; set; } public Nullable<int> SubmitType { get; set; }
......
...@@ -55,5 +55,10 @@ public class ag_workload_source ...@@ -55,5 +55,10 @@ public class ag_workload_source
/// ///
/// </summary> /// </summary>
public Nullable<decimal> Value { get; set; } public Nullable<decimal> Value { get; set; }
/// <summary>
/// 1、单项奖励 2、工作量占比 ..(自定义占比)
/// </summary>
public Nullable<int> WorkTypeId { get; set; }
} }
} }
...@@ -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());
}
} }
} }
} }
...@@ -133,7 +133,7 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se ...@@ -133,7 +133,7 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se
var configHeaders = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType); var configHeaders = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType);
if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any()) if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any())
configHeaders = configHeaders.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList(); configHeaders = configHeaders?.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList();
// 初始化固定列 // 初始化固定列
var headItems = Mapper.Map<List<HeadItem>>(fixedHeaders) ?? new List<HeadItem>(); var headItems = Mapper.Map<List<HeadItem>>(fixedHeaders) ?? new List<HeadItem>();
......
...@@ -420,15 +420,19 @@ public dynamic GetWorkloadDict(int secondId) ...@@ -420,15 +420,19 @@ public dynamic GetWorkloadDict(int secondId)
private dynamic GetWorkloadDictAfterAudit(int secondId) private dynamic GetWorkloadDictAfterAudit(int secondId)
{ {
var bodysources = agbodysourceRepository.GetEntities(t => t.SecondId == secondId); var bodysources = agbodysourceRepository.GetEntities(t => t.SecondId == secondId);
if (bodysources == null || !bodysources.Any()) return new string[] { };
var workloadsources = agworkloadsourceRepository.GetEntities(t => bodysources.Select(w => w.Id).Contains(t.BodyId)); var workloadsources = agworkloadsourceRepository.GetEntities(t => bodysources.Select(w => w.Id).Contains(t.BodyId));
if (workloadsources == null || !workloadsources.Any()) return new string[] { };
var dict = workloadsources.GroupBy(t => new { t.ItemId, t.ItemName, t.FactorValue }).Select(t => new var dict = workloadsources.GroupBy(t => new { t.ItemId, t.ItemName, t.FactorValue, t.Sort, t.WorkTypeId, t.WorkloadId })
{ .OrderBy(t => t.Key.WorkTypeId).ThenBy(t => t.Key.Sort)
Title = t.Key.ItemId, .Select(t => new
Value = t.Key.ItemName, {
Factor = t.Key.FactorValue Title = t.Key.ItemId,
}); Value = t.Key.ItemName,
Factor = t.Key.FactorValue
});
return dict; return dict;
} }
...@@ -553,7 +557,8 @@ private void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dyna ...@@ -553,7 +557,8 @@ private void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dyna
ItemName = workload.ItemName, ItemName = workload.ItemName,
FactorValue = workload.FactorValue, FactorValue = workload.FactorValue,
Sort = workload.Sort, Sort = workload.Sort,
Value = ConvertHelper.To<decimal>(dict[key]) Value = ConvertHelper.To<decimal>(dict[key]),
WorkTypeId = workload.WorkTypeId
}); });
} }
} }
......
...@@ -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);
...@@ -1656,7 +1662,10 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1656,7 +1662,10 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
return true; return true;
var computes = new List<ag_compute>(); var computes = new List<ag_compute>();
if (second.SubmitType == 1)
var (tempId, name) = GetUsingTempId(hospital.ID, second);
if (new int[] { (int)Temp.crosswise, (int)Temp.lengthways }.Contains(tempId))
{ {
var items = agfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId); var items = agfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId);
if (items != null && items.Any()) if (items != null && items.Any())
...@@ -1686,7 +1695,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1686,7 +1695,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
} }
} }
} }
else if (second.SubmitType == 2) else if (tempId == (int)Temp.other)
{ {
var others = agothersourceRepository.GetEntities(t => t.SecondId == request.SecondId); var others = agothersourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (others != null && others.Any()) if (others != null && others.Any())
...@@ -1710,6 +1719,30 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1710,6 +1719,30 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
} }
} }
} }
else
{
var bodys = agbodysourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (bodys != null && bodys.Any())
{
foreach (var item in bodys)
{
computes.Add(new ag_compute
{
AllotId = second.AllotId,
SecondId = second.Id,
UnitType = second.UnitType,
Department = second.Department,
WorkPost = item.Post,
JobNumber = item.WorkNumber,
PersonName = item.Name,
PerforSumFee = item.DistPerformance,
OthePerfor = item.OtherPerformance,
NightWorkPerfor = item.NightWorkPerformance,
RealGiveFee = item.RealAmount,
});
}
}
}
agcomputeRepository.AddRange(computes.ToArray()); agcomputeRepository.AddRange(computes.ToArray());
} }
......
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