fix gestione errori in area BYTE x dimensione vettori e fix string out...
This commit is contained in:
@@ -251,6 +251,7 @@ namespace MTC_Adapter
|
||||
int numero = 0;
|
||||
string status = "";
|
||||
string pathExeMode = "";
|
||||
string pathRunMode = "";
|
||||
bool isFeedHold = false;
|
||||
bool isActive = false;
|
||||
bool isReady = false;
|
||||
@@ -275,7 +276,6 @@ namespace MTC_Adapter
|
||||
{
|
||||
// Modo CN:0=Nessuno,1=Manuale,2=Automatico, 3=Pom,4=Mdi,5=SemiAutomatico,6=Rap,7=Test
|
||||
int modoCn = ncDevice.PLC_MemoryAreaIOT_Byte[byteNum];
|
||||
string pathRunMode = "";
|
||||
switch (modoCn)
|
||||
{
|
||||
case 1:
|
||||
@@ -306,7 +306,6 @@ namespace MTC_Adapter
|
||||
}
|
||||
// salvo run mode
|
||||
vettPath[idxPath].mPathRunMode.Value = pathRunMode;
|
||||
sb.AppendLine(string.Format("RunMode: {0}", pathRunMode));
|
||||
}
|
||||
else if (mapIOT_Byte[i].varName.StartsWith("IOT_LUB_"))
|
||||
{
|
||||
@@ -314,27 +313,34 @@ namespace MTC_Adapter
|
||||
try
|
||||
{
|
||||
numero = Convert.ToInt32(mapIOT_Byte[i].varName.Replace("IOT_LUB_", "").Replace("_STA", "").Replace("_CNT", ""));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// se non trovo --> 1!
|
||||
numero = 1;
|
||||
}
|
||||
if (mapIOT_Byte[i].varName.EndsWith("_STA"))
|
||||
{
|
||||
if (ncDevice.PLC_MemoryAreaIOT_Byte[byteNum] != 0)
|
||||
// salvo in vettore carico mandrini SE ho nel vettore...
|
||||
if (numero <= vettLubro.Length)
|
||||
{
|
||||
status = "EMPTY";
|
||||
if (mapIOT_Byte[i].varName.EndsWith("_STA"))
|
||||
{
|
||||
if (ncDevice.PLC_MemoryAreaIOT_Byte[byteNum] != 0)
|
||||
{
|
||||
status = "EMPTY";
|
||||
}
|
||||
else
|
||||
{
|
||||
status = "OK";
|
||||
}
|
||||
vettLubro[numero - 1].mLubroStatus.Value = status;
|
||||
}
|
||||
else if (mapIOT_Byte[i].varName.EndsWith("_CNT"))
|
||||
{
|
||||
vettLubro[numero - 1].mLubroNum.Value = ncDevice.PLC_MemoryAreaIOT_Byte[byteNum];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = "OK";
|
||||
lg.Error("Errore in inserimento vettore " + mapIOT_Byte[i].varName);
|
||||
}
|
||||
vettLubro[numero - 1].mLubroStatus.Value = status;
|
||||
}
|
||||
else if (mapIOT_Byte[i].varName.EndsWith("_CNT"))
|
||||
catch (Exception exc)
|
||||
{
|
||||
vettLubro[numero - 1].mLubroNum.Value = ncDevice.PLC_MemoryAreaIOT_Byte[byteNum];
|
||||
lg.Error(exc, "Errore in decodifica " + mapIOT_Byte[i].varName);
|
||||
}
|
||||
}
|
||||
else if (mapIOT_Byte[i].varName.StartsWith("IOT_I_MD_"))
|
||||
@@ -349,9 +355,11 @@ namespace MTC_Adapter
|
||||
vettUnOp[numero - 1].mUnOpLoad.Value = ncDevice.PLC_MemoryAreaIOT_Byte[byteNum];
|
||||
}
|
||||
else
|
||||
{ }
|
||||
{
|
||||
lg.Error("Errore in inserimento vettore " + mapIOT_Byte[i].varName);
|
||||
}
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Errore in decodifica " + mapIOT_Byte[i].varName);
|
||||
}
|
||||
@@ -429,6 +437,7 @@ namespace MTC_Adapter
|
||||
vettPath[idxPath].mPathExeMode.Value = pathExeMode;
|
||||
|
||||
// sistemo le stringhe x display
|
||||
sb.AppendLine(string.Format("RunMode: {0}", pathRunMode));
|
||||
sb.AppendLine(string.Format("ExeMode: {0}", pathExeMode));
|
||||
sb.AppendLine(string.Format("FeedRateOver: {0} %", FeedRateOver));
|
||||
sb.AppendLine(string.Format("SpeedRateOver: {0} %", SpeedRateOver));
|
||||
|
||||
Reference in New Issue
Block a user