From 54590920e42064a565a5e45a4778ded5a816a845 Mon Sep 17 00:00:00 2001 From: yhw0507 Date: Mon, 29 Aug 2022 19:58:10 +0800 Subject: [PATCH] =?UTF-8?q?20220829=E6=9C=AA=E5=81=9A=E5=9F=B9=E8=AE=AD?= =?UTF-8?q?=E8=AE=A1=E5=88=92=20=E6=96=B0=E5=A2=9E=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=8A=A0=E5=85=A5=E5=9F=B9=E8=AE=AD=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataBase/ConstInitData.sql | 36 ++++---- .../SGGLDB_V2022-08-04-001修改明细.txt | 0 .../SGGLDB_V2022-08-29-001.sql | 4 + .../SGGLDB_V2022-08-29-001修改明细.txt | 3 + SGGL/BLL/API/HSSE/APITrainRecordService.cs | 91 +++++++++++++++++++ SGGL/BLL/HSSE/EduTrain/TestPlanService.cs | 2 +- .../HSSE/EduTrain/TrainRecord.aspx.cs | 39 ++++++-- SGGL/FineUIPro.Web/Login.aspx | 4 +- .../Controllers/HSSE/TestingController.cs | 11 ++- 9 files changed, 162 insertions(+), 28 deletions(-) rename DataBase/版本日志/{ => 已更新脚本}/SGGLDB_V2022-08-04-001修改明细.txt (100%) create mode 100644 DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001.sql create mode 100644 DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001修改明细.txt diff --git a/DataBase/ConstInitData.sql b/DataBase/ConstInitData.sql index bd27932e..eb357dc8 100644 --- a/DataBase/ConstInitData.sql +++ b/DataBase/ConstInitData.sql @@ -538,36 +538,40 @@ GO --GO /*Ŀ*/ + INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) VALUES('D097252D-B42A-4CAE-9030-A5C351057ABD','Menu_ProjectSet','Ŀ',1,'MenuType_P') GO -INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('E116D85E-6215-4299-9EEA-FBC46B0E6163','Menu_CQMS','',2,'MenuType_P') +INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) +VALUES('CF2CA03F-84B3-432E-AEAC-4ECF7890D6D7','Menu_PZHGL','ʩ',2,'MenuType_P') GO INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('35282E20-81AB-4DA2-80F2-8F136776642D','Menu_HSSE','ȫ',3,'MenuType_P') +VALUES('E116D85E-6215-4299-9EEA-FBC46B0E6163','Menu_CQMS','',3,'MenuType_P') GO INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('B4F6F0B8-C7AD-421A-9BE3-DCC70EB39A8C','Menu_JDGL','ȹ',4,'MenuType_P') +VALUES('B4F6F0B8-C7AD-421A-9BE3-DCC70EB39A8C','Menu_JDGL','/ƻ',4,'MenuType_P') GO INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('CE689095-841F-4714-A2B4-BF72D13E2B94','Menu_HJGL','ӹ',5,'MenuType_P') +VALUES('35282E20-81AB-4DA2-80F2-8F136776642D','Menu_HSSE','HSE',5,'MenuType_P') +GO +INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) +VALUES('CE689095-841F-4714-A2B4-BF72D13E2B94','Menu_HJGL','ӹ',6,'MenuType_P') GO INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('7AD04F82-91B3-4579-993C-8C8FAC503864','Menu_TestRun','Գ',6,'MenuType_P') -GO -INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('CF2CA03F-84B3-432E-AEAC-4ECF7890D6D7','Menu_PZHGL','ʩۺ',7,'MenuType_P') +VALUES('7AD04F82-91B3-4579-993C-8C8FAC503864','Menu_TestRun','Գ',7,'MenuType_P') GO INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) -VALUES('85CF0BBF-A3F3-42DF-89DC-CE9A4886BCA1','Menu_DigitalSite','Ƶ',8,'MenuType_P') +VALUES('126FB0AC-521C-4145-86FC-B507D83B7646','Menu_Change','',8,'MenuType_P') +GO +INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) +VALUES('C0457DFF-AAA3-4019-AC9B-34BF22BF3A0E','Menu_DocControl','Ŀع',9,'MenuType_P') +GO +INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) +VALUES('0B13D4A9-E047-4C18-AD68-8D3724D4F0A8','Menu_Attendance','ֳ',10,'MenuType_P') +GO +INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) +VALUES('85CF0BBF-A3F3-42DF-89DC-CE9A4886BCA1','Menu_Video','Ƶ',11,'MenuType_P') GO ---INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) ---VALUES('0B13D4A9-E047-4C18-AD68-8D3724D4F0A8','Menu_Video','ֳ',9,'MenuType_P') ---GO ---INSERT INTO Sys_Const (ID,ConstValue,ConstText,SortIndex,GroupId) ---VALUES('69B856E6-E385-4771-9341-23E7416C46F1','Menu_PDigData','Ŀ',9,'MenuType_P') ---GO --Ŀ INSERT INTO dbo.Sys_Const(ID, ConstValue, ConstText, SortIndex, GroupId) diff --git a/DataBase/版本日志/SGGLDB_V2022-08-04-001修改明细.txt b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-04-001修改明细.txt similarity index 100% rename from DataBase/版本日志/SGGLDB_V2022-08-04-001修改明细.txt rename to DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-04-001修改明细.txt diff --git a/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001.sql b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001.sql new file mode 100644 index 00000000..50d55a1e --- /dev/null +++ b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001.sql @@ -0,0 +1,4 @@ +ALTER TABLE [dbo].[EduTrain_TrainRecord] DROP CONSTRAINT [FK_EduTrain_TrainRecord_Training_Plan] +GO + + diff --git a/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001修改明细.txt b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001修改明细.txt new file mode 100644 index 00000000..854c6e83 --- /dev/null +++ b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-08-29-001修改明细.txt @@ -0,0 +1,3 @@ +--ADD BY YangHongwei 2022-08-29 +1、旭科项目(张英魁)处理未做培训计划,直接按照考试计划考试的情况,新增按钮,手动将这部分考试记录归到到培训记录中。 +--END \ No newline at end of file diff --git a/SGGL/BLL/API/HSSE/APITrainRecordService.cs b/SGGL/BLL/API/HSSE/APITrainRecordService.cs index 82a9ff42..c5ce2526 100644 --- a/SGGL/BLL/API/HSSE/APITrainRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainRecordService.cs @@ -184,5 +184,96 @@ namespace BLL } } #endregion + + #region 将相关未做培训 但考试考生内容 写培训记录归档 + /// + /// 将相关未做培训 但考试考生内容 写培训记录归档 + /// + /// + + public static void InsertTrainRecordNoTrainingPlan(Model.Training_TestPlan getTestPlan) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.EduTrain_TrainRecord newTrainRecord = new Model.EduTrain_TrainRecord + { + TrainingId = SQLHelper.GetNewID(), + TrainingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainRecordMenuId, getTestPlan.ProjectId, Const.UnitId_CWCEC), + ProjectId = getTestPlan.ProjectId, + TrainTitle = getTestPlan.PlanName, + TrainContent = getTestPlan.PlanName, + TrainStartDate = getTestPlan.TestStartTime, + TeachHour = getTestPlan.Duration, + TrainEndDate = getTestPlan.TestEndTime, + TeachMan = UserService.GetUserNameByUserId(getTestPlan.PlanManId), + TeachAddress = getTestPlan.TestPalce, + Remark = "来源:考试计划", + TrainTypeId = Const.EntryTrainTypeId, + UnitIds = getTestPlan.UnitIds, + States = Const.State_2, + WorkPostIds = getTestPlan.WorkPostIds, + PlanId = getTestPlan.TestPlanId, + }; + newTrainRecord.CompileMan = newTrainRecord.TeachMan; + ///获取培训人员 + var getTestRecords = from x in db.Training_TestRecord + where x.TestPlanId == getTestPlan.TestPlanId + select x; + newTrainRecord.TrainPersonNum = getTestRecords.Count(); + ///新增培训记录 + db.EduTrain_TrainRecord.InsertOnSubmit(newTrainRecord); + db.SubmitChanges(); + + ////及格分数 + int passScore = 80; + var testRule = db.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + passScore = testRule.PassingScore; + } + + foreach (var item in getTestRecords) + { + var getItem = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.TestManId && x.CheckResult); + if (getItem == null) + { + + decimal gScores = item.TestScores ?? 0; + bool result = false; + if (gScores >= passScore) + { + result = true; + } + + Model.EduTrain_TrainRecordDetail newDetail = new Model.EduTrain_TrainRecordDetail + { + TrainDetailId = SQLHelper.GetNewID(), + TrainingId = newTrainRecord.TrainingId, + PersonId = item.TestManId, + CheckScore = gScores, + CheckResult = result, + }; + db.EduTrain_TrainRecordDetail.InsertOnSubmit(newDetail); + db.SubmitChanges(); + + ///// 培训考试 通过 更新卡号 + if (result) + { + var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == newDetail.PersonId); + if (getPerson != null && string.IsNullOrEmpty(getPerson.CardNo)) + { + getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitId(getPerson.UnitId)); + db.SubmitChanges(); + } + } + } + + ////增加一条编码记录 + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainRecordMenuId, newTrainRecord.ProjectId, null, newTrainRecord.TrainingId, newTrainRecord.TrainStartDate); + CommonService.btnSaveData(newTrainRecord.ProjectId, Const.ProjectTrainRecordMenuId, newTrainRecord.TrainingId, getTestPlan.PlanManId, true, newTrainRecord.TrainTitle, "../EduTrain/TrainRecordView.aspx?TrainingId={0}"); + } + } + } + #endregion } } diff --git a/SGGL/BLL/HSSE/EduTrain/TestPlanService.cs b/SGGL/BLL/HSSE/EduTrain/TestPlanService.cs index 90429d7f..dafd06de 100644 --- a/SGGL/BLL/HSSE/EduTrain/TestPlanService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TestPlanService.cs @@ -147,7 +147,7 @@ namespace BLL /// public static Model.Training_TestPlan GetTestPlanByPlanId(string planId) { - return Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == planId); + return Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == planId || x.TestPlanId ==planId); } } } diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs index 015c7065..b2ed5240 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using FineUIPro.Web.BoSheng; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -548,7 +549,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.Where(x => x.TrainingId == itemRecord.TrainingId); if (itemRecord.TrainPersonNum > getTrainRecordDetail.Count()) - { + { var getTrainingTasks = from x in Funs.DB.Training_Task where x.PlanId == itemRecord.PlanId select x; @@ -628,14 +629,36 @@ namespace FineUIPro.Web.HSSE.EduTrain Alert.ShowInTop("刷新完成!", MessageBoxIcon.Success); } - var getTestPlanStates = from x in Funs.DB.Training_TestPlan - join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId - where x.States == Const.State_3 && y.States == Const.State_2 - select x; - foreach (var item in getTestPlanStates) + var getTestPlans = from x in Funs.DB.Training_TestPlan + where x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3 + select x; + + var getTestPlanStates = from x in getTestPlans + join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId + where x.PlanId != null && y.States == Const.State_2 + select x; + if (getTestPlanStates.Count() > 0) { - ////TODO 讲培训计划 考试记录 写入到培训记录 - BLL. APITrainRecordService.InsertTrainRecord(item); + foreach (var item in getTestPlanStates) + { + ////TODO 讲培训计划 考试记录 写入到培训记录 + BLL.APITrainRecordService.InsertTrainRecord(item); + } + } + + var getTestPlanS = from x in getTestPlans + join y in Funs.DB.EduTrain_TrainRecord on x.TestPlanId equals y.PlanId into jonPerson + from y in jonPerson.DefaultIfEmpty() + where x.PlanId == null && y.TrainingId == null + orderby y.TrainStartDate + select x; + if (getTestPlanS.Count() > 0) + { + foreach (var item in getTestPlanS) + { + //// 将相关未做培训 但考试考生内容 写培训记录归档 + BLL.APITrainRecordService.InsertTrainRecordNoTrainingPlan(item); + } } } } diff --git a/SGGL/FineUIPro.Web/Login.aspx b/SGGL/FineUIPro.Web/Login.aspx index c099a13a..422ad4f8 100644 --- a/SGGL/FineUIPro.Web/Login.aspx +++ b/SGGL/FineUIPro.Web/Login.aspx @@ -140,11 +140,11 @@
-
忘记密码? -
+
--%>
diff --git a/SGGL/WebAPI/Controllers/HSSE/TestingController.cs b/SGGL/WebAPI/Controllers/HSSE/TestingController.cs index 320375dc..bab6c1bc 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestingController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestingController.cs @@ -298,7 +298,16 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - APITestRecordService.getTestRecordItemAnswerBySelectedItem(testRecordItemId, selectedItem); + if (!string.IsNullOrEmpty(testRecordItemId) && !string.IsNullOrEmpty(selectedItem)) + { + APITestRecordService.getTestRecordItemAnswerBySelectedItem(testRecordItemId, selectedItem); + } + else + { + responeData.code = 0; + responeData.message = "答题为空选项!"; + } + } catch (Exception ex) {