diff --git a/DataBase/版本日志/SGGLDB_CD_V2024-05-09-001.sql b/DataBase/版本日志/SGGLDB_CD_V2024-05-09-001.sql new file mode 100644 index 00000000..1f2333b2 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_CD_V2024-05-09-001.sql @@ -0,0 +1,6 @@ +alter TABLE [dbo].[Training_CompanyTrainingItem]add + [TestTrainingIds] [nvarchar](max) NULL + + + alter TABLE [dbo].[Training_TestRecord]add + [CompanyTrainingItemId] [nvarchar](50) NULL \ No newline at end of file diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 63380cdf..e8d09fa8 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -658,7 +658,7 @@ namespace BLL } List getTrainPersonList = new List(); var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId); - if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false)) + if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false)) { int score = 80; var sysTestRule = db.Sys_TestRule.FirstOrDefault(); @@ -699,7 +699,7 @@ namespace BLL } return getTrainPersonList; } - else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat == true)//重复的 过滤人员 + else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员 { foreach (var item in getPersons) { diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 1496eb17..18d43466 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -263,6 +263,164 @@ namespace BLL return testRecordId; } #endregion + + public static string CreateTestRecordItem(Model.Training_CompanyTrainingItem getCompanyTraining, string testRecordId, Model.SitePerson_Person person, Model.Sys_User user) + { + + + + + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var trainingIds = getCompanyTraining.TestTrainingIds.Split(','); + var testTrainings= db.Training_TestTraining.Where(x => trainingIds.Contains(x.TrainingId)); + var getTestRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecordId); + if (getTestRecord != null && !getTestRecord.TestStartTime.HasValue) + { + ////考试时长 + getTestRecord.Duration =120; + getTestRecord.TestStartTime = DateTime.Now; + db.SubmitChanges(); + } + + ////当前人考试记录 未加入考试计划的 当考试开始扫码时 不允许再参与考试 + var item = db.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordId == getTestRecord.TestRecordId); + if (item == null) + { + List getTestTrainingItemList = new List(); + //var testPlanTrainings = from x in db.Training_TestPlanTraining + // where x.TestPlanId == getTestPlan.TestPlanId + // select x; + //// 计划考试中单选、多选、判断题总数 + var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + + int sumTestType1Count = 0;// testPlanTrainings.Sum(x => x.TestType1Count) ?? 0; + int sumTestType2Count = 0;//testPlanTrainings.Sum(x => x.TestType2Count) ?? 0; + int sumTestType3Count = 0;//testPlanTrainings.Sum(x => x.TestType3Count) ?? 0; + if (sysTestRule != null) + { + + sumTestType1Count = sysTestRule.SCount; + sumTestType2Count = sysTestRule.MCount; + sumTestType3Count = sysTestRule.JCount; + } + ////获取类型下适合岗位试题集合 + List getTestTrainingItemALLs; + string WorkPostId = ""; + string DepartId = ""; + if (person != null) + { + WorkPostId = person.WorkPostId; + } + if (user != null) + { + DepartId = user.DepartId; + } + + getTestTrainingItemALLs = (from x in db.Training_TestTrainingItem + where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId)) + select x).ToList(); + foreach (var itemT in testTrainings) + { + //// 获取类型下的题目 + var getTestTrainingItems = getTestTrainingItemALLs.Where(x => x.TrainingId == itemT.TrainingId).ToList(); + if (getTestTrainingItems.Count() > 0) + { + ////单选题 + var getSItem = getTestTrainingItems.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid()); + if (getSItem.Count() > 0) + { + getTestTrainingItemList.AddRange(getSItem); + } + ///多选题 + var getMItem = getTestTrainingItems.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid()); + if (getMItem.Count() > 0) + { + getTestTrainingItemList.AddRange(getMItem); + } + ///判断题 + var getJItem = getTestTrainingItems.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid()); + if (getJItem.Count() > 0) + { + getTestTrainingItemList.AddRange(getJItem); + } + } + } + //// 获取得到的单选题、多选题、判断题 数量 + int getDiffTestType1Count = sumTestType1Count - getTestTrainingItemList.Where(x => x.TestType == "1").Count(); + int getDiffTestType2Count = sumTestType2Count - getTestTrainingItemList.Where(x => x.TestType == "2").Count(); + int getDiffTestType3Count = sumTestType3Count - getTestTrainingItemList.Where(x => x.TestType == "3").Count(); + if (getDiffTestType1Count > 0 || getDiffTestType2Count > 0 || getDiffTestType3Count > 0) + { + var getTestTrainingItemNulls = getTestTrainingItemALLs.Where(x => x.WorkPostIds == null).ToList(); + if (getTestTrainingItemNulls.Count() > 0) + { + /// 通用且未选择的题目 + var getTestTrainingItemDiffs = getTestTrainingItemNulls.Except(getTestTrainingItemList).ToList(); + ////单选题 + if (getDiffTestType1Count > 0) + { + var getSItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType1Count); + if (getSItemD.Count() > 0) + { + getTestTrainingItemList.AddRange(getSItemD); + } + } + ///多选题 + if (getDiffTestType2Count > 0) + { + var getMItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType2Count); + if (getMItemD.Count() > 0) + { + getTestTrainingItemList.AddRange(getMItemD); + } + } + ///判断题 + if (getDiffTestType3Count > 0) + { + var getJItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType3Count); + if (getJItemD.Count() > 0) + { + getTestTrainingItemList.AddRange(getJItemD); + } + } + } + } + + if (getTestTrainingItemList.Count() > 0) + { + var getItems = from x in getTestTrainingItemList + select new Model.Training_TestRecordItem + { + TestRecordItemId = SQLHelper.GetNewID(), + TestRecordId = getTestRecord.TestRecordId, + TrainingItemName = x.TrainingItemName, + TrainingItemCode = x.TrainingItemCode, + Abstracts = x.Abstracts, + AttachUrl = x.AttachUrl, + TestType = x.TestType, + AItem = x.AItem, + BItem = x.BItem, + CItem = x.CItem, + DItem = x.DItem, + EItem = x.EItem, + AnswerItems = x.AnswerItems, + Score = x.TestType == "1" ? sysTestRule.SValue : (x.TestType == "2" ? sysTestRule.MValue : sysTestRule.JValue), + }; + + db.Training_TestRecordItem.InsertAllOnSubmit(getItems); + db.SubmitChanges(); + BLL.RedisHelper redis = new BLL.RedisHelper(); + redis.SetObjString(testRecordId, getItems); + } + } + } + return testRecordId; + } + + + + #region 根据PersonId、TestPlanId生成试卷 扫码生成试卷 /// /// 根据PersonId、TestPlanId生成试卷 扫码生成试卷 diff --git a/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs b/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs index e4b42307..7abbd0a4 100644 --- a/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs +++ b/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs @@ -33,8 +33,9 @@ namespace BLL newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl; newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan; newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate; - newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; - db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem); + newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; + newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds; + db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem); db.SubmitChanges(); } @@ -52,8 +53,11 @@ namespace BLL newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl; newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan; newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate; - newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; - db.SubmitChanges(); + newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; + newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds; + + + db.SubmitChanges(); } } diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx index 585817f2..b01b50fa 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx @@ -44,6 +44,20 @@ + + + + + + + + + + + + @@ -72,4 +86,46 @@ + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs index c64f6f52..89134c61 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs @@ -2,6 +2,8 @@ using System.Linq; using Model; using BLL; +using System.Collections.Generic; +using Microsoft.Office.Interop.Excel; namespace FineUIPro.Web.HSSE.EduTrain { @@ -46,7 +48,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { this.GetButtonPower(); btnClose.OnClientClick = ActiveWindow.GetHideReference(); - + BoundTree(treeTestTraining.Nodes, "0"); this.CompanyTrainingItemId = Request.QueryString["CompanyTrainingItemId"]; this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"]; if (!string.IsNullOrEmpty(this.CompanyTrainingItemId)) @@ -59,6 +61,21 @@ namespace FineUIPro.Web.HSSE.EduTrain txtCompanyTrainingItemName.Text = q.CompanyTrainingItemName; txtCompileMan.Text = q.CompileMan; hdCompileMan.Text = q.CompileMan; + if (!string.IsNullOrEmpty(q.TestTrainingIds)) + { + ddTestTraining.Values = q.TestTrainingIds.Split(','); + string text = ""; + var trains = Funs.DB.Training_TestTraining.ToList(); + foreach (var ids in ddTestTraining.Values) + { + var t = trains.FirstOrDefault(x => x.TrainingId == ids); + if (t != null) + { + text += "[" + t.TrainingCode + "]" + t.TrainingName + ","; + } + } + ddTestTraining.Text = text.TrimEnd(new char[] { ',' }); + } if (q.LearningTime.HasValue) { txtLearningTime.Text = (q.LearningTime.Value/60).ToString(); @@ -81,10 +98,49 @@ namespace FineUIPro.Web.HSSE.EduTrain txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); } } + + } } #endregion + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_TestTraining + where x.SupTrainingId == parentId + orderby x.TrainingCode + select x).ToList(); + } + private void BoundTree(TreeNodeCollection nodes, string parentId) + { + var dt = GetNewTraining(parentId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + string name = dr.TrainingName; + if (!string.IsNullOrEmpty(dr.TrainingCode)) + { + name = "[" + dr.TrainingCode + "]" + dr.TrainingName; + } + tn = new TreeNode + { + Text = name, + NodeID = dr.TrainingId, + EnableClickEvent = true, + ToolTip = dr.TrainingName + }; + nodes.Add(tn); + ///是否存在下级节点 + var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID); + if (sup != null) + { + BoundTree(tn.Nodes, tn.NodeID); + } + } + } + } #region 保存 /// /// 保存数据 @@ -97,7 +153,11 @@ namespace FineUIPro.Web.HSSE.EduTrain CompanyTrainingItemName = this.txtCompanyTrainingItemName.Text.Trim(), CompileMan = hdCompileMan.Text.Trim() }; - if (!string.IsNullOrEmpty(txtLearningTime.Text)) + if (ddTestTraining.Values != null && ddTestTraining.Values.Length > 0) + { + newCompanyTrainItem.TestTrainingIds = string.Join(",", ddTestTraining.Values); + } + if (!string.IsNullOrEmpty(txtLearningTime.Text)) { newCompanyTrainItem.LearningTime = int.Parse(txtLearningTime.Text)*60; } diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs index 4ee09095..0cba0240 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs @@ -11,151 +11,169 @@ namespace FineUIPro.Web.HSSE.EduTrain { - public partial class CompanyTrainingItemSave - { + public partial class CompanyTrainingItemSave + { - /// - /// form1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlForm form1; + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; - /// - /// PageManager1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.PageManager PageManager1; + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; - /// - /// SimpleForm1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Form SimpleForm1; + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; - /// - /// txtCompanyTrainingItemCode 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtCompanyTrainingItemCode; + /// + /// txtCompanyTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemCode; - /// - /// txtCompanyTrainingItemName 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtCompanyTrainingItemName; + /// + /// txtCompanyTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemName; - /// - /// txtCompileMan 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtCompileMan; + /// + /// txtCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompileMan; - /// - /// txtCompileDate 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtCompileDate; + /// + /// txtCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCompileDate; - /// - /// txtLearningTime 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox txtLearningTime; + /// + /// txtLearningTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtLearningTime; - /// - /// Toolbar1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar1; + /// + /// ddTestTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox ddTestTraining; - /// - /// lbTemp 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Label lbTemp; + /// + /// treeTestTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree treeTestTraining; - /// - /// btnAttachUrl 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnAttachUrl; + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; - /// - /// ToolbarFill1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.ToolbarFill ToolbarFill1; + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; - /// - /// btnSave 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnSave; + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; - /// - /// btnClose 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnClose; + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; - /// - /// hdCompileMan 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.HiddenField hdCompileMan; + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; - /// - /// WindowAtt 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window WindowAtt; - } + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } } diff --git a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx index 305dd1a9..a3f06880 100644 --- a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx @@ -119,6 +119,7 @@ // 返回false,来阻止浏览器右键菜单 function onTreeNodeContextMenu(event, nodeId) { + debugger currentNodeId = nodeId; F(menuID).show(); return false; diff --git a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs index 05b41163..b88dde0c 100644 --- a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs @@ -267,7 +267,7 @@ namespace FineUIPro.Web.ProjectData /// protected void btnMenuAdd_Click(object sender, EventArgs e) { - if (this.trProjects.SelectedNode != null) + if (this.trProjects.SelectedNode != null && this.trProjects.SelectedNode.CommandName == "project") { if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd)) { @@ -289,6 +289,10 @@ namespace FineUIPro.Web.ProjectData ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } + else if (this.trProjects.SelectedNode != null && this.trProjects.SelectedNode.CommandName != "project") + { + ShowNotify("装置只能录入一级!", MessageBoxIcon.Warning); + } else { ShowNotify("请选择树节点!", MessageBoxIcon.Warning); diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs index 64566ca5..a8341b8b 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs @@ -34,14 +34,31 @@ namespace FineUIPro.Web.SysManage // this.btnArrowRefresh.Hidden = false; //} /// TAB1加载页面方法 - this.LoadTab1Data(); + try + { + this.LoadTab1Data(); + } + catch (Exception e1) { } + ConstValue.InitConstValueDropDownList(this.drpSuperMenu, this.rblMenuType.SelectedValue, true); /// TAB2加载页面方法 - this.LoadTab2Data(); + try + { + this.LoadTab2Data(); + } + catch (Exception e1) { } /// TAB2加载页面方法 - this.LoadTab3Data(); + try + { + this.LoadTab3Data(); + } + catch (Exception e1) { } ///产值 - this.LoadTab4Data(); + try + { + this.LoadTab4Data(); + } + catch (Exception e1) { } } } #region 多附件转换 diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 1cda58c4..6a5ef312 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -22,7 +22,7 @@ namespace Model using System; - public partial class SGGLDB : System.Data.Linq.DataContext + public partial class SGGLDB : System.Data.Linq.DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); @@ -365195,6 +365195,8 @@ namespace Model private System.Nullable _LearningTime; + private string _TestTrainingIds; + private EntitySet _Person_TrainingTask; private EntityRef _Training_CompanyTraining; @@ -365221,6 +365223,8 @@ namespace Model partial void OnWorkPostIdsChanged(); partial void OnLearningTimeChanging(System.Nullable value); partial void OnLearningTimeChanged(); + partial void OnTestTrainingIdsChanging(string value); + partial void OnTestTrainingIdsChanged(); #endregion public Training_CompanyTrainingItem() @@ -365414,6 +365418,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestTrainingIds", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string TestTrainingIds + { + get + { + return this._TestTrainingIds; + } + set + { + if ((this._TestTrainingIds != value)) + { + this.OnTestTrainingIdsChanging(value); + this.SendPropertyChanging(); + this._TestTrainingIds = value; + this.SendPropertyChanged("TestTrainingIds"); + this.OnTestTrainingIdsChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Person_TrainingTask_Training_CompanyTrainingItem", Storage="_Person_TrainingTask", ThisKey="CompanyTrainingItemId", OtherKey="CompanyTrainingItemId", DeleteRule="NO ACTION")] public EntitySet Person_TrainingTask { @@ -369018,6 +369042,8 @@ namespace Model private string _Fingerprint; + private string _CompanyTrainingItemId; + private EntityRef _Training_TestPlan; private EntitySet _Training_TestRecordItem; @@ -369052,6 +369078,8 @@ namespace Model partial void OnSignatureChanged(); partial void OnFingerprintChanging(string value); partial void OnFingerprintChanged(); + partial void OnCompanyTrainingItemIdChanging(string value); + partial void OnCompanyTrainingItemIdChanged(); #endregion public Training_TestRecord() @@ -369325,6 +369353,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemId", DbType="NVarChar(50)")] + public string CompanyTrainingItemId + { + get + { + return this._CompanyTrainingItemId; + } + set + { + if ((this._CompanyTrainingItemId != value)) + { + this.OnCompanyTrainingItemIdChanging(value); + this.SendPropertyChanging(); + this._CompanyTrainingItemId = value; + this.SendPropertyChanged("CompanyTrainingItemId"); + this.OnCompanyTrainingItemIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestRecord_Training_TestPlan", Storage="_Training_TestPlan", ThisKey="TestPlanId", OtherKey="TestPlanId", IsForeignKey=true)] public Training_TestPlan Training_TestPlan { diff --git a/SGGL/WebAPI/Controllers/HSSE/TestPlanController.cs b/SGGL/WebAPI/Controllers/HSSE/TestPlanController.cs index e970f786..b6d9847e 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestPlanController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestPlanController.cs @@ -308,5 +308,59 @@ namespace WebAPI.Controllers return responeData; } #endregion + + + + public Model.ResponeData getTrainingPlanTestRecordItemByTestPlanIdPersonId(string companyTrainingItemId, string personId,string projectId) + { + var responeData = new Model.ResponeData(); + try + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + var getCompanyTraining = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == companyTrainingItemId ); + if (getCompanyTraining != null) + { + var user = db.Sys_User.FirstOrDefault(x => x.UserId == personId); + Model.SitePerson_Person person; + if (user != null) + { + person = db.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == projectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId); + } + else + { + person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId && e.ProjectId == projectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId); + + } + if (person != null || user != null) + { + var testRecord = db.Training_TestRecord.FirstOrDefault(x => x.CompanyTrainingItemId == getCompanyTraining.CompanyTrainingItemId && x.TestManId == personId && !x.TestEndTime.HasValue); + if (testRecord != null) + { + string testRecordId = APITestRecordService.CreateTestRecordItem(getCompanyTraining, testRecord.TestRecordId, person, user); + responeData.code = 2; + responeData.data = new { testRecordId }; + } + else if (person != null) + { + var testRecord2 = db.Training_TestRecord.FirstOrDefault(x => x.CompanyTrainingItemId == getCompanyTraining.CompanyTrainingItemId && x.TestManId == person.PersonId && !x.TestEndTime.HasValue); + if (testRecord2 != null) + { + string testRecordId = APITestRecordService.CreateTestRecordItem(getCompanyTraining, testRecord2.TestRecordId, person, user); + responeData.code = 2; + responeData.data = new { testRecordId }; + } + } + } + } + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } } }