rt = New prt.RenderTable() '定义一个表格对象
rt.Rows(rt.Rows.Count).Height = 9 '新增一行
rt.Cells(rt.Rows.Count-1,0).SpanCols = 2
rt.Cells(rt.Rows.Count-1,0).Text = "产品代号"
rt.Cells(rt.Rows.Count-1,1).SpanCols = 3
rt.Cells(rt.Rows.Count-1,1).Text = CurRow("产品编码")
rt.Cells(rt.Rows.Count-1,2).Text = "产品规格"
rt.Cells(rt.Rows.Count-1,3).Text = CurRow("规格")
rt.Cells(rt.Rows.Count-1,4).SpanCols = 2
rt.Cells(rt.Rows.Count-1,4).Text = "下单日期"
rt.Cells(rt.Rows.Count-1,5).SpanCols = 2
rt.Cells(rt.Rows.Count-1,5).Text = CurRow("下单日期")
rt.Rows(rt.Rows.Count).Height = 9 '新增一行
rt.Cells(rt.Rows.Count-1,0).SpanCols = 2
rt.Cells(rt.Rows.Count-1,0).Text = "产品名称"
rt.Cells(rt.Rows.Count-1,1).SpanCols = 3
rt.Cells(rt.Rows.Count-1,1).Text = CurRow("品名")
rt.Cells(rt.Rows.Count-1,2).Text = "生产数量"
rt.Cells(rt.Rows.Count-1,3).Text = CurRow("生产数量")
rt.Cells(rt.Rows.Count-1,4).SpanCols = 2
rt.Cells(rt.Rows.Count-1,4).Text = "完成日期"
rt.Cells(rt.Rows.Count-1,5).SpanCols = 2
rt.Cells(rt.Rows.Count-1,5).Text = CurRow("计划结束")
rt.Rows(rt.Rows.Count).Height = 9 '新增一行
rt.Cells(rt.Rows.Count-1,0).SpanCols = 6
rt.Cells(rt.Rows.Count-1,0).Text = "物料明细"
rt.Cells(rt.Rows.Count-1,1).SpanCols = 6
rt.Cells(rt.Rows.Count-1,1).Text = "工序明细"
rt.Rows(rt.Rows.Count).Height = "auto" '新增一行
rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体",9) '设置字体
rt.Rows(rt.Rows.Count-1).Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本水平居中
Dim nms As String() = {"使用工序","材料代号","规格","单位","需求数量","工序号","工序名称","模号","机台吨位","加工方式","生产车间"} '明细表标题列
For c As Integer = 0 To nms.Length -1
rt.Cells(rt.Rows.Count-1,c).Text = nms(c)
Next
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.Page '指定表头行
Dim ColNames As String() = {"使用工序","物料编码","规格","计量单位","需求数量","工序号","工序名称","模号","机台吨位","加工方式","生产车间"} '明细表数据列
Dim drs As List(Of DataRow)
drs = DataTables("生产单_物料明细").Select("生产单号 = '" & CurRow("生产单号") & "'")
If drs.Count > 0 Then '如果有值
For i As Integer = 0 To drs.Count-1
rt.Rows(rt.Rows.Count).Height = rh '新增一行
For c As Integer = 0 To ColNames.Length -1
If c < 5 Then '左边五列来自生产物料明细
rt.cells(rt.Rows.Count-1,c).text = dr(i)(ColNames(c))
Else
rt.cells(rt.Rows.Count-1,c).text = dr(i)(ColNames(c))
End If
Next
Next
End If