Dim Value()As String,Sjbm()As String
Dim zc As String,fl As String
Dim zcx As String
Dim tr1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim td1 As WinForm.TreeNode
td1 = tr1.Nodes(0)
Dim dr As DataRow
zc=""
If e.Node.Level=0 Then
If td1.Text="临时检索" Then
If e.Node.name="临时检索" Then
Return
End If
sjbm = e.Node.name.Split("|")
dr = DataTables("库存").Find ("货品编码 = '" & sjbm(1) & "'")
If dr IsNot Nothing Then
If Forms("输入出入库单").Opened=True Then
Dim r As Row = Tables("出入库明细").Current
r("货品名称")=dr("货品名称")
r("货品编码")=dr("货品编码")
' r("类别")=dr("类别")
r("品号")=dr("品号")
r("类别")=dr("类别")
r("即时库存")=dr("当前库存")
' r("SNP")=dr("SNP")
r("仓库")=dr("存放仓库")
Dim dr9 As DataRow = DataTables("近期出货数量").Find("方向='" & 出入库标识 & "' And 货品编码= '" & dr("货品编码") & "' AND 企业编码='" & Tables("出入库汇总").Current("商家编码") & "'")
If dr9 IsNot Nothing Then
r("SNP")= dr9("新SNP")
zcx="近期的" & 出入库标识 & "SNP是"
Else
zcx="库存内" & 出入库标识 & "SNP是"
End If
Dim l18 As WinForm.Label = Forms("输入出入库单").Controls("Label18")
l18.text= dr("货品编码") & "/" & zcx & "|" & r("SNP") & "元."
DataTables("出入库明细").AllowEdit=True
Tables("出入库明细").AddNew
Tables("出入库明细").Current("出入库单")=Tables("出入库汇总").Current("出入库单") ' "ZZZZZZZZZZ"
Tables("出入库明细").Current("变更日期")=Date.now
Tables("出入库明细").Current("状态")="正常"
End If
End If
'MessageBox.Show(e.Node.name & "|" & td1.Text)
End If
Return
End If
Value = e.Node.FullPath.Split("\")
Select Case e.Node.Level
Case 1
Return
Select Case Value(0)
Case "加载全部记录"
Case "存放仓库"
fl="[存放仓库]='"
zc =fl & Value(1) & "'"
Case "类别"
fl="[类别]='"
zc =fl & Value(1) & "'"
End Select
Case 2
sjbm = Value(2).Split("|")
Select Case Value(0)
Case "加载全部记录"
Case "存放仓库"
fl="存放仓库='"
zc =fl & Value(1) & "' And 货品编码 = '" & sjbm(1) & "'"
Case "类别"
fl="类别='"
zc =fl & Value(1) & "' And 货品编码 = '" & sjbm(1) & "'"
End Select
End Select
If e.Node.Name="加载全部记录" Then
zc=""
End If
dr = DataTables("库存").Find (zc)
If dr IsNot Nothing Then
If Forms("输入出入库单").Opened=True Then
DataTables("出入库明细").AllowEdit=True
Dim r As Row = Tables("出入库明细").Current
r("货品名称")=dr("货品名称")
r("货品编码")=dr("货品编码")
' r("类别")=dr("类别")
r("品号")=dr("品号")
r("类别")=dr("类别")
r("即时库存")=dr("当前库存")
' r("SNP")=dr("SNP")
r("仓库")=dr("存放仓库")
' Tables("出入库明细").AddNew
'If Tables("出入库汇总").Current("出入库单")="ZZZZZZZZZZ" Then
Dim dr9 As DataRow = DataTables("近期出货数量").Find("方向='" & 出入库标识 & "' And 货品编码= '" & dr("货品编码") & "' AND 企业编码='" & Tables("出入库汇总").Current("商家编码") & "'")
If dr9 IsNot Nothing Then
r("SNP")= dr9("新SNP")
zcx="近期的" & 出入库标识 & "SNP是"
Else
' r("SNP")=dr("SNP")
' zcx="价格采用的是" & 出入库标识 & "价!"
zcx="库存内" & 出入库标识 & "SNP是"
End If
' If Forms("输入出入库单").Opened=True Then
Dim l18 As WinForm.Label = Forms("输入出入库单").Controls("Label18")
'l18.text=zcx
l18.text=dr("货品编码") & "/" & zcx & "|" & r("SNP") & "元."
Tables("出入库明细").AddNew
Tables("出入库明细").Current("出入库单")=Tables("出入库汇总").Current("出入库单") ' "ZZZZZZZZZZ"
Tables("出入库明细").Current("变更日期")=Date.now
Tables("出入库明细").Current("状态")="正常"
End If
End If
'e.Form.close