1、审计追踪一
Function KSZ1_MyAlarmBool_JOG(BaseScreenName,TagName,BoolName,WinccTagNameCHS,WinccTagNameENG,WinccTagNameITA)
Dim Button1,MyAlarm,CurrentUser,NewValue,OldValue
Set MyAlarm=HMIRuntime.Alarms(121901)
Set CurrentUser=HMIRuntime.Tags("@CurrentUser")
' Set Button1=HMIRuntime.Screens(ScreenName).ScreenItems(TagName)
' Set Button1=HMIRuntime.Screens("main_screen").ScreenItems(TagName)
CurrentUser.read
MyAlarm.State=5
'MyAlarm.Comment="MyComment"
MyAlarm.UserName=CurrentUser.Value
' MyAlarm.ProcessValues(2)="Jog"
MyAlarm.ProcessValues(3)=WinccTagNameENG
MyAlarm.ProcessValues(4)=WinccTagNameCHS
MyAlarm.ProcessValues(5)=WinccTagNameITA
MyAlarm.Create "MyApplication"
End Function
例子:
2、审计追踪二(根据变量的值显示不同信息)
Function KSZ1_MyAlarmBool(BaseScreenName,TagName,BoolName,WinccTagNameCHS,WinccTagNameENG,WinccTagNameITA) '报警功能
Dim Button1,MyAlarm,CurrentUser,NewValue,OldValue
HMIRuntime.Trace HMIRuntime.Tags(BoolName).Read & vbCrlf
If HMIRuntime.Tags(BoolName).Read=0 Then'BoolName的值来自于开启记录变量public_gbo_db8_begin_record 应改为HMIRuntime.Tags(BoolName).Read=1
Set MyAlarm=HMIRuntime.Alarms(121901)'报警序号
Set CurrentUser=HMIRuntime.Tags("@CurrentUser")'获得当前用户(使用变量引用方式)
CurrentUser.read'用户值
MyAlarm.State=5'报警状态为5
'MyAlarm.Comment="MyComment"
MyAlarm.UserName=CurrentUser.Value'当前用户赋给报警用户
MyAlarm.ProcessValues(2)="Off---On"'报警消息
MyAlarm.ProcessValues(3)=WinccTagNameENG'报警对像
MyAlarm.ProcessValues(4)=WinccTagNameCHS'报警对像
MyAlarm.ProcessValues(5)=WinccTagNameITA'报警对像
MyAlarm.Create "MyApplication"'创建报警
Else
Set MyAlarm=HMIRuntime.Alarms(121901)'报警序号
Set CurrentUser=HMIRuntime.Tags("@CurrentUser")'获得当前用户(使用变量引用方式)
CurrentUser.read'用户值
MyAlarm.State=5'报警状态为5
'MyAlarm.Comment="MyComment"
MyAlarm.UserName=CurrentUser.Value'当前用户赋给报警用户
MyAlarm.ProcessValues(2)="On---Off"'报警消息
MyAlarm.ProcessValues(3)=WinccTagNameENG'报警对像
MyAlarm.ProcessValues(4)=WinccTagNameCHS'报警对像
MyAlarm.ProcessValues(5)=WinccTagNameITA'报警对像
MyAlarm.Create "MyApplication" '创建报警
End If
End Function
例子:
3、审计追踪&电子签名