allot状态调整

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