20260817 积分、扣分
This commit is contained in:
@@ -698,6 +698,82 @@ namespace FineUIPro.Web.Check.HSE
|
||||
{
|
||||
Funs.DB.CheckProblem_Safety.InsertAllOnSubmit(toInsert);
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
#region 扣分记录
|
||||
toInsert = toInsert.OrderBy(x => x.CheckDate).ToList();
|
||||
foreach (var item in toInsert)
|
||||
{
|
||||
ScoreFlowLog log = new ScoreFlowLog();
|
||||
log.Id = SQLHelper.GetNewID();
|
||||
log.Year = item.CheckDate.Year;
|
||||
log.UserId = item.RectificationUserId;
|
||||
log.UserName = item.RectificationUserName;
|
||||
var user = BLL.UserService.GetUserByUserId(item.RectificationUserId);
|
||||
if (user != null)
|
||||
{
|
||||
log.IdentityCard = user.IdentityCard;
|
||||
}
|
||||
log.UnitId = item.UnitId;
|
||||
log.ProjectId = item.ProjectId;
|
||||
log.UnitName = item.UnitName;
|
||||
log.ProjectName = item.ProjectName;
|
||||
log.Item = "安全不符合项";
|
||||
log.LogContent = "隐患问责扣分";
|
||||
log.CheckDate = item.CheckDate;
|
||||
log.CompileDate = DateTime.Now;
|
||||
log.CompileMan = this.CurrUser.UserName;
|
||||
log.CompileManId = this.CurrUser.UserId;
|
||||
log.DataSourceId = item.CheckId;
|
||||
log.Type = 0;//扣分
|
||||
//特别严重(管控红线)扣成0分,严重(危险作业许可)扣除100分,较大扣除50分,一般扣除20分,轻微扣除2分
|
||||
if (item.NatureId == BLL.Const.SafetyNatureIdN1)
|
||||
{
|
||||
var sfl = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate);
|
||||
if (sfl != null)
|
||||
{
|
||||
log.Score = -sfl.CurrentScore;//上一条记录多少分扣多少分
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Score = -100;
|
||||
}
|
||||
}
|
||||
else if (item.NatureId == BLL.Const.SafetyNatureIdN2)
|
||||
{
|
||||
log.Score = -100;
|
||||
}
|
||||
else if (item.NatureId == BLL.Const.SafetyNatureIdN3)
|
||||
{
|
||||
log.Score = -50;
|
||||
}
|
||||
else if (item.NatureId == BLL.Const.SafetyNatureIdN4)
|
||||
{
|
||||
log.Score = -20;
|
||||
}
|
||||
var cs = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate);
|
||||
if (cs != null)
|
||||
{
|
||||
log.CurrentScore = cs.CurrentScore + log.Score;//记分后人员得分值
|
||||
}
|
||||
else
|
||||
{
|
||||
log.CurrentScore = 100 + log.Score;
|
||||
}
|
||||
|
||||
BLL.ScoreFlowLogService.AddScoreFlowLog(log);
|
||||
|
||||
ScoreUser su = new ScoreUser();
|
||||
su.Id = SQLHelper.GetNewID();
|
||||
su.Year = log.Year;
|
||||
su.IdentityCard = log.IdentityCard;
|
||||
su.Score = log.CurrentScore;
|
||||
su.UserName = log.UserName;
|
||||
su.CompileDate = log.CompileDate;
|
||||
su.DataSourceId = log.DataSourceId;
|
||||
su.CheckDate = log.CheckDate;
|
||||
BLL.ScoreUserService.AddScoreUser(su);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
ShowNotify($"成功导入 {toInsert.Count} 条记录。", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
|
||||
Reference in New Issue
Block a user