Try
Dim tdd As Date = Date.Today
Dim tdt As Date = Date.now
Dim Arys As List(Of String())
Dim cmd As new sqlcommand
cmd.connectionname = gs_strActiveConn
cmd.commandtext = "sel ect * from 任务计划 where 执行 = 0 or 执行 is null" '如果已经任务设置中已经暂停,那么计划中尚未执行的任务也不再执行.
Dim db As DataTable = cmd.executereader(True)
Arys = db.GetValues("任务ID|任务名称|任务函数","计划日期 = # " & tdd & " # and 计划时间 <= # " & tdt & " #")
If Arys.Count > 0 Then
Output.Logs("AutoLog").Add("自动数据处理开始" & Now.ToString("yyyy-MM-dd HH:mm:ss.fffff"))
For Each Ary As String() In Arys
Output.Show(Ary(0) & "|" & Ary(1) & "|" & Ary(2))
Dim rwid As Integer = Ary(0)
Dim rwmc As String = Ary(1)
Dim rwhs As String = Ary(2)
Dim hscs As String = rwhs & "," & rwid & "," & rwmc
Output.Logs("AutoLog").Add("自动数据处理" & hscs & "开始:" & Now.ToString("yyyy-MM-dd HH:mm:ss.fffff"))
'CallFun_Thread(hscs)
Functions.AsyncExecute(rwhs,rwid,rwmc) '多线程
Threading.Thread.Sleep(3000) '必要时须延时一些
Dim filter As String ="任务ID = " & rwid & " And 计划时间 <= #" & tdt & "# "
db.ReplaceFor("执行",True,filter)
db.ReplaceFor("执行时间",Date.now,filter)
db.save
Output.Logs("AutoLog").Add("自动数据处理" & hscs & "结束:" & Now.ToString("yyyy-MM-dd HH:mm:ss.fffff"))
Next
Output.Logs("AutoLog").Add("----------------------------------")
Output.Logs("AutoLog").Save(ProjectPath & "AutoLog.txt",True)
End If
Catch ex As Exception
Output.Logs("AutoLog").Add("----------------------------------")
Output.Logs("AutoLog").Add("自动数据处理" & ex.Message & "报错:" & Now.ToString("yyyy-MM-dd HH:mm:ss.fffff"))
Output.Logs("AutoLog").Save(ProjectPath & "AutoLog.txt",True)
End Try