provato a decodificare allarmi CNC MA NON FORNA (il cod 161 iniziale è corretto a video, gli altri recuperati SEMBRANO NON corrispondere...)
This commit is contained in:
@@ -925,11 +925,11 @@ Namespace CNC
|
||||
Return True
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Chiama ReadErrMsg x ottenere elenco errori
|
||||
''' Chiama ReadCurrentErrorMsg x ottenere elenco errori
|
||||
''' </summary>
|
||||
''' <param name="ErrMsg"></param>
|
||||
''' <param name="CurrMsgError"></param>
|
||||
''' <returns></returns>
|
||||
Public Overridable Function O_ReadErrMsg(ByRef ErrMsg As OPENcontrol.ERRMSG) As Boolean
|
||||
Public Overridable Function O_ReadCurrentErrorMsg(ByRef CurrMsgError As OPENcontrol.MSGERROR) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
@@ -1005,13 +1005,13 @@ Retry: nRetry += 1
|
||||
|
||||
End Function
|
||||
|
||||
Public Overloads Overrides Function O_ReadErrMsg(ByRef ErrMsg As OPENcontrol.ERRMSG) As Boolean
|
||||
Public Overloads Overrides Function O_ReadCurrentErrorMsg(ByRef CurrMsgError As OPENcontrol.MSGERROR) As Boolean
|
||||
' RIFERIMENTO:
|
||||
' CndexLinkUser.pdf | pag 160, 270
|
||||
' CndexLinkUser.pdf | pag 162, 270
|
||||
|
||||
Dim szReturn As String = ""
|
||||
Dim myReadErrMsgR As OPENcontrol.ReadErrMsgR
|
||||
Dim myReadErrMsg As New OPENcontrol.ReadErrMsg
|
||||
Dim myReadCurrentErrorMsgR As OPENcontrol.ReadCurrentErrorMsgR
|
||||
Dim myReadCurrentErrorMsg As New OPENcontrol.ReadCurrentErrorMsg
|
||||
Dim ProcessId As Short
|
||||
Dim nRetry As Integer
|
||||
Retry: nRetry += 1
|
||||
@@ -1019,14 +1019,14 @@ Retry: nRetry += 1
|
||||
Try
|
||||
O_GetSelectedProcess(ProcessId)
|
||||
|
||||
myReadErrMsg.ProcNum = ProcessId
|
||||
myReadErrMsgR = OPENws.ReadErrMsg(myReadErrMsg)
|
||||
If O_CheckRetError(myReadErrMsgR.retval, myReadErrMsgR.ErrClass, myReadErrMsgR.ErrNum, "GetNcInfo1() O_GetNcInfo1 CNC.OSAI_OPEN", szReturn) Then
|
||||
myReadCurrentErrorMsg.Process = ProcessId
|
||||
myReadCurrentErrorMsgR = OPENws.ReadCurrentErrorMsg(myReadCurrentErrorMsg)
|
||||
If O_CheckRetError(myReadCurrentErrorMsgR.retval, myReadCurrentErrorMsgR.ErrClass, myReadCurrentErrorMsgR.ErrNum, "ReadCurrentErrorMsg() O_ReadCurrentErrorMsg CNC.OSAI_OPEN", szReturn) Then
|
||||
Throw New CmsNcException(szReturn)
|
||||
Return False
|
||||
End If
|
||||
|
||||
ErrMsg = myReadErrMsgR.SysErrMsg
|
||||
CurrMsgError = myReadCurrentErrorMsgR.Data
|
||||
Return True
|
||||
Catch ex As System.ServiceModel.CommunicationException
|
||||
If nRetry < MAXRET Then GoTo Retry
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace MTC_Adapter
|
||||
/// <summary>
|
||||
/// Vettore degli allarmi CNC attivi
|
||||
/// </summary>
|
||||
public CMSCncLib.OPENcontrol.ERRMSG allarmiCNC;
|
||||
public CMSCncLib.OPENcontrol.MSGERROR allarmiCNC;
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base...
|
||||
@@ -1264,13 +1264,13 @@ namespace MTC_Adapter
|
||||
sb.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.lastncerror));
|
||||
|
||||
inizio = DateTime.Now;
|
||||
OSAI_ref.O_ReadErrMsg(ref allarmiCNC);
|
||||
OSAI_ref.O_ReadCurrentErrorMsg(ref allarmiCNC);
|
||||
if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ALARMS", DateTime.Now.Subtract(inizio).Ticks);
|
||||
checkCNCAlarms();
|
||||
}
|
||||
else
|
||||
{
|
||||
allarmiCNC = new CMSCncLib.OPENcontrol.ERRMSG();
|
||||
allarmiCNC = new CMSCncLib.OPENcontrol.MSGERROR();
|
||||
}
|
||||
|
||||
parentForm.dataMonitor = sb.ToString();
|
||||
@@ -1401,11 +1401,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
if (allarmiCNC != null)
|
||||
{
|
||||
// faccio parse allarmi: se ci sono invio e presento
|
||||
if (allarmiCNC.Msg1 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
|
||||
if (allarmiCNC.Msg2 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
|
||||
if (allarmiCNC.Msg3 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
|
||||
if (allarmiCNC.Msg4 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
|
||||
sendAlarmIfPresent(allarmiCNC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1413,16 +1409,28 @@ namespace MTC_Adapter
|
||||
/// Invia singolo allarme CNC se presente
|
||||
/// </summary>
|
||||
/// <param name="allarme"></param>
|
||||
protected void sendAlarmIfPresent(string allarme)
|
||||
protected void sendAlarmIfPresent(CMSCncLib.OPENcontrol.MSGERROR allarme)
|
||||
{
|
||||
// controllo valore...
|
||||
if (allarme != "" && allarme != null)
|
||||
if (allarme != null)
|
||||
{
|
||||
if (utils.CRI("loglevel") > 5)
|
||||
try
|
||||
{
|
||||
lg.Info(string.Format("Allarmi CNC: {0} ", allarme));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (utils.CRI("loglevel") > 5)
|
||||
{
|
||||
lg.Info(string.Format("Allarmi CNC: {0} ", allarme.CodeErr));
|
||||
}
|
||||
string alarmText = string.Format("Cod: {0} | Proc: {1} | Comm: {2} | SubCom: {3} | {4}", allarme.CodeErr, allarme.Process, allarme.Comando, allarme.SubCom, allarme.FormatTxt);
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, alarmText, allarme.CodeErr.ToString(), "", "");
|
||||
// mostro in form!
|
||||
sb.AppendLine(alarmText);
|
||||
parentForm.dataMonitor += sb.ToString();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, allarme, allarme, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user