If pause = True Then
Return
Dim jb2 As New SQLJoinTableBuilder("产品详细","产品表")
jb2.C
jb2.AddTable("产品表","组件号","产品信息2","键",JoinModeEnum.left)
jb2.AddCols("父键","描述")
jb2.Filter="[产品编号]='" & Tables("订单主表.订单详细").current("产品编码") & "'"
Tables("订单管理_Table3").DataSource=jb2.BuildDataSource
For Each r As Row In Tables("订单管理_Table3")
r("父键")=DataTables("产品信息2").find("[键]='" & r("父键") & "'")("描述")
Next
'MessageBox.show ("5")
Dim fl As String
fl=Tables("订单主表.订单详细").current("详细编号")
Dim jb As new SQLJoinTableBuilder("分解信息","订单详细")
jb.C
jb.addtable("订单详细","产品编码","产品表","产品编号")
jb.addtable("订单详细","原料","原料主表","原料编号",JoinModeEnum.left)
jb.AddTable("产品表","组件号","BOM","父键")
jb.AddTable("BOM","键","零件表","键",JoinModeEnum.left)
jb.addtable("零件表","键","零件检验标准","零件编号",JoinModeEnum.left)
jb.Filter="[详细编号] = '" & fl & "'"
jb.AddCols ("详细编号","{零件表}.模具编号","{零件表}.名称",True)
jb.AddExp ("数量","sum({BOM}.数量)") '承接上级窗口使用
jb.AddCols ("{零件检验标准}.单重",True)
jb.AddExp ("重量","Round(单重 * 数量,1)")
jb.AddCols ("{零件表}.型号","{零件表}.键","原料","固定原料","BOM原料","{原料主表}.材质",True)
Tables("订单管理_Table4").DataSource =jb.BuildDataSource()
With Tables("订单管理_Table4")
.Cols("数量").GrandTotal = True
.Cols("重量").GrandTotal = True
.GrandTotal = True
End With
'MessageBox.show ("6")
For Each r As Row In Tables("订单管理_Table4")
If r.Isnull("BOM原料") Then
'MessageBox.show ("6.1")
Else
r("原料")=r("BOM原料")
r("材质")=DataTables("原料主表").Find("[原料编号]='" & r("原料") & "'")("材质")
End If
'MessageBox.show ("7")
If r.Isnull("固定原料") Then
'MessageBox.show ("7.1")
Else
r("原料")=r("固定原料")
r("材质")=DataTables("原料主表").Find("[原料编号]='" & r("原料") & "'")("材质")
End If
Next
'MessageBox.show ("8")
With Tables("订单管理_Table4")
.Cols("固定原料").Visible = False
.Cols("BOM原料").Visible = False
'.Cols("需求数量").Visible = False
.AutoSizeCols
.Sort="型号"
End With
End If
End If
End If
End If