以下为定时器任务,一般情况下正常,偶尔会取的时间会为00:00:00 ,但实际数据库的字段又不是这个值,请问是怎么回事?
比如:我收到的短信字样为:
【短信通】计算机中心提示您:有报障消息经过47分钟(00:00:00)仍未处理,ID:6145 问题描述:系统不能打图片 报障电脑IP:172.016.093.117 报障人:李民 电话: 请注意及时督促负责人!
一般都会为正常的时间字样: 比如:(2019-08-21 15:23:01) ,偶尔会有上述问题,我看不出来代码有什么问题,好奇怪!
Dim drs As List(of DataRow)= DataTables("自助报障记录表").SQLSelect("问题描述 is not null and 问题处理状态 is null")
For Each nr As DataRow In drs
Dim sp_str As String= "请" & nr("计算机中心责任人") & "注意:" & nr("所在科室") & "有报障仍未解决:" & nr("问题描述")
Audio.play("Voice\新报障信息提示音.wav",AudioPlayMode.WaitToComplete) '播放提示音
sp.Speak(sp_str,DotNetSpeech.SpeechVoiceSpeakFlags.SVSFDefault) '同步播放 报障明细内容 不能进行其它操作
''''''''''''''''''''''''''''''''''''''' 以下代码为在下班时间对值班人员发送短信.
'取服务器时间
Dim cmd As New SQLCommand
Dim d As Date
cmd.C
cmd.CommandText = "S elect GetDate()"
d = cmd.ExecuteScalar()
Dim LatestDate As Date= DataTables("计算机中心交班表").S QLCompute("MAX(交班时间)")
Dim nr_onduty As DataRow=DataTables("计算机中心交班表").S QLFind("交班时间>= '" & latestDate & "' And 交班时间 <= '" & latestDate.AddSeconds(1) & "'") '因数据库中存的时间带有毫秒,故这里使用了一个相差1秒的时间范围来框
Dim tp As TimeSpan
tp = Date.Now - CDate(nr("提交时间"))
If (Functions.Execute("判断法定节假日",d.Date)="工作日" And (( d.hour>= 8 And d.hour<=12 ) Or (d.hour= 14 And d.minute>=30) Or (d.hour>=15 And d.hour<17) Or (d.hour= 17 And d.minute<=30 )) ) Then
If Date.Now.AddMinutes(-10)>nr("提交时间") Then '如果在工作时间提交10分钟后还未解决,则发送给当模块负责人(频率为8分钟)
Dim lr As DataRow=DataTables("计算机中心人员字典").S QLFind("姓名='" & nr("计算机中心责任人") & "'") '找到计算机中心接班人的基本信息
Dim str_content_sms As String="有报障消息经过" & tp.Minutes & "分钟(" & nr("提交时间") & ")仍未处理,ID" & nr("_identify") & " 问题描述:" & nr("问题描述") & " 报障电脑IP:" & nr("报障电脑IP") & " 报障人:" & nr("报障人_姓名") & " 电话:" & nr("报障人_手机") & " 请注意及时处理!"
Functions.Execute("智慧宜昌短信平台_手机",nr("计算机中心责任人"),"计算机中心",lr("手机"),str_content_sms,"")
End If
If Date.Now.AddMinutes(-20)>nr("提交时间") Then ''如果在工作时间提交20分钟后还未解决,则发送给当周值班人(频率为8分钟)
If nr_onduty("接班人") IsNot Nothing Then '如果接班人不为空,发送短信
Dim lr As DataRow=DataTables("计算机中心人员字典").S QLFind("姓名='" & nr_onduty("接班人") & "'") '找到计算机中心接班人的基本信息
Dim str_content_sms As String="有报障消息经过" & tp.Minutes & "分钟(" & nr("提交时间") & ")仍未处理,ID:" & nr("_identify") & " 问题描述:" & nr("问题描述") & " 报障电脑IP:" & nr("报障电脑IP") & " 报障人:" & nr("报障人_姓名") & " 电话:" & nr("报障人_手机") & " 请注意及时督促负责人!"
Functions.Execute("智慧宜昌短信平台_手机",nr_onduty("接班人"),"计算机中心",lr("手机"),str_content_sms,"")
End If
End If
If Date.Now.AddMinutes(-30)>nr("提交时间") Then ''如果在工作时间提交30分钟后还未解决,则发送给胡鹏(频率为8分钟)
Dim lr As DataRow=DataTables("计算机中心人员字典").SQLFind("[姓名]='胡鹏'") '找到计算机中心胡鹏的基本信息
Dim str_content_sms As String="有报障消息经过" & tp.Minutes & "分钟(" & nr("提交时间") & ")仍未处理,ID:" & nr("_identify") & " 问题描述:" & nr("问题描述") & " 报障电脑IP:" & nr("报障电脑IP") & " 报障人:" & nr("报障人_姓名") & " 电话:" & nr("报障人_手机") & " 请注意及时督促负责人!"
Functions.Execute("智慧宜昌短信平台_手机","胡鹏","计算机中心",lr("手机"),str_content_sms,"")
End If
If Date.Now.AddMinutes(-40)>nr("提交时间") Then '如果在工作时间提交40分钟后还未解决,则发送给王昆(频率为8分钟)
Dim lr As DataRow=DataTables("计算机中心人员字典").SQLFind("[姓名]='王昆'") '找到计算机中心王昆的基本信息
Dim str_content_sms As String="有报障消息经过" & tp.Minutes & "分钟(" & nr("提交时间") & ")仍未处理,ID:" & nr("_identify") & " 问题描述:" & nr("问题描述") & " 报障电脑IP:" & nr("报障电脑IP") & " 报障人:" & nr("报障人_姓名") & " 电话:" & nr("报障人_手机") & " 请注意及时督促负责人!"
Functions.Execute("智慧宜昌短信平台_手机","王昆","计算机中心",lr("手机"),str_content_sms,"")
End If
Else '否则如果不在上述工作时段,则一扫描到就发给值班人
'查找接班人
If nr_onduty("接班人") IsNot Nothing Then '如果接班人不为空,发送短信
Dim lr As DataRow=DataTables("计算机中心人员字典").SQLFind("姓名='" & nr_onduty("接班人") & "'") '找到计算机中心接班人的基本信息
Dim str_content_sms As String="有报障消息经过" & tp.Minutes & "分钟(" & nr("提交时间") & ")仍未处理,ID:" & nr("_identify") & " 问题描述:" & nr("问题描述") & " 报障电脑IP:" & nr("报障电脑IP") & " 报障人:" & nr("报障人_姓名") & " 电话:" & nr("报障人_手机") & " 请注意及时处理!"
Functions.Execute("智慧宜昌短信平台_手机",nr_onduty("接班人"),"计算机中心",lr("手机"),str_content_sms,"")
End If
End If
Next