194 lines
5.5 KiB
VB.net
194 lines
5.5 KiB
VB.net
Public Class MachLog
|
|
|
|
#Region "Private Fields"
|
|
|
|
Private m_AlarmCode As String
|
|
Private m_AlarmDateTime As DateTime
|
|
Private m_AlarmMessage As String
|
|
Private m_AlarmOperation As Integer
|
|
Private m_AlarmType As Integer
|
|
Private m_CommandExecutedCorrectly As Boolean
|
|
Private m_CommandState As CommandStates
|
|
Private m_CommandType As LogCommandTypes
|
|
Private m_Description As String
|
|
|
|
Private m_newOpState As Integer
|
|
|
|
Private m_ResultType As ResultTypes
|
|
|
|
Private m_VarAddress As String
|
|
|
|
Private m_VarValue As String
|
|
|
|
#End Region
|
|
|
|
#Region "Protected Constructors"
|
|
|
|
Protected Sub New()
|
|
m_AlarmCode = ""
|
|
m_AlarmDateTime = DateTime.MinValue
|
|
m_AlarmMessage = ""
|
|
m_AlarmOperation = 0
|
|
m_AlarmType = 0
|
|
m_CommandExecutedCorrectly = False
|
|
m_CommandState = CommandStates.NULL
|
|
m_CommandType = LogCommandTypes.NULL
|
|
m_Description = ""
|
|
m_newOpState = 0
|
|
m_ResultType = ResultTypes.NULL
|
|
m_VarAddress = ""
|
|
m_VarValue = ""
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "Public Properties"
|
|
|
|
Public ReadOnly Property AlarmCode As String
|
|
Get
|
|
Return m_AlarmCode
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AlarmDateTime As Date
|
|
Get
|
|
Return m_AlarmDateTime
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AlarmMessage As String
|
|
Get
|
|
Return m_AlarmMessage
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AlarmOperation As Integer
|
|
Get
|
|
Return m_AlarmOperation
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AlarmType As Integer
|
|
Get
|
|
Return m_AlarmType
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CommandExecutedCorrectly As Boolean
|
|
Get
|
|
Return m_CommandExecutedCorrectly
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CommandState As CommandStates
|
|
Get
|
|
Return m_CommandState
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CommandType As LogCommandTypes
|
|
Get
|
|
Return m_CommandType
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Description As String
|
|
Get
|
|
Return m_Description
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property newOpState As Integer
|
|
Get
|
|
Return m_newOpState
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ResultType As ResultTypes
|
|
Get
|
|
Return m_ResultType
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property VarAddress As String
|
|
Get
|
|
Return m_VarAddress
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property VarValue As String
|
|
Get
|
|
Return m_VarValue
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
#Region "Internal Methods"
|
|
|
|
Public Shared Function CreateAlarmLog(AlarmOperation As Integer, AlarmType As Integer, AlarmMessage As String, AlarmCode As String, AlarmDateTime As String)
|
|
Dim NewMachLog As New MachLog
|
|
NewMachLog.m_CommandType = LogCommandTypes.ALARM
|
|
NewMachLog.m_AlarmOperation = AlarmOperation
|
|
NewMachLog.m_AlarmType = AlarmType
|
|
NewMachLog.m_AlarmMessage = AlarmMessage
|
|
NewMachLog.m_AlarmCode = AlarmCode
|
|
DateTime.TryParse(AlarmDateTime, NewMachLog.m_AlarmDateTime)
|
|
Return NewMachLog
|
|
End Function
|
|
|
|
Public Shared Function CreateOPStateLog(newOpState As Integer)
|
|
Dim NewMachLog As New MachLog
|
|
NewMachLog.m_CommandType = LogCommandTypes.NEWOP
|
|
NewMachLog.m_newOpState = newOpState
|
|
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
|
Return NewMachLog
|
|
End Function
|
|
|
|
Public Shared Function CreateReadLog(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String)
|
|
Dim NewMachLog As New MachLog
|
|
NewMachLog.m_CommandType = CommandTypes.READ_TPA
|
|
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
|
NewMachLog.m_VarAddress = VarAddress
|
|
NewMachLog.m_VarValue = VarValue
|
|
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
|
Return NewMachLog
|
|
End Function
|
|
|
|
Public Shared Function CreateResultLog(CommandType As LogCommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Description As String)
|
|
Dim NewMachLog As New MachLog
|
|
NewMachLog.m_CommandType = CommandType
|
|
NewMachLog.m_CommandState = CommandState
|
|
NewMachLog.m_ResultType = ResultType
|
|
NewMachLog.m_Description = Description
|
|
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
|
Return NewMachLog
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "Public Methods"
|
|
|
|
Public Shared Function CreateMacLog(AlarmCode As String, AlarmDateTime As Date, AlarmMessage As String, AlarmOperation As Integer, AlarmType As Integer, CommandExecutedCorrectly As Boolean, CommandState As CommandStates, CommandType As LogCommandTypes, Description As String, newOpState As Integer, ResultType As ResultTypes, VarAddress As String, VarValue As String) As MachLog
|
|
|
|
Dim NewMachLog As New MachLog
|
|
NewMachLog.m_AlarmCode = AlarmCode
|
|
NewMachLog.m_AlarmDateTime = AlarmDateTime
|
|
NewMachLog.m_AlarmMessage = AlarmMessage
|
|
NewMachLog.m_AlarmOperation = AlarmOperation
|
|
NewMachLog.m_AlarmType = AlarmType
|
|
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
|
NewMachLog.m_CommandState = CommandState
|
|
NewMachLog.m_CommandType = CommandType
|
|
NewMachLog.m_Description = Description
|
|
NewMachLog.m_newOpState = newOpState
|
|
NewMachLog.m_ResultType = ResultType
|
|
NewMachLog.m_VarAddress = VarAddress
|
|
NewMachLog.m_VarValue = VarValue
|
|
|
|
Return NewMachLog
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
End Class |