Aggiunto trim allarmi vuoti...

This commit is contained in:
Samuele Locatelli
2022-07-25 14:35:25 +02:00
parent efb310f229
commit 6e617dedc3
21 changed files with 100 additions and 78 deletions
+8 -5
View File
@@ -38,17 +38,20 @@
},
"OptPar": {
"AlarmMode": "RawList",
"Log2Console": true,
"Log2File": true,
"ForceSplit": true,
"AlarmRegexp": "\\[[\\w\\s]*\\]",
"AlarmCleanPre": "[",
"AlarmCleanPost": "]",
"CleanupRegexpPre": "",
//"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]",
"CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]",
"FiltCrLf": true,
"FiltSplitChar": [],
"VetoSendCache": 50,
"ForceSplit": true,
"Log2Console": true,
"Log2File": true,
"MinWait": 50,
"MaxWait": 150
"MaxWait": 150,
"VetoSendCache": 50
},
"Machine": {
"Manufacturer": "Multiax",
+8 -5
View File
@@ -38,17 +38,20 @@
},
"OptPar": {
"AlarmMode": "RawList",
"Log2Console": true,
"Log2File": true,
"ForceSplit": true,
"AlarmRegexp": "\\[[\\w\\s]*\\]",
"AlarmCleanPre": "[",
"AlarmCleanPost": "]",
"CleanupRegexpPre": "",
//"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]",
"CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]",
"FiltCrLf": true,
"FiltSplitChar": [],
"VetoSendCache": 50,
"ForceSplit": true,
"Log2Console": true,
"Log2File": true,
"MinWait": 50,
"MaxWait": 150
"MaxWait": 150,
"VetoSendCache": 50
},
"Machine": {
"Manufacturer": "Multiax",
+8 -5
View File
@@ -38,17 +38,20 @@
},
"OptPar": {
"AlarmMode": "RawList",
"Log2Console": true,
"Log2File": true,
"ForceSplit": true,
"AlarmRegexp": "\\[[\\w\\s]*\\]",
"AlarmCleanPre": "[",
"AlarmCleanPost": "]",
"CleanupRegexpPre": "",
//"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]",
"CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]",
"FiltCrLf": true,
"FiltSplitChar": [],
"VetoSendCache": 50,
"ForceSplit": true,
"Log2Console": true,
"Log2File": true,
"MinWait": 50,
"MaxWait": 150
"MaxWait": 150,
"VetoSendCache": 50
},
"Machine": {
"Manufacturer": "Multiax",
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2207.2512</Version>
<Version>1.2.2207.2514</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2207.2512</h4>
<h4>Version: 1.2.2207.2514</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2207.2512
1.2.2207.2514
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2207.2512</version>
<version>1.2.2207.2514</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2207.2512</Version>
<Version>1.2.2207.2514</Version>
</PropertyGroup>
<ItemGroup>
+59 -47
View File
@@ -85,6 +85,7 @@ MachineDTO machinePlate = new MachineDTO();
// gestione configurazioni da redis
int blinkCount = 10;
bool AlarmIgnoreEmpty = true;
setupConf();
/* --------------------------------
@@ -147,6 +148,9 @@ void setupConf()
// imposto blinkCount da conf...
string rConf = config["OptPar:BlinkCount"];
int.TryParse(rConf, out blinkCount);
// impostyo ignore empty alarms
rConf = config["OptPar:AlarmIgnoreEmpty"];
bool.TryParse(rConf, out AlarmIgnoreEmpty);
// recupero valori e deserializzo
string rawData = "";
@@ -254,57 +258,65 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e)
// ciclo x ogni allarme attivo x verificare se si sia CHIUSO
foreach (var newAlarm in alarmList)
{
// in primis... se è muted --> lo escludo...
bool isMuted = false;
var maybeMuted = mutedAlarmsList.Where(x => x.FullValue == newAlarm).FirstOrDefault();
if (maybeMuted != null)
// se AlarmIgnoreEmpty=true + vuoto --> salto
if (AlarmIgnoreEmpty && string.IsNullOrEmpty(newAlarm))
{
isMuted = maybeMuted.Muted;
}
// cerco l'allarme nell'elenco degli allarmi dal DB
var foundAlarm = alarmsRecorded
.Where(x => x.FullValue == newAlarm)
.FirstOrDefault();
// se non lo trovo --> chiamo procedura che verifica su DB, eventualmente inserisce, restituisce nuovo elenco
if (foundAlarm == null)
{
// salvo sul DB
foundAlarm = dbController.AlarmListInsert(newAlarm);
// ora rileggo ed aggiorno redis e cerco di nuovo record...
alarmsRecorded = dbController.AlarmListGetAll();
redisDb.StringSet(Constants.ALARMS_SETT_RLIST_KEY, JsonConvert.SerializeObject(alarmsRecorded));
}
if (!isMuted)
{
if (!lastAlarms.Contains(newAlarm))
{
if (foundAlarm != null)
{
// segno come iniziato...
AlarmRecModel newAlarmRec = new AlarmRecModel()
{
MachineId = MachineId,
DtStart = adesso,
DtEnd = adesso,
AlarmId = foundAlarm.AlarmId
};
alarmRecList.Add(newAlarmRec);
}
// gestione blink allarmi
if (blinkStatus.ContainsKey(newAlarm))
{
blinkStatus[newAlarm] = blinkCount;
}
else
{
blinkStatus.Add(newAlarm, blinkCount);
}
}
alarmList.Remove(newAlarm);
}
else
{
// rimuovo da alarmList perché muted...
alarmList.Remove(newAlarm);
// in primis... se è muted --> lo escludo...
bool isMuted = false;
var maybeMuted = mutedAlarmsList.Where(x => x.FullValue == newAlarm).FirstOrDefault();
if (maybeMuted != null)
{
isMuted = maybeMuted.Muted;
}
// cerco l'allarme nell'elenco degli allarmi dal DB
var foundAlarm = alarmsRecorded
.Where(x => x.FullValue == newAlarm)
.FirstOrDefault();
// se non lo trovo --> chiamo procedura che verifica su DB, eventualmente inserisce, restituisce nuovo elenco
if (foundAlarm == null)
{
// salvo sul DB
foundAlarm = dbController.AlarmListInsert(newAlarm);
// ora rileggo ed aggiorno redis e cerco di nuovo record...
alarmsRecorded = dbController.AlarmListGetAll();
redisDb.StringSet(Constants.ALARMS_SETT_RLIST_KEY, JsonConvert.SerializeObject(alarmsRecorded));
}
if (!isMuted)
{
if (!lastAlarms.Contains(newAlarm))
{
if (foundAlarm != null)
{
// segno come iniziato...
AlarmRecModel newAlarmRec = new AlarmRecModel()
{
MachineId = MachineId,
DtStart = adesso,
DtEnd = adesso,
AlarmId = foundAlarm.AlarmId
};
alarmRecList.Add(newAlarmRec);
}
// gestione blink allarmi
if (blinkStatus.ContainsKey(newAlarm))
{
blinkStatus[newAlarm] = blinkCount;
}
else
{
blinkStatus.Add(newAlarm, blinkCount);
}
}
}
else
{
// rimuovo da alarmList perché muted...
alarmList.Remove(newAlarm);
}
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2207.2512</h4>
<h4>Version: 1.2.2207.2514</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2207.2512
1.2.2207.2514
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2207.2512</version>
<version>1.2.2207.2514</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -34,6 +34,7 @@
},
"OptPar": {
"AlarmMode": "RawList",
"AlarmIgnoreEmpty": true,
"BlinkCount": 10
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2207.2512</Version>
<Version>1.2.2207.2514</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2207.2512</h4>
<h4>Version: 1.2.2207.2514</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2207.2512
1.2.2207.2514
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2207.2512</version>
<version>1.2.2207.2514</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2207.2512</Version>
<Version>1.2.2207.2514</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2207.2512</h4>
<h4>Version: 1.2.2207.2514</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2207.2512
1.2.2207.2514
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2207.2512</version>
<version>1.2.2207.2514</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>