Dim r As Row = Tables("订单明细表").Current
If r IsNot Nothing Then
Dim dr5 As DataRow
If r.IsNull("客户电话") = False
Dim dhs() As String = r("客户电话").trim().split("/")
For Each dh As String In dhs
dr5 = DataTables("客户数据表") .SQLFind("'/'+客户电话+'/' like '%/" & dh & "/%'")
If dr5 IsNot Nothing Then Exit For
Next
If dr5 IsNot Nothing Then
Dim lst As new List(of String)
For Each d As String In dr5("客户电话").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In dhs
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户电话") = String.Join("/",lst.ToArray)
If dr5.IsNull("客户QQ号")
dr5("客户QQ号")=r("客户QQ号")
Else
lst.Clear
For Each d As String In dr5("客户QQ号").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户QQ号").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户QQ号") = String.Join("/",lst.ToArray)
End If
If dr5.IsNull("微信号码")
dr5("微信号码")= r("客户微信")
Else
lst.Clear
For Each d As String In dr5("微信号码").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户微信").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("微信号码") = String.Join("/",lst.ToArray)
End If
End If
End If
If dr5 Is Nothing AndAlso r.IsNull("客户QQ号") = False
Dim dhs() As String = r("客户QQ号").trim().split("/")
For Each dh As String In dhs
dr5 = DataTables("客户数据表") .SQLFind("'/'+客户QQ号+'/' like '%/" & dh & "/%'")
If dr5 IsNot Nothing Then Exit For
Next
If dr5 IsNot Nothing Then
Dim lst As new List(of String)
For Each d As String In dr5("客户QQ号").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In dhs
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户QQ号") = String.Join("/",lst.ToArray)
If dr5.IsNull("客户电话")
dr5("客户电话")=r("客户电话")
Else
lst.Clear
For Each d As String In dr5("客户电话").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户电话").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户电话") = String.Join("/",lst.ToArray)
End If
If dr5.IsNull("微信号码")
dr5("微信号码")= r("客户微信")
Else
lst.Clear
For Each d As String In dr5("微信号码").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户微信").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("微信号码") = String.Join("/",lst.ToArray)
End If
End If
End If
If dr5 Is Nothing AndAlso r.IsNull("客户微信") = False
Dim dhs() As String = r("客户微信").trim().split("/")
For Each dh As String In dhs
dr5 = DataTables("客户数据表") .SQLFind("'/'+微信号码+'/' like '%/" & dh & "/%'")
If dr5 IsNot Nothing Then Exit For
Next
If dr5 IsNot Nothing Then
Dim lst As new List(of String)
For Each d As String In dr5("微信号码").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In dhs
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("微信号码") = String.Join("/",lst.ToArray)
If dr5.IsNull("客户电话")
dr5("客户电话")=r("客户电话")
Else
lst.Clear
For Each d As String In dr5("客户电话").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户电话").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户电话") = String.Join("/",lst.ToArray)
End If
If dr5.IsNull("客户QQ号")
dr5("客户QQ号")= r("客户QQ号")
Else
lst.Clear
For Each d As String In dr5("客户QQ号").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
For Each d As String In r("客户QQ号").trim().split("/")
If lst.Contains(d) = False Then lst.Add(d)
Next
dr5("客户QQ号") = String.Join("/",lst.ToArray)
End If
End If
End If
If dr5 IsNot Nothing Then
If dr5.IsNull("客户网名")
dr5("客户网名")=r("客户网名")
Else
Dim qqs As new List(of String)
For Each d As String In dr5("客户网名").trim().split("/")
If qqs.Contains(d) = False Then qqs.Add(d)
Next
For Each d As String In r("客户网名").trim().split("/")
If qqs.Contains(d) = False Then qqs.Add(d)
Next
dr5("客户网名") = String.Join("/",qqs.ToArray)
End If
r("客户编号") = dr5("客户编号")
Else
dr5 = DataTables("客户数据表").AddNew()
Dim bh2 As String
Dim Inx2 As Integer
bh2 = DataTables("客户数据表").SQLCompute("Max(客户编号)")
Inx2 = CInt(bh2.SubString(3,5) + 1)
dr5("客户编号") = "KH" & "-" & Format(Inx2,"00000")
r("客户编号") = dr5("客户编号")
dr5("客户网名") = r("客户网名")
'dr5("网名备注") = r("客户_网名备注")
dr5("客户电话")= r("客户电话")
dr5("客户QQ号") = r("客户QQ号")
dr5("微信号码") = r("客户微信")
'dr5("客户类型") = r("客户_类型")
'dr5("YZ") = r("客户_YZ")
dr5("首单日期") = r("订单日期")
dr5("尾单日期") = r("订单日期")
End If
r.Save()
dr5.Save()
End If
DataTables("客户数据表").load