Foxtable(狐表)用户栏目专家坐堂 → [求助]处理时长计算


  共有3449人关注过本帖树形打印复制链接

主题:[求助]处理时长计算

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/21 10:31:00 [显示全部帖子]

Dim d As Date = "2018-05-21 16:31:25" 'e.DataRow("派单时间")
If d.Hour >= 16 Then
    d = d.AddDays(1)
    d = new Date(d.year, d.month, d.day, 12, 0, 0)
ElseIf d.hour < 8 Then
    d = new Date(d.year, d.month, d.day, 12, 0, 0)
End If
msgbox(d)


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/10 14:36:00 [显示全部帖子]


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/12 23:14:00 [显示全部帖子]

If stime.DayOfWeek <> 0 Then 这个的意思是,不是周日。

 

不是周六、周日,这样写 If stime.DayOfWeek <> 6 AndAlso stime.DayOfWeek <> 0 Then


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/17 9:25:00 [显示全部帖子]

你的d变量名重复定义

 

Dim cmd As New SQLCommand
Dim dt As Date
cmd.CommandText = "Select GetDate()"
dt = cmd.ExecuteScalar()

 

For Each r As Row In Tables("装机工单盯控清单表").Rows
   
    If  ( r.Isnull("缓装状态") Or  r("缓装状态") = "待客户短信确认"  Or  r("缓装状态") = "客户已拒绝" Or  r("缓装状态") = "未进行缓装" ) And  r("工单号") <> ""   Then
       
       
       
       
        Dim wtimes() As String = {"08:00-20:00"}
        Dim stime As Date = dt
        Dim etime As Date = r("达到服开时间")
        Dim sumHours As Double = 0
        Dim sp As TimeSpan
        Dim dhours As Double = 0
       
       
        For Each wtime As String In wtimes
            Dim ary() As String = wtime.Split("-")
            Dim d1 As Date = stime.Date & " " & ary(0)
            Dim d2 As Date = stime.Date & " " & ary(1)
            sp = d2 - d1
            dhours += sp.TotalHours
            If stime < d1 Then
                If etime > d2 Then
                    sp = d2 - d1
                    sumhours += sp.TotalHours
                ElseIf etime > d1 Then
                    sp = etime - d1
                    sumhours += sp.TotalHours
                End If
            ElseIf stime < d2 Then
                If etime > d2 Then
                    sp = d2 - stime
                    sumhours += sp.TotalHours
                ElseIf etime > d1 Then
                    sp = etime - stime
                    sumhours += sp.TotalHours
                End If
            End If
        Next
       
       
        Dim d As Date = stime.AddDays(1)
        Do While d.Date < etime.Date
           
            sumhours += dhours
           
            d = d.AddDays(1)
        Loop
       
        If stime.Date < etime.Date Then
            For Each wtime As String In wtimes
                Dim ary() As String = wtime.Split("-")
                Dim d1 As Date = etime.Date & " " & ary(0)
                Dim d2 As Date = etime.Date & " " & ary(1)
                If etime > d2 Then
                    sp = d2 - d1
                    sumhours += sp.TotalHours
                ElseIf etime > d1 Then
                    sp = etime - d1
                    sumhours += sp.TotalHours
                End If
            Next
        End If
       
       
       
       
        r("工单时长") = sumhours
       
       
       
       
    Else
        If    r("缓装状态") = "客户已同意" And r.Isnull("客户原因缓装结束时间")  = Nothing  Then
            Dim tp As TimeSpan = dt - CDate(r("客户原因缓装结束时间"))
            r("工单时长") = Format(tp.TotalSeconds() /"3600","00.00")
        Else
            r("工单时长") = Nothing
        End If
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/8/5 20:31:00 [显示全部帖子]

If e.Form.Controls("起始时长").value  = nothing Or e.Form.Controls("截止时长").value  = nothing  Then 
    MessageBox.show("请选择要加载的【起始时长】【截止时长】!!!", "非常关键提醒")
Else
    DataTables("装机工单盯控清单表").LoadFIlter =  "工单时长 >= '" & e.Form.Controls("起始时长").value & "' and 工单时长 <= '" & e.Form.Controls("截止时长").value & "' "
    DataTables("装机工单盯控清单表").Load
   
    MessageBox.show("完成【装机工单盯控清单表】的 加载 工作!!!", "非常关键提醒")
End If

 回到顶部