'-----填入物料清单
Dim filter As String = Tables("IL接头任务单").filter
If filter > "" Then filter = filter & " and "
'填入物料编号
Dim Products As List(Of String) = DataTables("IL接头任务单").GetValues("产品型号与回路号",filter & " SO号与箱号 ='" & ctn(s-1) & "'", "侧盖板组件") '按侧盖板组件进行排序
Dim idx As Integer = 1
Dim qty As Integer = 0
For Each sss As String In Products
'填入物料代号
rt = new prt.RenderText
Dim dr90 As DataRow
dr90 = DataTables("IL接头任务单").find("SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "' ")
' rt.text = sss
rt.text = dr90("产品型号")
re.Rows(idx).Height = 8
re.cells(idx,0).renderObject = rt
re.cells(idx,0).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.Style.Font = New Font("Arial", 18)
re.cells(1,0).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,1).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,2).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,3).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,4).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,5).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
re.cells(1,6).Style.GridLines.Top = New prt.Linedef(0.5, color.black)
'填入侧盖板组件代号
rt = new prt.RenderText
Dim dr99 As DataRow
dr99 = DataTables("IL接头任务单").find("SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "' ")
rt.text = dr99("侧盖板组件")
re.Rows(idx).Height = 8
re.cells(idx,3).RenderObject = rt
re.cells(idx,3).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.Style.Font = New Font("Arial", 14)
re.cells(idx,2).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.cells(idx,4).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
'填入数量个
rt = new prt.RenderText
Dim qty1 As Integer = Tables("IL接头任务单").Compute("sum(数量个)","SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "'")
' rt.text = Tables("IL接头任务单").Compute("sum(数量个)","SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "'")
rt.text = qty1
re.Rows(idx).Height = 8
re.cells(idx,1).RenderObject = rt
re.cells(idx,1).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.Style.Font = New Font("Arial", 18)
' idx +=1
qty = qty + qty1
'填入螺丝包代号
rt = new prt.RenderText
Dim dr98 As DataRow
dr98 = DataTables("IL接头任务单").find("SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "' ")
rt.text = dr98("螺丝包")
re.Rows(idx).Height = 8
re.cells(idx,5).RenderObject = rt
re.cells(idx,5).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.Style.Font = New Font("Arial", 14)
'填入回路号
rt = new prt.RenderText
Dim dr97 As DataRow
dr97 = DataTables("IL接头任务单").find("SO号与箱号 ='" & ctn(s-1) & "' and 产品型号与回路号='" & sss & "' ")
rt.text = dr97("回路号")
re.Rows(idx).Height = 8
re.cells(idx,6).RenderObject = rt
re.cells(idx,6).Style.GridLines.bottom = New prt.Linedef(0.5, color.black,DashStyle.Dot)
re.Style.Font = New Font("Arial", 14)
idx +=1
Next
ra.children.add(re)
附件是一个按钮的全部代码。上面贴出的是其中一段代码。早上这段代码都可以运行的,下午再测试时就有警告“未将对象引用设置到对象的实例”。我估计就是上面这段代码的问题。但是又找不出是什么问题。特此请教。谢谢。这里我曾经将getvalues 后面的 “产品型号”改为了“产品型号与回路号”。