For Each dt As DataTable In DataTables
dt.Save()
Next
Dim jb As New SQLJoinTableBuilder("零件加工工艺单", "任务单")
jb.C
jb.AddTable("任务单", "任务单编号", "项目阶段", "任务单编号", JoinModeEnum.left)
jb.AddTable("项目阶段", "项目段号", "零件加工", "项目段号", JoinModeEnum.left)
jb.AddTable("零件加工", "工艺单编号", "工艺内容", "工艺单编号", JoinModeEnum.left)
jb.AddTable("工艺内容", "工序号", "工步", "工序号", JoinModeEnum.left)
jb.AddCols( "{任务单}.任务单编号", "{任务单}.工装模具编号", "{任务单}.产品名称", "{任务单}.产品图号", "{任务单}.模具工", "{零件加工}.工艺单编号", "{零件加工}.零件名称", "{零件加工}.零件图号", "{零件加工}.零件数量", "{工艺内容}.工序号", "{工艺内容}.工序", "{工艺内容}.计划作业人员", "{工艺内容}.机床代号", "{工艺内容}.机床编号", "{工艺内容}.计划开始日期", "{工艺内容}.计划完成日期", "{工艺内容}.工期", "{工艺内容}.加工人", "工步号", "工步", "工步时间小计", "加工内容")
If Tables("生产管理_Table03").Current IsNot Nothing Then
jb.Filter = "{零件加工}.[工艺单编号] = '" & Tables("生产管理_Table03").Current("工艺单编号") & "'"
End If
For Each dr1 As Datadow In jb
dr1("工序号") = Right (dr1("工序号"), 2)
Next
jb.Build()
Dim Book As New XLS.Book(ProjectPath & "Attachments\零件加工工艺单.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()