diff --git a/SGGL/BLL/OpenService/MonitorService.cs b/SGGL/BLL/OpenService/MonitorService.cs index 89af3095..92b2fd06 100644 --- a/SGGL/BLL/OpenService/MonitorService.cs +++ b/SGGL/BLL/OpenService/MonitorService.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Web.UI.WebControls; using System.Collections.Generic; using Newtonsoft.Json.Linq; +using Microsoft.SqlServer.Dts.Runtime; namespace BLL { @@ -2178,6 +2179,7 @@ namespace BLL //////推送订阅消息 GetDataService.SendSubscribeMessage(); GetDataService.CorrectingPersonInOutNumber(null); + } #region 启动监视器 定时每天执行 获取指定项目管道焊接工程量等信息 @@ -2452,5 +2454,69 @@ namespace BLL } } #endregion + + #region 启动监视器 系统启动5分钟 --人工时定时校正 + /// + /// 监视组件 + /// + private static Timer messageTimerPersonHour; + + /// + /// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟 + /// + public static void StartMonitorPersonHour() + { + //int adTimeJ = 60; + //if (adomain.AdTimeH.HasValue) + //{ + // adTimeJ += adomain.AdTimeH.Value * 60; + //} + //if (adomain.AdTimeM.HasValue) + //{ + // adTimeJ += adomain.AdTimeM.Value; + //} + if (messageTimerPersonHour != null) + { + messageTimerPersonHour.Stop(); + messageTimerPersonHour.Dispose(); + messageTimerPersonHour = null; + } + + messageTimerPersonHour = new Timer + { + AutoReset = true + }; + messageTimerPersonHour.Elapsed += new ElapsedEventHandler(PersonHour); + messageTimerPersonHour.Interval = 1000 * 2 * 120;// 60分钟 60000 * adTimeJ; + messageTimerPersonHour.Start(); + } + + /// + /// 流程确认 定时执行 系统启动5分钟 + /// + /// Timer组件 + /// 事件参数 + private static void PersonHour(object sender, ElapsedEventArgs e) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + try + { + var getProjects = (from x in db.Base_Project + where x.ProjectState == null || x.ProjectState == Const.ProjectState_1 + orderby x.ProjectCode descending + select x).ToList(); + + foreach (var projectItem in getProjects) + { + GetDataService.CorrectingPersonInOutNumberD(projectItem.ProjectId); + } + } + catch (Exception ex) + { + } + } + } + #endregion } } diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index 881084d6..ebfb44db 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -94,6 +94,15 @@ { ErrLogInfo.WriteLog("通用定时器启动失败!", ex); } + ////自动校正人工时 + try + { + BLL.MonitorService.StartMonitorPersonHour(); + } + catch (Exception ex) + { + ErrLogInfo.WriteLog("自动校正人工时定时器启动失败!", ex); + } ////材料软件定时 try {