老师好, 我在表的DataColChanged 里设置了代码,但是当通过自定义项目...打开窗口然后选择内容写入列后,列内容改变之后代码有时候实现不了? 我测试重置列的话又可以实现代码。请问是代码问题还是? 代码如下:
If e.DataCol.Name = "库位" Then
Dim dr4 As DataRow
Dim filter4 As String
Dim filter2 As String
Dim filter As String = "1=1"
If e.DataRow.isnull("品名") = False Then
filter &= " and 品名 = '" & e.DataRow("品名") & "'"
End If
If e.DataRow.isnull("批号") = False Then
filter &= " and 批号 = '" & e.DataRow("批号") & "'"
End If
filter4 = filter & " and [库位] = '" & e.DataRow("库位") & "' and [货权] = '" & e.DataRow("货权") & "'"
filter2 = filter & " and [库位] = '" & e.DataRow("库位") & "' and [货权] = '" & e.DataRow("货权") & "' and [日期]='" & Date.today & "'"
dr4 = DataTables("总库存表").SQLFind(Filter4 )
Dim Sum1 As Single=DataTables("总库存表").SQLCompute("Sum(昨日结存)", filter4)
Dim Sum2 As Single=DataTables("出库明细表").Compute("Sum(出库重量)", filter2)
If dr4 IsNot Nothing Then
dr4("今日出库")=sum2
dr4.Save
End If
If dr4 IsNot Nothing And Sum1 <e.DataRow("出库重量") Then
Dim drs As List(Of DataRow) = DataTables("入库明细表").Select(Filter2 )
If drs.Count > 0 Then
Dim Sum3 As Single= e.DataRow("出库重量")-sum1
Dim str As String = ""
For Each dr As DataRow In drs
str = str & dr("入库车号") & "|" & sum3 & "+" & dr4("库位") & "|" & sum1 & "-"
Next
e.DataRow("出库详情") = str.TrimEnd("-")
End If
ElseIf dr4 IsNot Nothing And Sum1 >=e.DataRow("出库重量") Then '如果找到
e.DataRow("出库详情") =e.DataRow("出库重量")
End If
End If