Now that the support is in place for exception reporting you can add the code to create a group, request exception reporting and display the results to the user.
In the Barcode module, add the global variables for keeping track of the step of the MIXTANKS SFC.
'OPC Exception Reporting
Global gStepHandle As Long
Global gStepItemHandle As Long
Global gStep As String
In the sub Main of the Barcode module, add the following code before the frmMain.Show command:
'Add group for receiving notices from the DeltaV System
gStepHandle = gOpcServer.AddGroup("Notify", 1000)
If gStepHandle <= 0 Then
MsgBox "Unable to add group Notify"
Exit Sub
End If
'Add items to track in Notify Group - save handles for callbacks
gStepItemHandle = gOpcServer.AddItem("Notify", "OPCSAMPLE/STEP_COUNT.CV", VT_BSTR)
gOpcServer.Subscribe ("Notify")
In the declarations section of the Barcode module, add a global variable for flagging the time to add dry ingredients:
Global Const DRYADD_STEP = "DRY_ADD"
Global gDryAddTime As Date
In the Timer1_Timer function of the form frmMain, add the following:
If gDryAddTime <> 0 Then
Beep
MsgBox "Add " & txtTargetIngAmt & "kgs of " _
& txtTargetIngName & " to product and Scan in the bar code"
gDryAddTime = 0
End If