Dim tb4 As Table = e.Form.Controls("Table4").Table
'生成前面分组列
Dim b1 As New SQLGroupTableBuilder("统计表1","无损_射线_拍片计划量")
Dim zhb1 As fxDataSource
b1.C
b1.Groups.AddDef("工程名称")
b1.Groups.AddDef("单项工程名称")
b1.Groups.AddDef("检验批名称")
b1.Groups.AddDef("检验批吨位")
b1.Groups.AddDef("总段数")
b1.Groups.AddDef("结构形式")
b1.Groups.AddDef("板厚","板厚范围")
zhb1 = b1.BuildDataSource()
'生成计划量
Dim b2 As New SQLCrossTableBuilder("统计表1","无损_射线_拍片计划量")
Dim zhb2 As fxDataSource
b2.C
b2.HGroups.AddDef("工程名称")
b2.HGroups.AddDef("单项工程名称")
b2.HGroups.AddDef("检验批名称")
b2.VGroups.AddDef("焊缝类型","计划量_{0}")
b2.VGroups.AddDef("部位")
b2.Totals .AddDef("计划量")
zhb2 = b2.BuildDataSource()
'统计实际检测量(条)
Dim b3 As New SQLCrossTableBuilder("统计表1","无损_检测明细")
Dim zhb3 As fxDataSource
b3.C
b3.HGroups.AddDef("工程名称")
b3.HGroups.AddDef("单项工程","单项工程名称")
b3.HGroups.AddDef("检验批","检验批名称")
b3.VGroups.AddDef("焊缝类型","有效拍片量条_{0}")
b3.VGroups.AddDef("拍片_部位")
b3.Totals.AddDef("检测量_单位1")
b3.Filter = "焊缝类型 is not null and 拍片_部位 is not null"
zhb3 = b3.BuildDataSource()
'统计实际检测量(张)
Dim b4 As New SQLCrossTableBuilder("统计表1","无损_检测明细")
Dim zhb4 As fxDataSource
b4.C
b4.HGroups.AddDef("工程名称")
b4.HGroups.AddDef("单项工程","单项工程名称")
b4.HGroups.AddDef("检验批","检验批名称")
b4.VGroups.AddDef("焊缝类型","有效拍片量张_{0}")
b4.VGroups.AddDef("拍片_部位")
b4.Totals.AddDef("首检_检测长度")
b4.Filter = "焊缝类型 is not null and 拍片_部位 is not null"
zhb4 = b4.BuildDataSource()
Dim sz As String() = {"工程名称","单项工程名称","检验批名称"}
zhb1.Combine(sz,zhb2,sz)
zhb1.Combine(sz,zhb3,sz)
zhb1.Combine(sz,zhb4,sz)
tb4.StopRedraw '暂停绘制表单
tb4.DataSource = zhb1
'没有对应的列增加列
'有效排片量(张)
Dim sz3() As String = {"有效拍片量条_横向对接_顶板","有效拍片量条_横向对接_底板","有效拍片量条_横向对接_腹板","有效拍片量条_横向对接_横隔板","有效拍片量条_纵向对接_顶板","有效拍片量条_纵向对接_底板","有效拍片量张_纵向对接_腹板","有效拍片量张_横向对接_顶板","有效拍片量张_横向对接_底板","有效拍片量张_横向对接_腹板","有效拍片量张_横向对接_横隔板","有效拍片量张_纵向对接_顶板","有效拍片量张_纵向对接_底板","有效拍片量张_纵向对接_腹板"}
Dim jh3 As new List(of String)
jh3.AddRange(sz3)
For a As Integer = 0 To sz3.Length - 1
If DataTables("射线拍片_Table4").DataCols.Contains(sz3(a)) = False
DataTables("射线拍片_Table4").DataCols.Add(sz3(a),Gettype(Integer),"",sz3(a))
End If
Next
'列名和标题转换----------------------------------------------------------------------------------------------------------------------------------------------------------
Dim jh1,jh2 As new List(of String)
Dim sz1(),sz2() As String
Dim i1,i2,i3,i4,i5,i6,i7 As Integer
Dim x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14 As Integer
'转换计划量
For Each dc As DataCol In DataTables("射线拍片_Table4") .DataCols
jh1.Add(dc.Name) '列名
jh2.Add(dc.Caption) '标题
Next
sz1 = jh1.ToArray
sz2 = jh2.ToArray
i1 = Array.IndexOf(sz2,"计划量_横向对接_顶板")
i2 = Array.IndexOf(sz2,"计划量_横向对接_底板")
i3 = Array.IndexOf(sz2,"计划量_横向对接_腹板")
i4 = Array.IndexOf(sz2,"计划量_横向对接_横隔板")
i5 = Array.IndexOf(sz2,"计划量_纵向对接_顶板")
i6 = Array.IndexOf(sz2,"计划量_纵向对接_底板")
i7 = Array.IndexOf(sz2,"计划量_纵向对接_腹板")
'转换拍片量
x1 = Array.IndexOf(sz2,"有效拍片量条_横向对接_顶板")
x2 = Array.IndexOf(sz2,"有效拍片量条_横向对接_底板")
x3 = Array.IndexOf(sz2,"有效拍片量条_横向对接_腹板")
x4 = Array.IndexOf(sz2,"有效拍片量条_横向对接_横隔板")
x5 = Array.IndexOf(sz2,"有效拍片量条_纵向对接_顶板")
x6 = Array.IndexOf(sz2,"有效拍片量条_纵向对接_底板")
x7 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_腹板")
x8 = Array.IndexOf(sz2,"有效拍片量张_横向对接_顶板")
x9 = Array.IndexOf(sz2,"有效拍片量张_横向对接_底板")
x10 = Array.IndexOf(sz2,"有效拍片量张_横向对接_腹板")
x11 = Array.IndexOf(sz2,"有效拍片量张_横向对接_横隔板")
x12 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_顶板")
x13 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_底板")
x14 = Array.IndexOf(sz2,"有效拍片量张_纵向对接_腹板")
Dim t1 As String = sz1(x5) &"+"& sz1(x6) &"+"& sz1(x7)
'合并各列数值
With DataTables("射线拍片_Table4")
msgbox(sz1(i5) & " + " & sz1(i6) & " + " & sz1(i7))
.DataCols.Add("纵向对接_计划量_条",Gettype(Integer), sz1(i5) & " + " & sz1(i6) & " + " & sz1(i7),"纵向对接(顶,底,腹)_计划量_条")
'.DataCols.Add("纵向对接_计划量_条",Gettype(Integer),""& sz1(i5) &" + "& sz1(i6) &" + "& sz1(i7) &"","纵向对接(顶,底,腹)_计划量_条")
.DataCols.Add("纵向对接_有效拍片量_条",Gettype(Integer), sz1(x5) &"+"& sz1(x6) &"+"& sz1(x7) ,"纵向对接(顶,底,腹)_有效拍片量_条")
'.DataCols.Add("纵向对接_有效拍片量_条",Gettype(Integer),""& sz1(x5) &" + "& sz1(x6) &" + "& sz1(x7) &"","纵向对接(顶,底,腹)_有效拍片量_条")
.DataCols.Add("纵向对接_有效拍片量_张",Gettype(Integer),""& sz1(x12) &" + "& sz1(x13) &" + "& sz1(x14) &"","纵向对接(顶,底,腹)_有效拍片量_张")
.DataCols.Add("横向对接_计划量_条",Gettype(Integer),""& sz1(i1) &" + "& sz1(i2) &" + "& sz1(i3) &"","横向对接(顶,底,腹)_计划量_条")
.DataCols.Add("横向对接_有效拍片量_条",Gettype(Integer),""& sz1(x1) &" + "& sz1(x2) &" + "& sz1(x3) &"","横向对接(顶,底,腹)_有效拍片量_条")
.DataCols.Add("横向对接_有效拍片量_张",Gettype(Integer),""& sz1(x8) &" + "& sz1(x9) &" + "& sz1(x10) &"","横向对接(顶,底,腹)_有效拍片量_张")
.DataCols.Add("横隔板横向对接_计划量_条",Gettype(Integer),""& sz1(i4) &"")
.DataCols.Add("横隔板横向对接_有效拍片量_条",Gettype(Integer),""& sz1(x4) &"")
.DataCols.Add("横隔板横向对接_有效拍片量_张",Gettype(Integer),""& sz1(x11) &"")
.DataCols.Add("拍片量统计_计划_总条数",Gettype(Integer),"纵向对接_计划量_条 + 横向对接_计划量_条 + 横隔板横向对接_计划量_条")
.DataCols.Add("拍片量统计_有效拍片量统计_条数",Gettype(Integer),"纵向对接_有效拍片量_条 + 横向对接_有效拍片量_条 + 横隔板横向对接_有效拍片量_条")
.DataCols.Add("拍片量统计_有效拍片量统计_张数",Gettype(Integer),"纵向对接_有效拍片量_张 + 横向对接_有效拍片量_张 + 横隔板横向对接_有效拍片量_张")
.DataCols.Add("拍片量统计_不合格拍片量统计_条数",Gettype(Integer),"")
.DataCols.Add("拍片量统计_不合格拍片量统计_张数",Gettype(Integer),"")
.DataCols.Add("拍片量统计_差额_条数",Gettype(Integer),"拍片量统计_计划_总条数 - 拍片量统计_有效拍片量统计_条数")
.DataCols.Add("拍片量统计_合格率(张)",Gettype(Integer),"")
End With
'设置列可见
Dim sz4() As String = {"工程名称","单项工程名称","检验批名称","检验批吨位","结构形式","板厚","总段数","结构形式","板厚范围","纵向对接(顶,底,腹)_计划量_条","纵向对接(顶,底,腹)_有效拍片量_条","纵向对接(顶,底,腹)_有效拍片量_张","横向对接(顶,底,腹)_计划量_条","横向对接(顶,底,腹)_有效拍片量_条","横向对接(顶,底,腹)_有效拍片量_张","横隔板横向对接_计划量_条","横隔板横向对接_有效拍片量_条","横隔板横向对接_有效拍片量_张","拍片量统计_计划_总条数","拍片量统计_有效拍片量统计_条数","拍片量统计_有效拍片量统计_张数","拍片量统计_不合格拍片量统计_条数","拍片量统计_不合格拍片量统计_张数","拍片量统计_差额_条数","拍片量统计_合格率(张)"}
For Each dc As Col In Tables("射线拍片_Table4").Cols
If sz4.Contains(dc.Caption)
dc.Visible = True
Else
dc.Visible = False
End If
Next
tb4.ResumeRedraw '恢复绘制表窗口