以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  定时任务取的时间偶尔会提示为?00:00:00 ?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=142538)

--  作者:ycwk
--  发布时间:2019/10/30 11:35:00
--  定时任务取的时间偶尔会提示为?00:00:00 ?
用下面这段代码,定时发送短信提示负责人,为什么有时候短信内容会为:    可是表中记录的"提交时间"明明是2019-10-30 11:14:19  呀,  也不是每次都是这样,只是偶尔,这是什么问题?

计算机中心提示您:有报障消息经过12分钟(00:00:00)仍未处理,ID:7520 问题描述:477100有两条费用上传不了 报障电脑IP:172.016.2.2  报障人:王** 电话:13911111111 请注意及时督促负责人!

     Dim drs As List(of DataRow)= DataTables("自助报障记录表").SQLSelect("问题描述 is not null and 问题处理状态 is null")
     For Each nr As DataRow In  drs        

        
            \'取服务器时间
            Dim cmd As New SQLCommand
            Dim d As Date
            cmd.C
            cmd.CommandText = "Select GetDate()"
            d = cmd.ExecuteScalar()
  
            Dim LatestDate As Date= DataTables("交班表").SQLCompute("MAX(交班时间)") 
            Dim nr_onduty As DataRow=DataTables("交班表").SQLFind("交班时间>= \'" & 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("人员字典").SQLFind("姓名=\'" & 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
            end if 


………………


[此贴子已经被作者于2019/10/30 11:37:40编辑过]

--  作者:有点蓝
--  发布时间:2019/10/30 12:09:00
--  
如果是临时表,设置一下日期格式:http://www.foxtable.com/webhelp/topics/1611.htm
--  作者:ycwk
--  发布时间:2019/10/30 14:36:00
--  
是固定表,时间格式也是    Datalongtime   
--  作者:有点蓝
--  发布时间:2019/10/30 14:48:00
--  
If Date.Now.AddMinutes(-10)>nr("提交时间") Then     \'如果在工作时间提交10分钟后还未解决,则发送给当模块负责人(频率为8分钟)
                         Dim lr As DataRow=DataTables("人员字典").SQLFind("姓名=\'" & nr("计算机中心责任人") & "\'")    \'找到接班人的基本信息
msgbox(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

另外,记录的"提交时间"明明是2019-10-30 11:14:19  呀】-- 数据有没有保存?