Foxtable(狐表)用户栏目专家坐堂 → 排号问题


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

主题:排号问题

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


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

分开2批处理

For Each Ary As String() In Arys
    Dim filter As String = CExp("学校代码='{0}' and 年级代码='{1}' and 考试名称='{2}'",Ary(0),Ary(1),ary(2))
    Dim bhstr As String = Ary(1) & Ary(0)

    Dim bj As List(Of String) = dt.GetValues("班级",filter & " and 班级 in (1,2,3)","班级")
    Dim bjlist As new List(Of List(of DataRow))(bj.Count)
    Dim max As Integer = 0
    For Each s As String In bj
        Dim lst As List(of DataRow) = dt.Select(filter & " And 班级 ='" & s & "'","姓名")
        If max < lst.Count Then max = lst.Count
        bjlist.add(lst)
    Next
    Dim idx As Integer = 1
    Dim dr As DataRow
    For i As Integer = 0 To max - 1
        For j As Integer = 0 To bjlist.Count - 1
            Dim lst As List(of DataRow) = bjlist(j)
            If i < lst.Count Then
                dr = lst(i)
                If dr("考号锁定") = False
                    dr("考号") = bhstr & Format(idx,"0000")
                    idx += 1
                    p.Value = i
                End If
            End If
        Next
    Next
    
    bj = dt.GetValues("班级",filter & " and 班级 in (4,5,6,7)","班级")
    bjlist.Clear
    max = 0
    For Each s As String In bj
        Dim lst As List(of DataRow) = dt.Select(filter & " And 班级 ='" & s & "'","姓名")
        If max < lst.Count Then max = lst.Count
        bjlist.add(lst)
    Next
    idx = 1
    dr = Nothing
    For i As Integer = 0 To max - 1
        For j As Integer = 0 To bjlist.Count - 1
            Dim lst As List(of DataRow) = bjlist(j)
            If i < lst.Count Then
                dr = lst(i)
                If dr("考号锁定") = False
                    dr("考号") = bhstr & Format(idx,"0000")
                    idx += 1
                    p.Value = i
                End If
            End If
        Next
    Next
    
Next

 回到顶部