diff --git a/DataBase/版本日志/SGGLDB_V2026-04-15-gf.sql b/DataBase/版本日志/SGGLDB_V2026-04-15-gf.sql new file mode 100644 index 00000000..5176b63d --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-04-15-gf.sql @@ -0,0 +1,104 @@ + +ALTER VIEW [dbo].[View_SitePerson_Person] +AS +/*ֳԱͼ*/ +SELECT SitePerson.ProjectId, + Project.ProjectCode, + Project.ProjectName, + SitePerson.SitePersonId, + persons.PersonId, + SitePerson.CardNo, + Persons.PersonName, + Persons.Sex, + (Case Persons.Sex WHEN '1' THEN '' WHEN '2' THEN 'Ů' ELSE '' END) AS SexName, + Persons.IdentityCard, + Persons.Address, + SitePerson.UnitId, + Persons.DepartId, + Persons.Birthday, + SitePerson.TeamGroupId, + SitePerson.WorkAreaId, + SitePerson.WorkPostId, + SitePerson.InTime, + SitePerson.OutTime, + SitePerson.OutResult, + Persons.Telephone, + Persons.PositionId, + Persons.PostTitleId, + Persons.PhotoUrl, + Unit.UnitCode, + Unit.UnitName, + TeamGroup.TeamGroupName, + Post.WorkPostName, + Position.PositionName, + Title.PostTitleName, + Depart.DepartName, + Post.PostType, + Post.IsHsse, + (SELECT COUNT(*) FROM EduTrain_TrainRecordDetail T + LEFT JOIN EduTrain_TrainRecord AS E ON T.TrainingId=E.TrainingId + WHERE T.PersonId=SitePerson.PersonId AND E.ProjectId=SitePerson.ProjectId AND T.CheckResult=1) AS TrainCount, + (SELECT COUNT(*) FROM Training_TestRecord R + WHERE R.TestManId=SitePerson.PersonId AND R.ProjectId=SitePerson.ProjectId and R.TestScores > ISNULL((SELECT TOP 1 PassingScore FROM Sys_TestRule),60)) AS TrainCount1, + (SELECT COUNT(*) FROM Training_TestRecord R1 + left join Training_TestPlan p1 on p1.TestPlanId=R1.TestPlanId + left join Training_Plan p2 on p2.PlanId=p1.PlanId + WHERE R1.TestManId=SitePerson.PersonId AND R1.ProjectId=SitePerson.ProjectId and R1.TestScores > ISNULL((SELECT TOP 1 PassingScore FROM Sys_TestRule),60) and p2.TrainTypeId='8920c9cc-fa92-49b2-9493-775a55da27bb' and R1.TestStartTime>=SitePerson.InTime) AS TrainCount2, --볡볡ѵԺϸ + SitePerson.AuditorId, + Persons.PersonName AS AuditorName, + SitePerson.AuditorDate, + Persons.IDCardUrl, + Persons.IsForeign, + case when Persons.IsForeign=1 then '' else '' end as IsForeignStr, + Persons.IdcardType, + BasicData1.dictName as IdcardTypeName, + Persons.IdcardStartDate, + Persons.IdcardEndDate, + Persons.IdcardForever, + case when Persons.IdcardForever='Y' then '' else '' end as IdcardForeverStr, + Persons.PoliticsStatus, + BasicData2.dictName as PoliticsStatusName, + Persons.IdcardAddress, + Persons.Nation, + BasicData3.dictName as NationName, + Persons.EduLevel, + BasicData4.dictName as EduLevelName, + Persons.MaritalStatus, + BasicData5.dictName as MaritalStatusName, + Persons.CountryCode, + Country.cname as CountryName, + Persons.ProvinceCode, + City.cname as ProvinceName, + Persons.PersonType, + (case when Persons.PersonType='2' then 'Ƹ' when Persons.PersonType='3' then '' else 'Ա' end) as IsOutsideStr, + --WorkArea.UnitWorkCode AS WorkAreaCode, + WorkAreaCode= STUFF((SELECT ',' + UnitWorkCode FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +SitePerson.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''), + --WorkArea.UnitWorkName AS WorkAreaName + WorkAreaName= STUFF((SELECT ',' + UnitWorkName FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +SitePerson.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''), + SitePerson.RealNameAddTime, + SitePerson.RealNameUpdateTime, + Persons.HeadImage, + SitePerson.States, + Persons.YunMouState +FROM SitePerson_Person AS SitePerson +LEFT JOIN Person_Persons AS Persons ON SitePerson.PersonId=Persons.PersonId +LEFT JOIN Base_Project AS Project ON Project.ProjectId=SitePerson.ProjectId +LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = SitePerson.UnitId +LEFT JOIN ProjectData_TeamGroup AS TeamGroup ON TeamGroup.TeamGroupId=SitePerson.TeamGroupId +LEFT JOIN Base_WorkPost AS Post ON Post.WorkPostId = SitePerson.WorkPostId +LEFT JOIN Base_Position AS Position ON Position.PositionId = Persons.PositionId +Left JOIN Base_PostTitle AS Title ON Title.PostTitleId = Persons.PostTitleId +Left JOIN Base_Depart AS Depart ON Depart.DepartId = Persons.DepartId +Left JOIN RealName_BasicData AS BasicData1 ON BasicData1.dictCode = Persons.IdcardType +Left JOIN RealName_BasicData AS BasicData2 ON BasicData2.dictCode = Persons.PoliticsStatus +Left JOIN RealName_BasicData AS BasicData3 ON BasicData3.dictCode = Persons.Nation +Left JOIN RealName_BasicData AS BasicData4 ON BasicData4.dictCode = Persons.EduLevel +Left JOIN RealName_BasicData AS BasicData5 ON BasicData5.dictCode = Persons.MaritalStatus +Left JOIN RealName_Country AS Country ON Country.CountryId = Persons.CountryCode +Left JOIN RealName_City AS City ON City.provinceCode = Persons.ProvinceCode and City.CountryId = Persons.CountryCode + + + +GO + + diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 79cf2841..276579bd 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -566,7 +566,7 @@ namespace BLL { var getPersons = from x in db.View_SitePerson_Person - where x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1 + where x.ProjectId == projectId select new Model.PersonItem { SitePersonId = x.SitePersonId, diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 5c0db85a..2e2d4e17 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -5358,6 +5358,9 @@ namespace BLL /// public const string CQMS_MeetingMenuId = "30754DF1-CB18-4F53-BB66-2B2A398D7180"; - + /// + /// 质量会议 + /// + public const string EntryEducationTrainTypeId = "8920c9cc-fa92-49b2-9493-775a55da27bb"; } } \ No newline at end of file diff --git a/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs b/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs index c2ed027b..8426c8a6 100644 --- a/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs @@ -197,5 +197,24 @@ namespace BLL } return icount; } + + /// + /// 根据人员id、日期获取入场教育合格考试记录 + /// + /// + /// + public static Model.Training_TestRecord GetOKTestRecordByPersonIdAndDate(string testManId, DateTime? date) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var testRecord = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + join z in db.Training_Plan on y.PlanId equals z.PlanId + where x.TestManId == testManId && x.TestStartTime >= date && x.TestScores >= 60 + && z.TrainTypeId == BLL.Const.EntryEducationTrainTypeId + select x).FirstOrDefault(); + return testRecord; + } + } } } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs index f111e53a..50156447 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs @@ -244,7 +244,7 @@ Where ProjectId=@ProjectId "; } if (this.ckTrain.Checked) { - strSql += " AND (TrainCount =0 AND TrainCount1 =0)"; + strSql += " AND ((TrainCount =0 AND TrainCount1 =0) || TrainCount2=0)"; } if (this.ckIsUsed.Checked) { diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index cf54f5d6..48fe55f9 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -319096,6 +319096,8 @@ namespace Model private System.Nullable _TrainCount1; + private System.Nullable _TrainCount2; + private string _AuditorId; private string _AuditorName; @@ -319728,6 +319730,22 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainCount2", DbType="Int")] + public System.Nullable TrainCount2 + { + get + { + return this._TrainCount2; + } + set + { + if ((this._TrainCount2 != value)) + { + this._TrainCount2 = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AuditorId", DbType="NVarChar(50)")] public string AuditorId { diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 06edabf8..35243ee1 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -436,7 +436,7 @@ namespace WebAPI.Controllers /// /// /// - public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, string name, int pageIndex, string startDate, string endDate,string isRepeat) + public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, string name, int pageIndex, string startDate, string endDate, string isRepeat) { var responeData = new Model.ResponeData(); try @@ -546,7 +546,20 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - SitePerson_PersonService.SetSitePerson_PersonStates(sitePersonId, states, DateTime.Now); + var getSitePerson = SitePerson_PersonService.GetSitePersonById(sitePersonId); + if (getSitePerson != null) + { + var testRecord = BLL.TestRecordService.GetOKTestRecordByPersonIdAndDate(getSitePerson.PersonId, getSitePerson.InTime); + if (testRecord != null) + { + SitePerson_PersonService.SetSitePerson_PersonStates(sitePersonId, states, DateTime.Now); + } + else + { + responeData.code = 0; + responeData.message = "入场教育考试未合格,无法审核入场!"; + } + } } catch (Exception ex) {