Select Case e.DataCol.Name
Case "出库单号"
Dim bmcls As List(Of String) = DataTables("部门信息表").GetValues("领用单位表名")
For Each bmcl As String In bmcls
If DataTables.Contains(bmcl) Then
Dim dh As DataRow = DataTables(bmcl).Find("[出库单号] = '" & e.NewValue & "'")
If dh IsNot Nothing Then
e.Cancel = True
End If
'Dim ckdh As DataRow = DataTables(bmcl).Find("[出库单号] = '" & e.NewValue & "'")
If dh Is Nothing Then
'Dim bms As List(Of String) = DataTables("部门").GetValues("部门类别")
' For Each bm As String In bms
' If DataTables.Contains(bm) Then
If e.DataRow("记账") = True And e.DataRow("分配表名") = bmcl Then
Dim nma() As String = {"物料代码","物料名称","规格型号","常用计量单位","加权平均单价","出库数量","出库金额","出库日期","出库单号","作业项目","成本项目","材料用途","领用人"} 'A表数据来源列
Dim nmb() As String = {"物料代码","物料名称","规格型号","常用计量单位","加权平均单价","出库数量","出库金额","领用日期","出库单号","作业项目","成本项目","材料用途","领用人"} 'B表数据接收列
Dim dr As DataRow = DataTables(bmcl).AddNew()
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
' End If
' Next
End If
End If
Next
End Select