20221017新增定时器,自动校正人工时
This commit is contained in:
parent
b72cf8845f
commit
6382b43e73
|
@ -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分钟 --人工时定时校正
|
||||
/// <summary>
|
||||
/// 监视组件
|
||||
/// </summary>
|
||||
private static Timer messageTimerPersonHour;
|
||||
|
||||
/// <summary>
|
||||
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程确认 定时执行 系统启动5分钟
|
||||
/// </summary>
|
||||
/// <param name="sender">Timer组件</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,15 @@
|
|||
{
|
||||
ErrLogInfo.WriteLog("通用定时器启动失败!", ex);
|
||||
}
|
||||
////自动校正人工时
|
||||
try
|
||||
{
|
||||
BLL.MonitorService.StartMonitorPersonHour();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("自动校正人工时定时器启动失败!", ex);
|
||||
}
|
||||
////材料软件定时
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue