Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
If e.DataCol.Name = "口岸" Then
If e.NewValue Is Nothing Then
e.datarow("开始箱号") = Nothing
Else
Dim dr As DataRow = DataTables("装箱单").Find("[订单号] = '" & e.datarow("订单号") & "' And [口岸] = '" & e.NewValue & "' And [结束箱号] > 0","_identify Desc")
if dr IsNot Nothing Then
e.datarow("开始箱号") = dr("结束箱号")+1
End if
End if
ElseIf e.DataCol.Name = "开始箱号" OrElse e.Datacol.Name = "箱数" Then
If e.Datarow.IsNull("开始箱号") = False AndAlso e.Datarow.IsNull("箱数") = False Then
e.DataRow("结束箱号") = e.DataRow("开始箱号") +e.DataRow("箱数") -1
End If
End if
If e.DataCol.Name = "口岸" Then
If e.NewValue Is Nothing Then
e.datarow("开始箱号") = Nothing
Else
Dim dr As DataRow = DataTables("装箱单").Find("[订单号] = '" & e.datarow("订单号") & "' And [口岸] = '" & e.NewValue & "' And [结束箱号] > 0","_identify Desc")
if dr IsNot Nothing Then
e.datarow("开始箱号") = dr("结束箱号")+1
End if
End if
ElseIf e.DataCol.Name = "开始箱号" OrElse e.Datacol.Name = "箱数" Then
If e.Datarow.IsNull("开始箱号") = False AndAlso e.Datarow.IsNull("箱数") = False Then
e.DataRow("结束箱号") = e.DataRow("开始箱号") +e.DataRow("箱数") -1
End If
End if
狐爸:你怎么这么聪明呢?太厉害了。我从开始学代码到今日,还是连个皮毛都没有学到。
结束箱号:[开始箱号] + [箱数]-1
Dim dr As DataRow
Dim T,T1,T2,T3 As String
T = e.datarow("_identify")
T1 = e.datarow("订单号")
T2 = e.datarow("口岸")
T3 = "[订单号] = '" & T1 & "' And [口岸] = '" & T2
T3 = T3 & "' And _identify < " & T
dr = e.DataTable.Find(T3,"_identify Desc")
If "订单号口岸".Indexof(e.DataCol.Name) >-1 Then
If T1 Is Nothing OrElse T2 Is Nothing Then
e.datarow("开始箱号") = Nothing
Elseif dr Is Nothing Then
e.datarow("开始箱号") = 1
Else
e.datarow("开始箱号") = dr("结束箱号")+1
End if
End if