inizio test allarmi OSAI
This commit is contained in:
@@ -2107,7 +2107,6 @@ namespace MTC_Adapter
|
||||
}
|
||||
}
|
||||
}
|
||||
// aggiungo eventuali allarmi "extra"... !!!FARE!!! salvare in vettore condition gli allarmi extra da "riaggiungere"... osai if (allNcData.lastncerror != 0)
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe fittizia in caso di processing GLOBALE di tutto in 1 solo colpo...
|
||||
|
||||
@@ -167,7 +167,8 @@ namespace MTC_Adapter
|
||||
/// <summary>
|
||||
/// Vettore degli allarmi CNC attivi
|
||||
/// </summary>
|
||||
public CMSCncLib.OPENcontrol.MSGERROR allarmiCNC;
|
||||
//public CMSCncLib.OPENcontrol.MSGERROR allarmiCNC;
|
||||
public Dictionary<string, string> allarmiCNC =new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// estende l'init della classe base...
|
||||
/// </summary>
|
||||
@@ -1181,27 +1182,32 @@ namespace MTC_Adapter
|
||||
// se ho allarmi li accodo...
|
||||
if (allNcData.lastncerror != 0)
|
||||
{
|
||||
if (true)
|
||||
|
||||
if (utils.CRI("loglevel") > 5)
|
||||
{
|
||||
if (utils.CRI("loglevel") > 5)
|
||||
{
|
||||
lg.Info(string.Format("Allarmi CNC: {0} ", allNcData.lastncerror));
|
||||
}
|
||||
string alarmText = string.Format("CNC Alarm | Cod: {0}", allNcData.lastncerror);
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, alarmText, allNcData.lastncerror.ToString(), "", "");
|
||||
// mostro in form!
|
||||
sb1.AppendLine(alarmText);
|
||||
parentForm.dataMonitor_1 += sb1.ToString();
|
||||
lg.Info(string.Format("Allarmi CNC: {0} ", allNcData.lastncerror));
|
||||
}
|
||||
else
|
||||
{
|
||||
string alarmText = string.Format("CNC Alarm - Cod: {0}", allNcData.lastncerror);
|
||||
|
||||
allarmiCNC.Add(allNcData.lastncerror.ToString(), alarmText);
|
||||
// 2017.05.09 gestione allarmi commentata
|
||||
#if false
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, alarmText, allNcData.lastncerror.ToString(), "", "");
|
||||
// mostro in form!
|
||||
sb1.AppendLine(alarmText);
|
||||
parentForm.dataMonitor_1 += sb1.ToString();
|
||||
#endif
|
||||
|
||||
// 2017.05.09 gestione allarmi commentata
|
||||
#if false
|
||||
// il codice è corretto (manca prima aprte codice + traduzione), se cerco di trovare oggett completo NON c'è, verificare con Andrea...
|
||||
sb1.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.lastncerror));
|
||||
|
||||
inizio = DateTime.Now;
|
||||
OSAI_ref.O_ReadCurrentErrorMsg(ref allarmiCNC);
|
||||
if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ERROR-MSG", DateTime.Now.Subtract(inizio).Ticks);
|
||||
checkCNCAlarms();
|
||||
checkCNCAlarms();
|
||||
#endif
|
||||
#if false
|
||||
// provo altri metodi...
|
||||
CMSCncLib.OPENcontrol.MSGEMERGENCY emergCNC = new CMSCncLib.OPENcontrol.MSGEMERGENCY();
|
||||
@@ -1209,11 +1215,13 @@ namespace MTC_Adapter
|
||||
CMSCncLib.OPENcontrol.MSGANOMALY anomCNC = new CMSCncLib.OPENcontrol.MSGANOMALY();
|
||||
OSAI_ref.O_ReadCurrentAnomalyMsg(ref anomCNC);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
allarmiCNC = new CMSCncLib.OPENcontrol.MSGERROR();
|
||||
allarmiCNC.Clear();
|
||||
allarmiCNC = new Dictionary<string, string>();
|
||||
// 2017.05.09 gestione allarmi commentata
|
||||
//allarmiCNC = new CMSCncLib.OPENcontrol.MSGERROR();
|
||||
}
|
||||
|
||||
// accodo dati base!
|
||||
@@ -1351,6 +1359,39 @@ namespace MTC_Adapter
|
||||
sendAlarmIfPresent(allarmiCNC);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia singolo allarme CNC se presente (da dictionary)
|
||||
/// </summary>
|
||||
/// <param name="allarmi"></param>
|
||||
protected void sendAlarmIfPresent(Dictionary<string, string> allarmi)
|
||||
{
|
||||
// controllo valore...
|
||||
if (allarmi != null && allarmi.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (KeyValuePair<string, string> item in allarmi)
|
||||
{
|
||||
string alarmText = string.Format("{0} - {1}", item.Key, item.Value);
|
||||
if (utils.CRI("loglevel") > 5)
|
||||
{
|
||||
lg.Info(string.Format("Allarme CNC: {0}", alarmText));
|
||||
}
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, alarmText, item.Key, "", "");
|
||||
// mostro in form!
|
||||
sb.AppendLine(alarmText);
|
||||
}
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
}
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Invia singolo allarme CNC se presente
|
||||
/// </summary>
|
||||
@@ -1378,7 +1419,8 @@ namespace MTC_Adapter
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Recupero dati x UnOp
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user