下面代码和图片:
表事件:PositionChanged
根据表1中当前行的期初日期, 在表2中加载数据,问题如图!着急
Dim cmd As New SQLCommand
cmd.C
Dim r As Row = Tables("期初表_Table1").Current '获取当前行
If r IsNot Nothing Then
cmd.CommandText = "select * f rom (select d._Identify,rkid,仓库地点,产品线,库存类型,仓库属性,d.条码,BOM编码,产品型号,isnull(d.数量,0)-isnull(b.数量,0) as 数量,采购合同号,入库日期 f rom (select 入库表._identify,c.rkid,仓库地点,产品线,库存类型,仓库属性,条码,BOM编码,产品型号,数量,采购合同号,入库日期 f rom (select * f rom 入库条码明细) as c left join 入库表 on c.rkid = 入库表._identify where 审核 = 'true') as d left join (select 出库表._identify,a.ckid,出库日期,条码,数量 f rom (select * f rom 出库条码明细) as a left join 出库表 on a.ckid = 出库表._identify where 审核 = 'true' and 出库日期 <='" & r("期初日期") & "') As b on d.条码 = b.条码 ) As e where 数量 > 0 And 入库日期<= '" & r("期初日期") & "'"
Dim dt As DataTable = cmd.ExecuteReader
cmd.CommandText = "select _Identify,qcid as 期初序列号,仓库地点,产品线,库存类型,仓库属性,条码,BOM编码,产品型号,数量,采购合同号,入库日期 f rom 期初表 where 入库日期 <='" & r("期初日期") & "'"
Dim s As String = cmd.CommandText
Dim dt1 As DataTable = cmd.ExecuteReader
Tables("期初表_Table2").Fill( s , "user" ,True)
Tables("期初表_Table2").AllowEdit=False
If dt.DataRows.Count > 0 Then
For j As Integer = 0 To DataTables("期初表_Table2").DataRows.Count-1
Dim dr As DataRow = dt.DataRows(0)
Dim dr1 As DataRow = dt1.DataRows(j)
dr1("期初序列号") = r("_Identify")
dr1("产品线") = dr("产品线")
dr1("库存类型") = dr("库存类型")
dr1("条码") = dr("条码")
dr1("BOM编码") = dr("BOM编码")
dr1("产品型号") = dr("产品型号")
dr1("数量") = dr("数量")
dr1("采购合同号") = dr("采购合同号")
dr1("入库日期") = dr("入库日期")
DataTables("期初表_Table2").Save
Tables("期初表_Table2").SetColVisibleWidth("期初序列号|40|仓库地点|90|产品线|70|仓库属性|90|条码|150|BOM编码|90|产品型号|90|数量|50||采购合同号|100|入库日期|90")
Next
End If
End If
此主题相关图片如下:1.png
此主题相关图片如下:2.png