朦一下:
Dim dr,dr1 As DataRow
Dim idx As Integer
dr = e.DataRow
Select e.DataCol.Name
Case "商城","客户名称","店铺名称"
If dr.IsNull("商城") OrElse dr.IsNull("客户名称") OrElse dr.IsNull("店铺名称") Then
dr("取货商品名") = Nothing
Else
Dim bh As String = "QF-" & dr("商城") & "-" & dr("店铺名称") & "-" & dr("客户名称") & "-" & dr("_Identify") '生成该月编号的前缀
'idx = e.DataTable.Compute("Count(取货商品名)","取货商品名 like '" & bh & "*' and [_identify] < " & dr("_identify")) +1 '這idx沒有引用它,應該不要
dr("取货商品名") = bh
End If
Case "客户名称"
dr1 = DataTables("客户资料").Find("name2 = " & "'" & dr("客户名称") & "'" )
If dr1 IsNot Nothing '如果找到, 则设置各列内容
dr1("邮箱")= dr("qq") & "@QQ.com"
End If
Case "应取数量","已取数量"
idx = dr("应取数量")-dr("已取数量")
If dr("应取数量") <> 0 AndAlso idx >0 Then
dr ("状态")= 2
ElseIf dr("应取数量") <> 0 AndAlso idx < = 0 Then
dr ("状态")= 6
Else
Dim tbl As Table = Tables("取货录入表")
If tbl.Current IsNot Nothing Then
Tables("取货录入表").Current("状态") = dr("状态")
End If
End If
End Select