调度程序等待的FIX32.NODE1.DOWNTIMESTART.F_CV值为真。调度程序等待的FIX32.NODE1.DOWNTIMESTART.F_CV值为真。当它为真时,脚本则启动一个窗体让用户输入停机事件发生的原因。当用户单击“确定”后,脚本打开一个相关的数据库,并写入时间、日期、数据源和停机事件描述到数据库中。使用下表中的参数来创建事件对象和窗体,准确地将选项按钮放在结构内部。
停机开始事件属性
对象
|
属性
|
设置
|
事件
|
名称 事件类型 数据源
|
Line1Packer1DownTime On True Fix32.NodeName.DownTimeStart.F_CV
|
窗体
|
名称 Caption
|
frmDownTime Downtime Monitoring Logging to Relational Database
|
命令按钮
|
名称 Caption
|
cmdOK OK
|
Frame
|
名称 Caption
|
fraLine1Packer1 Packaging Line 1 Packer 1
|
Option Button
|
名称 Caption
|
optDownTimeReasonOne Bad packaging material
|
Option Button
|
名称 Caption
|
optDownTimeReasonTwo Fallen bottle or bottle jam on line to packer
|
Option Button
|
名称 Caption
|
optDownTimeReasonThree Low oil pressure in packer drive
|
Option Button
|
名称 Caption
|
optDownTimeReasonFour <Leave this caption blank>
|
Textbox
|
名称 启用
|
TxtDownTimeReasonFour False
|
例: 记录监测停机时间
Private Sub Line1Packer1DownTime_OnTrue()
frmDownTime.InitializeDataSource _
(Line1Packer1DownTime.Source)
frmDownTime.Show
End Sub
关系型数据库的停机监控记录
Public sDataSource As String
Public Sub InitializeDataSource(DataSource As String)
sDataSource = DataSource
End Sub
Private Sub optDownTimeReasonFour_Click()
txtDownTimeReasonFour.Enabled = True
txtDownTimeReasonFour.SetFocus
End Sub
Private Sub UserForm_Activate()
optDownTimeReasonOne.Value = True
End Sub
Private Sub cmdOK_Click()
Dim DownTimeReason As String
If optDownTimeReasonOne.Value = True Then
DownTimeReason = optDownTimeReasonOne.Caption
ElseIf optDownTimeReasonTwo.Value = True Then
DownTimeReason = optDownTimeReasonTwo.Caption
ElseIf optDownTimeReasonThree.Value = True Then
DownTimeReason = optDownTimeReasonThree.Caption
ElseIf optDownTimeReasonFour.Value = True Then
If txtDownTimeReasonFour.Text <> "" Then
DownTimeReason = txtDownTimeReasonFour.Text
Else
MsgBox "Please enter a reason for the _
downtime event"
txtDownTimeReasonFour.SetFocus
End If
End If
Call AddDownTImeEventData(DownTimeReason)
Unload Me
End Sub
Public Sub AddDownTImeEventData(DownTimeReason As String)
Dim wrkSpace As Workspace
Set wrkSpace = CreateWorkspace("", "admin", "", dbUseJet)
Dim db As Database
Set db = wrkSpace.OpenDatabase(System.PicturePath & _
"\downtime.mdb")
Dim rs As Recordset
Set rs = db.OpenRecordset("Packaging", dbOpenDynaset)
Dim TimeDate As Date
TimeDate = Now
rs.AddNew
rs.Fields(1) = TimeDate
rs.Fields(2) = TimeDate
rs.Fields(3) = sDataSource
rs.Fields(4) = DownTimeReason
rs.Fields(5) = Fix32.NODE1.downtimeperiod.f_cv
rs.Update
End Sub
相关信息