1
This commit is contained in:
@@ -4,6 +4,7 @@ using System.DirectoryServices;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
//using Microsoft.SqlServer.Dts.Runtime;
|
||||
@@ -16,9 +17,12 @@ namespace BLL
|
||||
|
||||
private static Timer inOutTimer1;
|
||||
|
||||
public static void StartInOutSync()
|
||||
public static async Task StartInOutSync()
|
||||
{
|
||||
|
||||
ErrLogInfo.WriteLog("启用出入定时器开始!");
|
||||
|
||||
// 停止并释放之前的定时器(如果存在)
|
||||
if (inOutTimer1 != null)
|
||||
{
|
||||
inOutTimer1.Stop();
|
||||
@@ -26,24 +30,26 @@ namespace BLL
|
||||
inOutTimer1 = null;
|
||||
}
|
||||
|
||||
// 创建新的定时器
|
||||
inOutTimer1 = new Timer
|
||||
{
|
||||
AutoReset = true
|
||||
AutoReset = true,
|
||||
Interval = 1000 * 60 * 10 // 60分钟
|
||||
};
|
||||
inOutTimer1.Elapsed += new ElapsedEventHandler(InOutProcess1);
|
||||
inOutTimer1.Interval = 1000 * 60 * 10;// 60分钟 60000 * adTimeJ;
|
||||
|
||||
// 使用异步事件处理方法
|
||||
inOutTimer1.Elapsed += async (sender, e) => await InOutProcess1Async(sender, e);
|
||||
|
||||
// 启动定时器
|
||||
inOutTimer1.Start();
|
||||
|
||||
|
||||
|
||||
|
||||
ErrLogInfo.WriteLog("启用出入定时器结束!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void InOutProcess1(object sender, ElapsedEventArgs e)
|
||||
public static async Task InOutProcess1Async(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
ErrLogInfo.WriteLog("氟化工出入同步开始");
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user