diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs
index 5001f313..c67b0ae7 100644
--- a/IOB-UT-NEXT/Enums.cs
+++ b/IOB-UT-NEXT/Enums.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace IOB_UT_NEXT
{
@@ -11,7 +8,7 @@ namespace IOB_UT_NEXT
public enum boolCheckMode
{
///
- /// AND: tutte vere -> true
+ /// AND: tutte vere -> true
///
AND = 0,
@@ -21,17 +18,6 @@ namespace IOB_UT_NEXT
OR
}
- ///
- /// Modalità gestione setup macchina
- ///
- public enum MachineSetupMode
- {
- ND=0,
-
- // Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
- MECOLPRESS = 1
- }
-
///
/// Elenco MODI CNC
///
@@ -182,6 +168,17 @@ namespace IOB_UT_NEXT
VLF
}
+ ///
+ /// Modalità gestione setup macchina
+ ///
+ public enum MachineSetupMode
+ {
+ ND = 0,
+
+ // Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
+ MECOLPRESS = 1
+ }
+
///
/// StFlag32: set di 32 bit (4 word) contente semaforo di variabili
///
@@ -396,7 +393,7 @@ namespace IOB_UT_NEXT
SIEMENS_APROCHIM,
///
- /// Adapter SIEMENS, interfaccia versione VIPA @2001
+ /// Adapter SIEMENS, interfaccia versione VIPA @2001
///
SIEMENS_AT2001,
@@ -510,4 +507,20 @@ namespace IOB_UT_NEXT
///
ULog
}
+
+ ///
+ /// Tipologia dato RAW da trasmettere/ricevere (derivare da MapoSdk e togliere qui)
+ ///
+ public enum rawDataType
+ {
+ ND = 0,
+ ///
+ /// Icoel: Batch info
+ ///
+ IcoelBatch,
+ ///
+ /// Icoel: Variety + layout info relative
+ ///
+ IcoelVarInfo
+ }
}
\ No newline at end of file
diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs
index 8a643b7a..580c2479 100644
--- a/IOB-WIN-NEXT/AdapterForm.cs
+++ b/IOB-WIN-NEXT/AdapterForm.cs
@@ -1132,7 +1132,7 @@ namespace IOB_WIN_NEXT
tipoIob = tipoScelto,
optPar = optParRead,
versIOB = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
- codIOB = CurrIOB,
+ codIOB = fIni.ReadString("IOB", "IOB_NAME", CurrIOB),
cncIpAddr = fIni.ReadString("CNC", "IP", "::1"),
cncPort = fIni.ReadString("CNC", "PORT", "0"),
iniFileName = iniConfFile,
@@ -1280,7 +1280,7 @@ namespace IOB_WIN_NEXT
iobObj = new IobOpcUaOmronIcoel(this, IOBConf);
start.Enabled = true;
break;
-
+
case tipoAdapter.PingWatchdog:
iobObj = new IobPing(this, IOBConf);
start.Enabled = true;
diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_001.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_001.ini
index 1e80902f..7eee9efe 100644
--- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_001.ini
+++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_001.ini
@@ -3,6 +3,7 @@
;Centro di lavoro OpcUa
CNCTYPE=OpcUaOmronIcoel
PING_MS_TIMEOUT=500
+IOB_NAME=GIACO_ICOEL
[MACHINE]
VENDOR=ICOEL
diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini
new file mode 100644
index 00000000..d7f61e8a
--- /dev/null
+++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini
@@ -0,0 +1,72 @@
+;Configurazione IOB-WIN
+[IOB]
+;WebService SOAP x sizer
+CNCTYPE=IcoelSoap
+PING_MS_TIMEOUT=500
+IOB_NAME=GIACO_ICOEL
+
+[MACHINE]
+VENDOR=ICOEL
+MODEL=Impianto Ciliegie Turi
+
+[CNC]
+IP=192.168.137.50
+PORT=8001
+GETPRGNAME=false
+
+[SERVER]
+MPIP=http://192.168.1.14
+MPURL=/MP/IO
+CMDBASE=/IOB/input/
+CMDFLOG=/IOB/flog/
+CMDALIVE=/IOB
+CMDENABLED=/IOB/enabled/
+CMDADV1=?valore=
+CMDREBO=/sendReboot.aspx?idxMacchina=
+
+[MEMORY]
+ADDR_READ=DB9999.DBB0
+ADDR_WRITE=DB9999.DBB0
+SIZE_READ=0
+SIZE_WRITE=0
+;BIT0=CONN
+;BIT1=DB60.DBB1
+;BIT2=PZCOUNT.STD.DB700.DBW22
+;BIT3=DB60.DBB3
+;BIT4=DB60.DBB4
+
+
+[BLINK]
+;MAX_COUNTER_BLINK = 30
+MAX_COUNTER_BLINK = 15
+;bit0 = 0
+;bit1 = 0
+;bit2 = 1
+;bit3 = 1
+;bit4 = 1
+;bit5 = 0
+;bit6 = 0
+;bit7 = 0
+BLINK_FILT=0
+;BLINK_FILT=28
+
+[OPTPAR]
+AUTO_CHANGE_ODL=false
+CHANGE_ODL_MODE=TIME
+CHANGE_ODL_HOURS=24
+CHANGE_ODL_IDLE_MIN=5
+PZCOUNT_MODE=Icoel
+DISABLE_PZCOUNT=FALSE
+ENABLE_SEND_PZC_BLOCK=TRUE
+MIN_SEND_PZC_BLOCK=0
+MAX_SEND_PZC_BLOCK=100
+ENABLE_DYN_DATA=FALSE
+FORCE_DYN_DATA=TRUE
+ENABLE_DATA_FILTER=TRUE
+ENABLE_CLI_RESTART=TRUE
+
+; conf parametri memoria READ/WRITE
+OPC_PARAM_CONF=GIACO_ICOEL_001.json
+
+[BRANCH]
+NAME=master
\ No newline at end of file
diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
index de03bf72..e5807f3c 100644
--- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
+++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
@@ -194,6 +194,8 @@
VersGen.cs
+
+
@@ -305,6 +307,9 @@
Always
+
+ PreserveNewest
+
Always
diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs
index 74a0030e..af7d4afd 100644
--- a/IOB-WIN-NEXT/IobGeneric.cs
+++ b/IOB-WIN-NEXT/IobGeneric.cs
@@ -3426,6 +3426,58 @@ namespace IOB_WIN_NEXT
}
}
+ ///
+ /// Accumula in coda i valori RawData logga...
+ ///
+ /// Dictionary pronto x invio
+ public void accodaRawData(Dictionary sendObj)
+ {
+ //
+
+ /*--------------------------------
+ * nuova gestione coda dictionary
+ * fixme todo da fare !!!
+ *
+ * - conterrà tanti dictionary, con key data-ora accodamento
+ * - i dati vanno poi "scodati" dal + vecchio ed inviati a MP/IO
+ * - mostra un sunto delle info da inviare
+ * - accodamento vero e proprio
+ * - verifica (opzionale) coda massima x gestire roundRobin ultimi eventi
+ * - trace della coda
+ * - counter invio??? valutare se c'è dataora e poi sono da salvare su MongoDb / Redis
+ *
+ * */
+
+#if false
+ // mostro dati variati letti...
+ displayOtherData(val);
+ // --> accodo (valore già formattato)!
+ QueueFLog.Enqueue(encodedVal);
+ // se abilitato controllo coda FLog (superiore a 0...)
+ if (maxQueueFLog > 0)
+ {
+ // se ho una coda superiore a max ammesso
+ if (QueueFLog.Count > maxQueueFLog)
+ {
+ // elimino valori iniziali fino a tornare al max ammesso...
+ while (QueueFLog.Count > maxQueueFLog)
+ {
+ string currVal = "";
+ QueueFLog.TryDequeue(out currVal);
+ lgInfo($"Eliminazione da coda FLog per superamento maxLengh: {currVal}");
+ }
+ }
+ }
+ // loggo!
+ lgTrace(string.Format("[QUEUE-FLOG] {0}", encodedVal));
+ counterFLog++;
+ if (counterFLog > 9999)
+ {
+ counterFLog = 0;
+ }
+#endif
+ }
+
///
/// Accoda (visualizzando in cima allo stack) la nuova stringa di output per area OTHER DATA
///
@@ -3833,6 +3885,7 @@ namespace IOB_WIN_NEXT
}
else if (ciclo == gatherCycle.LF)
{
+ processCustomTaskLF();
processOtherCounters();
processProgram();
// verifico se devo gestire cambio ODL in modo automatico
@@ -3920,6 +3973,13 @@ namespace IOB_WIN_NEXT
raiseRefresh(currDispData);
}
+ ///
+ /// Effettua processing CUSTOM x l'IOB corrente (ed invia ad IO)
+ /// (task svolto tipicamente ogni 5 sec se base timer 10ms, vedere app.config)
+ ///
+ public virtual void processCustomTaskLF()
+ { }
+
///
/// Recupera eventuali allarmi CNC...
///
diff --git a/IOB-WIN-NEXT/IobIcoelDb.cs b/IOB-WIN-NEXT/IobIcoelDb.cs
new file mode 100644
index 00000000..f7c969b2
--- /dev/null
+++ b/IOB-WIN-NEXT/IobIcoelDb.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IOB_WIN_NEXT
+{ ///
+ /// Adapter specializzato per ICOEL e le chiamate tramite DB per i dati
+ /// - accettazione lotti prodotto (frontiera / entrata ciliegie)
+ /// - export (totale per prodotti)
+ /// - tracciabilità (confezioni
+ ///
+
+ public class IobIcoelDb : IobGeneric
+ {
+ ///
+ /// Costruttore dell'IOB Icoel DB
+ ///
+ /// AdapterForm chiamante
+ /// Configurazione IOB per avvio
+ public IobIcoelDb(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
+ {
+ }
+
+ public override Dictionary executeTasks(Dictionary task2exe)
+ {
+ return base.executeTasks(task2exe);
+ }
+ }
+}
diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs
new file mode 100644
index 00000000..eb70204e
--- /dev/null
+++ b/IOB-WIN-NEXT/IobIcoelSoap.cs
@@ -0,0 +1,212 @@
+using EgwProxy.Icoel;
+using EgwProxy.Icoel.SizerService;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Net.NetworkInformation;
+
+namespace IOB_WIN_NEXT
+{
+ ///
+ /// Adapter specializzato per ICOEL e le chiamate tramite WS Soap al Sizer, con libreria EgwProxy.Icoel
+ ///
+ public class IobIcoelSoap : IobGeneric
+ {
+ #region Public Constructors
+
+ ///
+ /// Costruttore dell'IOB Icoel SOAP
+ ///
+ /// AdapterForm chiamante
+ /// Configurazione IOB per avvio
+ public IobIcoelSoap(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
+ {
+ /* --------------------------------------
+ * todo's
+ * --------------------------------------
+ * - init obj comunicazione da conf e nuget
+ * - test comunicazione
+ * - estensione IOB come OPT_PAR di OVERRIDE (x inviare dati di un unico iOB da più IOB programs)
+ * - gestione processCustomTaskLF
+ * - x lettura dei 2 batch correnti (sx/dx)
+ * - calcolo batch in corso/chiusi da date inizio/fine
+ * - trasmettere a MP/IO risultato valutazioni
+ * - gestione executeTasks
+ * - task di invio batch configurato in coda
+ * - task di recupero info anagrafiche (grower, variety, layout,...)
+ * - contapezzi (SE ha senso con sizer oppure saltare)
+ */
+
+ IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort);
+ }
+
+ #endregion Public Constructors
+
+ #region Public Methods
+
+ ///
+ /// Implementazione custom esecuzione task specifici
+ ///
+ ///
+ ///
+ public override Dictionary executeTasks(Dictionary task2exe)
+ {
+ /*---------------------------------------
+ * fixme todo fare !!!
+ * gestione execute task SPECIFICI x il sizer:
+ * - recupero anagrafice variety/layout (attivi)
+ * - recupero grower
+ * - invio batch da accodare
+ * - recupero dati da sizer (OVE disponibili)
+ * - recupero batch corrente (modalità force/resync?)
+ *
+ *---------------------------------------*/
+
+ return base.executeTasks(task2exe);
+ }
+
+ ///
+ /// Effettua processing CUSTOM x Icoel:
+ /// - recupera elenco batch delle 2 linee
+ /// - invia al sistema
+ ///
+ public override void processCustomTaskLF()
+ {
+ var currBatch = IcoelSizer.GetCurrentBatch();
+ if (currBatch != null)
+ {
+ // verifico se i batch siano variati... e quindi da inviare...
+ bool doSend = false;
+ if (currBatch.Count > 0)
+ {
+ foreach (var item in currBatch)
+ {
+ // se variato ID è cambiato
+ doSend = (currBatchList[item.Key].Id != item.Value.Id);
+ }
+ }
+ // se devo inviare impacchetto dati
+ if (doSend)
+ {
+ // serializzo ed invio al sistema il risultato
+ string rawData = JsonConvert.SerializeObject(currBatch);
+ // invio come tipo "IcoelBatch"
+ Dictionary sendObj = new Dictionary();
+ sendObj.Add(IOB_UT_NEXT.rawDataType.IcoelBatch, rawData);
+
+ // accodo per invio...
+ accodaRawData(sendObj);
+ }
+ }
+ }
+
+ ///
+ /// Override connessione
+ ///
+ public override void tryConnect()
+ {
+ if (!connectionOk)
+ {
+ // controllo che il ping sia stato tentato almeno pingTestSec fa...
+ if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
+ {
+ if (verboseLog || periodicLog)
+ {
+ lgInfo("IcoelSoap: ConnKO - tryConnect");
+ }
+ // in primis salvo data ping...
+ lastPING = DateTime.Now;
+ // se passa il ping faccio il resto...
+ if (testPingMachine == IPStatus.Success)
+ {
+ string szStatusConnection = "";
+ try
+ {
+ // ora provo connessione...
+ parentForm.commPlcActive = true;
+ // recupero elenco batch... se != vuoto -_> connesso!
+ var batchList = IcoelSizer.GetCurrentBatch();
+ if (batchList != null && batchList.Count > 0)
+ {
+ lgInfo($"szStatusConnection IcoelSoap, recuperato elenco di {batchList.Count} batch");
+ parentForm.commPlcActive = false;
+ connectionOk = true;
+ }
+ // refresh stato connessione!!!
+ if (connectionOk)
+ {
+ if (adpRunning)
+ {
+ lgInfo("Connessione OK");
+ }
+ }
+ else
+ {
+ lgError("Impossibile procedere, connessione mancante...");
+ }
+ }
+ catch (Exception exc)
+ {
+ lgFatal($"Errore nella connessione all'adapter IcoelSoap: {szStatusConnection}{Environment.NewLine}{exc}");
+ connectionOk = false;
+ lgInfo($"Eccezione in TryConnect, Adapter IcoelSoap NON running, pausa di {utils.CRI("waitRecMSec")} msec prima di ulteriori tentativi di riconnessione");
+ }
+ }
+ else
+ {
+ // loggo no risposta ping ...
+ connectionOk = false;
+ if (verboseLog || periodicLog)
+ {
+ lgInfo($"Attenzione: IcoelSoap controllo PING fallito per IP {cIobConf.cncIpAddr}");
+ }
+ }
+ }
+ }
+ else
+ {
+ needRefresh = true;
+ }
+ }
+
+ public override void tryDisconnect()
+ {
+ // registro solo che è disconnesso
+ connectionOk = false;
+ }
+
+ #endregion Public Methods
+
+ #region Protected Properties
+
+ ///
+ /// elenco dei BAtch correntemente caricati x testing variazione
+ ///
+ protected Dictionary currBatchList { get; set; }
+
+ protected Connector IcoelSizer { get; set; }
+
+ #endregion Protected Properties
+
+ #region Protected Methods
+
+ ///
+ /// recupera le variety ed i rispettivi layout e li invia al sistema MP/IO
+ ///
+ protected void refreshVarietyData()
+ {
+ ///determina se recuperare SOLO varietà attive o tutte
+ bool soloAttive = false;
+ var varList = IcoelSizer.GetVarietyList(soloAttive);
+ if (varList != null && varList.Length > 0)
+ {
+ var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
+ // invio dai al server IO
+
+ }
+
+ }
+
+ #endregion Protected Methods
+ }
+}
\ No newline at end of file