Refresh e refactor vario codice
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
@@ -39,7 +36,8 @@ namespace IOB_UT_NEXT
|
||||
TimeSet,
|
||||
|
||||
/// <summary>
|
||||
/// Verificato il canale di comunicazione è OK, fatta pulizia con AbortAll, NON ci sono report attivi
|
||||
/// Verificato il canale di comunicazione è OK, fatta pulizia con AbortAll, NON ci sono
|
||||
/// report attivi
|
||||
/// </summary>
|
||||
ChannelOk,
|
||||
|
||||
@@ -135,7 +133,8 @@ namespace IOB_UT_NEXT
|
||||
public int PzPallet { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se sia possibile impostare i pezzi pallet dal server, ed in tal caso moltiplica i pezzi letti dalla macchina per il valore pzPallet (vedi sopra)
|
||||
/// Indica se sia possibile impostare i pezzi pallet dal server, ed in tal caso
|
||||
/// moltiplica i pezzi letti dalla macchina per il valore pzPallet (vedi sopra)
|
||||
/// </summary>
|
||||
public bool SetPzPalletFromSrv { get; set; } = false;
|
||||
|
||||
@@ -170,7 +169,8 @@ namespace IOB_UT_NEXT
|
||||
public List<FileTask> FileList { get; set; } = new List<FileTask>();
|
||||
|
||||
/// <summary>
|
||||
/// Numero MAX di esecuzioni da mantenere in HIST prima di eliminare i + vecchi (fare folder HIST\SESSnnnn)
|
||||
/// Numero MAX di esecuzioni da mantenere in HIST prima di eliminare i + vecchi (fare
|
||||
/// folder HIST\SESSnnnn)
|
||||
/// </summary>
|
||||
public int Max2Keep { get; set; } = 50;
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace IOB_UT_NEXT
|
||||
public string RespOk { get; set; } = "PROCESSED";
|
||||
|
||||
/// <summary>
|
||||
/// Seconds before do a new retry (default = 0 --> no veto)
|
||||
/// Seconds before do a new retry (default = 0 --> no veto)
|
||||
/// </summary>
|
||||
public double RetrySec { get; set; } = 0;
|
||||
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
<Compile Include="Objects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RedisMan.cs" />
|
||||
<Compile Include="val.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ExtLib\krcc.dll" />
|
||||
|
||||
+67
-24
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
@@ -16,9 +16,6 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
// INI filename
|
||||
|
||||
// import windows dll functions
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
@@ -33,25 +30,6 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Methods
|
||||
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileInt(string section, string key, int def, string filePath);
|
||||
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileSection(string section, IntPtr retVal, uint size, string filePath);
|
||||
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
[DllImport("kernel32")]
|
||||
private static extern bool WritePrivateProfileSection(string section, string value, string filePath);
|
||||
|
||||
[DllImport("kernel32", CharSet = CharSet.Auto, BestFitMapping = false)]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -149,7 +127,9 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// Section name
|
||||
/// <returns>restituisce delle stringhe keys=values da suddividere appunto come key/val successivamente</returns>
|
||||
/// <returns>
|
||||
/// restituisce delle stringhe keys=values da suddividere appunto come key/val successivamente
|
||||
/// </returns>
|
||||
public string[] ReadSection(string Section)
|
||||
{
|
||||
const int bufferSize = 2048; // max is 32767
|
||||
@@ -270,5 +250,68 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
|
||||
// INI filename
|
||||
|
||||
/// <summary>
|
||||
/// GetPrivateProfileInt: import windows dll functions
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="def"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileInt(string section, string key, int def, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// GetPrivateProfileSection: import windows dll functions
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="retVal"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileSection(string section, IntPtr retVal, uint size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// GetPrivateProfileString: import windows dll functions
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="def"></param>
|
||||
/// <param name="retVal"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// WritePrivateProfileSection: import windows dll functions
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern bool WritePrivateProfileSection(string section, string value, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// WritePrivateProfileString: import windows dll functions
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="val"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32", CharSet = CharSet.Auto, BestFitMapping = false)]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{/// <summary>
|
||||
/// Classe helper x LOG basata su NLog
|
||||
/// </summary>
|
||||
/// Classe helper x LOG basata su NLog </summary>
|
||||
public static class Logging
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
+111
-108
@@ -2,68 +2,12 @@
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
public class RedisIobCache
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
string RedisConn = baseUtils.CRS("RedisConn");
|
||||
if (string.IsNullOrEmpty(RedisConn))
|
||||
{
|
||||
RedisConn = "localhost,abortConnect=false,ssl=false";
|
||||
}
|
||||
|
||||
return ConnectionMultiplexer.Connect(RedisConn);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private Lazy<ConnectionMultiplexer> lazyConnectionAdmin = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
string RedisConnAdmin = baseUtils.CRS("RedisConnAdmin");
|
||||
if (string.IsNullOrEmpty(RedisConnAdmin))
|
||||
{
|
||||
RedisConnAdmin = "localhost,abortConnect=false,ssl=false,allowAdmin=true";
|
||||
}
|
||||
|
||||
return ConnectionMultiplexer.Connect(RedisConnAdmin);
|
||||
});
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Cod IOB
|
||||
/// </summary>
|
||||
protected string currCodIob = "000";
|
||||
/// <summary>
|
||||
/// Tipo IOB
|
||||
/// </summary>
|
||||
protected string currIobType = "ND";
|
||||
|
||||
/// <summary>
|
||||
/// Hash redis x dati IOB
|
||||
/// </summary>
|
||||
protected string redIobKey = "";
|
||||
|
||||
/// <summary>
|
||||
/// Hash redis x dati server
|
||||
/// </summary>
|
||||
protected string redServKey = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -97,7 +41,7 @@ namespace IOB_UT_NEXT
|
||||
IobWinStatus newIobStatus = new IobWinStatus()
|
||||
{
|
||||
CodIob = currCodIob,
|
||||
IobType= currIobType,
|
||||
IobType = currIobType,
|
||||
online = false
|
||||
};
|
||||
// salvo in area REDIS
|
||||
@@ -137,15 +81,6 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto currentDb locale
|
||||
/// </summary>
|
||||
private IDatabase _currDB { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -216,7 +151,7 @@ namespace IOB_UT_NEXT
|
||||
answ = new IobWinStatus()
|
||||
{
|
||||
CodIob = currCodIob,
|
||||
IobType=currIobType,
|
||||
IobType = currIobType,
|
||||
online = false
|
||||
};
|
||||
// salvo serializzando...
|
||||
@@ -298,39 +233,6 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP ASC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKey(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return x.Key.CompareTo(y.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP DESC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKeyDesc(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return y.Key.CompareTo(x.Key);
|
||||
}
|
||||
|
||||
private void initHashKeys()
|
||||
{
|
||||
// init dati di base...
|
||||
redServKey = redHash($"MP");
|
||||
redIobKey = redHash($"IOB:{currCodIob}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -477,8 +379,7 @@ namespace IOB_UT_NEXT
|
||||
public int redCountKey(string keyPattern)
|
||||
{
|
||||
int answ = 0;
|
||||
// cerco se ci sia valore in redis...
|
||||
// se vuoto = ALL...
|
||||
// cerco se ci sia valore in redis... se vuoto = ALL...
|
||||
keyPattern = string.IsNullOrEmpty(keyPattern) ? "**" : keyPattern;
|
||||
try
|
||||
{
|
||||
@@ -528,8 +429,7 @@ namespace IOB_UT_NEXT
|
||||
public bool redFlushKey(string keyPattern)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
// se vuoto = ALL...
|
||||
// cerco se ci sia valore in redis... se vuoto = ALL...
|
||||
keyPattern = string.IsNullOrEmpty(keyPattern) ? "**" : keyPattern;
|
||||
try
|
||||
{
|
||||
@@ -702,7 +602,8 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto...
|
||||
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da
|
||||
/// funzionalita' DbConfig) + keyName richiesto...
|
||||
/// </summary>
|
||||
public string redHash(string keyName)
|
||||
{
|
||||
@@ -834,7 +735,9 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <param name="expireSeconds">scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)</param>
|
||||
/// <param name="expireSeconds">
|
||||
/// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHash(string hashKey, KeyValuePair<string, string>[] hashFields, double expireSeconds = -1)
|
||||
{
|
||||
@@ -891,7 +794,9 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <param name="expireSeconds">scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)</param>
|
||||
/// <param name="expireSeconds">
|
||||
/// scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHashDict(string hashKey, Dictionary<string, string> hashFields, double expireSeconds = -1)
|
||||
{
|
||||
@@ -1058,7 +963,7 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva un set KVP (Key Value Pair) in RedisCache
|
||||
/// Salva un set KVP (Key Value Pair) in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="valori">Set KVP chiave-valore da salvare</param>
|
||||
/// <returns></returns>
|
||||
@@ -1123,5 +1028,103 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Cod IOB
|
||||
/// </summary>
|
||||
protected string currCodIob = "000";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo IOB
|
||||
/// </summary>
|
||||
protected string currIobType = "ND";
|
||||
|
||||
/// <summary>
|
||||
/// Hash redis x dati IOB
|
||||
/// </summary>
|
||||
protected string redIobKey = "";
|
||||
|
||||
/// <summary>
|
||||
/// Hash redis x dati server
|
||||
/// </summary>
|
||||
protected string redServKey = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
string RedisConn = baseUtils.CRS("RedisConn");
|
||||
if (string.IsNullOrEmpty(RedisConn))
|
||||
{
|
||||
RedisConn = "localhost,abortConnect=false,ssl=false";
|
||||
}
|
||||
|
||||
return ConnectionMultiplexer.Connect(RedisConn);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private Lazy<ConnectionMultiplexer> lazyConnectionAdmin = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
string RedisConnAdmin = baseUtils.CRS("RedisConnAdmin");
|
||||
if (string.IsNullOrEmpty(RedisConnAdmin))
|
||||
{
|
||||
RedisConnAdmin = "localhost,abortConnect=false,ssl=false,allowAdmin=true";
|
||||
}
|
||||
|
||||
return ConnectionMultiplexer.Connect(RedisConnAdmin);
|
||||
});
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto currentDb locale
|
||||
/// </summary>
|
||||
private IDatabase _currDB { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP ASC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKey(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return x.Key.CompareTo(y.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP DESC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKeyDesc(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return y.Key.CompareTo(x.Key);
|
||||
}
|
||||
|
||||
private void initHashKeys()
|
||||
{
|
||||
// init dati di base...
|
||||
redServKey = redHash($"MP");
|
||||
redIobKey = redHash($"IOB:{currCodIob}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
+44
-47
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
@@ -27,50 +24,6 @@ namespace IOB_UT_NEXT
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Fattore lambda (innovazione) per calcolo EWMA valore TCiclo corrente
|
||||
/// </summary>
|
||||
protected double _lambda { get; set; } = 0.4;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo TCiclo osservato in SECONDI
|
||||
/// </summary>
|
||||
protected double _lastTC { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ULTIMO Contapezzi IOB VALIDO
|
||||
/// </summary>
|
||||
protected int _lastValidPzCountIOB { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ULTIMO Contapezzi PLC VALIDO
|
||||
/// </summary>
|
||||
protected int _lastValidPzCountPLC { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Fattore massimo ammesso di delay x il TCiclo
|
||||
/// </summary>
|
||||
protected double _maxDelayFactor { get; set; } = 1.2;
|
||||
|
||||
/// <summary>
|
||||
/// Incremento amssimo pezzi per cui fare calcolo del tempociclo attuale
|
||||
/// </summary>
|
||||
protected double _maxIncrPz { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Contapezzi IOB
|
||||
/// </summary>
|
||||
protected int _pzCountIOB { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Contapezzi PLC
|
||||
/// </summary>
|
||||
protected int _pzCountPLC { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -171,5 +124,49 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Fattore lambda (innovazione) per calcolo EWMA valore TCiclo corrente
|
||||
/// </summary>
|
||||
protected double _lambda { get; set; } = 0.4;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo TCiclo osservato in SECONDI
|
||||
/// </summary>
|
||||
protected double _lastTC { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ULTIMO Contapezzi IOB VALIDO
|
||||
/// </summary>
|
||||
protected int _lastValidPzCountIOB { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ULTIMO Contapezzi PLC VALIDO
|
||||
/// </summary>
|
||||
protected int _lastValidPzCountPLC { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Fattore massimo ammesso di delay x il TCiclo
|
||||
/// </summary>
|
||||
protected double _maxDelayFactor { get; set; } = 1.2;
|
||||
|
||||
/// <summary>
|
||||
/// Incremento amssimo pezzi per cui fare calcolo del tempociclo attuale
|
||||
/// </summary>
|
||||
protected double _maxIncrPz { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Contapezzi IOB
|
||||
/// </summary>
|
||||
protected int _pzCountIOB { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Contapezzi PLC
|
||||
/// </summary>
|
||||
protected int _pzCountPLC { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
}
|
||||
}
|
||||
+143
-130
@@ -1,11 +1,7 @@
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
@@ -14,7 +10,23 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public class BaseAlarmConf
|
||||
{
|
||||
#region Public Fields
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei contatori blink x gestione caso fronte salita/discesa segnale che blinka
|
||||
/// </summary>
|
||||
public int[] alarmsBlinkCounter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BitMask 16bit (1 = valido, 0 = filtro) degli allarmi silenziati/disabilitati (se
|
||||
/// iniziano per ##) come valore da sottrarre x check
|
||||
/// </summary>
|
||||
public uint[] alarmsMask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Array dei valori allarme correnti
|
||||
/// </summary>
|
||||
public uint[] alarmsState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// valore di partenza x un segnale di blink in caso di fine variazione (fronte discesa)
|
||||
@@ -26,25 +38,6 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public int blinkUpVal { get; set; } = 3;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei contatori blink x gestione caso fronte salita/discesa segnale che blinka
|
||||
/// </summary>
|
||||
public int[] alarmsBlinkCounter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BitMask 16bit (1 = valido, 0 = filtro) degli allarmi silenziati/disabilitati (se iniziano per ##) come valore da sottrarre x check
|
||||
/// </summary>
|
||||
public uint[] alarmsMask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Array dei valori allarme correnti
|
||||
/// </summary>
|
||||
public uint[] alarmsState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione area allarmi
|
||||
/// </summary>
|
||||
@@ -177,7 +170,8 @@ namespace IOB_UT_NEXT
|
||||
alarmsState = new uint[size / 2];
|
||||
alarmsMask = new uint[size / 2];
|
||||
|
||||
// una volta inizializzata la classe di base sistemo vettori allarmi disabilitati ed il contatore blink dei fronti di discesa
|
||||
// una volta inizializzata la classe di base sistemo vettori allarmi disabilitati ed il
|
||||
// contatore blink dei fronti di discesa
|
||||
alarmsBlinkCounter = new int[messages.Count];
|
||||
int idx = 0;
|
||||
int bank = 0;
|
||||
@@ -217,7 +211,8 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe gestione configurazione parametri di base x configuraizone estesa (es MTConnect, OPC-UA, ...)
|
||||
/// Classe gestione configurazione parametri di base x configuraizone estesa (es MTConnect,
|
||||
/// OPC-UA, ...)
|
||||
/// </summary>
|
||||
public class BaseParamConf
|
||||
{
|
||||
@@ -229,14 +224,13 @@ namespace IOB_UT_NEXT
|
||||
public List<diCheckCondition> condWork { get; set; } = new List<diCheckCondition>();
|
||||
|
||||
/// <summary>
|
||||
/// Indica se l'emergenza armata va riportata verso Mapo come bit a TRUE
|
||||
/// True --> armata = 1 / triggered = 0
|
||||
/// False --> triggered = 1 / armata = 0
|
||||
/// Indica se l'emergenza armata va riportata verso Mapo come bit a TRUE True --> armata
|
||||
/// = 1 / triggered = 0 False --> triggered = 1 / armata = 0
|
||||
/// </summary>
|
||||
public bool emergencyArmedTrue { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco items FILTRATI da invio come dynData --> FluxLog (events o samples)
|
||||
/// Elenco items FILTRATI da invio come dynData --> FluxLog (events o samples)
|
||||
/// </summary>
|
||||
public List<string> fluxLogVeto { get; set; } = new List<string>();
|
||||
|
||||
@@ -309,7 +303,8 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per rappresentare una lista di oggetti chiave/valore target x controlo condizioni multiple + indicazione modalità di controllo (AND/OR/...)
|
||||
/// Classe per rappresentare una lista di oggetti chiave/valore target x controlo condizioni
|
||||
/// multiple + indicazione modalità di controllo (AND/OR/...)
|
||||
/// </summary>
|
||||
public class diCheckCondSetup
|
||||
{
|
||||
@@ -326,13 +321,75 @@ namespace IOB_UT_NEXT
|
||||
public boolCheckMode checkMode { get; set; } = boolCheckMode.AND;
|
||||
|
||||
/// <summary>
|
||||
/// indica se il check vada NEGATO (esempio se cerco la condizione opposta, esempio num allarmi 0 --> se true NEGO la condizione HO ALLARMI)
|
||||
/// indica se il check vada NEGATO (esempio se cerco la condizione opposta, esempio num
|
||||
/// allarmi 0 --> se true NEGO la condizione HO ALLARMI)
|
||||
/// </summary>
|
||||
public bool negateValue { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x definizione delle azioni in fase di setup macchina
|
||||
/// </summary>
|
||||
public class MachineSetupAction
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Indica se vada disabilitato il contapezzi quando la condizione NotEqual sia soddisfatta
|
||||
/// </summary>
|
||||
public bool DisablePzCountNotEqual { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Parametro target dell'azione
|
||||
/// </summary>
|
||||
public string TargetParam { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// parametro da impostare SE il check da esito EQUAL
|
||||
/// </summary>
|
||||
public int TargetValEqual { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// parametro da impostare SE il check da esito NOT EQUAL
|
||||
/// </summary>
|
||||
public int TargetValNotEqual { get; set; } = 1;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione parametri di setup incrociato...
|
||||
/// </summary>
|
||||
public class MachineSetupConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei parametri di corrispondenza tra variabili MES e variabili Macchina MES =
|
||||
/// scritte dal MES Macchina = scritte da macchina
|
||||
/// </summary>
|
||||
public Dictionary<string, string> checkParList { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione gestione Setup Avanzato (= scrittura)
|
||||
/// </summary>
|
||||
public bool EnableAdvSetup { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Modalità gestione setup
|
||||
/// </summary>
|
||||
public MachineSetupMode SetupMode { get; set; } = MachineSetupMode.ND;
|
||||
|
||||
/// <summary> Dizionario dei parametri da scrivere quando si rilevano differenze tra i
|
||||
/// parametri MES/Macchina string (key) --> memoria da scrivere tuple<int isEqual,int
|
||||
/// notEqual> --> valori da scrivere quando uguali o diversi </summary>
|
||||
public List<MachineSetupAction> writeParAction { get; set; } = new List<MachineSetupAction>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COnfigurazione blocchi x accesso memoria ottimizzato
|
||||
/// </summary>
|
||||
@@ -360,84 +417,6 @@ namespace IOB_UT_NEXT
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione parametri watchdog
|
||||
/// </summary>
|
||||
public class WatchDogConf
|
||||
{
|
||||
/// <summary>
|
||||
/// Abilitazione WatchDog
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Conf memoria x lettura WatchDog (ToMes), se !="" è gestito
|
||||
/// </summary>
|
||||
public string MemConfRead { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Conf memoria x scrittura WatchDog (FromMes), se !="" è gestito
|
||||
/// </summary>
|
||||
public string MemConfWrite { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Valore max contatore prima di resettare
|
||||
/// </summary>
|
||||
public int MaxVal { get; set; } = 9999;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione parametri di setup incrociato...
|
||||
/// </summary>
|
||||
public class MachineSetupConf
|
||||
{
|
||||
/// <summary>
|
||||
/// Modalità gestione setup
|
||||
/// </summary>
|
||||
public MachineSetupMode SetupMode { get; set; } = MachineSetupMode.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione gestione Setup Avanzato (= scrittura)
|
||||
/// </summary>
|
||||
public bool EnableAdvSetup { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei parametri di corrispondenza tra variabili MES e variabili Macchina
|
||||
/// MES = scritte dal MES
|
||||
/// Macchina = scritte da macchina
|
||||
/// </summary>
|
||||
public Dictionary<string, string> checkParList { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei parametri da scrivere quando si rilevano differenze tra i parametri MES/Macchina
|
||||
/// string (key) --> memoria da scrivere
|
||||
/// tuple<int isEqual,int notEqual> --> valori da scrivere quando uguali o diversi
|
||||
/// </summary>
|
||||
public List<MachineSetupAction> writeParAction { get; set; } = new List<MachineSetupAction>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x definizione delle azioni in fase di setup macchina
|
||||
/// </summary>
|
||||
public class MachineSetupAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Parametro target dell'azione
|
||||
/// </summary>
|
||||
public string TargetParam { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// parametro da impostare SE il check da esito EQUAL
|
||||
/// </summary>
|
||||
public int TargetValEqual { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// parametro da impostare SE il check da esito NOT EQUAL
|
||||
/// </summary>
|
||||
public int TargetValNotEqual { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se vada disabilitato il contapezzi quando la condizione NotEqual sia soddisfatta
|
||||
/// </summary>
|
||||
public bool DisablePzCountNotEqual { get; set; } = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe gestione configurazione parametri specifici OPC-UA da BaseParamConf
|
||||
/// </summary>
|
||||
@@ -470,12 +449,6 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public diCheckCondSetup condError { get; set; } = new diCheckCondSetup();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Struttura dati x check condizione Errore
|
||||
/// </summary>
|
||||
public diCheckCondSetup condWorkOpc { get; set; } = new diCheckCondSetup();
|
||||
|
||||
/// <summary>
|
||||
/// Struttura dati x check condizione Emergenza
|
||||
/// </summary>
|
||||
@@ -496,6 +469,11 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public diCheckCondSetup condReady { get; set; } = new diCheckCondSetup();
|
||||
|
||||
/// <summary>
|
||||
/// Struttura dati x check condizione Setup
|
||||
/// </summary>
|
||||
public diCheckCondSetup condSetup { get; set; } = new diCheckCondSetup();
|
||||
|
||||
/// <summary>
|
||||
/// Struttura dati x check condizione WarmUp - CoolDown
|
||||
/// </summary>
|
||||
@@ -505,16 +483,19 @@ namespace IOB_UT_NEXT
|
||||
/// Struttura dati x check condizione Warning
|
||||
/// </summary>
|
||||
public diCheckCondSetup condWarning { get; set; } = new diCheckCondSetup();
|
||||
|
||||
/// <summary>
|
||||
/// Struttura dati x check condizione Setup
|
||||
/// Struttura dati x check condizione Errore
|
||||
/// </summary>
|
||||
public diCheckCondSetup condSetup { get; set; } = new diCheckCondSetup();
|
||||
public diCheckCondSetup condWorkOpc { get; set; } = new diCheckCondSetup();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei NodeId da ignorare intesi come interi rami (se vuoto NON filtro)
|
||||
/// </summary>
|
||||
public List<string> filterItemsNodeId { get; set; } = new List<string>();
|
||||
|
||||
public UserIdent Identity { get; set; } = new UserIdent();
|
||||
|
||||
/// <summary>
|
||||
/// Aree di memoria lettura
|
||||
/// </summary>
|
||||
@@ -525,34 +506,66 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public Dictionary<string, dataConf> mMapWrite { get; set; } = new Dictionary<string, dataConf>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei SOLI item sottoscritti (se vuoto TUTTI)
|
||||
/// </summary>
|
||||
public List<string> subscribedItems { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco item RAW sottoscritti e relative configurazioni di decodifica da byte[]
|
||||
/// </summary>
|
||||
public Dictionary<string, string> rawSubscribedItemsConf { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Conf Gestione WatchDog
|
||||
/// </summary>
|
||||
public WatchDogConf WatchDog { get; set; } = new WatchDogConf();
|
||||
|
||||
/// <summary>
|
||||
/// Conf gestione setup macchina
|
||||
/// </summary>
|
||||
public MachineSetupConf SetupConf { get; set; } = new MachineSetupConf();
|
||||
|
||||
public UserIdent Identity { get; set; } = new UserIdent();
|
||||
/// <summary>
|
||||
/// Elenco dei SOLI item sottoscritti (se vuoto TUTTI)
|
||||
/// </summary>
|
||||
public List<string> subscribedItems { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Conf Gestione WatchDog
|
||||
/// </summary>
|
||||
public WatchDogConf WatchDog { get; set; } = new WatchDogConf();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class UserIdent
|
||||
{
|
||||
public string UserName { get; set; } = "";
|
||||
#region Public Properties
|
||||
|
||||
public string Passwd { get; set; } = "";
|
||||
public string UserName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione parametri watchdog
|
||||
/// </summary>
|
||||
public class WatchDogConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione WatchDog
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Valore max contatore prima di resettare
|
||||
/// </summary>
|
||||
public int MaxVal { get; set; } = 9999;
|
||||
|
||||
/// <summary>
|
||||
/// Conf memoria x lettura WatchDog (ToMes), se !="" è gestito
|
||||
/// </summary>
|
||||
public string MemConfRead { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Conf memoria x scrittura WatchDog (FromMes), se !="" è gestito
|
||||
/// </summary>
|
||||
public string MemConfWrite { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
internal class val
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user