If e.DataCol.Name = "邮寄" Then '如果内容发生变动的是品名列 '’If e.NewValue Is Nothing Then '如果新值是空白,也就是品名列的内容为空 'e.DataRow("邮寄清单") = Nothing '那么清空此行单价列的内容 'Else Dim str As String = e.DataRow("案号") Dim drs = e.DataTable.Select("案号='" & str & "' and 邮寄 = true", "收寄日期") Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(\([0-9]+\)[鲁0-9]+)|(行初[0-9\-]+)|(赔初[0-9\-]+)|(行终[0-9\-]+)|([0-9\-]+)") Dim qz As String = "" Dim lx As String = "" For i As Integer = 0 To mc.count-1 Dim s As String = mc(i).value 'msgbox(s) If i = 0 Then qz = s Else If s.StartsWith("行初") Then lx = "行初" s = s.replace("行初", "") ElseIf s.StartsWith("赔初") Then lx = "行赔初" s = s.replace("赔初", "") ElseIf s.StartsWith("行终") Then lx = "行终" s = s.replace("行终", "") End If Dim ii = 0 Dim jj = 0 If s.Indexof("-") >= 0 Then ii = s.split("-")(0) jj = s.split("-")(1) Else ii = s jj = s End If For k As Integer = ii To jj 'msgbox(qz & lx & k & "号") Dim dr1 As DataRow dr1 = DataTables("数据表").Find("[案号] = '" & qz & lx & k & "号" & "'") If dr1 IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing Dim ls As new List(of String) For Each cdr As DataRow In drs For Each l As String In cdr.lines("邮寄清单") If ls.Contains(l) = False Then ls.Add(l) End If Next Next dr1.lines("邮寄清单") = ls End If Next End If Next End If
|