Select Case e.DataCol.Name
Case "物资名称" '发生变化的是物资名称
Dim dr As DataRow
dr = DataTables("物资明细").Find("物资名称 = '" & e.DataRow("物资名称") & "'" ) '在物资明细表找出该产品
e.DataRow("保存地点") = User.name
If dr IsNot Nothing '如果找到, 则设置各列内容
e.DataRow("物资类别") = dr("物资类别")
e.DataRow("入库总量") = dr("入库总量")
e.DataRow("原有库存") = dr("库存数量")
e.DataRow("规格") = dr("规格")
e.DataRow("单位") = dr("单位")
Else
e.DataRow("原有库存")= 0
End If
Case "入库数量" '如果"入库数量发生变化
Dim dr As DataRow
dr = DataTables("物资明细").Find("物资名称 = '" & e.DataRow("物资名称") & "'" ) '在物资明细表找出该产品
If dr IsNot Nothing
e.DataRow ("入库总量") = e.DataRow("入库总量") + e.DataRow("入库数量")
e.DataRow("原有库存") = e.DataRow("原有库存") + e.DataRow("入库数量")
dr("入库总量") = e.DataRow ("入库总量")
Else
e.DataRow("原有库存")= 0
e.DataRow ("入库总量") = e.DataRow("入库数量")
End If
Case "piao据号" '如果piao据号发生变化,piao据号输入完成
Dim nma() As String = {"物资名称","物资编号","物资类别","保存地点","入库总量","品牌","规格","单位"} 'A表数据来源列
Dim nmb() As String = {"物资名称","物资编号","物资类别","保存地点","入库总量","品牌","规格","单位"} 'B表数据接收列
Dim ddd As Row = Tables("物资明细").AddNew
For i As Integer = 0 To nma.Length - 1
ddd(nmb(i)) = e.DataRow(nma(i))
Next
Case "保存地点" '如果保存地点发生变化
Dim mc As DataRow
mc = DataTables("物资管理人").find("部门 = '" & e.DataRow("保存地点") & "'")
e.DataRow("保管员") = mc("姓名")
End Select