以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于排考室座位号的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=174524)

--  作者:jhxb8821
--  发布时间:2022/1/19 16:15:00
--  关于排考室座位号的问题
这段代码是自定义考场数,比如总考生160人,分6个考场,这段代码实现001号-004号每个考场27人,005-006号每个考场26人,座位号从001一直排到160。我想实现座位号按每个考场单独排,比如001号考场27人座位号排号01-27,005号考场26人从01-26,请教老师代码如何修改

If Forms("高考排考室").Controls("NumericComboBox1").Value <= 0 Then
    MessageBox.Show("考场号不能小等于零值!","中止操作",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
Else
    Dim f As New Filler
    f.SourceTable = DataTables("高考排考室")
    f.SourceCols = "班级,姓名"
    f.DataTable = DataTables("高考排考室")
    f.DataCols = "班级,姓名"
    f.ExcludeExistValue = True
    f.Fill
    For i As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(i)("索引顺序") = Rand.Next(10000)
    Next
    CurrentTable.sort = "索引顺序"
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("考场号") = Format(1 + b Mod e.Form.Controls("NumericComboBox1").Value,"100")
    Next
    CurrentTable.sort = "索引顺序,考场号 Asc"
    \'================
    For b As Integer = 0 To CurrentTable.rows.count -1
        CurrentTable.Rows(b)("座位号") = Format(Rand.Next(1000) + b Mod e.Form.Controls("NumericComboBox1").Value,"000")
    Next
[此贴子已经被作者于2022/1/19 16:30:36编辑过]

--  作者:有点蓝
--  发布时间:2022/1/19 16:42:00
--  
……
CurrentTable.sort = "索引顺序"
Dim k As Integer = 1
Dim z As Integer = 1
For b As Integer = 0 To CurrentTable.rows.count -1
    CurrentTable.Rows(b)("考场号") = Format(k,"100")
    CurrentTable.Rows(b)("座位号") = z
    z = z + 1
    If k<= 4
        If z > 27 Then
            z = 1
            k = k + 1
        End If
    Else
        If z > 26 Then
            z = 1
            k = k + 1
        End If
    End If
    
Next
[此贴子已经被作者于2022/1/19 16:43:25编辑过]

--  作者:jhxb8821
--  发布时间:2022/1/19 17:12:00
--  每个考场人数是动态的
蓝老师,这个代码每个考场人数是动态的,不确定。若按照每个考场排30个座位,前5个考场排满,座位号按01-30排,剩余的放在最后一个考场,这个代码怎么修改,请指教
--  作者:有点蓝
--  发布时间:2022/1/19 17:22:00
--  
For b As Integer = 0 To CurrentTable.rows.count -1
    CurrentTable.Rows(b)("考场号") = Format(k,"100")
    CurrentTable.Rows(b)("座位号") = z
    z = z + 1
        If z > 30 Then
            z = 1
            k = k + 1
        End If
Next

--  作者:jhxb8821
--  发布时间:2022/1/19 17:30:00
--  保留位数
蓝老师,这个代码这样保留2位数,比如座位号1、2 变成01、02,麻烦蓝老师再看一下

[此贴子已经被作者于2022/1/19 17:37:56编辑过]

--  作者:有点蓝
--  发布时间:2022/1/19 17:38:00
--  
参考"考场号"的format用法呀,自己都用上了还不会?
--  作者:jhxb8821
--  发布时间:2022/1/19 17:40:00
--  代码

蓝老师,这段代码改在按钮上,帮我修改一下

Dim dr As DataRow = e.DataRow

Select Case e.DataCol.Name

    Case "县级代号","科类代号","类别代号","考生序号"

        dr("准考证号") = dr("县级代号")+dr("科类代号")+dr("类别代号")+dr("考生序号")

End Select


--  作者:有点蓝
--  发布时间:2022/1/20 8:31:00
--  
dim r as row = tables("表A").current
if r isnot nothing then
r("准考证号") = r("县级代号")+r("科类代号")+r("类别代号")+r("考生序号")
end if

--  作者:jhxb8821
--  发布时间:2022/1/20 9:37:00
--  代码
蓝老师,座位号保留2位数,比如座位号1、2 变成01、02,我搞了半天还是没有弄出来,麻烦蓝老师帮忙再看一下

--  作者:有点蓝
--  发布时间:2022/1/20 9:45:00
--  
    CurrentTable.Rows(b)("考场号") = Format(k,"000")
    CurrentTable.Rows(b)("座位号") = Format(z,"00")
[此贴子已经被作者于2022/1/20 9:44:53编辑过]