代码如下
Dim drs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂'", "考核分 desc")
Dim count As Integer = 1 For Each dr As DataRow In drs dr("名次") = count count = count + 1 Next
Dim dr3 As DataRow = DataTables("考核名次").Find("名次 = 3 And 厂家 = '一分厂'") Dim dr5 As DataRow = DataTables("考核名次").Find("名次 = 5 And 厂家 = '一分厂'") Dim drMin As DataRow = DataTables("考核名次").Find("名次 = " & count - 1 & " And 厂家 = '一分厂'") Dim odrs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂' And 名次 > 5", "考核分 desc")
drs = DataTables("考核名次").Select("厂家 = '二分厂'") For Each dr As DataRow In drs If dr("考核分") >= dr3("考核分") Then dr("名次") = 3 Else If dr("考核分") >= dr5("考核分") Then dr("名次") = 5 Else If dr("考核分") >= drMin("考核分") Then For Each odr As DataRow In odrs If dr("考核分") >= odr("考核分") Then dr("名次") = odr("名次") Exit For End If Next Else dr("名次") = count - 1 End If Next
|