diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj
index edb5f975..12a9b114 100644
--- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj
+++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj
@@ -156,6 +156,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -220,7 +240,6 @@
-
diff --git a/IOB-UT-NEXT/Objects/CachedInt.cs b/IOB-UT-NEXT/Objects/CachedInt.cs
new file mode 100644
index 00000000..3226847d
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/CachedInt.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Cache a tempo valori INT
+ ///
+ public class CachedInt
+ {
+ #region Public Properties
+
+ public DateTime ValidUntil { get; set; } = DateTime.Now;
+ public int Value { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/CachedString.cs b/IOB-UT-NEXT/Objects/CachedString.cs
new file mode 100644
index 00000000..944834b9
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/CachedString.cs
@@ -0,0 +1,18 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Cache a tempo valori String
+ ///
+ public class CachedString
+ {
+ #region Public Properties
+
+ public DateTime ValidUntil { get; set; } = DateTime.Now;
+ public string Value { get; set; } = "";
+
+ #endregion Public Properties
+ }
+
+}
diff --git a/IOB-UT-NEXT/Objects/DynDataItem.cs b/IOB-UT-NEXT/Objects/DynDataItem.cs
new file mode 100644
index 00000000..724f3d75
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/DynDataItem.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe conf x item DynData
+ ///
+ public class DynDataItem
+ {
+ #region Public Fields
+
+ ///
+ /// DataOra scadenza invio forzato
+ ///
+ public DateTime DTScad = DateTime.Now;
+
+ #endregion Public Fields
+
+ #region Public Properties
+
+ ///
+ /// Valore effettivo da salvare
+ ///
+ public string actVal { get; set; } = "";
+
+ public string func { get; set; } = "";
+ public string key { get; set; } = "";
+ public int maxVal { get; set; }
+ public int minVal { get; set; }
+ public string name { get; set; } = "";
+ public int sPeriod { get; set; } = 60;
+ public string unit { get; set; } = "";
+ public string val { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/IOB-UT-NEXT/Objects/EVData.cs b/IOB-UT-NEXT/Objects/EVData.cs
new file mode 100644
index 00000000..92a0b7af
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/EVData.cs
@@ -0,0 +1,33 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Configurazione per Eventi/Variabili
+ ///
+ public class EVData
+ {
+ #region Public Fields
+
+ ///
+ /// DataOra scadenza invio forzato
+ ///
+ public DateTime DTScad = DateTime.Now;
+
+ #endregion Public Fields
+
+ #region Public Properties
+
+ ///
+ /// Unità di misura
+ ///
+ public string UM { get; set; } = "num";
+
+ ///
+ /// Valore salvato
+ ///
+ public string Val { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/IOB-UT-NEXT/Objects/Endian.cs b/IOB-UT-NEXT/Objects/Endian.cs
new file mode 100644
index 00000000..4fe43678
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/Endian.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Gestione Endianness
+ ///
+ public static class Endian
+ {
+ #region Public Methods
+
+ ///
+ /// Scambia MSB/LSB per 16bit
+ ///
+ ///
+ ///
+ public static UInt16 SwapUInt16(UInt16 inValue)
+ {
+ return (UInt16)(((inValue & 0xff00) >> 8) |
+ ((inValue & 0x00ff) << 8));
+ }
+
+ ///
+ /// Scambia MSB/LSB per 32bit
+ ///
+ ///
+ ///
+ public static UInt32 SwapUInt32(UInt32 inValue)
+ {
+ return ((inValue & 0xff000000) >> 24) |
+ ((inValue & 0x00ff0000) >> 8) |
+ ((inValue & 0x0000ff00) << 8) |
+ ((inValue & 0x000000ff) << 24);
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/FtpTaskList.cs b/IOB-UT-NEXT/Objects/FtpTaskList.cs
new file mode 100644
index 00000000..27522c59
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/FtpTaskList.cs
@@ -0,0 +1,13 @@
+using IOB_UT_NEXT.Config.Special;
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Elenco task di tipo FTP
+ ///
+ public class FtpTaskList
+ {
+ public List ListTask { get; set; } = new List();
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/GenLogRow.cs b/IOB-UT-NEXT/Objects/GenLogRow.cs
new file mode 100644
index 00000000..0635cb0f
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/GenLogRow.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Generico evento log
+ ///
+ public class GenLogRow
+ {
+ public DateTime dtRif { get; set; } = DateTime.Now;
+
+ public string valString { get; set; } = "";
+ }
+
+}
diff --git a/IOB-UT-NEXT/Objects/GenTaskList.cs b/IOB-UT-NEXT/Objects/GenTaskList.cs
new file mode 100644
index 00000000..37739f36
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/GenTaskList.cs
@@ -0,0 +1,13 @@
+using IOB_UT_NEXT.Config;
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Elenco task generici
+ ///
+ public class GenTaskList
+ {
+ public List ListTask { get; set; } = new List();
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/MonitoredItemsConf.cs b/IOB-UT-NEXT/Objects/MonitoredItemsConf.cs
new file mode 100644
index 00000000..8cfd7717
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/MonitoredItemsConf.cs
@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Elenco oggetti del monitoraggio (DynData, Status) per WPS
+ ///
+ public class MonitoredItemsConf
+ {
+ #region Public Properties
+
+ public List DynData { get; set; }
+ public srvData SrvData { get; set; }
+ public List Status { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/IOB-UT-NEXT/Objects/Objects.cs b/IOB-UT-NEXT/Objects/Objects.cs
deleted file mode 100644
index 5a2ca465..00000000
--- a/IOB-UT-NEXT/Objects/Objects.cs
+++ /dev/null
@@ -1,701 +0,0 @@
-using IOB_UT_NEXT.Config;
-using IOB_UT_NEXT.Config.Special;
-using MapoSDK;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace IOB_UT_NEXT.Objects
-{
- ///
- /// informazioni di produzione
- ///
- public struct prodData
- {
- #region Public Fields
-
- public int AccTime;
- public bool EmrStop;
- public string FuncMode;
- public string MessageCode;
- public string MessageText;
- public string Operator;
-
- public int Power;
- public bool Status;
-
- #endregion Public Fields
- }
-
- ///
- /// Gestione Endianness
- ///
- public static class Endian
- {
- #region Public Methods
-
- ///
- /// Scambia MSB/LSB per 16bit
- ///
- ///
- ///
- public static UInt16 SwapUInt16(UInt16 inValue)
- {
- return (UInt16)(((inValue & 0xff00) >> 8) |
- ((inValue & 0x00ff) << 8));
- }
-
- ///
- /// Scambia MSB/LSB per 32bit
- ///
- ///
- ///
- public static UInt32 SwapUInt32(UInt32 inValue)
- {
- return ((inValue & 0xff000000) >> 24) |
- ((inValue & 0x00ff0000) >> 8) |
- ((inValue & 0x0000ff00) << 8) |
- ((inValue & 0x000000ff) << 24);
- }
-
- #endregion Public Methods
- }
-
- ///
- /// Elenco task di tipo FTP
- ///
- public class FtpTaskList
- {
- public List ListTask { get; set; } = new List();
- }
-
- ///
- /// Elenco task generici
- ///
- public class GenTaskList
- {
- public List ListTask { get; set; } = new List();
- }
-
- ///
- /// Gestione dati di timing
- ///
- public static class TimingData
- {
- #region Public Fields
-
- public static List results = new List();
-
- #endregion Public Fields
-
- #region Public Methods
-
- ///
- /// aggiorno vettore aggiungendo risultato
- ///
- /// Codice chiamante
- /// Codice da registrare (univoco con chiamante)
- /// Tempo esecuzione in ticks
- public static void addResult(string caller, string codice, long ticks)
- {
- if (results.Count == 0)
- {
- results.Add(new TimeRec(caller, codice, ticks));
- }
- int indice = -1;
- for (int i = 0; i < results.Count; i++)
- {
- // se il codice è quello cercato...
- if (results[i].codCall == codice && results[i].classCall == caller)
- {
- indice = i;
- }
- }
- // se c'è aggiorno...
- if (indice >= 0)
- {
- results[indice].numCall++;
- results[indice].totMsec = results[indice].totMsec.Add(new TimeSpan(ticks));
- }
- // altrimenti aggiungo...
- else
- {
- results.Add(new TimeRec(caller, codice, ticks));
- }
- }
-
- ///
- /// Resetta i dati registrati (ad avvio adapter...)
- ///
- public static void resetData()
- {
- results = new List();
- }
-
- #endregion Public Methods
- }
-
- ///
- /// Cache a tempo valori INT
- ///
- public class CachedInt
- {
- #region Public Properties
-
- public DateTime ValidUntil { get; set; } = DateTime.Now;
- public int Value { get; set; } = 0;
-
- #endregion Public Properties
- }
-
- ///
- /// Cache a tempo valori String
- ///
- public class CachedString
- {
- #region Public Properties
-
- public DateTime ValidUntil { get; set; } = DateTime.Now;
- public string Value { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Classe conf x item DynData
- ///
- public class DynDataItem
- {
- #region Public Fields
-
- ///
- /// DataOra scadenza invio forzato
- ///
- public DateTime DTScad = DateTime.Now;
-
- #endregion Public Fields
-
- #region Public Properties
-
- ///
- /// Valore effettivo da salvare
- ///
- public string actVal { get; set; } = "";
-
- public string func { get; set; } = "";
- public string key { get; set; } = "";
- public int maxVal { get; set; }
- public int minVal { get; set; }
- public string name { get; set; } = "";
- public int sPeriod { get; set; } = 60;
- public string unit { get; set; } = "";
- public string val { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Configurazione per Eventi/Variabili
- ///
- public class EVData
- {
- #region Public Fields
-
- ///
- /// DataOra scadenza invio forzato
- ///
- public DateTime DTScad = DateTime.Now;
-
- #endregion Public Fields
-
- #region Public Properties
-
- ///
- /// Unità di misura
- ///
- public string UM { get; set; } = "num";
-
- ///
- /// Valore salvato
- ///
- public string Val { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Elenco oggetti del monitoraggio (DynData, Status) per WPS
- ///
- public class MonitoredItemsConf
- {
- #region Public Properties
-
- public List DynData { get; set; }
- public srvData SrvData { get; set; }
- public List Status { get; set; }
-
- #endregion Public Properties
- }
-
- ///
- /// Classe che contiene tutte le NUOVE informazioni da aggiornare sulla form
- ///
- public class newDisplayData
- {
- #region Public Properties
-
- ///
- /// Oggetto COUTNER generico (pezzi, portata...)
- ///
- public int counter { get; set; } = -9999;
-
- ///
- /// Bitmap attuale segnali letti
- ///
- public string currBitmap { get; set; } = "";
-
- ///
- /// Verifica se contenga valori (NON default/empty)
- ///
- public bool hasData
- {
- get
- {
- bool answ = false;
- // true se qualcosa NON E' come default
- if (!string.IsNullOrWhiteSpace(newInData) || !string.IsNullOrWhiteSpace(newSignalData) || !string.IsNullOrWhiteSpace(newFLogData) || !string.IsNullOrWhiteSpace(newUrlCallData) || !string.IsNullOrWhiteSpace(newLiveLogData) || counter > -9999 || !string.IsNullOrWhiteSpace(currBitmap) || semIn != Semaforo.ND || semOut != Semaforo.ND)
- {
- answ = true;
- }
- return answ;
- }
- }
-
- ///
- /// Dati tipo FluxLog
- ///
- public string newFLogData { get; set; } = "";
-
- ///
- /// Dati tipo IN (RAW)
- ///
- public string newInData { get; set; } = "";
-
- ///
- /// Dati tipo LiveLog
- ///
- public string newLiveLogData { get; set; } = "";
-
- ///
- /// Dati tipo Signal
- ///
- public string newSignalData { get; set; } = "";
-
- ///
- /// Dati tipo UrlCall
- ///
- public string newUrlCallData { get; set; } = "";
-
- ///
- /// Stato semaforo IN verso PLC
- ///
- public Semaforo semIn { get; set; } = Semaforo.ND;
-
- ///
- /// Stato semaforo OUT verso MES
- ///
- public Semaforo semOut { get; set; } = Semaforo.ND;
-
- #endregion Public Properties
- }
-
- ///
- /// Dato generico (per decodifica)
- ///
- public class otherData
- {
- #region Public Fields
-
- public string codNum;
- public string dataType;
- public string memAddr;
- public string varName;
-
- #endregion Public Fields
-
- #region Public Constructors
-
- public otherData()
- {
- codNum = "";
- memAddr = "";
- varName = "";
- dataType = "";
- }
-
- public otherData(string _codNum, string _memAddr, string _varName, string _dataType)
- {
- codNum = _codNum;
- memAddr = _memAddr;
- varName = _varName;
- dataType = _dataType;
- }
-
- #endregion Public Constructors
- }
-
- ///
- /// Classe gestione valori campionati su periodo
- ///
- public class sampleVect
- {
- #region Public Constructors
-
- ///
- /// Inizializzo l'oggetto
- ///
- public sampleVect()
- {
- // init valori default...
- windSize = baseUtils.CRI("countWindSize") > 0 ? baseUtils.CRI("countWindSize") : 60;
- lTime = new List();
- lVal = new List();
- }
-
- #endregion Public Constructors
-
- #region Public Properties
-
- ///
- /// Calcola il valore mediano...
- ///
- public double vcMedian
- {
- get
- {
- double answ = 0;
- // restituisce la mediana SE valida, altrimenti null...
- if (numElem > 2 && flWindSize > windSize)
- {
- try
- {
- // calcolo mediana!
- //answ = Statistics.Median(lVal.ToArray());
-
- // rif: https://blogs.msmvps.com/deborahk/linq-mean-median-and-mode/
- var sortedNumbers = lVal.OrderBy(n => n);
- int numCount = lVal.Count;
- int indice50 = lVal.Count / 2;
- if ((numCount % 2) == 0)
- {
- answ = ((sortedNumbers.ElementAt(indice50) + sortedNumbers.ElementAt(indice50 - 1)) / 2);
- }
- else
- {
- answ = sortedNumbers.ElementAt(indice50);
- }
- }
- catch
- { }
- }
- return answ;
- }
- }
-
- ///
- /// Verifica se la vc sia valida (ovvero almeno 2 valori e intervallo > window richiesta)
- ///
- public bool vcValid
- {
- get
- {
- return (flWindSize > windSize && numElem > 1);
- }
- }
-
- #endregion Public Properties
-
- #region Public Methods
-
- ///
- /// Aggiunge un valore alla serie ed eventualmente elimina i valori superflui a garantirne
- /// una finestra temporale valida
- ///
- ///
- ///
- public void addValue(DateTime tempo, int valore)
- {
- lTime.Add(tempo);
- lVal.Add(valore);
- // verifico se siano da accorciare le serie... ovvero i 2 intervalli ENTRAMBI sono
- // superiori al periodo minimo (in tal caso riduco..
- while (flWindSize > windSize && slWindSize > windSize)
- {
- // elimino i 2 valori + vecchi
- lTime.RemoveAt(0);
- lVal.RemoveAt(0);
- // ora ricontrollo...
- }
- }
-
- #endregion Public Methods
-
- #region Protected Fields
-
- ///
- /// vettore valori temporali della serie
- ///
- protected List lTime;
-
- ///
- /// vettore valori puntuali della serie
- ///
- protected List lVal;
-
- ///
- /// Dimensione finestra di campionamento (secondi)
- ///
- protected int windSize;
-
- #endregion Protected Fields
-
- #region Protected Properties
-
- ///
- /// Verifica ampiezza finestra valori First-Last
- ///
- protected double flWindSize
- {
- get
- {
- double answ = 0;
- if (numElem > 1)
- {
- answ = lTime.Last().Subtract(lTime[0]).TotalSeconds;
- }
- return answ;
- }
- }
-
- ///
- /// Conteggio elementi
- ///
- protected int numElem
- {
- get
- {
- int answ = 0;
- try
- {
- answ = lTime.Count;
- }
- catch
- { }
- return answ;
- }
- }
-
- ///
- /// Verifica ampiezza finestra valori Second-Last
- ///
- protected double slWindSize
- {
- get
- {
- double answ = 0;
- if (numElem > 2) // altrimenti SE non ne ho almeno 3 NON posso avere secondo/ultimo...
- {
- answ = lTime.Last().Subtract(lTime[1]).TotalSeconds;
- }
- return answ;
- }
- }
-
- #endregion Protected Properties
- }
-
- ///
- /// Classe x descrivere status server MP
- ///
- public class ServerMpStatus
- {
- #region Public Properties
-
- ///
- /// IP server
- ///
- public string IP { get; set; }
-
- ///
- /// DataOra ultima comunicazione OUT (con MP Server)
- ///
- public DateTime lastUpdate { get; set; } = DateTime.Now.AddDays(-1);
-
- ///
- /// Status del server
- ///
- public bool online { get; set; } = false;
-
- #endregion Public Properties
- }
-
- ///
- /// Classe conf server html
- ///
- public class srvData
- {
- #region Public Properties
-
- public string baseUri { get; set; } = "";
- public string driverName { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Classe conf x decodifica status
- ///
- public class StatusItem : DynDataItem
- {
- #region Public Fields
-
- public Dictionary codeMapping;
-
- #endregion Public Fields
- }
-
- ///
- /// Oggetto timing x archiviazione dati perfomances
- ///
- public class TimeRec
- {
- #region Public Fields
-
- ///
- /// Classe chiamante della funzione (es codice univoco IOB)
- ///
- public string classCall;
-
- ///
- /// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte)
- ///
- public string codCall;
-
- ///
- /// Num chiamate totale
- ///
- public int numCall;
-
- ///
- /// Totale Msec accumulati
- ///
- public TimeSpan totMsec;
-
- #endregion Public Fields
-
- #region Public Constructors
-
- ///
- /// Classe record timing
- ///
- public TimeRec()
- {
- codCall = "";
- numCall = 0;
- totMsec = new TimeSpan(0);
- }
-
- ///
- /// Classe record timing
- ///
- ///
- ///
- ///
- public TimeRec(string caller, string codice, long nTicks)
- {
- classCall = caller;
- codCall = codice;
- numCall = 1;
- totMsec = new TimeSpan(nTicks);
- }
-
- #endregion Public Constructors
-
- #region Public Properties
-
- ///
- /// Tempo medio chiamata
- ///
- public double avgMsec
- {
- get
- {
- return totMsec.TotalMilliseconds / numCall;
- }
- }
-
- #endregion Public Properties
- }
-
- ///
- /// Configurazione per Variabili Casuali
- ///
- public class VCData
- {
- #region Public Fields
-
- ///
- /// Array dati per calcolo
- ///
- public List dataArray;
-
- ///
- /// DataOra inizio periodo di elaborazione
- ///
- public DateTime DTStart;
-
- #endregion Public Fields
-
- #region Public Properties
-
- ///
- /// Tipologia di funzione da applicare
- ///
- public VC_func Funzione { get; set; } = VC_func.POINT;
-
- ///
- /// Periodo di riferimento
- ///
- public int Period { get; set; } = 60;
-
- ///
- /// UM parametro, impiegato anche x conversione (es epoch --> datetime)
- ///
- public string UM { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Generico evento log
- ///
- public class GenLogRow
- {
- public DateTime dtRif { get; set; } = DateTime.Now;
-
- public string valString { get; set; } = "";
- }
-
-
- ///
- /// Informazioni generiche su batch produzione rilevati
- ///
- public class ProdBatchData
- {
- public DateTime dtStart { get; set; } = DateTime.Now;
- public DateTime? dtEnd { get; set; } = null;
-
- public string codArt { get; set; } = "";
- public int numPz { get; set; } = 0;
- }
-}
\ No newline at end of file
diff --git a/IOB-UT-NEXT/Objects/ProdBatchData.cs b/IOB-UT-NEXT/Objects/ProdBatchData.cs
new file mode 100644
index 00000000..a888b7c9
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/ProdBatchData.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Informazioni generiche su batch produzione rilevati
+ ///
+ public class ProdBatchData
+ {
+ public DateTime dtStart { get; set; } = DateTime.Now;
+ public DateTime? dtEnd { get; set; } = null;
+
+ public string codArt { get; set; } = "";
+ public int numPz { get; set; } = 0;
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/ServerMpStatus.cs b/IOB-UT-NEXT/Objects/ServerMpStatus.cs
new file mode 100644
index 00000000..0c32d47e
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/ServerMpStatus.cs
@@ -0,0 +1,29 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe x descrivere status server MP
+ ///
+ public class ServerMpStatus
+ {
+ #region Public Properties
+
+ ///
+ /// IP server
+ ///
+ public string IP { get; set; }
+
+ ///
+ /// DataOra ultima comunicazione OUT (con MP Server)
+ ///
+ public DateTime lastUpdate { get; set; } = DateTime.Now.AddDays(-1);
+
+ ///
+ /// Status del server
+ ///
+ public bool online { get; set; } = false;
+
+ #endregion Public Properties
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/StatusItem.cs b/IOB-UT-NEXT/Objects/StatusItem.cs
new file mode 100644
index 00000000..05227535
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/StatusItem.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe conf x decodifica status
+ ///
+ public class StatusItem : DynDataItem
+ {
+ #region Public Fields
+
+ public Dictionary codeMapping;
+
+ #endregion Public Fields
+ }
+
+}
diff --git a/IOB-UT-NEXT/Objects/TimeRec.cs b/IOB-UT-NEXT/Objects/TimeRec.cs
new file mode 100644
index 00000000..b736111d
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/TimeRec.cs
@@ -0,0 +1,78 @@
+using System;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Oggetto timing x archiviazione dati perfomances
+ ///
+ public class TimeRec
+ {
+ #region Public Fields
+
+ ///
+ /// Classe chiamante della funzione (es codice univoco IOB)
+ ///
+ public string classCall;
+
+ ///
+ /// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte)
+ ///
+ public string codCall;
+
+ ///
+ /// Num chiamate totale
+ ///
+ public int numCall;
+
+ ///
+ /// Totale Msec accumulati
+ ///
+ public TimeSpan totMsec;
+
+ #endregion Public Fields
+
+ #region Public Constructors
+
+ ///
+ /// Classe record timing
+ ///
+ public TimeRec()
+ {
+ codCall = "";
+ numCall = 0;
+ totMsec = new TimeSpan(0);
+ }
+
+ ///
+ /// Classe record timing
+ ///
+ ///
+ ///
+ ///
+ public TimeRec(string caller, string codice, long nTicks)
+ {
+ classCall = caller;
+ codCall = codice;
+ numCall = 1;
+ totMsec = new TimeSpan(nTicks);
+ }
+
+ #endregion Public Constructors
+
+ #region Public Properties
+
+ ///
+ /// Tempo medio chiamata
+ ///
+ public double avgMsec
+ {
+ get
+ {
+ return totMsec.TotalMilliseconds / numCall;
+ }
+ }
+
+ #endregion Public Properties
+ }
+
+}
diff --git a/IOB-UT-NEXT/Objects/TimingData.cs b/IOB-UT-NEXT/Objects/TimingData.cs
new file mode 100644
index 00000000..ac8c612b
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/TimingData.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Gestione dati di timing
+ ///
+ public static class TimingData
+ {
+ #region Public Fields
+
+ public static List results = new List();
+
+ #endregion Public Fields
+
+ #region Public Methods
+
+ ///
+ /// aggiorno vettore aggiungendo risultato
+ ///
+ /// Codice chiamante
+ /// Codice da registrare (univoco con chiamante)
+ /// Tempo esecuzione in ticks
+ public static void addResult(string caller, string codice, long ticks)
+ {
+ if (results.Count == 0)
+ {
+ results.Add(new TimeRec(caller, codice, ticks));
+ }
+ int indice = -1;
+ for (int i = 0; i < results.Count; i++)
+ {
+ // se il codice è quello cercato...
+ if (results[i].codCall == codice && results[i].classCall == caller)
+ {
+ indice = i;
+ }
+ }
+ // se c'è aggiorno...
+ if (indice >= 0)
+ {
+ results[indice].numCall++;
+ results[indice].totMsec = results[indice].totMsec.Add(new TimeSpan(ticks));
+ }
+ // altrimenti aggiungo...
+ else
+ {
+ results.Add(new TimeRec(caller, codice, ticks));
+ }
+ }
+
+ ///
+ /// Resetta i dati registrati (ad avvio adapter...)
+ ///
+ public static void resetData()
+ {
+ results = new List();
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/VCData.cs b/IOB-UT-NEXT/Objects/VCData.cs
new file mode 100644
index 00000000..1ef149a8
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/VCData.cs
@@ -0,0 +1,45 @@
+using MapoSDK;
+using System;
+using System.Collections.Generic;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Configurazione per Variabili Casuali
+ ///
+ public class VCData
+ {
+ #region Public Fields
+
+ ///
+ /// Array dati per calcolo
+ ///
+ public List dataArray;
+
+ ///
+ /// DataOra inizio periodo di elaborazione
+ ///
+ public DateTime DTStart;
+
+ #endregion Public Fields
+
+ #region Public Properties
+
+ ///
+ /// Tipologia di funzione da applicare
+ ///
+ public VC_func Funzione { get; set; } = VC_func.POINT;
+
+ ///
+ /// Periodo di riferimento
+ ///
+ public int Period { get; set; } = 60;
+
+ ///
+ /// UM parametro, impiegato anche x conversione (es epoch --> datetime)
+ ///
+ public string UM { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/newDisplayData.cs b/IOB-UT-NEXT/Objects/newDisplayData.cs
new file mode 100644
index 00000000..92abd646
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/newDisplayData.cs
@@ -0,0 +1,76 @@
+using MapoSDK;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe che contiene tutte le NUOVE informazioni da aggiornare sulla form
+ ///
+ public class newDisplayData
+ {
+ #region Public Properties
+
+ ///
+ /// Oggetto COUTNER generico (pezzi, portata...)
+ ///
+ public int counter { get; set; } = -9999;
+
+ ///
+ /// Bitmap attuale segnali letti
+ ///
+ public string currBitmap { get; set; } = "";
+
+ ///
+ /// Verifica se contenga valori (NON default/empty)
+ ///
+ public bool hasData
+ {
+ get
+ {
+ bool answ = false;
+ // true se qualcosa NON E' come default
+ if (!string.IsNullOrWhiteSpace(newInData) || !string.IsNullOrWhiteSpace(newSignalData) || !string.IsNullOrWhiteSpace(newFLogData) || !string.IsNullOrWhiteSpace(newUrlCallData) || !string.IsNullOrWhiteSpace(newLiveLogData) || counter > -9999 || !string.IsNullOrWhiteSpace(currBitmap) || semIn != Semaforo.ND || semOut != Semaforo.ND)
+ {
+ answ = true;
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// Dati tipo FluxLog
+ ///
+ public string newFLogData { get; set; } = "";
+
+ ///
+ /// Dati tipo IN (RAW)
+ ///
+ public string newInData { get; set; } = "";
+
+ ///
+ /// Dati tipo LiveLog
+ ///
+ public string newLiveLogData { get; set; } = "";
+
+ ///
+ /// Dati tipo Signal
+ ///
+ public string newSignalData { get; set; } = "";
+
+ ///
+ /// Dati tipo UrlCall
+ ///
+ public string newUrlCallData { get; set; } = "";
+
+ ///
+ /// Stato semaforo IN verso PLC
+ ///
+ public Semaforo semIn { get; set; } = Semaforo.ND;
+
+ ///
+ /// Stato semaforo OUT verso MES
+ ///
+ public Semaforo semOut { get; set; } = Semaforo.ND;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/IOB-UT-NEXT/Objects/otherData.cs b/IOB-UT-NEXT/Objects/otherData.cs
new file mode 100644
index 00000000..cbd21e13
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/otherData.cs
@@ -0,0 +1,37 @@
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Dato generico (per decodifica)
+ ///
+ public class otherData
+ {
+ #region Public Fields
+
+ public string codNum;
+ public string dataType;
+ public string memAddr;
+ public string varName;
+
+ #endregion Public Fields
+
+ #region Public Constructors
+
+ public otherData()
+ {
+ codNum = "";
+ memAddr = "";
+ varName = "";
+ dataType = "";
+ }
+
+ public otherData(string _codNum, string _memAddr, string _varName, string _dataType)
+ {
+ codNum = _codNum;
+ memAddr = _memAddr;
+ varName = _varName;
+ dataType = _dataType;
+ }
+
+ #endregion Public Constructors
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/prodData.cs b/IOB-UT-NEXT/Objects/prodData.cs
new file mode 100644
index 00000000..12923ac5
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/prodData.cs
@@ -0,0 +1,22 @@
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// informazioni di produzione
+ ///
+ public struct prodData
+ {
+ #region Public Fields
+
+ public int AccTime;
+ public bool EmrStop;
+ public string FuncMode;
+ public string MessageCode;
+ public string MessageText;
+ public string Operator;
+
+ public int Power;
+ public bool Status;
+
+ #endregion Public Fields
+ }
+}
diff --git a/IOB-UT-NEXT/Objects/sampleVect.cs b/IOB-UT-NEXT/Objects/sampleVect.cs
new file mode 100644
index 00000000..f5924b54
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/sampleVect.cs
@@ -0,0 +1,177 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe gestione valori campionati su periodo
+ ///
+ public class sampleVect
+ {
+ #region Public Constructors
+
+ ///
+ /// Inizializzo l'oggetto
+ ///
+ public sampleVect()
+ {
+ // init valori default...
+ windSize = baseUtils.CRI("countWindSize") > 0 ? baseUtils.CRI("countWindSize") : 60;
+ lTime = new List();
+ lVal = new List();
+ }
+
+ #endregion Public Constructors
+
+ #region Public Properties
+
+ ///
+ /// Calcola il valore mediano...
+ ///
+ public double vcMedian
+ {
+ get
+ {
+ double answ = 0;
+ // restituisce la mediana SE valida, altrimenti null...
+ if (numElem > 2 && flWindSize > windSize)
+ {
+ try
+ {
+ // calcolo mediana!
+ //answ = Statistics.Median(lVal.ToArray());
+
+ // rif: https://blogs.msmvps.com/deborahk/linq-mean-median-and-mode/
+ var sortedNumbers = lVal.OrderBy(n => n);
+ int numCount = lVal.Count;
+ int indice50 = lVal.Count / 2;
+ if ((numCount % 2) == 0)
+ {
+ answ = ((sortedNumbers.ElementAt(indice50) + sortedNumbers.ElementAt(indice50 - 1)) / 2);
+ }
+ else
+ {
+ answ = sortedNumbers.ElementAt(indice50);
+ }
+ }
+ catch
+ { }
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// Verifica se la vc sia valida (ovvero almeno 2 valori e intervallo > window richiesta)
+ ///
+ public bool vcValid
+ {
+ get
+ {
+ return (flWindSize > windSize && numElem > 1);
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ ///
+ /// Aggiunge un valore alla serie ed eventualmente elimina i valori superflui a garantirne
+ /// una finestra temporale valida
+ ///
+ ///
+ ///
+ public void addValue(DateTime tempo, int valore)
+ {
+ lTime.Add(tempo);
+ lVal.Add(valore);
+ // verifico se siano da accorciare le serie... ovvero i 2 intervalli ENTRAMBI sono
+ // superiori al periodo minimo (in tal caso riduco..
+ while (flWindSize > windSize && slWindSize > windSize)
+ {
+ // elimino i 2 valori + vecchi
+ lTime.RemoveAt(0);
+ lVal.RemoveAt(0);
+ // ora ricontrollo...
+ }
+ }
+
+ #endregion Public Methods
+
+ #region Protected Fields
+
+ ///
+ /// vettore valori temporali della serie
+ ///
+ protected List lTime;
+
+ ///
+ /// vettore valori puntuali della serie
+ ///
+ protected List lVal;
+
+ ///
+ /// Dimensione finestra di campionamento (secondi)
+ ///
+ protected int windSize;
+
+ #endregion Protected Fields
+
+ #region Protected Properties
+
+ ///
+ /// Verifica ampiezza finestra valori First-Last
+ ///
+ protected double flWindSize
+ {
+ get
+ {
+ double answ = 0;
+ if (numElem > 1)
+ {
+ answ = lTime.Last().Subtract(lTime[0]).TotalSeconds;
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// Conteggio elementi
+ ///
+ protected int numElem
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = lTime.Count;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+
+ ///
+ /// Verifica ampiezza finestra valori Second-Last
+ ///
+ protected double slWindSize
+ {
+ get
+ {
+ double answ = 0;
+ if (numElem > 2) // altrimenti SE non ne ho almeno 3 NON posso avere secondo/ultimo...
+ {
+ answ = lTime.Last().Subtract(lTime[1]).TotalSeconds;
+ }
+ return answ;
+ }
+ }
+
+ #endregion Protected Properties
+ }
+
+}
diff --git a/IOB-UT-NEXT/Objects/srvData.cs b/IOB-UT-NEXT/Objects/srvData.cs
new file mode 100644
index 00000000..01c417fe
--- /dev/null
+++ b/IOB-UT-NEXT/Objects/srvData.cs
@@ -0,0 +1,16 @@
+namespace IOB_UT_NEXT.Objects
+{
+ ///
+ /// Classe conf server html
+ ///
+ public class srvData
+ {
+ #region Public Properties
+
+ public string baseUri { get; set; } = "";
+ public string driverName { get; set; } = "";
+
+ #endregion Public Properties
+ }
+
+}
diff --git a/IOB-WIN-FORM/Iob/Generic.cs b/IOB-WIN-FORM/Iob/Generic.cs
index dbccbe43..18f9c730 100644
--- a/IOB-WIN-FORM/Iob/Generic.cs
+++ b/IOB-WIN-FORM/Iob/Generic.cs
@@ -6350,7 +6350,7 @@ namespace IOB_WIN_FORM.Iob
string rawData = File.ReadAllText(fileItem);
if (!string.IsNullOrEmpty(rawData))
{
- var convData = JsonConvert.DeserializeObject>(rawData);
+ var convData = JsonDeserialize>(rawData);
if (convData != null)
{
list2Send = convData;
@@ -6409,7 +6409,7 @@ namespace IOB_WIN_FORM.Iob
{
try
{
- writeList = JsonConvert.DeserializeObject>(resp);
+ writeList = JsonDeserialize>(resp);
// se ho da fare chiamo esecuzione..
if (writeList.Count > 0)
{