Foxtable(狐表)用户栏目专家坐堂 → [求助]自动生成课表


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

主题:[求助]自动生成课表

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


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

参考代码,生成对应的选择给学生,学生根据情况去上课。

 

不然,你要说明分配的逻辑,因为有多种可能符合,你要选择哪种?

 

Dim t1 As Table = Tables("学生选课表")
Dim t2 As DataTable = DataTables("课表")
'Dim dr As Row = t1.Current
For Each dr As Row In t1.Rows
    For i As Integer = 5 To 9
        dr("第" & i & "节") = Nothing
    Next
    For Each kc As String In dr("走班课程").split("|")
        If kc.EndsWith("E") = False Then
            For Each fdr As DataRow In t2.Select("科目='" & kc & "'")
                If fdr IsNot Nothing Then
                    For i As Integer = 5 To 9
                        If fdr.IsNull("第" & i & "节") = False Then
                            Dim str = dr("第" & i & "节")
                            str &= "," & fdr("第" & i & "节") '& "(" & fdr("教师") & ")"
                            dr("第" & i & "节")= str.trim(",")
                        End If
                    Next
                End If
            Next
        End If
    Next
Next


 回到顶部