e.Form.Controls("Label6").Text = "正在进行专业筛选,请稍后..."
Application.DoEvents()
Dim timestart, timeend As Date
timestart = Date.now
Dim drs As List(Of DataRow)
drs = DataTables("基础数据").Select("[确定导入] = True")
For Each dr As DataRow In drs
dr("确定导入") = False
Next
Dim Filter As String
If e.Form.Controls("选择历史").Checked = True Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "首选科目 = '历史'"
End If
If e.Form.Controls("选择物理").Checked = True Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "首选科目 = '物理'"
End If
Dim s As String = e.Form.Controls("CheckedComboBox1").Text
'考生选科数组
's=s.replace("物理","").replace("历史","").replace(",,",",").trim(",") '只剩下再选科目
'Output.Show(s)
Dim Xks() As String '考生选科集合
Xks = s.split(",")
Dim Jhxks As List(Of String) '招生计划中的选科
Jhxks = DataTables("基础数据").GetValues("次选科目")
Dim Xkmys As New List(Of String) '与我的选科匹配的选科集合
Xkmys.Add("不限")
Xkmys.Add(Xks(0) & "和" & Xks(1))
Xkmys.Add(Xks(1) & "和" & Xks(0))
''单科加"或"
For Index As Integer = 0 To Xks.Length - 1 '提示错误的位置在这里!
For Each Product As String In Jhxks
If (Product.contains(Xks(Index) & "或") Or Product.contains("或" & Xks(Index)) Or Product = Xks(Index)) And Xkmys.Contains(Product) = False Then
'filter=filter & "'" & Product & "'"
'Jhxks.Remove(Product)
Xkmys.Add(Product)
End If
Next
Next
'加组合,手动填加,
'开始生成筛选条件
Dim tj As String
For Each filter2 As String In Xkmys
tj = tj & "'" & filter2 & "',"
Next
tj = "[次选科目] In (" & tj.trim(",") & ")"
Tables("基础数据").Filter = tj
output.Show(tj)
If e.Form.Controls("FS+CGF").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 <= " & e.Form.Controls("FS+CGF").text
End If
If e.Form.Controls("FS").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 >= " & e.Form.Controls("FS").text
End If
If e.Form.Controls("FS").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 <= " & e.Form.Controls("FS").text
End If
If e.Form.Controls("FS-WFS").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 >= " & e.Form.Controls("FS-WFS").text
End If
If e.Form.Controls("FS-WFS").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 <= " & e.Form.Controls("FS-WFS").text
End If
If e.Form.Controls("FS-BDF").text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "预估分 >= " & e.Form.Controls("FS-BDF").text
End If
If Filter > "" Then
If tj > "" Then
Filter = Filter & " and " & tj
End If
Tables("基础数据").Filter = Filter
End If
Tables("基础数据").Sort = "预估分 DESC" '按"低分等效"列降序排列
e.Form.Controls("Label6").Text = "专业筛选完毕!."
timeend = Date.now
e.Form.Controls("Label6").text = "耗时" & (timeend - timestart).TotalSeconds & "秒"
Messagebox.show("按专业【预估分】分,筛选出符合条件的行,共" & (Tables("基础数据").rows.count) & "行", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
MainTable = Tables("基础数据")