diff --git a/DataBase/版本日志/SGGLDB_V2025-02-17-geh.sql b/DataBase/版本日志/SGGLDB_V2025-02-17-geh.sql new file mode 100644 index 0000000..fae4d11 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-02-17-geh.sql @@ -0,0 +1,38 @@ +alter table dbo.Training_TestPlan add TrainTypeId nvarchar(50); +go + + +alter TABLE [dbo].[Training_CompanyTrainingItem]add + [TestTrainingIds] [nvarchar](max) NULL ; + +alter TABLE [dbo].[Training_CompanyTrainingItem]add + [LearningTime] [int] NULL ; + +alter TABLE [dbo].[Training_CompanyTrainingItem]add + [Durations] [float](53) NULL ; + +alter TABLE [dbo].[Training_TestRecord]add + [CompanyTrainingItemId] [nvarchar](50) NULL ; + +update sys_menu set IsUsed=0 where menuid='EF99E038-5A12-4E02-B925-6671F9AE16CA'; +update sys_menu set IsUsed=0 where menuid='10736CAC-A343-4D73-9D03-E6A3D1909A7B'; +update sys_menu set IsUsed=0 where menuid='6C314522-AF62-4476-893E-5F42C09C3077'; +update sys_menu set menuname='ѵ¼' where menuid='1182E353-FAB9-4DB1-A1EC-F41A00892128'; +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('ACF2CAB1-CE56-4CED-B252-692558F9E36F','ѵ¼','HSSE/EduTrain/Trainingrecords.aspx',50,'6A0506EB-05CE-4BB3-9BA9-866389F01E1C','Menu_HSSE',0,1,1); +go + + + + + + + + + + + + + + + diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 6ad72c7..971e790 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -476,73 +476,159 @@ namespace BLL /// 培训岗位ID /// 培训类型ID /// - public static List getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId) + public static List getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId,string InTime,string strParam) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { + DateTime inDateTime=DateTime.Now; + if (!string.IsNullOrEmpty(InTime)&&!"null".Equals(InTime)) + { + inDateTime = DateTime.Parse(InTime); + } + List unitIdList = Funs.GetStrListByStr(unitIds, ','); - var getPersons = from x in db.View_SitePerson_Person - where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true + var getPersons = (from x in db.View_SitePerson_Person + where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true &&(string.IsNullOrEmpty(strParam)||x.PersonName.Contains(strParam)) && (string.IsNullOrEmpty(InTime) || x.InTime < inDateTime) && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now) select new Model.PersonItem - { - PersonId = x.PersonId, - CardNo = x.CardNo, - PersonName = x.PersonName, - SexName = x.SexName, - IdentityCard = x.IdentityCard, - Address = x.Address, - ProjectId = x.ProjectId, - ProjectCode = x.ProjectCode, - ProjectName = x.ProjectName, - UnitId = x.UnitId, - UnitCode = x.UnitCode, - UnitName = x.UnitName, - TeamGroupId = x.TeamGroupId, - TeamGroupName = x.TeamGroupName, - WorkPostId = x.WorkPostId, - WorkPostName = x.WorkPostName, - InTime = string.Format("{0:yyyy-MM-dd}", x.InTime), - OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime), - OutResult = x.OutResult, - Telephone = x.Telephone, - PhotoUrl = x.PhotoUrl, - DepartName = x.DepartName, - }; + { + PersonId = x.PersonId, + CardNo = x.CardNo, + PersonName = x.PersonName, + SexName = x.SexName, + IdentityCard = x.IdentityCard, + Address = x.Address, + ProjectId = x.ProjectId, + ProjectCode = x.ProjectCode, + ProjectName = x.ProjectName, + UnitId = x.UnitId, + UnitCode = x.UnitCode, + UnitName = x.UnitName, + TeamGroupId = x.TeamGroupId, + TeamGroupName = x.TeamGroupName, + WorkPostId = x.WorkPostId, + WorkPostName = x.WorkPostName, + InTime = string.Format("{0:yyyy-MM-dd}", x.InTime), + OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime), + OutResult = x.OutResult, + Telephone = x.Telephone, + PhotoUrl = x.PhotoUrl, + DepartName = x.DepartName, + }).ToList(); + + + + if (!string.IsNullOrEmpty(workPostIds)) { List workPostIdList = Funs.GetStrListByStr(workPostIds, ','); - getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)); + getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)).ToList(); + } + if (!string.IsNullOrEmpty(trainTypeId) &&trainTypeId == Const.SpecialSafeTrainId)//专项安全培训 + { + var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList(); + getPersons = getPersons.Where(x => ids.Contains(x.WorkPostId)).ToList(); } - List getTrainPersonList = new List(); var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId); - if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false)) - { - foreach (var item in getPersons) - { - var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail - join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId - where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId - select x).FirstOrDefault(); - if (getTrainPersonIdList1 == null) - { - var getTrainPersonIdList2 = (from x in db.Training_Task - join y in db.Training_Plan on x.PlanId equals y.PlanId - where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId - select x).FirstOrDefault(); - if (getTrainPersonIdList2 == null) - { - getTrainPersonList.Add(item); - } - } - } - return getTrainPersonList; - } - else - { - return getPersons.ToList(); - } + 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; + } + } + foreach (var item in getPersons) + { + var getTrainPersonIdList3 = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + where x.TestScores > score + select x).FirstOrDefault(); + if (getTrainPersonIdList3 != null) + { + continue; + } + var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail + join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId + select x).FirstOrDefault(); + if (getTrainPersonIdList1 == null) + { + var getTrainPersonIdList2 = (from x in db.Training_Task + join y in db.Training_Plan on x.PlanId equals y.PlanId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId + + select x).FirstOrDefault(); + if (getTrainPersonIdList2 == null) + { + getTrainPersonList.Add(item); + } + } + } + return getTrainPersonList; + } + else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员 + { + foreach (var item in getPersons) + { + //int score = 80; + //var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + //if (sysTestRule != null) + //{ + // if (sysTestRule.PassingScore > 0) + // { + // score = sysTestRule.PassingScore; + // } + //} + //var getTrainPersonIdList2 = (from x in db.Training_TestRecord + // join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + // where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + // where x.TestScores > score + // select x).FirstOrDefault(); + //if (getTrainPersonIdList2 != null) + //{ + // continue; + //} + getTrainPersonList.Add(item); + } + return getTrainPersonList; + } + //else if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))//重复的 过滤人员 + //{ + // int score = 80; + // var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + // if (sysTestRule != null) + // { + // if (sysTestRule.PassingScore > 0) + // { + // score = sysTestRule.PassingScore; + // } + // } + // foreach (var item in getPersons) + // { + + // var getTrainPersonIdList2 = (from x in db.Training_TestRecord + // join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + // where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + // where x.TestScores > score + // select x).FirstOrDefault(); + // if (getTrainPersonIdList2 != null) + // { + // continue; + // } + // getTrainPersonList.Add(item); + // } + // return getTrainPersonList; + //} + else + { + return getPersons.ToList(); + } } } #endregion diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 5175135..8504eaf 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -6233,6 +6233,10 @@ namespace BLL public const string InterFaceSetMenuId = "FFD221D7-AE05-447F-8727-80058A04F401"; public const string InterFaceTaskMenuId = "FFD221D7-AE05-447F-8727-80058A04F402"; public const string IFLogListMenuId = "FFD221D7-AE05-447F-8727-80058A04F404"; + /// + /// 专项安全培训 id + /// + public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18"; #endregion #region 数据同步状态 diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 6477a1e..f4b84e4 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1875,6 +1875,7 @@ + @@ -12733,6 +12734,8 @@ TaskNoticeEdit.aspx + + TrainTestRecordEdit.aspx ASPXCodeBehind @@ -19573,7 +19576,7 @@ - +