二次分配保存验证状态

parent fc3a95ba
......@@ -745,6 +745,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.SecondId);
if (second == null) throw new PerformanceException("参数SecondId无效!");
if (second.Status == (int)SecondAllot.Status.等待审核 || second.Status == (int)SecondAllot.Status.审核通过)
throw new PerformanceException("保存失败,当前二次分配已提交!");
var allot = _allotService.GetAllot(second.AllotId.Value);
if (allot == null)
throw new PerformanceException("绩效记录不存在!");
......
......@@ -134,4 +134,14 @@ public enum Role
数据收集 = 11,
绩效查询 = 12,
}
public class SecondAllot
{
public enum Status
{
未提交 = 1,
等待审核 = 2,
审核通过 = 3,
驳回 = 4,
}
}
}
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
return new List<view_second_compute_collect>();
}
public int Submit(int secondId, int tempId, decimal realGiveFee, string remark = "")
{
string sql = "UPDATE ag_secondallot SET UseTempId = @tempId,NursingDeptStatus = @status, Status = @status, SubmitTime = @date, Remark = @remark WHERE Id = @secondId AND RealGiveFee = @fee";
return Execute(sql, new { secondId, tempId, status = 2, date = DateTime.Now, fee = realGiveFee, remark });
}
}
}
......@@ -1620,6 +1620,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0)); // 其他模板 = 可分配绩效 + 夜班绩效
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
return true;
}
else if (new int[] { 7, 8 }.Contains(temp.UseTempId.Value))
{
......@@ -1631,6 +1636,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
.Sum(t => t.Sum(item => ConvertHelper.To<decimal>(item.ItemValue)));
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
return true;
}
else /*if (new int[] { 9, 10 }.Contains(temp.UseTempId.Value))*/
{
......@@ -1645,14 +1655,19 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0));
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee:0.####},提交金额:{total:0.####}");
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
return true;
}
second.UseTempId = temp.UseTempId;
second.Status = 2;
second.NursingDeptStatus = 2;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.UseTempId = temp.UseTempId;
//second.Status = 2;
//second.NursingDeptStatus = 2;
////second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
//second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
//return agsecondallotRepository.Update(second);
}
/// <summary>
......
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