Foxtable(狐表)用户栏目专家坐堂 → [求助]代码优化


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

主题:[求助]代码优化

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


加好友 发短信
等级:超级版主 帖子:110558 积分:562680 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/1/12 15:08:00 [显示全部帖子]

没看懂您的逻辑,使用文字说明一下操作逻辑,上传具体实例测试

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


加好友 发短信
等级:超级版主 帖子:110558 积分:562680 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/1/12 16:59:00 [显示全部帖子]

试试

Dim ss As String = "08:00:00"
Dim ssz As String = "08:30:00"

Dim sx As String = "12:00:00"
Dim sxz As String = "11:30:00"

Dim xs As String = "13:00:00"
Dim xsz As String = "13:30:00"

Dim xx As String = "17:00:00"
Dim xxz As String = "16:30:00"

Dim dr As DataRow

For Each bh() As String In DataTables("人员").GetValues("编号|姓名","启用 = 1")
    For Each dd() As String In  DataTables("采集数据").GetValues("Y|M|D","编号 = '" & bh(0) & "'")
        dr = DataTables("勤表").AddNew
        dr("编号") = bh(0)
        dr("姓名") = bh(1)
        dr("Y") = dd(0)
        dr("M") = dd(1)
        dr("D") = dd(2)
        Dim ts() As String = DataTables("采集数据").GetValues("T", "编号 = '" & bh(0) & "' and Y = '" & dd(0) & "' And M = '" & dd(1) & "' And D = '" & dd(2) & "'")
        Dim ti As String = ""
        Dim cd As Intege = 0
        Dim zt As Intege = 0
        Dim am As Intege = 0
        Dim pm As Intege = 0
        Dim all As Intege = 0
        For Each t As String In ts
            Dim st As String = t.SubString(t.Length - 8)
            ti = ti & "|" & st
            If st > ssz AndAlso st < ssz OrElse st > xs AndAlso st < xsz Then
                cd += 1
            ElseIf st > sxz AndAlso st < sx OrElse st > xxz AndAlso st < xx Then
                zt+= 1
            End If
            If st < ss OrElse st > xxz Then
                all+=1
            End If
            If st < ss OrElse st > sxz AndAlso st < xsz Then
                am += 1
            End If
            If st > xxz OrElse st > sxz AndAlso st < xsz Then
                pm += 1
            End If
        Next
        If all >= 2 Then
            dr("考勤") = 480
        Else
            If am >= 2 OrElse pm >= 2
                dr("考勤") = 240
            End If
        End If
        dk("迟到次") = cd
        dk("早退次") = zt
        dk("时间") = ti.Trim("|")
    Next
Next

 回到顶部