- Corretta ripartenza per parete

- Correzioni e miglioramento visalizzazione errori
This commit is contained in:
Emmanuele Sassi
2021-11-10 17:32:55 +01:00
parent ea0aa78530
commit 889e45bf31
4 changed files with 100 additions and 72 deletions
@@ -539,7 +539,7 @@ Public Class NUMFlexiumComm
Dim AplErrorAdditional As Object() = CType(ErrorAdditional, Object())
For index As Integer = 0 To numberOfError - 1
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = AplCnCNumber.ToString() AndAlso
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = AplCnCNumber AndAlso
x.CMsgErrorType = AplErrorType(index).ToString() AndAlso
x.CMsgErrorIndex = AplErrorIndex(index).ToString() AndAlso
x.CMsgErrorNumber = AplErrorNumber(index).ToString() AndAlso
@@ -552,7 +552,7 @@ Public Class NUMFlexiumComm
NewMessageInList.bFound = True
Else
' lo aggiungo
Dim NewMessage As ReadMessages = New ReadMessages(AplCnCNumber.ToString(),
Dim NewMessage As ReadMessages = New ReadMessages(AplCnCNumber,
AplErrorType(index).ToString(),
AplErrorIndex(index).ToString(),
AplErrorNumber(index).ToString(),
@@ -913,10 +913,10 @@ Public Class NUMFlexiumComm
Private Sub objDReadOperatorMessage_ValueChanged2(ByVal msgNumber As Object, ByVal line As Object)
Dim objMsgNumber As Object() = CType(msgNumber, Object())
Dim objLine As Object() = CType(line, Object())
Dim OpMsgErrType As Integer = 30
For index As Integer = 0 To objMsgNumber.Length - 1
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = "" AndAlso
x.CMsgErrorType = "" AndAlso
Dim NewMessageInList As ReadMessages = m_ReadFXMessages.FirstOrDefault(Function(x) x.CMsgCncNumber = 0 AndAlso
x.CMsgErrorType = OpMsgErrType.ToString() AndAlso
x.CMsgErrorIndex = "" AndAlso
x.CMsgErrorNumber = objMsgNumber(index).ToString() AndAlso
x.CMsgErrorLine = "" AndAlso
@@ -928,8 +928,8 @@ Public Class NUMFlexiumComm
NewMessageInList.bFound = True
Else
' lo aggiungo
Dim NewMessage As ReadMessages = New ReadMessages("",
"",
Dim NewMessage As ReadMessages = New ReadMessages(0,
OpMsgErrType.ToString(),
"",
objMsgNumber(index).ToString(),
"",
@@ -937,7 +937,7 @@ Public Class NUMFlexiumComm
"")
NewMessage.bFound = True
m_ReadFXMessages.Add(NewMessage)
m_NUMAlarmCallbackDlg(0, 0, "", "", objMsgNumber(index).ToString(), "", objLine(index).ToString(), "")
m_NUMAlarmCallbackDlg(0, 0, OpMsgErrType.ToString(), "", objMsgNumber(index).ToString(), "", objLine(index).ToString(), "")
End If
Next
@@ -967,7 +967,7 @@ Public Class ReadMessages
Public CMsgErrorMessage As String
Public CMsgErrorAdditional As String
Public bFound As Boolean = False
Public Sub New(ByVal MsgCncNumber As String, ByVal MsgErrorType As String, ByVal MsgErrorIndex As String, ByVal MsgErrorNumber As String, ByVal MsgErrorLine As String, ByVal MsgErrorMessage As String, ByVal MsgErrorAdditional As String)
Public Sub New(ByVal MsgCncNumber As Integer, ByVal MsgErrorType As String, ByVal MsgErrorIndex As String, ByVal MsgErrorNumber As String, ByVal MsgErrorLine As String, ByVal MsgErrorMessage As String, ByVal MsgErrorAdditional As String)
CMsgCncNumber = MsgCncNumber
CMsgErrorType = MsgErrorType
CMsgErrorIndex = MsgErrorIndex
@@ -28,6 +28,7 @@ Public Class MachCommandMessagePanelVM
Drive_Warning = 23
SysInfo_Message = 24
CNC_Warning = 25
OperatorMsg = 30
End Enum
Private m_AlarmTimer As New DispatcherTimer
@@ -145,7 +146,14 @@ Public Class MachCommandMessagePanelVM
Public ReadOnly Property sErrCycle As String
Get
Dim ShownErr As Alarm = If(m_ErrCycleCount < m_ErrCycle.Count, m_ErrCycle(m_ErrCycleCount), Nothing)
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Select Case CurrentMachine.NCType
Case NCTypes.TPA
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Case NCTypes.NUM_FLEXIUM
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
Case Else
Return ""
End Select
End Get
End Property
@@ -154,7 +162,14 @@ Public Class MachCommandMessagePanelVM
Public ReadOnly Property sIso As String
Get
Dim ShownErr As Alarm = If(m_IsoCount < m_Iso.Count, m_Iso(m_IsoCount), Nothing)
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Select Case CurrentMachine.NCType
Case NCTypes.TPA
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Case NCTypes.NUM_FLEXIUM
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
Case Else
Return ""
End Select
End Get
End Property
@@ -163,7 +178,14 @@ Public Class MachCommandMessagePanelVM
Public ReadOnly Property sMessage As String
Get
Dim ShownErr As Alarm = If(m_MessageCount < m_Message.Count, m_Message(m_MessageCount), Nothing)
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Select Case CurrentMachine.NCType
Case NCTypes.TPA
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Case NCTypes.NUM_FLEXIUM
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
Case Else
Return ""
End Select
End Get
End Property
@@ -173,7 +195,14 @@ Public Class MachCommandMessagePanelVM
Public ReadOnly Property sErrSystem As String
Get
Dim ShownErr As Alarm = If(m_ErrSystemCount < m_ErrSystem.Count, m_ErrSystem(m_ErrSystemCount), Nothing)
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Select Case CurrentMachine.NCType
Case NCTypes.TPA
Return If(Not IsNothing(ShownErr), ShownErr.sCode & ": " & ShownErr.sMessage, "")
Case NCTypes.NUM_FLEXIUM
Return If(Not IsNothing(ShownErr), ShownErr.sMessage, "")
Case Else
Return ""
End Select
End Get
End Property
@@ -549,31 +578,54 @@ Public Class MachCommandMessagePanelVM
Dim AlarmCode As String = ErrorTyp & " : " & ErrorIndex & " : " & ErrorNumber & " : " & ErrorLine
Dim AlarmMessage As String = ErrorMessage & " : " & ErrorAdditional
Dim ErrorNumberMsg As String = "Number:"
Dim ErrorIndexMsg As String = "Index:"
Dim ErrorTypMsg As String = "Type:"
Dim ErrorLineMsg As String = "Line:"
Dim ErrorAdditionalMsg As String = "Additional:"
Dim nErrorIndex As Integer
Dim nErrorNumber As Integer
Dim nErrorExtNumber As Integer
Dim nErrorTyp As Integer
Dim nErrorLine As Integer
Dim nErrorAdditional As Integer
' converto parametri messaggio in interi
Integer.TryParse(ErrorIndex, nErrorIndex)
Integer.TryParse(ErrorNumber, nErrorNumber)
Integer.TryParse(ErrorTyp, nErrorTyp)
Integer.TryParse(ErrorLine, nErrorLine)
Integer.TryParse(ErrorAdditional, nErrorAdditional)
Dim ErrorNumberMsg As String = "Number"
Dim ErrorIndexMsg As String = "Index"
Dim ErrorTypMsg As String = "Type"
Dim ErrorLineMsg As String = "Line"
Dim ErrorAdditionalMsg As String = "Additional"
Dim ErrorExtNumberMsg As String = "Extended Number"
Dim ErrorExtNumber As Integer = 0
' costruisco messaggio errore in base al tipo
Select Case ErrorTyp
Case NUM_ErrorTypes.CNC_Boot_Message
Case NUM_ErrorTypes.CNC_System_Warning
Case NUM_ErrorTypes.CNC_Message
ErrorIndexMsg = "Cnc Channel"
ErrorIndexMsg = "CN"
If Map.refMachManaging.Num_Flexium.IsFlexiumPlus Then
ErrorExtNumber = Convert.ToInt32(ErrorNumber) >> 16
ErrorNumber = Convert.ToInt32(ErrorNumber) And &HFFFF
nErrorExtNumber = Convert.ToInt32(ErrorNumber) >> 16
nErrorNumber = Convert.ToInt32(ErrorNumber) And &HFFFF
ErrorExtNumberMsg = "Ext"
ErrorAdditionalMsg = "Line Number"
ErrorNumberMsg = "CN:"
End If
ErrorLineMsg = "Number from the Cnc Block"
AlarmMessage = If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
" " & ErrorMessage
Case NUM_ErrorTypes.Drive_Error
ErrorIndexMsg = "Drive Address"
ErrorExtNumber = Convert.ToInt32(ErrorNumber) >> 16
ErrorNumber = Convert.ToInt32(ErrorNumber) And &HFFFF
ErrorIndexMsg = "Azionamento: Asse"
ErrorNumberMsg = "Ext"
ErrorExtNumberMsg = "Errore"
nErrorExtNumber = Convert.ToInt32(ErrorNumber) >> 16
nErrorNumber = Convert.ToInt32(ErrorNumber) And &HFFFF
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
" " & ErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
Case NUM_ErrorTypes.Communication_Message
Case NUM_ErrorTypes.PLC_Message_Reaction_Class_1,
NUM_ErrorTypes.PLC_Message_Reaction_Class_2,
@@ -582,19 +634,33 @@ Public Class MachCommandMessagePanelVM
NUM_ErrorTypes.PLC_Message_Reaction_Class_5,
NUM_ErrorTypes.PLC_Message_Reaction_Class_6,
NUM_ErrorTypes.PLC_Message_Reaction_Class_7,
NUM_ErrorTypes.PLC_Message_Reaction_Class_8,
NUM_ErrorTypes.PLC_Message_Reaction_Class_8
ErrorNumberMsg = "PLC"
ErrorTypMsg = "Classe"
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
ErrorTypMsg & ": " & nErrorTyp - 5 &
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
" " & ErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
Case NUM_ErrorTypes.HMI_Message
Case NUM_ErrorTypes.RTS_Message
Case NUM_ErrorTypes.Drive_Warning
ErrorIndexMsg = "Drive Address"
Case NUM_ErrorTypes.SysInfo_Message
Case NUM_ErrorTypes.CNC_Warning
Case NUM_ErrorTypes.OperatorMsg
ErrorTypMsg = "OpMsg"
End Select
AlarmCode = If(ErrorIndex <> 0, ErrorIndexMsg & ": " & ErrorIndex & " - ", "") & ErrorNumberMsg & ": " & ErrorNumber & " - " & If(ErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & ErrorExtNumber, "") & ErrorTypMsg & ": " & ErrorTyp - 5 & If(ErrorLine <> 0, " - " & ErrorLineMsg & ": " & ErrorLine, "")
AlarmMessage = ErrorMessage & If(ErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & ErrorAdditional, "")
AlarmCode = nErrorIndex & "." & nErrorNumber & "." & nErrorExtNumber & "." & nErrorTyp & "." & nErrorLine & "." & nErrorAdditional
If IsNothing(AlarmMessage) Then
AlarmMessage = If(nErrorIndex <> 0, ErrorIndexMsg & ": " & nErrorIndex & " - ", "") &
If(nErrorNumber <> 0, ErrorNumberMsg & ": " & nErrorNumber & " - ", "") &
If(nErrorExtNumber <> 0, " - " & ErrorExtNumberMsg & ": " & nErrorExtNumber, "") &
ErrorTypMsg & ": " &
If(nErrorLine <> 0, " - " & ErrorLineMsg & ": " & nErrorLine, "") &
" " & ErrorMessage & If(nErrorAdditional <> 0, " - " & ErrorAdditionalMsg & ": " & nErrorAdditional, "")
End If
' scrivo messaggio di errore
Select Case ErrorTyp
' CInt(ISOCNC.Remoting.AlarmType.Cycle)
@@ -606,8 +672,6 @@ Public Class MachCommandMessagePanelVM
CInt(NUM_ErrorTypes.PLC_Message_Reaction_Class_6),
CInt(NUM_ErrorTypes.PLC_Message_Reaction_Class_7),
CInt(NUM_ErrorTypes.PLC_Message_Reaction_Class_8)
'AlarmCode = "PLC: " & ErrorNumber & If(ErrorIndex <> 0, " - Index: " & ErrorIndex, "") & " - Classe: " & ErrorTyp - 5 & If(ErrorLine <> 0, " - Line: " & ErrorLine, "")
'AlarmMessage = ErrorMessage & If(ErrorAdditional <> 0, " - Additional: " & ErrorAdditional, "")
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
m_ErrCycle.Add(Alarm.CreateAlarm(AlarmCode, AlarmMessage))
Else
@@ -626,7 +690,8 @@ Public Class MachCommandMessagePanelVM
Case CInt(NUM_ErrorTypes.CNC_Boot_Message),
CInt(NUM_ErrorTypes.CNC_Message),
CInt(NUM_ErrorTypes.Communication_Message),
CInt(NUM_ErrorTypes.User_Message)
CInt(NUM_ErrorTypes.User_Message),
CInt(NUM_ErrorTypes.OperatorMsg)
'AlarmCode = ErrorTyp & " : " & ErrorIndex & " : " & ErrorNumber & " : " & ErrorLine
'AlarmMessage = ErrorMessage & " : " & ErrorAdditional
If AlarmOperation = CInt(ISOCNC.Remoting.AlarmOperation.Addition) Then
@@ -193,8 +193,8 @@ Public Class MyMachGroupVM
MyMachGroupVM.UpdateProduceIsEnabledForAll()
Return
End If
' se lavorazione interrotta da reset
If (bResetWhileCutting OrElse dtStartTime <> DateTime.MinValue) And Not Map.refLeftPanelVM.bRestart Then
' se progetto travi e lavorazione interrotta da reset
If Map.refSupervisorManagerVM.CurrProd.nType = BWType.BEAM AndAlso (bResetWhileCutting OrElse dtStartTime <> DateTime.MinValue) And Not Map.refLeftPanelVM.bRestart Then
' chiedo se riprendere o rifare la barra da zero
Dim bRedo As MessageBoxResult = MessageBox.Show("Riprendere lavorazione barra corrente?", "", MessageBoxButton.YesNo, MessageBoxImage.Information)
Select Case bRedo
@@ -521,43 +521,6 @@ Public Class MachManaging
End If
End If
Next
'Select Case CurrentMachine.NCType
' Case NCTypes.TPA
' For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
' If Not MyMachGroup.bSentToMachine AndAlso MyMachGroup.dtStartTime = DateTime.MinValue Then
' ' verifico se ricalcolo finito
' If MyMachGroup.bReadyForMachining Then
' ' lo lancio
' bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
' EgtOutLog("Mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
' MyMachGroup.SetSentToMachine(bSent)
' m_NextBarId = 0
' Exit For
' Else
' ' programma non ancora pronto, esco per attendere
' Return False
' End If
' End If
' Next
' Case NCTypes.NUM_FLEXIUM
' For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
' If Not MyMachGroup.bSentToMachine AndAlso MyMachGroup.dtStartTime = DateTime.MinValue Then
' ' verifico se ricalcolo finito
' If MyMachGroup.bReadyForMachining AndAlso Not MyMachGroup.bSendingToMachine Then
' ' lo lancio
' bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
' EgtOutLog("Mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
' MyMachGroup.SetSendingToMachine(bSent)
' m_NextBarId = 0
' Exit For
' Else
' ' programma non ancora pronto, esco per attendere
' Return False
' End If
' End If
' Next
'End Select
End SyncLock
EgtOutLog("End " & DateTime.Now())
End If