Select Case e.DataCol.name
Case "产品名称", "规格型号"
If e.DataRow.IsNull("产品名称") Then
e.DataRow("物料编码") = Nothing
e.DataRow("主计量单位") = Nothing
e.DataRow("辅助计量单位") = Nothing
e.DataRow("折算系数") = Nothing
e.DataRow("受托加工前产品名称") = Nothing
e.DataRow("工资表上的产品名称") = Nothing
e.DataRow("供应商或客户叫的产品名称") = Nothing
e.DataRow("客货号") = Nothing
e.DataRow("货品属性") = Nothing
e.DataRow("物料分类") = Nothing
e.DataRow("供应商或客户") = Nothing
e.DataRow("供应商或客户简称") = Nothing
e.DataRow("修改人姓名") = Nothing
Else
Dim fdr As DataRow = DataTables("货品资料").find("产品名称 = '" & e.DataRow("产品名称").replace("'", "''") & "' and 规格型号 " & IIF(e.DataRow.IsNull("规格型号")," Is Null"," ='" & e.DataRow("规格型号") & "'"))
If fdr IsNot Nothing Then
e.DataRow("物料编码") = fdr("物料编码")
e.DataRow("主计量单位") = fdr("主计量单位")
e.DataRow("辅助计量单位") = fdr("辅助计量单位")
e.DataRow("折算系数") = fdr("折算系数")
e.DataRow("受托加工前产品名称") = fdr("受托加工前产品名称")
e.DataRow("工资表上的产品名称") = fdr("工资表上的产品名称")
e.DataRow("客货号") = fdr("客货号")
e.DataRow("货品属性") = fdr("货品属性")
e.DataRow("物料分类") = fdr("物料分类")
If e.DataRow("业务类型") = "采购收货" OrElse e.DataRow("业务类型") = "采购退货" OrElse e.DataRow("业务类型") = "销售出仓" OrElse e.DataRow("业务类型") = "销售退货" Then
e.DataRow("供应商或客户叫的产品名称") = fdr("供应商或客户叫的产品名称")
e.DataRow("单位名称") = fdr("供应商")
End If
End If
End If
Case "业务类型"
If e.NewValue = "采购收货" OrElse e.NewValue = "采购退货" OrElse e.NewValue = "销售出仓" OrElse e.NewValue = "销售退货" Then
Dim fdr As DataRow = DataTables("货品资料").find("产品名称 = '" & e.DataRow("产品名称").replace("'", "''") & "' and 规格型号 " & IIF(e.DataRow.IsNull("规格型号")," Is Null"," ='" & e.DataRow("规格型号") & "'"))
If fdr IsNot Nothing Then
e.DataRow("供应商或客户叫的产品名称") = fdr("供应商或客户叫的产品名称")
e.DataRow("单位名称") = fdr("供应商")
End If
Else
e.DataRow("供应商或客户叫的产品名称") = Nothing
e.DataRow("单位名称") = Nothing
End If
End Select