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( "{任务单}.任务单编号", "{任务单}.工装模具编号", "{任务单}.产品名称", "{任务单}.产品系列", "{任务单}.产品图号", "{任务单}.进度", "{任务单}.模具工", "{零件加工}.工艺单编号", "{零件加工}.零件名称", "{零件加工}.零件图号", "{零件加工}.零件数量", "{工艺内容}.工序号", "{工艺内容}.工序", "{工艺内容}.计划作业人员", "{工艺内容}.机床代号", "{工艺内容}.机床编号", "{工艺内容}.计划开始日期", "{工艺内容}.计划完成日期", "{工艺内容}.工期", "{工艺内容}.完成加工日期", "{工艺内容}.加工人", "工步号", "工步", "工步时间小计", "加工内容") jb.Filter = "{任务单}.[进度] = '加工' or {任务单}.[进度] = '调整'" jb.Build() Dim drs As List(Of DataRow) = DataTables("加工滞留").Select("", "工艺单编号,完成加工日期 Desc") Dim rst As New List(Of DataRow) Dim bh As String = "" Dim Filter As String For Each dr As DataRow In drs If dr("工艺单编号") <> bh Then rst.Add(dr) bh = dr("工艺单编号") If Filter > "" Then Filter = Filter & " or " End If Filter = Filter & "工序号 = '" & dr("工序号") & "'" End If Next MessageBox.Show(1) msgbox(Filter) If Filter > "" Then MessageBox.Show(2)'执行时,显示数字2 Tables("加工滞留").Filter = Filter'狐表停止运行 End If