From 93a48943a1b9d67b717ebd11ccbcaa53368b03b3 Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Wed, 25 Nov 2026 19:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/HSSE/APIServerTestRecordService.cs | 8 ++-- SGGL/BLL/API/HSSE/APITestRecordService.cs | 1 + SGGL/BLL/API/HSSE/APITrainingTaskService.cs | 39 +++++++++++++++++++ SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs | 9 +++-- SGGL/BLL/Score/ScoreFlowLogService.cs | 2 + .../Controllers/HSSE/TestRecordController.cs | 11 ++++++ 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs b/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs index abafb64f..c336bbec 100644 --- a/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs @@ -506,10 +506,10 @@ namespace BLL { getTItem.SubjectScore = getTItem.Score ?? 0; } - else - { - getTItem.SubjectScore = Convert.ToDecimal((getTItem.Score ?? 0) * 1.0 / 2); - } + //else + //{ + // getTItem.SubjectScore = Convert.ToDecimal((getTItem.Score ?? 0) * 1.0 / 2); + //} } } } diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 1171fa23..3500fdd7 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -960,6 +960,7 @@ namespace BLL { using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString)) { + //ErrLogInfo.WriteLog($"【考试交卷后记分2】testRecordId:{testPlanId};"); //// 获取考试计划 var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId); if (getTestPlan != null) diff --git a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs index 565e8202..144fc020 100644 --- a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs +++ b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs @@ -62,6 +62,45 @@ namespace BLL #endregion + #region 根据testRecordId关闭【培训任务】和计划 + + /// + /// 关闭人员培训任务计划 + /// + /// + public static void UpdatePersonTask(string testRecordId, string companyTrainingItemId, string projectId, string testManId) + { + using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString)) + { + var taskIds = from tba in db.Training_Plan + join tbb in db.Training_Task on tba.PlanId equals tbb.PlanId + where tba.ProjectId == projectId && tba.CompanyTrainingItemId == companyTrainingItemId && tbb.States == "1" && tbb.UserId == testManId + select tbb.TaskId; + foreach (var tid in taskIds) + { + var taskItem = db.Training_TaskItem.Where(x => x.TaskId == tid && x.CompanyTrainingItemId == companyTrainingItemId && x.PersonId == testManId).FirstOrDefault(); + if (taskItem != null) + { + taskItem.EndTime = DateTime.Now;//有结束时间代表已完成 + db.SubmitChanges(); + } + var taskItems = db.Training_TaskItem.Where(x => x.TaskId == tid && x.EndTime.HasValue == false); + //if (taskItems.Count() == 0) + if (!taskItems.Any()) + { + var task = db.Training_Task.Where(x => x.TaskId == tid).FirstOrDefault(); + if (task != null) + { + task.States = Const.State_2;//0-未响应;1-已响应;2-已完成 + db.SubmitChanges(); + } + } + } + } + } + + #endregion + #region 根据TaskId获取培训任务教材列表 /// /// 根据TaskId获取培训任务列表 diff --git a/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs b/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs index 555b1971..bad4e986 100644 --- a/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TrainingPlanService.cs @@ -298,7 +298,7 @@ namespace BLL var workPostPersons = PersonService.GetPersonListByWorkPostIds(info.CurrProjectId, workPostIds); //人员单位 - var unitIds = workPostPersons.Any() ? String.Join(", ", workPostPersons.Select(x => x.UnitId).Distinct()) : string.Empty; + var unitIds = workPostPersons.Any() ? string.Join(", ", workPostPersons.Select(x => x.UnitId).Distinct()) : string.Empty; //2、根据教材id查询今年是否有相关培训计划(排除重修培训计划),如果有先删除; var plans = GetThisYearPlanByCompanyTrainingItemId(info.CurrProjectId, info.CompanyTrainingItemId, DateTime.Now.Year); if (plans.Any()) @@ -350,7 +350,7 @@ namespace BLL TrainLevelId = Const.OtherTrainLevelId, UnitIds = unitIds, WorkPostId = companyTrainingItem.WorkPostIds, - States = "1", + States = "1",//0-待提交;1-已提交;2-已推送;-1-已作废 Cycle = "", //IsRetakeCourse = 0, //CheckType = info.CheckType.ToString(), @@ -371,8 +371,9 @@ namespace BLL List newTasks = new List(); List newTaskItems = new List(); + var proWorkPostPersons = workPostPersons.Where(x => x.ProjectId == pid); //循环给人员添加任务 - foreach (var person in workPostPersons) + foreach (var person in proWorkPostPersons) { string taskId = SQLHelper.GetNewID(); //新增培训任务 @@ -383,7 +384,7 @@ namespace BLL PlanId = planId, UserId = person.PersonId, TaskDate = DateTime.Now, - States = Const.State_1, + States = Const.State_1,//0-未响应;1-已响应;2-已完成 }; newTasks.Add(newTask); diff --git a/SGGL/BLL/Score/ScoreFlowLogService.cs b/SGGL/BLL/Score/ScoreFlowLogService.cs index 74488798..333b9c4c 100644 --- a/SGGL/BLL/Score/ScoreFlowLogService.cs +++ b/SGGL/BLL/Score/ScoreFlowLogService.cs @@ -188,6 +188,8 @@ namespace BLL /// public static void HseScoring(string testRecordId) { + //ErrLogInfo.WriteLog($"【考试后记分】testRecordId:{testRecordId};"); + if (string.IsNullOrWhiteSpace(testRecordId)) { return; diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index 04855ea2..4622d4af 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -354,6 +354,7 @@ namespace WebAPI.Controllers } else { + //ErrLogInfo.WriteLog($"【考试交卷后记分】testRecordId:{testRecordId};"); //记分 ScoreFlowLogService.HseScoring(testRecordId); APITestRecordService.updateAll(getTestRecord.TestPlanId); @@ -383,6 +384,7 @@ namespace WebAPI.Controllers string Signature = testRecordItem.Signature; string Fingerprint = testRecordItem.Fingerprint; var responeData = new Model.ResponeData(); + //ErrLogInfo.WriteLog($"【交卷】testRecordId:{testRecordId};"); try { using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString)) @@ -465,6 +467,7 @@ namespace WebAPI.Controllers } else { + //ErrLogInfo.WriteLog($"【考试交卷后记分2】testRecordId:{testRecordId};"); //记分 ScoreFlowLogService.HseScoring(testRecordId); APITestRecordService.updateAll(getTestRecord.TestPlanId); @@ -474,6 +477,14 @@ namespace WebAPI.Controllers } else { + if (getTestScores >= getPassScores) + { + //ErrLogInfo.WriteLog($"【考试交卷后记分2.2】testRecordId:{testRecordId};"); + //记分 + ScoreFlowLogService.HseScoring(testRecordId); + //关闭培训任务 + APITrainingTaskService.UpdatePersonTask(getTestRecord.TestRecordId, getTestRecord.CompanyTrainingItemId, getTestRecord.ProjectId, getTestRecord.TestManId); + } responeData.data = new { getTestScores, getPassScores }; } }