From 1cb6714d67686938d5dd5cd9cdeae6b53d116979 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Wed, 17 Jul 2024 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataBase/版本日志/SGGLDB_WH_2024-7-15-wq.sql | 2 +- .../ZHGL/RealName/RealNameMonitorService.cs | 69 +++++++++++++- SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user | 2 +- SGGL/FineUIPro.Web/Global.asax.cs | 11 +++ .../JDGL/Check/MonthPlan.aspx.cs | 3 +- SGGL/FineUIPro.Web/Web.config | 2 +- SGGL/Model/Model.cs | 93 +++++++++++++++++++ SGGL/WebAPI/WebAPI.csproj.user | 2 +- 8 files changed, 176 insertions(+), 8 deletions(-) diff --git a/DataBase/版本日志/SGGLDB_WH_2024-7-15-wq.sql b/DataBase/版本日志/SGGLDB_WH_2024-7-15-wq.sql index e87af813..dad9f40f 100644 --- a/DataBase/版本日志/SGGLDB_WH_2024-7-15-wq.sql +++ b/DataBase/版本日志/SGGLDB_WH_2024-7-15-wq.sql @@ -1,6 +1,6 @@ --󼶱 alter table Control_PointCropping add MaxLevel int null; - +GO truncate table Control_PointCropping INSERT [dbo].[Control_PointCropping] ([ControlId], [ProjectId], [ParentId], [ControlCode], [ControlLevel], [PlanId], [PlanTypeId], [SubItemsId], [DetectionItems], [BasedCriterion], [QualityRecordName], [RecordNumber], [Partition], [Subcontractors], [FiveRings], [Supervision], [Owner], [Remark], [AddUser], [OperateTime], [States], [Sort], [MaxLevel]) VALUES (N'0098CE85-B091-4985-8570-CEEC6D73B10F', N'', N'E9AC9563-E338-48B7-867D-488222AD0557', N'3', 2, N'E9AC9563-E338-48B7-867D-488222AD0557', N'0098CE85-B091-4985-8570-CEEC6D73B10F', N'', N'װװ', N'GB50210-2018', NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'C', N'C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0', CAST(N'2024-07-10T23:33:28.320' AS DateTime), 0, 410, 5) INSERT [dbo].[Control_PointCropping] ([ControlId], [ProjectId], [ParentId], [ControlCode], [ControlLevel], [PlanId], [PlanTypeId], [SubItemsId], [DetectionItems], [BasedCriterion], [QualityRecordName], [RecordNumber], [Partition], [Subcontractors], [FiveRings], [Supervision], [Owner], [Remark], [AddUser], [OperateTime], [States], [Sort], [MaxLevel]) VALUES (N'00B24696-64E9-49F2-BDF8-16B73BD05748', N'', N'B32DAB39-7FD3-40F5-B455-0EEEF3BE0B19', N'7.2.2', 4, N'E9AC9563-E338-48B7-867D-488222AD0557', N'B32DAB39-7FD3-40F5-B455-0EEEF3BE0B19', N'00B24696-64E9-49F2-BDF8-16B73BD05748', N'֧()ܼϼ', NULL, NULL, NULL, N'C', NULL, NULL, NULL, NULL, N'GGG2', N'C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0', CAST(N'2024-07-10T23:33:28.320' AS DateTime), 0, 569, 5) diff --git a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs index 35f5cd9f..85217206 100644 --- a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs +++ b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs @@ -42,6 +42,28 @@ namespace BLL } } + public static void StartUpdateSitePerson() + { + //var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(); + //if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue) + //{ + // adTimeJ = getSynchroSet.Intervaltime.Value; + //} + if (messageTimer != null) + { + messageTimer.Stop(); + messageTimer.Dispose(); + messageTimer = null; + } + messageTimer = new Timer + { + AutoReset = true + }; + messageTimer.Elapsed += new ElapsedEventHandler(UpdateSitePerson); + messageTimer.Interval = 1000 * 60 * 60 * 24;// 60分钟 60000 * adTimeJ; + messageTimer.Start(); + } + /// /// 流程确认 定时执行 系统启动5分钟 /// @@ -75,6 +97,49 @@ namespace BLL ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); } } + + /// + /// 流程确认 定时执行 系统启动5分钟 + /// + /// Timer组件 + /// 事件参数 + private static void UpdateSitePerson(object sender, ElapsedEventArgs e) + { + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var persons = from x in db.SitePerson_Person + join y in db.Base_Project on x.ProjectId equals y.ProjectId + join z in db.RealName_Project on y.JTProjectCode equals z.ProCode + join p in db.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId } + join v in db.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId + join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId + where z.JTproCode != null && x.IsCardNoOK == true && v.TeamId.HasValue && !x.OutTime.HasValue + && p.IsSynchro == true + select x; + var personInOutNows = from x in db.RealName_PersonInOutNow select x; + foreach (var person in persons) + { + var personInOutNow = personInOutNows.OrderByDescending(x => x.ChangeTime).FirstOrDefault(); + if (personInOutNow == null) + { + person.OutTime = DateTime.Now; + } + else if (personInOutNow.ChangeTime < DateTime.Now.AddDays(-3)) + { + person.OutTime = personInOutNow.ChangeTime; + } + } + db.SubmitChanges(); + } + } + catch (Exception ex) + { + StartMonitor(); + ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); + } + } #endregion #region 启动监视器 系统启动5分钟-实名制出入记录去重 @@ -159,7 +224,7 @@ namespace BLL } if (delCount >= 10000) - { + { return; } } @@ -185,7 +250,7 @@ namespace BLL /// public static void StartMonitorDeletePushLog() { - int adTimeJ = 60 * 4; + int adTimeJ = 60 * 4; if (messageTimer1 != null) { messageTimer1.Stop(); diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user index cb873201..63722353 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -1,7 +1,7 @@  - Release|Any CPU + Debug|Any CPU true false diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index eecd6531..8646021c 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -69,6 +69,17 @@ { ErrLogInfo.WriteLog("实名制同步定时器启动失败!", ex); } + ////根据考勤记录修改人员状态定时器 + try + { + BLL.RealNameMonitorService.StartUpdateSitePerson(); + // BLL.RealNameMonitorService.StartMonitorProject(); + SynchroSetService.InsertRealNamePushLog(null, null, "根据考勤记录修改人员状态定时器开始启动", "sucess", "200", null, "成功", null); + } + catch (Exception ex) + { + ErrLogInfo.WriteLog("根据考勤记录修改人员状态定时器启动失败!", ex); + } ///实名制出入记录去重 try { diff --git a/SGGL/FineUIPro.Web/JDGL/Check/MonthPlan.aspx.cs b/SGGL/FineUIPro.Web/JDGL/Check/MonthPlan.aspx.cs index 6b2c5397..078c75a3 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/MonthPlan.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/MonthPlan.aspx.cs @@ -220,11 +220,10 @@ left join Sys_User us on us.UserId=mp.DutyPerson where mp.ProjectId=@ProjectId a // 第二步:创建新数据行 NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); int i = 1; - int sum = 0; foreach (var item in lists) { // 第二步:创建新数据行 - NPOI.SS.UserModel.IRow row = sheet.GetRow(i); + NPOI.SS.UserModel.IRow row = sheet.CreateRow(i); NPOI.SS.UserModel.ICell cell; // 添加数据 cell = row.CreateCell(0); diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index 963148f2..f50b26d3 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -77,7 +77,7 @@ - + diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 3d323f69..e19430f3 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -61968,6 +61968,8 @@ namespace Model private EntityRef _Base_Project; + private EntityRef _Technique_CheckItemSet; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -62019,6 +62021,7 @@ namespace Model public Check_CheckSpecial() { this._Base_Project = default(EntityRef); + this._Technique_CheckItemSet = default(EntityRef); OnCreated(); } @@ -62337,6 +62340,10 @@ namespace Model { if ((this._CheckItemSetId != value)) { + if (this._Technique_CheckItemSet.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } this.OnCheckItemSetIdChanging(value); this.SendPropertyChanging(); this._CheckItemSetId = value; @@ -62480,6 +62487,40 @@ namespace Model } } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckSpecial_Technique_CheckItemSet", Storage="_Technique_CheckItemSet", ThisKey="CheckItemSetId", OtherKey="CheckItemSetId", IsForeignKey=true)] + public Technique_CheckItemSet Technique_CheckItemSet + { + get + { + return this._Technique_CheckItemSet.Entity; + } + set + { + Technique_CheckItemSet previousValue = this._Technique_CheckItemSet.Entity; + if (((previousValue != value) + || (this._Technique_CheckItemSet.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Technique_CheckItemSet.Entity = null; + previousValue.Check_CheckSpecial.Remove(this); + } + this._Technique_CheckItemSet.Entity = value; + if ((value != null)) + { + value.Check_CheckSpecial.Add(this); + this._CheckItemSetId = value.CheckItemSetId; + } + else + { + this._CheckItemSetId = default(string); + } + this.SendPropertyChanged("Technique_CheckItemSet"); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -103492,6 +103533,8 @@ namespace Model private System.Nullable _States; + private System.Nullable _MaxLevel; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -103540,6 +103583,8 @@ namespace Model partial void OnSortChanged(); partial void OnStatesChanging(System.Nullable value); partial void OnStatesChanged(); + partial void OnMaxLevelChanging(System.Nullable value); + partial void OnMaxLevelChanged(); #endregion public Control_PointCropping() @@ -103987,6 +104032,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaxLevel", DbType="Int")] + public System.Nullable MaxLevel + { + get + { + return this._MaxLevel; + } + set + { + if ((this._MaxLevel != value)) + { + this.OnMaxLevelChanging(value); + this.SendPropertyChanging(); + this._MaxLevel = value; + this.SendPropertyChanged("MaxLevel"); + this.OnMaxLevelChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -370320,6 +370385,8 @@ namespace Model private System.Nullable _IsBuiltIn; + private EntitySet _Check_CheckSpecial; + private EntitySet _Technique_CheckItemDetail; #region 可扩展性方法定义 @@ -370346,6 +370413,7 @@ namespace Model public Technique_CheckItemSet() { + this._Check_CheckSpecial = new EntitySet(new Action(this.attach_Check_CheckSpecial), new Action(this.detach_Check_CheckSpecial)); this._Technique_CheckItemDetail = new EntitySet(new Action(this.attach_Technique_CheckItemDetail), new Action(this.detach_Technique_CheckItemDetail)); OnCreated(); } @@ -370510,6 +370578,19 @@ namespace Model } } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckSpecial_Technique_CheckItemSet", Storage="_Check_CheckSpecial", ThisKey="CheckItemSetId", OtherKey="CheckItemSetId", DeleteRule="NO ACTION")] + public EntitySet Check_CheckSpecial + { + get + { + return this._Check_CheckSpecial; + } + set + { + this._Check_CheckSpecial.Assign(value); + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Technique_CheckItemDetail_Technique_CheckItemSet", Storage="_Technique_CheckItemDetail", ThisKey="CheckItemSetId", OtherKey="CheckItemSetId", DeleteRule="NO ACTION")] public EntitySet Technique_CheckItemDetail { @@ -370543,6 +370624,18 @@ namespace Model } } + private void attach_Check_CheckSpecial(Check_CheckSpecial entity) + { + this.SendPropertyChanging(); + entity.Technique_CheckItemSet = this; + } + + private void detach_Check_CheckSpecial(Check_CheckSpecial entity) + { + this.SendPropertyChanging(); + entity.Technique_CheckItemSet = null; + } + private void attach_Technique_CheckItemDetail(Technique_CheckItemDetail entity) { this.SendPropertyChanging(); diff --git a/SGGL/WebAPI/WebAPI.csproj.user b/SGGL/WebAPI/WebAPI.csproj.user index bd497c6b..5fe155da 100644 --- a/SGGL/WebAPI/WebAPI.csproj.user +++ b/SGGL/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@  - Release|Any CPU + Debug|Any CPU true