If e.DataCol.Name = "批次设置" AndAlso e.DataRow("批次设置") = True Then '复制行' For Each dc As DataCol In DataTables("库存商品批次汇总表").DataCols If e.DataTable.DataCols.Contains(dc.Name) AndAlso e.DataRow.IsNull(dc.name) Then messagebox.show("请先输入" & dc.name) Return End If Next If e.DataRow.IsNull("生产日期") = False Then Dim dr As DataRow = DataTables("库存商品批次汇总表").Find("货品编号 = '" & e.DataRow("货品编号") & "' And 批次 = '" & e.DataRow("批次") & "'And 生产日期 = '" & e.DataRow("生产日期") & "'And 规格 = '" & e.DataRow("规格") & "'And 型号 = '" & e.DataRow("型号") & "'") If dr IsNot Nothing Tables("库存商品批次汇总表").Position = Tables("库存商品批次汇总表").FindRow(dr) Else Dim r As Row = Tables("库存商品批次汇总表").AddNew() For Each dc As DataCol In DataTables("库存商品批次汇总表").DataCols If e.DataTable.DataCols.Contains(dc.Name) Then r(dc.name) = e.DataRow(dc.name) End If Next End If End If End If Select Case e.DataCol.Name Case "货品编号","比率" Dim dr As DataRow = DataTables("货品资料").Find("货品编号 = '" & e.DataRow("货品编号") & "'") If dr IsNot Nothing AndAlso dr("比率填充为批次") = True e.DataRow("批次") =e.DataRow("比率") End If End Select
|