diff --git a/DataBase/版本日志/SGGLDB_V2026-11-20-xiaj.sql b/DataBase/版本日志/SGGLDB_V2026-11-20-xiaj.sql new file mode 100644 index 00000000..fa593595 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-11-20-xiaj.sql @@ -0,0 +1,25 @@ +SET QUOTED_IDENTIFIER ON +GO +SET ANSI_NULLS ON +GO + +IF NOT EXISTS(SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.ScoreFlowLog') AND name = 'IX_ScoreFlowLog_DataSourceId') +BEGIN + CREATE NONCLUSTERED INDEX [IX_ScoreFlowLog_DataSourceId] ON [dbo].[ScoreFlowLog]([DataSourceId] ASC) + INCLUDE([IdentityCard], [Year]) +END +GO + +IF NOT EXISTS(SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.ScoreFlowLog') AND name = 'IX_ScoreFlowLog_IdentityCard_Year_CompileDate') +BEGIN + CREATE NONCLUSTERED INDEX [IX_ScoreFlowLog_IdentityCard_Year_CompileDate] ON [dbo].[ScoreFlowLog]([IdentityCard] ASC, [Year] ASC, [CompileDate] DESC) + INCLUDE([CurrentScore], [Type]) +END +GO + +IF NOT EXISTS(SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('dbo.Sys_Const') AND name = 'UX_Sys_Const_GroupId_ConstValue_PostType') +BEGIN + CREATE UNIQUE INDEX [UX_Sys_Const_GroupId_ConstValue_PostType] ON [dbo].[Sys_Const]([GroupId] ASC, [ConstValue] ASC) + WHERE [GroupId] = 'PostType' +END +GO diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index e66cb467..55f7fa25 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -534,15 +534,7 @@ namespace BLL var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId); if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false)) { - int score = 80; - var sysTestRule = db.Sys_TestRule.FirstOrDefault(); - if (sysTestRule != null) - { - if (sysTestRule.PassingScore > 0) - { - score = sysTestRule.PassingScore; - } - } + int score = SysConstSetService.getPassScore(); foreach (var item in getPersons) { var getTrainPersonIdList3 = (from x in db.Training_TestRecord diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 70fb4d17..1171fa23 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -1012,6 +1012,7 @@ namespace BLL TestType = getTestRecord.TestType, TemporaryUser = getTestRecord.TemporaryUser, Duration = getTestRecord.Duration, + CompanyTrainingItemId = getTestRecord.CompanyTrainingItemId, // TestStartTime = DateTime.Now, }; @@ -1019,10 +1020,13 @@ namespace BLL Funs.DB.SubmitChanges(); var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId); - var person = PersonService.GetPersonByUserId(newTestRecord.TestManId, getTestPlan.ProjectId); - if (getTestPlan != null && person != null) + if (getTestPlan != null) { - CreateTestRecordItem(getTestPlan, newTestRecord.TestRecordId, person); + var person = PersonService.GetPersonByUserId(newTestRecord.TestManId, getTestPlan.ProjectId); + if (person != null) + { + CreateTestRecordItem(getTestPlan, newTestRecord.TestRecordId, person); + } } return newTestRecord.TestRecordId; } diff --git a/SGGL/BLL/API/HSSE/APITrainRecordService.cs b/SGGL/BLL/API/HSSE/APITrainRecordService.cs index ab0588d3..bab33650 100644 --- a/SGGL/BLL/API/HSSE/APITrainRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainRecordService.cs @@ -128,12 +128,7 @@ namespace BLL db.SubmitChanges(); ////及格分数 - int passScore = 80; - //var testRule = db.Sys_TestRule.FirstOrDefault(); - //if (testRule != null) - //{ - // passScore = testRule.PassingScore; - //} + int passScore = SysConstSetService.getPassScore(); foreach (var item in getTrainingTasks) { diff --git a/SGGL/BLL/Score/ScoreFlowLogService.cs b/SGGL/BLL/Score/ScoreFlowLogService.cs index 2da9e12c..74488798 100644 --- a/SGGL/BLL/Score/ScoreFlowLogService.cs +++ b/SGGL/BLL/Score/ScoreFlowLogService.cs @@ -178,5 +178,495 @@ namespace BLL db.SubmitChanges(); } } + + + #region 考试后记分 + + /// + /// 考试后记分 + /// + /// + public static void HseScoring(string testRecordId) + { + if (string.IsNullOrWhiteSpace(testRecordId)) + { + return; + } + //考试大于等于及格分、已开考、且没有加过分的记录,加分 + int passScore = SysConstSetService.getPassScore(); + var testRecordList = (from x in Funs.DB.View_Training_TestRecord + where x.TestScores >= passScore && x.TestRecordId == testRecordId && x.TestStartTime != null + && !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId) + select x).ToList(); + foreach (var item in testRecordList) + { + //无身份证(人员档案缺失)或教材/教材分类已删除时无法定位记分对象,跳过,避免按首档分重复加分 + if (string.IsNullOrWhiteSpace(item.IdentityCard) + || string.IsNullOrWhiteSpace(item.CompanyTrainingName) + || string.IsNullOrWhiteSpace(item.CompanyTrainingItemName)) + { + continue; + } + //查找最新一条积分记录 + var flowLog = GetScoreFlowLogByIdentityCard(item.IdentityCard, item.TestStartTime.Value.Year, DateTime.Now); + + //作业人员考试加分 + if (item.WorkPostType == "一般作业岗位" || item.WorkPostType == "特种作业人员") + { + //必修-岗位基本操作技能:一门专业课20分,最高20分;超过1门课程,多出的学习课程每门2分 + if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId3) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【岗位基本操作技能】") orderby x.CompileDate descending select x).ToList(); + //一个课程加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("岗位基本操作技能【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【岗位基本操作技能】"; + newlog.LogContent = "岗位基本操作技能【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + + if (scoreFlowLog.Count == 0) + { + newlog.Score = 20; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 20; + } + else + { + newlog.CurrentScore = 120; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-通用安全知识:60分,每门10分,最高60分;超过6门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); + //一个课程加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【通用安全知识】"; + newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 6) + { + newlog.Score = 10; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 10; + } + else + { + newlog.CurrentScore = 110; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //选修加分 每节课2分,加分上线不限制,以年度为节点 + else + { + var isExist = (from x in Funs.DB.ScoreFlowLog + where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year + && x.Item.Contains(item.CompanyTrainingName) + && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (isExist == null) + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【" + item.CompanyTrainingName + "】"; + newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + } + //管理人员考试加分 + else if (item.WorkPostType == "一般管理岗位" || item.WorkPostType == "特种管理人员") + { + //必修-知识方法工具,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 + if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId2) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【知识方法工具】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("知识方法工具【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【知识方法工具】"; + newlog.LogContent = "知识方法工具【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 5) + { + newlog.Score = 5; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 5; + } + else + { + newlog.CurrentScore = 105; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-生产受控管理,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId4) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【生产受控管理】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("生产受控管理【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【生产受控管理】"; + newlog.LogContent = "生产受控管理【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 5) + { + newlog.Score = 5; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 5; + } + else + { + newlog.CurrentScore = 105; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-通用课程:通用安全知识:30分,每门10分,最高30分;超过3门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【通用安全知识】"; + newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 3) + { + newlog.Score = 10; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 10; + } + else + { + newlog.CurrentScore = 110; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + else //选修加分 每节课2分,加分上线不限制,以年度为节点 + { + var isExist = (from x in Funs.DB.ScoreFlowLog + where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year + && x.Item.Contains(item.CompanyTrainingName) + && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (isExist == null) + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【" + item.CompanyTrainingName + "】"; + newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + } + } + } + + + #endregion } } diff --git a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs index 5f582b7c..cf1a8dca 100644 --- a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs @@ -544,7 +544,7 @@ namespace FineUIPro.Web.Check.HSE CurrUserId = this.CurrUser.UserId, CheckId = $"{this.CheckId}_{index}", CheckType = (int)Enums.RetakeCourseType.HSE不符合项, - CheckTypeName = $"HSE不符合项检查重修:{classModel.ClassifyItemName}", + CheckTypeName = $"HSE检查重修:{classModel.ClassifyItemName}", PersonId = model.RectificationUserId, CompanyTrainingItemId = ItemId, //TrainEndDate = model.RectificationPeriod diff --git a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs index 69e1feef..1c5c31f5 100644 --- a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs +++ b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs @@ -805,7 +805,7 @@ namespace FineUIPro.Web.Check.HSE CurrUserId = this.CurrUser.UserId, CheckId = $"{item.CheckId}_{index}", CheckType = (int)Enums.RetakeCourseType.HSE不符合项, - CheckTypeName = $"HSE不符合项检查重修:{classModel.ClassifyItemName}", + CheckTypeName = $"HSE检查重修:{classModel.ClassifyItemName}", PersonId = item.RectificationUserId, CompanyTrainingItemId = ItemId, //TrainEndDate = model.RectificationPeriod diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index 0798f5ac..9a63c40b 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -68,469 +68,18 @@ /// void Wtimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - //考试大于等于80分通过,且没有加过分的记录,加分 - var testRecordList = (from x in Funs.DB.View_Training_TestRecord - where x.TestScores >= 80 && !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId) - orderby x.TestStartTime - select x).ToList(); - foreach (var item in testRecordList) + //考试大于等于及格分、已开考、且没有加过分的记录,加分 + //与交卷接口共用同一套记分逻辑,避免两份实现各自维护 + //直接查基表,避免视图里 7 个 LEFT JOIN 的全表扫描 + int passScore = BLL.SysConstSetService.getPassScore(); + var testRecordIds = (from x in Funs.DB.Training_TestRecord + where x.TestScores >= passScore && x.TestStartTime != null + && !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId) + orderby x.TestStartTime + select x.TestRecordId).ToList(); + foreach (var testRecordId in testRecordIds) { - //查找最新一条积分记录 - var flowLog = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(item.IdentityCard, item.TestStartTime.Value.Year, DateTime.Now); - - //作业人员考试加分 - if (item.WorkPostType == "一般作业岗位" || item.WorkPostType == "特种作业人员") - { - //必修-岗位基本操作技能:一门专业课20分,最高20分;超过1门课程,多出的学习课程每门2分 - if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId3) - { - var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【岗位基本操作技能】") orderby x.CompileDate descending select x).ToList(); - //一个课程加分一次 - var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("岗位基本操作技能【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); - if (isExist == null)//第一次加分 - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【岗位基本操作技能】"; - newlog.LogContent = "岗位基本操作技能【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - - if (scoreFlowLog.Count == 0) - { - newlog.Score = 20; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 20; - } - else - { - newlog.CurrentScore = 120; - } - } - else - { - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - //必修-通用安全知识:60分,每门10分,最高60分;超过6门课程,多出的学习课程每门2分 - else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) - { - var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); - //一个课程加分一次 - var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); - if (isExist == null)//第一次加分 - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【通用安全知识】"; - newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - if (scoreFlowLog.Count < 6) - { - newlog.Score = 10; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 10; - } - else - { - newlog.CurrentScore = 110; - } - } - else - { - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - //选修加分 每节课2分,加分上线不限制,以年度为节点 - else - { - var isExist = (from x in Funs.DB.ScoreFlowLog - where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year - && x.Item.Contains(item.CompanyTrainingName) - && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (isExist == null) - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【" + item.CompanyTrainingName + "】"; - newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - } - //管理人员考试加分 - else if (item.WorkPostType == "一般管理岗位" || item.WorkPostType == "特种管理人员") - { - //必修-知识方法工具,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 - if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId2) - { - var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【知识方法工具】") orderby x.CompileDate descending select x).ToList(); - //一次考试加分一次 - var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("知识方法工具【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); - if (isExist == null)//第一次加分 - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【知识方法工具】"; - newlog.LogContent = "知识方法工具【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - if (scoreFlowLog.Count < 5) - { - newlog.Score = 5; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 5; - } - else - { - newlog.CurrentScore = 105; - } - } - else - { - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - //必修-生产受控管理,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 - else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId4) - { - var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【生产受控管理】") orderby x.CompileDate descending select x).ToList(); - //一次考试加分一次 - var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("生产受控管理【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); - if (isExist == null)//第一次加分 - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【生产受控管理】"; - newlog.LogContent = "生产受控管理【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - if (scoreFlowLog.Count < 5) - { - newlog.Score = 5; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 5; - } - else - { - newlog.CurrentScore = 105; - } - } - else - { - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - //必修-通用课程:通用安全知识:30分,每门10分,最高30分;超过3门课程,多出的学习课程每门2分 - else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) - { - var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); - //一次考试加分一次 - var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); - if (isExist == null)//第一次加分 - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【通用安全知识】"; - newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - if (scoreFlowLog.Count < 3) - { - newlog.Score = 10; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 10; - } - else - { - newlog.CurrentScore = 110; - } - } - else - { - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - else //选修加分 每节课2分,加分上线不限制,以年度为节点 - { - var isExist = (from x in Funs.DB.ScoreFlowLog - where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year - && x.Item.Contains(item.CompanyTrainingName) - && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (isExist == null) - { - //人员记分流水日志表 - Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); - newlog.Id = SQLHelper.GetNewID(); - newlog.Year = item.TestStartTime.Value.Year; - newlog.IdentityCard = item.IdentityCard; - newlog.UserName = item.PersonName; - newlog.PersonId = item.TestManId; - newlog.UnitId = item.UnitId; - newlog.ProjectId = item.ProjectId; - newlog.UnitName = item.UnitName; - newlog.ProjectName = item.ProjectName; - newlog.Type = 1; - newlog.Item = "考试【" + item.CompanyTrainingName + "】"; - newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; - newlog.CompileDate = DateTime.Now; - newlog.CompileManId = ""; - newlog.CompileMan = ""; - newlog.DataSourceId = item.TestRecordId; - newlog.CheckDate = item.TestStartTime; - newlog.Score = 2; - if (flowLog != null) - { - newlog.CurrentScore = flowLog.CurrentScore + 2; - } - else - { - newlog.CurrentScore = 102; - } - newlog.CurrentScore = newlog.CurrentScore < 0 ? 0 : newlog.CurrentScore; - BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); - - //人员记分情况 - Model.ScoreUser newScoreUser = new ScoreUser(); - newScoreUser.Id = SQLHelper.GetNewID(); - newScoreUser.Year = newlog.Year; - newScoreUser.IdentityCard = item.IdentityCard; - newScoreUser.Score = newlog.CurrentScore; - newScoreUser.UserName = newlog.UserName; - newScoreUser.CompileDate = newlog.CompileDate; - newScoreUser.DataSourceId = newlog.DataSourceId; - newScoreUser.CheckDate = newlog.CheckDate; - BLL.ScoreUserService.AddScoreUser(newScoreUser); - } - } - } + BLL.ScoreFlowLogService.HseScoring(testRecordId); } } diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx.cs index f18fa768..67326b1d 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestRecord.aspx.cs @@ -55,22 +55,7 @@ namespace FineUIPro.Web.HSSE.EduTrain } ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); - var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - if (sysTestRule != null) - { - if (sysTestRule.PassingScore > 0) - { - this.lbPassScore.Text = "红色表示分数低于" + sysTestRule.PassingScore.ToString() + "分。"; - } - else - { - this.lbPassScore.Text = "红色表示分数低于80分。"; - } - } - else - { - this.lbPassScore.Text = "红色表示分数低于80分。"; - } + this.lbPassScore.Text = "红色表示分数低于" + SysConstSetService.getPassScore().ToString() + "分。"; ///更新没有结束时间且超时的考试记录 GetDataService.UpdateTestPlanStates(); diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestStatistics.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestStatistics.aspx.cs index e6cab5d2..7a2dbaf2 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TestStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TestStatistics.aspx.cs @@ -52,12 +52,7 @@ namespace FineUIPro.Web.HSSE.EduTrain //this.GetButtonPower(); } this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); - var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - var passingScore = "60"; - if (sysTestRule != null) - { - passingScore = sysTestRule.PassingScore.ToString(); - } + var passingScore = SysConstSetService.getPassScore().ToString(); TestQualifyCount.HeaderText = passingScore + "分以上"; // 绑定表格 this.BindGrid(); @@ -96,12 +91,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { return; } - var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - var passingScore = "60"; - if (sysTestRule != null) - { - passingScore = sysTestRule.PassingScore.ToString(); - } + var passingScore = SysConstSetService.getPassScore().ToString(); string strSql = @"SELECT PersonId,CardNo,PersonName,person.UnitId,Unit.UnitCode,Unit.UnitName,person.DepartId,Depart.DepartCode,Depart.DepartName" + @",WorkPostName,ISNULL(TestCount,0) AS TestCount,ISNULL(TestQualifyCount,0) AS TestQualifyCount " + @" FROM SitePerson_Person AS person " diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs index 4cded1f8..b4a3968e 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs @@ -630,12 +630,7 @@ namespace FineUIPro.Web.HSSE.EduTrain where x.PlanId == itemRecord.PlanId select x; ////及格分数 - int passScore = 80; - //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - //if (testRule != null) - //{ - // passScore = testRule.PassingScore; - //} + int passScore = SysConstSetService.getPassScore(); foreach (var item in getTrainingTasks) { bool isInsert = true; diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs index 10b570b2..819ab3cd 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs @@ -232,8 +232,7 @@ namespace FineUIPro.Web.HSSE.EduTrain && x.TestPlanId == this.TestPlanId); if (getTestRecord.Count() > 0) { ////及格分数 - int getPassScores = 80; - //int getPassScores = SysConstSetService.getPassScore(); + int getPassScores = SysConstSetService.getPassScore(); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); if (getOK != null) { diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs index d2dbaf19..a4f9f4bc 100644 --- a/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs @@ -37,6 +37,7 @@ namespace FineUIPro.Web.Person.EduTrain /// private void BindGrid() { + var passingScore = SysConstSetService.getPassScore().ToString(); string strSql = @"SELECT UserId PersonId,IdentityCard CardNo,UserName PersonName,person.UnitId,Unit.UnitCode,Unit.UnitName,person.DepartId,Depart.DepartCode,Depart.DepartName ,WorkPostName,ISNULL(TestCount,0) AS TestCount,ISNULL(TestQualifyCount,0) AS TestQualifyCount FROM Sys_User AS person @@ -45,7 +46,7 @@ namespace FineUIPro.Web.Person.EduTrain LEFT JOIN Base_Depart AS Depart ON person.DepartId=Depart.DepartId LEFT JOIN (SELECT COUNT(TestRecordId) AS TestCount,TestManId FROM Training_TestRecord GROUP BY TestManId) AS TestCount ON person.UserId=TestCount.TestManId - LEFT JOIN (SELECT COUNT(TestRecordId) AS TestQualifyCount,TestManId FROM Training_TestRecord WHERE TestScores>= 60 GROUP BY TestManId) AS TestQualifyCount + LEFT JOIN (SELECT COUNT(TestRecordId) AS TestQualifyCount,TestManId FROM Training_TestRecord WHERE TestScores>= " + passingScore + @" GROUP BY TestManId) AS TestQualifyCount ON person.UserId=TestQualifyCount.TestManId WHERE UserId <> '" + BLL.Const.sysglyId + "' "; List listStr = new List(); diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs index 1bb4b4ff..8a07dadf 100644 --- a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs @@ -519,12 +519,7 @@ namespace FineUIPro.Web.Person.EduTrain where x.PlanId == itemRecord.PlanId select x; ////及格分数 - int passScore = 80; - //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - //if (testRule != null) - //{ - // passScore = testRule.PassingScore; - //} + int passScore = SysConstSetService.getPassScore(); foreach (var item in getTrainingTasks) { bool isInsert = true; diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs index e5c918d9..d2f493a6 100644 --- a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs @@ -232,8 +232,7 @@ namespace FineUIPro.Web.Person.EduTrain && x.TestPlanId == this.TestPlanId); if (getTestRecord.Count() > 0) { ////及格分数 - int getPassScores = 80; - //int getPassScores = SysConstSetService.getPassScore(); + int getPassScores = SysConstSetService.getPassScore(); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); if (getOK != null) { diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index 7f75878b..04855ea2 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -336,8 +336,7 @@ namespace WebAPI.Controllers ////考试分数 decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); ////及格分数 - int getPassScores = 80; - //int getPassScores = SysConstSetService.getPassScore(); + int getPassScores = SysConstSetService.getPassScore(); if (getTestScores < getPassScores) { int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); @@ -355,6 +354,8 @@ namespace WebAPI.Controllers } else { + //记分 + ScoreFlowLogService.HseScoring(testRecordId); APITestRecordService.updateAll(getTestRecord.TestPlanId); responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; } @@ -444,14 +445,9 @@ namespace WebAPI.Controllers ////考试分数 decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); - int getPassScores = 80; + int getPassScores = SysConstSetService.getPassScore(); if (!string.IsNullOrEmpty(getTestRecord.TestPlanId)) {////及格分数 - //var testRule = db.Sys_TestRule.FirstOrDefault(); - //if (testRule != null) - //{ - // getPassScores = testRule.PassingScore; - //} if (getTestScores < getPassScores) { int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); @@ -469,6 +465,8 @@ namespace WebAPI.Controllers } else { + //记分 + ScoreFlowLogService.HseScoring(testRecordId); APITestRecordService.updateAll(getTestRecord.TestPlanId); responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; }