'从Weekly和BK计划导入更新后的作业计划AutoUpdate_Schedule_From_WeeklyProductionSchedule_And_BK_INI_Production_Schedule
SystemReady = False
Try
Dim dts As String = "Schedule"
Dim dtm As String = "WeeklyMachineSchedule"
Dim dtb As String = "INISecondarySchedule"
If Not DataTables.Contains(dts) Then
DataTables(dts).Loadfilter = ""
DataTables(dts).Load
End If
If Not DataTables.Contains(dtm) Then
DataTables(dtm).Loadfilter = ""
DataTables(dtm).Load
End If
If Not DataTables.Contains(dtb) Then
DataTables(dtb).Loadfilter = ""
DataTables(dtb).Load
End If
Dim wo As String
Dim op As Integer
Dim drs As DataRow
Dim drm As DataRow
Dim i As Integer
Dim t1 As Date = Date.Now
Dim t2 As Date
Dim t3 As TimeSpan
For Each drm In DataTables(dtm).DataRows '机加计划刷新Schedule
If drm("Process_Competed") = False Then '未完工项
wo = drm("WO")
op = drm("OP")
drs = DataTables("Schedule").Find("[WO]= '" & wo & "' and [C_Op]= " & op)
If drs IsNot Nothing Then
If drs("Plan_StartTime") <> drm("Adj_StartTime") Then
drs("Plan_StartTime") = drm("Adj_StartTime")
End If
If drs("Plan_Endtime") <> drm("Adj_EndTime") Then
drs("Plan_Endtime") = drm("Adj_EndTime")
End If
End If
End If
Next
1:
t2 = Date.Now
t3 = t2 - t1
Output.Show(t3.TotalSeconds)
i = 0
Dim bDate As Date = Date.Today.AddMonths( - 1) '上月当天
Dim drbs As List(Of DataRow) = DataTables(dtb).Select("[工序类别] not in ('纵车','5 Axis Grinder','OutS - 纵车','Mill','EDM','Puma','Gun Drill','OutS - Mill') and [调整后_计划开工]>= #" & bdate & "#")
Output.Show("Drbs.count:" & drbs.Count)
For Each drb As DataRow In drbs 'BKSchedule刷新Schedule
'If drb("调整后_计划开工") > bdate Then
wo = drm("WO")
op = drm("OP")
drs = DataTables("Schedule").Find("[WO]= '" & wo & "' and [C_Op]= " & op)
If drs IsNot Nothing Then
'If drs("Plan_StartTime") <> drb("调整后_计划开工") Then
drs("Plan_StartTime") = drb("调整后_计划开工")
'End If
'If drs("Plan_Endtime") <> drb("调整后_计划结束") Then
drs("Plan_Endtime") = drb("调整后_计划结束")
'End If
'If drs("Status") <> drb("OPStatus") Then
drs("Status") = drb("OPStatus")
'End If
'If drs("C_NeedHours") <> drb("计算需求尚须小时") Then
drs("C_NeedHours") = drb("计算需求尚须小时")a
'End If
'If drs("Question_Des") <> drb("工序问题") Then
drs("Question_Des") = drb("工序问题")
'End If
i = i + 1
If i > 1000 Then
‘为测试运行时间跳出程序设置’
GoTo 2
End If
End If
'End If
Next
2:
t2 = Date.Now
t3 = t2 - t1
Output.Show(t3.TotalSeconds)
Catch ex As Exception
Output.Show("出现异常")
End Try
SystemReady = True
程序运行输出信息;
表A全部数据运行时间0.058804
表B 数据行数量:Drbs.count:12467
表B运行1000行数据花费的时间:24.6311707