allot状态调整

parent dc2de372
...@@ -132,7 +132,8 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -132,7 +132,8 @@ public ApiResponse Import([FromForm] IFormCollection form)
if (!FileHelper.CreateFile(path, bytes)) if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败");
allot.Path = path; allot.Path = path;
allot.States = 1; allot.States = (int)AllotStates.FileUploaded;
allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
allot.UploadDate = DateTime.Now; allot.UploadDate = DateTime.Now;
if (!_allotService.Update(allot)) if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
......
...@@ -22,4 +22,35 @@ public enum States ...@@ -22,4 +22,35 @@ public enum States
[Description("其他")] [Description("其他")]
Disabled = 2, Disabled = 2,
} }
public enum AllotStates
{
/// <summary> 用户状态 </summary>
[Description("数据未上传")]
NoData = 0,
/// <summary> 数据已上传 </summary>
[Description("数据已上传")]
FileUploaded = 1,
/// <summary> 正在校验数据 </summary>
[Description("正在校验数据")]
InCheckData = 2,
/// <summary> 数据验证通过 </summary>
[Description("数据验证通过")]
CheckPass = 3,
/// <summary> 数据错误 </summary>
[Description("数据错误")]
CheckFail = 4,
/// <summary> 正在生成绩效 </summary>
[Description("正在生成绩效")]
InGenerate = 5,
/// <summary> 绩效结果解析成功 </summary>
[Description("数据验证通过")]
GenerateSucceed = 6,
/// <summary> 绩效解析失败 </summary>
[Description("绩效解析失败")]
GenerateFail = 7,
/// <summary> 归档 </summary>
[Description("归档")]
Archive = 8,
}
} }
...@@ -8,63 +8,68 @@ ...@@ -8,63 +8,68 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels namespace Performance.EntityModels
{ {
/// <summary> /// <summary>
/// per_allot Entity Model /// per_allot Entity Model
/// </summary> /// </summary>
[Table("per_allot")] [Table("per_allot")]
public class per_allot public class per_allot
{ {
/// <summary> /// <summary>
/// ID /// ID
/// </summary> /// </summary>
[Key] [Key]
public int ID { get; set; } public int ID { get; set; }
/// <summary> /// <summary>
/// 医院ID /// 医院ID
/// </summary> /// </summary>
public int HospitalId { get; set; } public int HospitalId { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<int> CreateUser { get; set; } public Nullable<int> CreateUser { get; set; }
/// <summary> /// <summary>
/// 绩效统计时间 /// 绩效统计时间
/// </summary> /// </summary>
public Nullable<DateTime> CreateDate { get; set; } public Nullable<DateTime> CreateDate { get; set; }
/// <summary> /// <summary>
/// 绩效发放年 /// 绩效发放年
/// </summary> /// </summary>
public int Year { get; set; } public int Year { get; set; }
/// <summary> /// <summary>
/// 绩效发放月 /// 绩效发放月
/// </summary> /// </summary>
public int Month { get; set; } public int Month { get; set; }
/// <summary> /// <summary>
/// 绩效发放总金额 /// 绩效发放总金额
/// </summary> /// </summary>
public Nullable<decimal> AllotFee { get; set; } public Nullable<decimal> AllotFee { get; set; }
/// <summary> /// <summary>
/// 文件路径 /// 文件路径
/// </summary> /// </summary>
public string Path { get; set; } public string Path { get; set; }
/// <summary> /// <summary>
/// 上传日期 /// 上传日期
/// </summary> /// </summary>
public Nullable<DateTime> UploadDate { get; set; } public Nullable<DateTime> UploadDate { get; set; }
/// <summary> /// <summary>
/// 0 数据未上传 1 数据已上传 2 数据解析中 3 数据解析成功 4 绩效结果生成中 5绩效结果解析成功 6 归档 /// 0 数据未上传 1 数据已上传 2 正在校验数据 3 数据验证通过 4 数据错误 5 正在生成绩效 6 绩效结果解析成功 7 绩效解析失败 8 归档
/// </summary> /// </summary>
public int States { get; set; } public int States { get; set; }
/// <summary>
///
/// </summary>
public string Remark { get; set; }
} }
} }
...@@ -56,7 +56,8 @@ public AllotResponse InsertAllot(AllotRequest request, int userID) ...@@ -56,7 +56,8 @@ public AllotResponse InsertAllot(AllotRequest request, int userID)
var allot = Mapper.Map<per_allot>(request); var allot = Mapper.Map<per_allot>(request);
allot.CreateDate = DateTime.Now; allot.CreateDate = DateTime.Now;
allot.CreateUser = userID; allot.CreateUser = userID;
allot.States = 0; allot.States = (int)AllotStates.NoData;
allot.Remark = EnumHelper.GetDescription(AllotStates.NoData);
if (!_allotRepository.Add(allot)) if (!_allotRepository.Add(allot))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
......
...@@ -75,36 +75,58 @@ public class PerExcelService : IAutoInjection ...@@ -75,36 +75,58 @@ public class PerExcelService : IAutoInjection
public void Execute(per_allot allot) public void Execute(per_allot allot)
{ {
allot.States = 2; try
_perforPerAllotRepository.Update(allot); {
allot.States = (int)AllotStates.InCheckData;
allot.Remark = EnumHelper.GetDescription(AllotStates.InCheckData);
_perforPerAllotRepository.Update(allot);
Clear(allot.ID);
Clear(allot.ID); // 导出数据
var excel = Import(allot.Path);
// 导出数据 // 保存数据
var excel = Import(allot.Path); Save(excel.PerSheet, allot.ID, 1);
// 保存数据 Check();
Save(excel.PerSheet, allot.ID, 1);
allot.States = (int)AllotStates.InGenerate;
allot.Remark = EnumHelper.GetDescription(AllotStates.InGenerate);
_perforPerAllotRepository.Update(allot);
// 计算合并数据 // 计算合并数据
List<PerSheet> list = ProcessCompute(excel); List<PerSheet> list = ProcessCompute(excel);
// 保存过程数据 // 保存过程数据
Save(list, allot.ID, 2); Save(list, allot.ID, 2);
var baiscnorm = NurseBaiscnorm(list); var baiscnorm = NurseBaiscnorm(list);
// 计算最总数据 // 计算最总数据
var baiscnormList = Compute(allot, excel, baiscnorm); var baiscnormList = Compute(allot, excel, baiscnorm);
SpecialUnitCompute(excel, allot, baiscnormList); SpecialUnitCompute(excel, allot, baiscnormList);
//发送邮件 //发送邮件
SendEmail(allot); SendEmail(allot);
}
catch (Exception ex)
{
allot.States = (int)AllotStates.GenerateFail;
allot.Remark = EnumHelper.GetDescription(AllotStates.GenerateFail);
_perforPerAllotRepository.Update(allot);
}
allot.States = 5; allot.States = (int)AllotStates.GenerateSucceed;
allot.Remark = EnumHelper.GetDescription(AllotStates.GenerateSucceed);
_perforPerAllotRepository.Update(allot); _perforPerAllotRepository.Update(allot);
} }
private void Check()
{
}
/// <summary> /// <summary>
/// 特殊科室绩效计算 /// 特殊科室绩效计算
/// </summary> /// </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