Select Case e.DataCol.name
Case "计划跟踪号","产品组合"
Dim t As Table = Tables(e.DataTable.Name)
Dim idx As Integer =t.FindRow(e.DataRow)
If idx > -1 Then
Dim min As Integer = idx-1
Dim max As Integer = idx+1
Dim nv As String = e.NewValue
Dim ov As String = e.OldValue
If e.DataCol.name = "计划跟踪号" Then
nv = e.DataRow("产品组合")
ov = e.DataRow("产品组合")
End If
Do While min >= 0
Dim r As Row = t.Rows(min)
If r("产品组合") = nv OrElse r("产品组合") = ov Then
min -= 1
Else
Exit Do
End If
Loop
min += 1
Do While max < t.Rows.Count
Dim r As Row = t.Rows(max)
If r("产品组合") = nv OrElse r("产品组合") = ov Then
max += 1
Else
Exit Do
End If
Loop
max -= 1
Dim dr As Row = t.Rows(min)
Dim f As Integer = min
Dim gzh As String = dr("计划跟踪号")
For i As Integer = min + 1 To max
Dim r As Row = t.Rows(i)
If r("产品组合") = dr("产品组合") Then
gzh &= "," & r("计划跟踪号")
Else
For j As Integer = f To i-1
t.Rows(j)("跟踪号") = gzh
Next
f = i
dr = r
gzh = dr("计划跟踪号")
End If
Next
For k As Integer = f To max
t.Rows(k)("跟踪号") = gzh
Next
End If
End Select