update decodifica status

- errore in decodifica prog name (stringa)
This commit is contained in:
Samuele E. Locatelli
2022-06-23 14:42:08 +02:00
parent 4f4eafd5a2
commit 87b159b167
3 changed files with 52 additions and 46 deletions
+23 -21
View File
@@ -8,6 +8,26 @@ namespace MP.MONO.DECODER
{
public class CounterManager
{
#region Public Fields
public static string alarmStatus = "";
public static bool valueChanged = false;
#endregion Public Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected static string luaPath = "";
protected static Lua state = new Lua();
protected List<string> AlarmList = new List<string>();
#endregion Protected Fields
#region Private Fields
/// <summary>
@@ -17,22 +37,6 @@ namespace MP.MONO.DECODER
#endregion Private Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected static string luaPath = "";
protected static Lua state = new Lua();
protected List<string> AlarmList = new List<string>();
#endregion Protected Fields
#region Public Fields
public static string alarmStatus = "";
public static bool valueChanged = false;
#endregion Public Fields
#region Public Constructors
public CounterManager()
@@ -45,8 +49,8 @@ namespace MP.MONO.DECODER
luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ParamsDecoder.lua");
state.DoFile(luaPath);
Log.Info("ParamsManager OK");
Console.WriteLine("ParamsManager OK");
Log.Info("CounterManager OK");
Console.WriteLine("CounterManager OK");
}
#endregion Public Constructors
@@ -121,7 +125,7 @@ namespace MP.MONO.DECODER
Log.Trace($"calcVal: {calcVal}");
}
}
catch(Exception exc)
catch (Exception exc)
{
Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}");
}
@@ -135,7 +139,6 @@ namespace MP.MONO.DECODER
MachineId = 1,
ValNum = calcVal,
ValStr = $"{calcVal:N3}"
};
answ.Add(dbRecord);
@@ -145,7 +148,6 @@ namespace MP.MONO.DECODER
}
}
return answ;
}
+23 -21
View File
@@ -8,6 +8,26 @@ namespace MP.MONO.DECODER
{
public class MPStatusManager
{
#region Public Fields
public static string alarmStatus = "";
public static bool valueChanged = false;
#endregion Public Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected static string luaPath = "";
protected static Lua state = new Lua();
protected List<string> AlarmList = new List<string>();
#endregion Protected Fields
#region Private Fields
/// <summary>
@@ -17,22 +37,6 @@ namespace MP.MONO.DECODER
#endregion Private Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected static string luaPath = "";
protected static Lua state = new Lua();
protected List<string> AlarmList = new List<string>();
#endregion Protected Fields
#region Public Fields
public static string alarmStatus = "";
public static bool valueChanged = false;
#endregion Public Fields
#region Public Constructors
public MPStatusManager()
@@ -45,8 +49,8 @@ namespace MP.MONO.DECODER
luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ParamsDecoder.lua");
state.DoFile(luaPath);
Log.Info("ParamsManager OK");
Console.WriteLine("ParamsManager OK");
Log.Info("MPStatusManager OK");
Console.WriteLine("MPStatusManager OK");
}
#endregion Public Constructors
@@ -121,7 +125,7 @@ namespace MP.MONO.DECODER
Log.Trace($"calcVal: {calcVal}");
}
}
catch(Exception exc)
catch (Exception exc)
{
Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}");
}
@@ -135,7 +139,6 @@ namespace MP.MONO.DECODER
MachineId = 1,
ValNum = calcVal,
ValStr = $"{calcVal:N3}"
};
answ.Add(dbRecord);
@@ -145,7 +148,6 @@ namespace MP.MONO.DECODER
}
}
return answ;
}
+6 -4
View File
@@ -516,7 +516,7 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e)
try
{
// verifico codici ricevuti
var dataList = JsonConvert.DeserializeObject<Dictionary<string, int>>(currArgs.newMessage);
var dataList = JsonConvert.DeserializeObject<Dictionary<string, string>>(currArgs.newMessage);
if (dataList != null)
{
/************************************************************************
@@ -572,19 +572,21 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e)
currKey = "MACHINE STATUS";
if (dataList.ContainsKey(currKey))
{
int.TryParse(currKey, out machStatus);
int.TryParse(dataList[currKey], out machStatus);
}
currKey = "PROCESS STATUS";
if (dataList.ContainsKey(currKey))
{
int.TryParse(currKey, out procStatus);
int.TryParse(dataList[currKey], out procStatus);
}
currKey = "PROCESS MODE";
if (dataList.ContainsKey(currKey))
{
int.TryParse(currKey, out procMode);
int.TryParse(dataList[currKey], out procMode);
}
// fix me todo inserire gestione program name!!!
if (machStatus == 0)
{
machinePlate.StatusId = 7;