From 6b43ed1081a9b8f3549cdab376c125d1ffc38ef1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 20 May 2022 18:12:22 +0200 Subject: [PATCH 01/22] Aggiunta preliminare classi IOB Icoel --- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 2 ++ IOB-WIN-NEXT/IobIcoelDb.cs | 26 ++++++++++++++++++++++++++ IOB-WIN-NEXT/IobIcoelSoap.cs | 23 +++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 IOB-WIN-NEXT/IobIcoelDb.cs create mode 100644 IOB-WIN-NEXT/IobIcoelSoap.cs diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index de03bf72..7e99419e 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -194,6 +194,8 @@ VersGen.cs + + diff --git a/IOB-WIN-NEXT/IobIcoelDb.cs b/IOB-WIN-NEXT/IobIcoelDb.cs new file mode 100644 index 00000000..656c7a81 --- /dev/null +++ b/IOB-WIN-NEXT/IobIcoelDb.cs @@ -0,0 +1,26 @@ +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) + { + } + } +} diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs new file mode 100644 index 00000000..c1709aaa --- /dev/null +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -0,0 +1,23 @@ +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 WS Soap al Sizer, con libreria EgwProxy.Icoel + /// + public class IobIcoelSoap : IobGeneric + { + /// + /// Costruttore dell'IOB Icoel SOAP + /// + /// AdapterForm chiamante + /// Configurazione IOB per avvio + public IobIcoelSoap(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf) + { + } + } +} From 5afee5d82365dcd985cba9056b4e06b151220bea Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 21 May 2022 12:26:53 +0200 Subject: [PATCH 02/22] Aggiunta modifiche x IcoelSoap e generalizzazione invii vari --- IOB-UT-NEXT/Enums.cs | 45 +++++++----- IOB-WIN-NEXT/AdapterForm.cs | 4 +- IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_001.ini | 1 + IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini | 72 +++++++++++++++++++ IOB-WIN-NEXT/IobGeneric.cs | 60 ++++++++++++++++ IOB-WIN-NEXT/IobIcoelSoap.cs | 81 ++++++++++++++++++++++ 6 files changed, 245 insertions(+), 18 deletions(-) create mode 100644 IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini 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/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/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index c1709aaa..44f32af6 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using EgwProxy.Icoel; +using Newtonsoft.Json; namespace IOB_WIN_NEXT { @@ -11,6 +13,7 @@ namespace IOB_WIN_NEXT /// public class IobIcoelSoap : IobGeneric { + protected Connector IcoelSizer { get; set; } = null!; /// /// Costruttore dell'IOB Icoel SOAP /// @@ -18,6 +21,84 @@ namespace IOB_WIN_NEXT /// 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 abtch 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); } + + /// + /// 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) + { + // 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); + } + } + + /// + /// 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); + var varietyData = IcoelSizer.GetLayoutForVarietyList(varList); + } + + /// + /// 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); + } + + } } From 922e0a4f5d27bad099a471d75698fe62f51a9e6e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 10:29:10 +0200 Subject: [PATCH 03/22] Bozza icoelSoap da avviare in Giacovelli --- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 3 + IOB-WIN-NEXT/IobIcoelDb.cs | 5 + IOB-WIN-NEXT/IobIcoelSoap.cs | 202 ++++++++++++++++++++++++------- 3 files changed, 163 insertions(+), 47 deletions(-) diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 7e99419e..e5807f3c 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -307,6 +307,9 @@ Always + + PreserveNewest + Always diff --git a/IOB-WIN-NEXT/IobIcoelDb.cs b/IOB-WIN-NEXT/IobIcoelDb.cs index 656c7a81..f7c969b2 100644 --- a/IOB-WIN-NEXT/IobIcoelDb.cs +++ b/IOB-WIN-NEXT/IobIcoelDb.cs @@ -22,5 +22,10 @@ namespace IOB_WIN_NEXT 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 index 44f32af6..eb70204e 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -1,10 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using EgwProxy.Icoel; +using EgwProxy.Icoel; +using EgwProxy.Icoel.SizerService; using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Net.NetworkInformation; namespace IOB_WIN_NEXT { @@ -13,7 +12,8 @@ namespace IOB_WIN_NEXT /// public class IobIcoelSoap : IobGeneric { - protected Connector IcoelSizer { get; set; } = null!; + #region Public Constructors + /// /// Costruttore dell'IOB Icoel SOAP /// @@ -27,53 +27,22 @@ namespace IOB_WIN_NEXT * - 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 + * - gestione processCustomTaskLF * - x lettura dei 2 batch correnti (sx/dx) - * - calcolo abtch in corso/chiusi da date inizio/fine + * - 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); } - /// - /// 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) - { - // 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); + #endregion Public Constructors - //accodo per invio... - accodaRawData(sendObj); - } - } - - /// - /// 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); - var varietyData = IcoelSizer.GetLayoutForVarietyList(varList); - } + #region Public Methods /// /// Implementazione custom esecuzione task specifici @@ -90,15 +59,154 @@ namespace IOB_WIN_NEXT * - 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 From 6f5e9b30bbf65b5160c1232ac22db41016e94450 Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Mon, 23 May 2022 10:35:40 +0200 Subject: [PATCH 04/22] update conf x start MAIN.ini --- IOB-WIN-NEXT/DATA/CONF/MAIN.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini index 67e800b7..cb0aa7c3 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini +++ b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini @@ -79,6 +79,6 @@ CLI_INST=SteamWareSim ;STARTLIST=VL25 ;STARTLIST=SIMUL_03 ;STARTLIST=GIACO_CEDAX_01 -STARTLIST=GIACO_ICOEL_001 +STARTLIST=GIACO_ICOEL_002 MAXCNC=10 \ No newline at end of file From ba72168d85a3ae6182f5889d7234b1f1bb792657 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 11:18:06 +0200 Subject: [PATCH 05/22] Refresh IcoelSoap x non invaire letture semafori --- IOB-WIN-NEXT/IobIcoelSoap.cs | 10 ++++++++++ IOB-WIN-NEXT/IobOpcUa.cs | 4 ++-- IOB-WIN-NEXT/IobOpcUaOmronIcoel.cs | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index eb70204e..374b3090 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -1,5 +1,6 @@ using EgwProxy.Icoel; using EgwProxy.Icoel.SizerService; +using IOB_UT_NEXT; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -40,6 +41,15 @@ namespace IOB_WIN_NEXT IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort); } + /// + /// Effettua lettura semafori principale + /// Parametri da aggiornare x display in form + /// + public override void readSemafori(ref newDisplayData currDispData) + { + base.readSemafori(ref currDispData); + } + #endregion Public Constructors #region Public Methods diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index bb08b5f8..e3049e89 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -164,8 +164,8 @@ namespace IOB_WIN_NEXT } /// - /// Effettua lettura semafori principale Parametri da - /// aggiornare x display in form + /// Effettua lettura semafori principale + /// Parametri da aggiornare x display in form /// public override void readSemafori(ref newDisplayData currDispData) { diff --git a/IOB-WIN-NEXT/IobOpcUaOmronIcoel.cs b/IOB-WIN-NEXT/IobOpcUaOmronIcoel.cs index b5ef7978..91803e95 100644 --- a/IOB-WIN-NEXT/IobOpcUaOmronIcoel.cs +++ b/IOB-WIN-NEXT/IobOpcUaOmronIcoel.cs @@ -460,7 +460,7 @@ namespace IOB_WIN_NEXT } /// - /// effettua verifica del datablock icoel invianod eventualmente i dati variati + /// effettua verifica del datablock icoel inviando eventualmente i dati variati /// /// /// From 5eed8cbac61329cad892520aa0d87e1d2ef0bab3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 11:22:37 +0200 Subject: [PATCH 06/22] refresh nuget --- IOB-UT-NEXT/IOB-UT-NEXT.csproj | 4 ++-- IOB-UT-NEXT/app.config | 36 +++++++++++++++++----------------- IOB-UT-NEXT/packages.config | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj index 0f5de88d..8dbe51fe 100644 --- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj +++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj @@ -59,8 +59,8 @@ ..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll - - ..\packages\MapoSDK.6.14.2204.2115\lib\net40\MapoSDK.dll + + ..\packages\MapoSDK.6.14.2204.2616\lib\MapoSDK.dll ..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll diff --git a/IOB-UT-NEXT/app.config b/IOB-UT-NEXT/app.config index 2206d0a3..1b1d33ee 100644 --- a/IOB-UT-NEXT/app.config +++ b/IOB-UT-NEXT/app.config @@ -1,39 +1,39 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + diff --git a/IOB-UT-NEXT/packages.config b/IOB-UT-NEXT/packages.config index ebcbf207..70e045e6 100644 --- a/IOB-UT-NEXT/packages.config +++ b/IOB-UT-NEXT/packages.config @@ -1,6 +1,6 @@  - + From 46705d265e03e952a05ee18768aee08fcd3b7d66 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 11:28:10 +0200 Subject: [PATCH 07/22] Aggiunto start x IobIcoel DB/Soap --- IOB-UT-NEXT/Enums.cs | 12 +++++++- IOB-WIN-NEXT/AdapterForm.Designer.cs | 42 ++++++++++++++-------------- IOB-WIN-NEXT/AdapterForm.cs | 9 ++++++ 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index c67b0ae7..852a0210 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -278,10 +278,20 @@ namespace IOB_UT_NEXT //FILE_XYLOG, /// - /// adapter KAWASAKI e-controller + /// Adapter KAWASAKI e-controller /// KAWASAKI, + /// + /// Adapter Icoel per DB (barcode, tracciatura, produzione,...) + /// + IcoelDb, + + /// + /// Adapter Icoel per WS SOAP (sizer) + /// + IcoelSoap, + /// /// Adapter non specificato /// diff --git a/IOB-WIN-NEXT/AdapterForm.Designer.cs b/IOB-WIN-NEXT/AdapterForm.Designer.cs index d5a4057c..52448d2a 100644 --- a/IOB-WIN-NEXT/AdapterForm.Designer.cs +++ b/IOB-WIN-NEXT/AdapterForm.Designer.cs @@ -51,6 +51,8 @@ this.tabMes = new System.Windows.Forms.TabPage(); this.btnForceAutoOdl = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); + this.label24 = new System.Windows.Forms.Label(); + this.lblQueueULog = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); this.lblQueueAlarmLen = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -107,8 +109,6 @@ this.lblOutMessage3 = new System.Windows.Forms.Label(); this.lblOutMessage2 = new System.Windows.Forms.Label(); this.tabData = new System.Windows.Forms.TabControl(); - this.label24 = new System.Windows.Forms.Label(); - this.lblQueueULog = new System.Windows.Forms.Label(); this.statusStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tabMes.SuspendLayout(); @@ -387,6 +387,25 @@ this.panel1.Size = new System.Drawing.Size(343, 248); this.panel1.TabIndex = 88; // + // label24 + // + this.label24.AutoSize = true; + this.label24.Location = new System.Drawing.Point(15, 214); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(85, 13); + this.label24.TabIndex = 94; + this.label24.Text = "ULog Queue len"; + // + // lblQueueULog + // + this.lblQueueULog.AutoSize = true; + this.lblQueueULog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblQueueULog.Location = new System.Drawing.Point(105, 214); + this.lblQueueULog.Name = "lblQueueULog"; + this.lblQueueULog.Size = new System.Drawing.Size(31, 13); + this.lblQueueULog.TabIndex = 95; + this.lblQueueULog.Text = "###"; + // // label19 // this.label19.AutoSize = true; @@ -1024,25 +1043,6 @@ this.tabData.TabIndex = 71; this.tabData.Selected += new System.Windows.Forms.TabControlEventHandler(this.TabData_Selected); // - // label24 - // - this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(15, 214); - this.label24.Name = "label24"; - this.label24.Size = new System.Drawing.Size(85, 13); - this.label24.TabIndex = 94; - this.label24.Text = "ULog Queue len"; - // - // lblQueueULog - // - this.lblQueueULog.AutoSize = true; - this.lblQueueULog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblQueueULog.Location = new System.Drawing.Point(105, 214); - this.lblQueueULog.Name = "lblQueueULog"; - this.lblQueueULog.Size = new System.Drawing.Size(31, 13); - this.lblQueueULog.TabIndex = 95; - this.lblQueueULog.Text = "###"; - // // AdapterForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index 580c2479..f0a300fe 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -1210,6 +1210,15 @@ namespace IOB_WIN_NEXT start.Enabled = true; break; + case tipoAdapter.IcoelDb: + iobObj = new IobIcoelDb(this, IOBConf); + start.Enabled = true; + break; + case tipoAdapter.IcoelSoap: + iobObj = new IobIcoelSoap(this, IOBConf); + start.Enabled = true; + break; + case tipoAdapter.MODBUS_TCP: iobObj = new IobModbusTCP(this, IOBConf); start.Enabled = true; From b812efd438d4b5b062831dcd6b6b9930b1aba2aa Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Mon, 23 May 2022 11:46:05 +0200 Subject: [PATCH 08/22] update conf x gestione ws icoel --- IOB-WIN-NEXT/App.config | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IOB-WIN-NEXT/App.config b/IOB-WIN-NEXT/App.config index caccef85..13ffb3ff 100644 --- a/IOB-WIN-NEXT/App.config +++ b/IOB-WIN-NEXT/App.config @@ -144,9 +144,21 @@ + + + + + + + + + + + + From 6d9a3ef898c6643a7360bdaf23a4b599b36c37b7 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 11:46:41 +0200 Subject: [PATCH 09/22] Update gestione semafori IcoelSoap --- IOB-WIN-NEXT/App.config | 12 ++++++++++++ IOB-WIN-NEXT/IobIcoelSoap.cs | 24 +++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/IOB-WIN-NEXT/App.config b/IOB-WIN-NEXT/App.config index caccef85..13ffb3ff 100644 --- a/IOB-WIN-NEXT/App.config +++ b/IOB-WIN-NEXT/App.config @@ -144,9 +144,21 @@ + + + + + + + + + + + + diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index 374b3090..83042c42 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -1,6 +1,7 @@ using EgwProxy.Icoel; using EgwProxy.Icoel.SizerService; using IOB_UT_NEXT; +using MapoSDK; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -47,7 +48,22 @@ namespace IOB_WIN_NEXT /// public override void readSemafori(ref newDisplayData currDispData) { - base.readSemafori(ref currDispData); + if (connectionOk) + { + B_input = 1; + currDispData.semIn = Semaforo.SV; + // se ho batch NON chiusi (fine < numAnni anni fa...) è 3... + int numAnni = 10; + if (currBatchList[1].EndTime < DateTime.Today.AddYears(-numAnni) || currBatchList[1].EndTime < DateTime.Today.AddYears(-numAnni)) + { + B_input = 3; + } + } + else + { + B_input = 0; + currDispData.semIn = Semaforo.SR; + } } #endregion Public Constructors @@ -86,7 +102,7 @@ namespace IOB_WIN_NEXT if (currBatch != null) { // verifico se i batch siano variati... e quindi da inviare... - bool doSend = false; + bool doSend = (currBatchList == null || currBatchList.Count == 0); if (currBatch.Count > 0) { foreach (var item in currBatch) @@ -106,6 +122,7 @@ namespace IOB_WIN_NEXT // accodo per invio... accodaRawData(sendObj); + currBatchList = currBatch; } } } @@ -141,6 +158,7 @@ namespace IOB_WIN_NEXT lgInfo($"szStatusConnection IcoelSoap, recuperato elenco di {batchList.Count} batch"); parentForm.commPlcActive = false; connectionOk = true; + currBatchList = batchList; } // refresh stato connessione!!! if (connectionOk) @@ -212,7 +230,7 @@ namespace IOB_WIN_NEXT { var varietyData = IcoelSizer.GetLayoutForVarietyList(varList); // invio dai al server IO - + } } From ff340ee8a52327ee600cf206f76dbd59c34be0b6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 12:08:08 +0200 Subject: [PATCH 10/22] Aggiunta gestione veto invio sig in x adapter --- IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini | 1 + IOB-WIN-NEXT/IobGeneric.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini index d7f61e8a..16caef0b 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini @@ -64,6 +64,7 @@ ENABLE_DYN_DATA=FALSE FORCE_DYN_DATA=TRUE ENABLE_DATA_FILTER=TRUE ENABLE_CLI_RESTART=TRUE +VETO_SIG_IN=TRUE ; conf parametri memoria READ/WRITE OPC_PARAM_CONF=GIACO_ICOEL_001.json diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index af7d4afd..da7ca1ec 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -3498,10 +3498,19 @@ namespace IOB_WIN_NEXT { // mostro dati variati letti... displayInData(ref currDispData); - // --> accodo (valore già formattato)! - QueueIN.Enqueue(qEncodeIN); - // loggo! - lgTrace(string.Format("[QUEUE-IN] {0}", qEncodeIN)); + // verifico veto a invio status macchina + string keyName = "VETO_SIG_IN"; + if (getOptPar(keyName).ToUpper() == "TRUE") + { + lgTrace($"Filtrato accodamento valore da conf IOB | {keyName} | [QUEUE-IN] {qEncodeIN}"); + } + else + { + // --> accodo (valore già formattato)! + QueueIN.Enqueue(qEncodeIN); + // loggo! + lgTrace(string.Format("[QUEUE-IN] {0}", qEncodeIN)); + } // aggiorno counters ed eventuale reset nReadFilt++; if (nReadFilt > int.MaxValue - 1) From d4d65ae3a1cfd2991aef9a7e50a240d4d8dd3c3b Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Mon, 23 May 2022 12:09:03 +0200 Subject: [PATCH 11/22] Migliorato test Batch attivo --- IOB-WIN-NEXT/IobIcoelSoap.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index 83042c42..0040f9b4 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -52,9 +52,8 @@ namespace IOB_WIN_NEXT { B_input = 1; currDispData.semIn = Semaforo.SV; - // se ho batch NON chiusi (fine < numAnni anni fa...) è 3... - int numAnni = 10; - if (currBatchList[1].EndTime < DateTime.Today.AddYears(-numAnni) || currBatchList[1].EndTime < DateTime.Today.AddYears(-numAnni)) + // se ho batch NON chiusi (data = minValue) allora lavora + if (currBatchList[1].EndTime == DateTime.MinValue || currBatchList[1].EndTime == DateTime.MinValue) { B_input = 3; } From 997e70fc88074dbad478d414665cac61d7aacfa2 Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Mon, 23 May 2022 12:28:18 +0200 Subject: [PATCH 12/22] Update x gestione rielttura periodica batch --- IOB-WIN-NEXT/IobIcoelSoap.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index 0040f9b4..bd6cf8ab 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -52,10 +52,13 @@ namespace IOB_WIN_NEXT { B_input = 1; currDispData.semIn = Semaforo.SV; - // se ho batch NON chiusi (data = minValue) allora lavora - if (currBatchList[1].EndTime == DateTime.MinValue || currBatchList[1].EndTime == DateTime.MinValue) + if (currBatchList != null) { - B_input = 3; + // se ho batch NON chiusi (data = minValue) allora lavora + if (currBatchList[1].EndTime == DateTime.MinValue || currBatchList[1].EndTime == DateTime.MinValue) + { + B_input = 3; + } } } else @@ -97,12 +100,13 @@ namespace IOB_WIN_NEXT /// public override void processCustomTaskLF() { + lgInfo($"Richiesto processCustomTaskLF"); var currBatch = IcoelSizer.GetCurrentBatch(); if (currBatch != null) { // verifico se i batch siano variati... e quindi da inviare... bool doSend = (currBatchList == null || currBatchList.Count == 0); - if (currBatch.Count > 0) + if (currBatch.Count > 0 && !doSend) { foreach (var item in currBatch) { @@ -157,7 +161,6 @@ namespace IOB_WIN_NEXT lgInfo($"szStatusConnection IcoelSoap, recuperato elenco di {batchList.Count} batch"); parentForm.commPlcActive = false; connectionOk = true; - currBatchList = batchList; } // refresh stato connessione!!! if (connectionOk) From 7225941f5e4c3ddb8ec035bc0a38f87966f9887a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:00:52 +0200 Subject: [PATCH 13/22] Aggiunta Fanuc x lettura macro (indice elevato) --- .../CNC/CNC.FANUC/CNC.FANUC.vb | 82 +++++++++++++++++-- .../CNC/CNC.FANUC/_/fwlib32.vb | 17 ++++ 2 files changed, 91 insertions(+), 8 deletions(-) diff --git a/EgwProxy.MultiCncLib/CNC/CNC.FANUC/CNC.FANUC.vb b/EgwProxy.MultiCncLib/CNC/CNC.FANUC/CNC.FANUC.vb index 81736c0e..c6e92a67 100644 --- a/EgwProxy.MultiCncLib/CNC/CNC.FANUC/CNC.FANUC.vb +++ b/EgwProxy.MultiCncLib/CNC/CNC.FANUC/CNC.FANUC.vb @@ -1078,14 +1078,80 @@ Namespace CNC - ''' - ''' Legge o scrive le variabile Custom Macro - ''' - ''' Se True SCRIVE, se False LEGGE - ''' Indice di memoria - ''' Matrice di valori da scrivere su scrittura o letti su lettura - ''' True se andata a buon fine - Public Overloads Function F_RW_Macro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value() As Short) As Boolean + ''' + ''' Legge una variabile macro (#) + ''' + ''' Indirizzo da leggere + ''' Valore letto (restituito per riferimento) + ''' Boolean di eseguito/errore + Public Function F_Read_macro(ByVal nVar As Integer, ByRef dValue As Double) As Boolean + + Const ONE_DATA_ONLY As Integer = 1 + + Const CUSTOM_MACRO_SIZE As Integer = 10 + + Dim ODBM As Focas1.ODBM + Dim MacroInfo3 As Focas1.IODBMRN3 = Nothing + + Dim n_ret_code As Short + + Dim sz_routine As String = "-", sz_temp As String = "", d As Double = 0.0 + + Try + If nVar >= &H8000 Then ' if var like 98xxx then use the other read routine .... ( :(( no comment ) + + n_ret_code = Focas1.cnc_rdmacror3(nLibHandle(1), nVar, ONE_DATA_ONLY, MacroInfo3) + + If (n_ret_code = Focas1.EW_OK) Then ' no Fanuc error + + dValue = MacroInfo3.mcr_val + + Else + 'Error reading parameter : + + dValue = 0.0 + Return False + + End If ' no Fanuc error + + Else ' good ole boys + + ' cnc_rdmacro : read custom macro variable + + n_ret_code = Focas1.cnc_rdmacro(nLibHandle(1), nVar, CUSTOM_MACRO_SIZE, ODBM) + + If (n_ret_code = Focas1.EW_OK) Then ' no Fanuc error + + If ODBM.mcr_val = 0 And ODBM.dec_val = -1 Then ' variabile non definita + dValue = 0 '"Null" + Else + dValue = ODBM.mcr_val * (10 ^ -(ODBM.dec_val)) + End If + Else + 'Error reading parameter : + + dValue = 0.0 + Return False + End If ' no Fanuc error + + End If ' var > 8000h + + Catch ex As Exception + + dValue = 0.0 + Return False + End Try + + End Function + + ''' + ''' Legge o scrive le variabile Custom Macro + ''' + ''' Se True SCRIVE, se False LEGGE + ''' Indice di memoria + ''' Matrice di valori da scrivere su scrittura o letti su lettura + ''' True se andata a buon fine + Public Overloads Function F_RW_Macro_Short(ByVal bWrite As Boolean, ByVal MacroIndex As Integer, ByRef Value() As Short) As Boolean Dim iodbmr As Focas1.IODBMR Dim nlength As Integer Dim nReturn As Integer diff --git a/EgwProxy.MultiCncLib/CNC/CNC.FANUC/_/fwlib32.vb b/EgwProxy.MultiCncLib/CNC/CNC.FANUC/_/fwlib32.vb index 94e6d90a..5546971f 100644 --- a/EgwProxy.MultiCncLib/CNC/CNC.FANUC/_/fwlib32.vb +++ b/EgwProxy.MultiCncLib/CNC/CNC.FANUC/_/fwlib32.vb @@ -10949,4 +10949,21 @@ Public Class Focas1 Declare Function cnc_rdetherinfo Lib "FWLIB32.DLL" _ (ByVal FlibHndl As Integer, ByRef a As Short, ByRef b As Short) As Short + ' + '-------------------------------------------------------- 28 - VI - 2019 cv ------------------------------ + ' + + ' cnc_rdmacror3 :read Custom macro names(area specified) + + Public Structure IODBMRN3 + Public mcr_val As Double + + Public name As String ' var name + End Structure + + + ' read custom macro variables:read Custom macro names(area specified) + Declare Function cnc_rdmacror3 Lib "FWLIB32.DLL" _ + (ByVal FlibHndl As Integer, ByVal a As Integer, ByRef b As Integer, ByRef c As IODBMRN3) As Short + End Class 'Focas1 From 1371a321640711c628dbe103a7aad62fbd56c11a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:01:12 +0200 Subject: [PATCH 14/22] Refresh x gestione (giacovelli) dell'invio dati RawTransfer (NON concluso) --- IOB-UT-NEXT/Enums.cs | 15 +- IOB-UT-NEXT/Objects.cs | 257 +++++++++++++++++---------- IOB-WIN-NEXT/AdapterForm.Designer.cs | 31 +++- IOB-WIN-NEXT/AdapterForm.cs | 45 ++++- IOB-WIN-NEXT/IobGeneric.cs | 13 +- IOB-WIN-NEXT/IobIcoelSoap.cs | 4 +- 6 files changed, 257 insertions(+), 108 deletions(-) diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index 852a0210..92572e53 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -1,4 +1,6 @@ -using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; namespace IOB_UT_NEXT { @@ -518,10 +520,15 @@ namespace IOB_UT_NEXT ULog } - /// - /// Tipologia dato RAW da trasmettere/ricevere (derivare da MapoSdk e togliere qui) + /// + /// Tipologia dato Raw Transfer (derivare da MapoSdk e togliere qui) /// - public enum rawDataType + /// serializzazione Native + /// [JsonConverter(typeof(JsonStringEnumConverter))] + /// serializzazione Newtonsoft json + /// [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] + public enum rawTransfType { ND = 0, /// diff --git a/IOB-UT-NEXT/Objects.cs b/IOB-UT-NEXT/Objects.cs index 1685b504..dbe3a6f0 100644 --- a/IOB-UT-NEXT/Objects.cs +++ b/IOB-UT-NEXT/Objects.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace IOB_UT_NEXT { @@ -118,6 +117,32 @@ namespace IOB_UT_NEXT #endregion Public Methods } + /// + /// Classe di base per trasferimento informazioni di tipo RawTransfer FixMe Todo Fare !!! + /// elimnare usando SDK MAPO + /// + public class BaseRawTransf + { + #region Public Properties + + /// + /// Data-Ora riferimento (x ordinamento fifo) + /// + public DateTime dataRif { get; set; } = DateTime.Now; + + /// + /// Messaggio in modalità raw/stringa + /// + public object mesContent { get; set; } = null; + + /// + /// Tipo di messaggio trasmesso + /// + public rawTransfType mesType { get; set; } = rawTransfType.ND; + + #endregion Public Properties + } + /// /// Cache a tempo valori INT /// @@ -268,8 +293,56 @@ namespace IOB_UT_NEXT /// public int queueMsLen { get; set; } = 0; + /// + /// Lungh coda UserLog in uscita + /// + public int queueRawTransfLen { get; set; } = 0; + + /// + /// Lungh coda UserLog in uscita + /// + public int queueUlLen { get; set; } = 0; + #endregion Public Properties + /// + /// Override metodo di equality + /// + /// + /// + public override bool Equals(object obj) + { + if (!(obj is IobWinStatus item)) + return false; + + if (online != item.online) + return false; + if (lastDataIn != item.lastDataIn) + return false; + if (counterIOB != item.counterIOB) + return false; + if (counterMAC != item.counterMAC) + return false; + if (queueAlLen != item.queueAlLen) + return false; + if (queueEvLen != item.queueEvLen) + return false; + if (queueFlLen != item.queueFlLen) + return false; + if (queueMsLen != item.queueMsLen) + return false; + if (queueRawTransfLen != item.queueRawTransfLen) + return false; + if (queueUlLen!= item.queueUlLen) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } } /// @@ -398,6 +471,97 @@ namespace IOB_UT_NEXT /// 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 /// @@ -417,21 +581,6 @@ namespace IOB_UT_NEXT #endregion Protected Fields - #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 Protected Properties /// @@ -485,80 +634,6 @@ namespace IOB_UT_NEXT } #endregion Protected Properties - - #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 } /// @@ -625,7 +700,7 @@ namespace IOB_UT_NEXT /// /// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte) - /// + /// public string codCall; /// diff --git a/IOB-WIN-NEXT/AdapterForm.Designer.cs b/IOB-WIN-NEXT/AdapterForm.Designer.cs index 52448d2a..a541e906 100644 --- a/IOB-WIN-NEXT/AdapterForm.Designer.cs +++ b/IOB-WIN-NEXT/AdapterForm.Designer.cs @@ -109,6 +109,8 @@ this.lblOutMessage3 = new System.Windows.Forms.Label(); this.lblOutMessage2 = new System.Windows.Forms.Label(); this.tabData = new System.Windows.Forms.TabControl(); + this.label25 = new System.Windows.Forms.Label(); + this.lblQueueRwTrLog = new System.Windows.Forms.Label(); this.statusStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tabMes.SuspendLayout(); @@ -364,6 +366,8 @@ // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Controls.Add(this.label25); + this.panel1.Controls.Add(this.lblQueueRwTrLog); this.panel1.Controls.Add(this.label24); this.panel1.Controls.Add(this.lblQueueULog); this.panel1.Controls.Add(this.label19); @@ -384,13 +388,13 @@ this.panel1.Location = new System.Drawing.Point(4, 6); this.panel1.Margin = new System.Windows.Forms.Padding(2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(343, 248); + this.panel1.Size = new System.Drawing.Size(343, 306); this.panel1.TabIndex = 88; // // label24 // this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(15, 214); + this.label24.Location = new System.Drawing.Point(10, 236); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(85, 13); this.label24.TabIndex = 94; @@ -400,7 +404,7 @@ // this.lblQueueULog.AutoSize = true; this.lblQueueULog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblQueueULog.Location = new System.Drawing.Point(105, 214); + this.lblQueueULog.Location = new System.Drawing.Point(104, 236); this.lblQueueULog.Name = "lblQueueULog"; this.lblQueueULog.Size = new System.Drawing.Size(31, 13); this.lblQueueULog.TabIndex = 95; @@ -1043,6 +1047,25 @@ this.tabData.TabIndex = 71; this.tabData.Selected += new System.Windows.Forms.TabControlEventHandler(this.TabData_Selected); // + // label25 + // + this.label25.AutoSize = true; + this.label25.Location = new System.Drawing.Point(10, 213); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(85, 13); + this.label25.TabIndex = 96; + this.label25.Text = "RwTr Queue len"; + // + // lblQueueRwTrLog + // + this.lblQueueRwTrLog.AutoSize = true; + this.lblQueueRwTrLog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblQueueRwTrLog.Location = new System.Drawing.Point(104, 213); + this.lblQueueRwTrLog.Name = "lblQueueRwTrLog"; + this.lblQueueRwTrLog.Size = new System.Drawing.Size(31, 13); + this.lblQueueRwTrLog.TabIndex = 97; + this.lblQueueRwTrLog.Text = "###"; + // // AdapterForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1168,5 +1191,7 @@ private System.Windows.Forms.TabControl tabData; private System.Windows.Forms.Label label24; private System.Windows.Forms.Label lblQueueULog; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Label lblQueueRwTrLog; } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index f0a300fe..728abef3 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -274,6 +274,8 @@ namespace IOB_WIN_NEXT protected int maxFlQueue { get; set; } protected int maxMsQueue { get; set; } + + protected int maxRwTrQueue { get; set; } protected int maxUlQueue { get; set; } @@ -284,6 +286,8 @@ namespace IOB_WIN_NEXT protected int qFlLen { get; set; } protected int qMsLen { get; set; } + + protected int qRTrLen { get; set; } protected int qUlLen { get; set; } @@ -643,6 +647,31 @@ namespace IOB_WIN_NEXT } } + public int rtrQueueLen + { + set + { + qRTrLen = value; + lblQueueRwTrLog.Text = qRTrLen.ToString(); + showQueueData(); + // se supero max precedente, ed è > 10... loggo! + if (qRTrLen > maxRwTrQueue && qRTrLen > 10) + { + maxRwTrQueue = qRTrLen; + lgInfo($"[WARN] Coda RawTransf di {value} record"); + } + else + { + maxRwTrQueue--; + maxRwTrQueue = maxRwTrQueue < qRTrLen ? qRTrLen : maxRwTrQueue; + } + } + get + { + return qRTrLen; + } + } + public int ulQueueLen { set @@ -1454,11 +1483,12 @@ namespace IOB_WIN_NEXT private void refreshFormData() { // aggiorno visualizzazioni varie in form... + alQueueLen = iobObj.QueueAlarm.Count; evQueueLen = iobObj.QueueIN.Count; flQueueLen = iobObj.QueueFLog.Count; - alQueueLen = iobObj.QueueAlarm.Count; msQueueLen = iobObj.QueueMessages.Count; - ulQueueLen = iobObj.QueueMessages.Count; + rtrQueueLen = iobObj.QueueRawTransf.Count; + ulQueueLen = iobObj.QueueULog.Count; // aggiorno labels counters... counterIob = $"pz IOB {iobObj.contapezziIOB}"; counterMac = $"pz PLC {iobObj.contapezziPLC}"; @@ -1467,10 +1497,12 @@ namespace IOB_WIN_NEXT { CodIob = iobObj.cIobConf.codIOB, IobType = iobObj.cIobConf.tipoIob.ToString(), + queueAlLen = alQueueLen, queueEvLen = evQueueLen, queueFlLen = flQueueLen, - queueAlLen = alQueueLen, queueMsLen = msQueueLen, + queueRawTransfLen = rtrQueueLen, + queueUlLen = ulQueueLen, counterIOB = iobObj.contapezziIOB, counterMAC = iobObj.contapezziPLC, lastUpdate = lastIobStatus.lastUpdate, @@ -1478,7 +1510,7 @@ namespace IOB_WIN_NEXT lastDataIn = iobObj.lastReadPLC }; // se diverso SALVO! - if (lastIobStatus.online != currIobStatus.online || lastIobStatus.lastDataIn != currIobStatus.lastDataIn || lastIobStatus.counterIOB != currIobStatus.counterIOB || lastIobStatus.counterMAC != currIobStatus.counterMAC || lastIobStatus.queueEvLen != currIobStatus.queueEvLen || lastIobStatus.queueFlLen != currIobStatus.queueFlLen || lastIobStatus.queueAlLen != currIobStatus.queueAlLen || lastIobStatus.queueMsLen != currIobStatus.queueMsLen) + if (!lastIobStatus.Equals(currIobStatus)) { // aggiorno data currIobStatus.lastUpdate = DateTime.Now; @@ -1540,8 +1572,11 @@ namespace IOB_WIN_NEXT { stop.Enabled = false; - evQueueLen = 0; + alQueueLen = 0; flQueueLen = 0; + msQueueLen = 0; + rtrQueueLen = 0; + ulQueueLen = 0; nLine2show = utils.CRI("numRowConsole"); } diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index da7ca1ec..743edaa8 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -386,6 +386,12 @@ namespace IOB_WIN_NEXT /// public ConcurrentQueue QueueMessages = new ConcurrentQueue(); + /// + /// Oggetto della coda degli elementi di tipo RawTransf (e non ancora trasmessi) + /// NB: sono salvati serializzati come stringhe + /// + public ConcurrentQueue QueueRawTransf = new ConcurrentQueue(); + /// /// Coda valori LOG UTENTE (da non sottocampionare come samples)... /// @@ -2083,10 +2089,11 @@ namespace IOB_WIN_NEXT // svuoto code se richiesto if (resetQueue) { + QueueAlarm = new ConcurrentQueue(); QueueIN = new ConcurrentQueue(); QueueFLog = new ConcurrentQueue(); - QueueAlarm = new ConcurrentQueue(); QueueMessages = new ConcurrentQueue(); + QueueRawTransf = new ConcurrentQueue(); QueueULog = new ConcurrentQueue(); } // imposto contatori blink a zero... @@ -3430,7 +3437,7 @@ namespace IOB_WIN_NEXT /// Accumula in coda i valori RawData logga... /// /// Dictionary pronto x invio - public void accodaRawData(Dictionary sendObj) + public void accodaRawData(Dictionary sendObj) { // @@ -3438,7 +3445,7 @@ namespace IOB_WIN_NEXT * nuova gestione coda dictionary * fixme todo da fare !!! * - * - conterrà tanti dictionary, con key data-ora accodamento + * - conterrà una lista di oggetti baseRawTransf * - i dati vanno poi "scodati" dal + vecchio ed inviati a MP/IO * - mostra un sunto delle info da inviare * - accodamento vero e proprio diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index bd6cf8ab..d14ae42e 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -120,8 +120,8 @@ namespace IOB_WIN_NEXT // 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); + Dictionary sendObj = new Dictionary(); + sendObj.Add(IOB_UT_NEXT.rawTransfType.IcoelBatch, rawData); // accodo per invio... accodaRawData(sendObj); From 05fce2e224024ebdab7f7c6a818398300c3c91cf Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:23:29 +0200 Subject: [PATCH 15/22] Update conf jetco z 3025 con MACRO al posto di PAR --- IOB-WIN-NEXT/DATA/CONF/3025.ini | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/3025.ini b/IOB-WIN-NEXT/DATA/CONF/3025.ini index 008d6846..59840aed 100644 --- a/IOB-WIN-NEXT/DATA/CONF/3025.ini +++ b/IOB-WIN-NEXT/DATA/CONF/3025.ini @@ -26,7 +26,7 @@ CMDREBO=/sendReboot.aspx?idxMacchina= ; Red: Y31.4 | Yellow: Y31.5 | Green Y31.6 | riscaldamento Y7.4 ??? ;BIT0=CONN BIT1=Y31.6 -BIT2=PZCOUNT.PAR.6711 +BIT2=STD.MACRO.10100 BIT3=Y31.4 BIT4=Y31.5 BIT5=Y7.4 @@ -59,7 +59,10 @@ BLINK_FILT=0 [OPTPAR] ;PZCOUNT_MODE=STD|BIT -PZCOUNT_MODE=STD.PAR.6711 +;PZCOUNT_MODE=STD.PAR.6711 +;PZREQ_MODE=STD.PAR.6713 +PZCOUNT_MODE=STD.MACRO.10100 +PZREQ_MODE=STD.MACRO.10000 PZGTOT_MODE=STD.PAR.6712 PZREQ_MODE=STD.PAR.6713 ;PZCAD_MODE=STD.D.6408.DW From 3895543199f08f0def008b6b6e851a5e0d07b19e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:25:38 +0200 Subject: [PATCH 16/22] Modifica Fanuc x lettura valori MACRO (contapezzi STAR 3025 Jetco) --- IOB-WIN-NEXT/App.config | 8 ++++---- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 8 ++++---- IOB-WIN-NEXT/IobFanuc.cs | 16 ++++++++++++++++ IOB-WIN-NEXT/packages.config | 6 +++--- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/IOB-WIN-NEXT/App.config b/IOB-WIN-NEXT/App.config index 13ffb3ff..063a79cf 100644 --- a/IOB-WIN-NEXT/App.config +++ b/IOB-WIN-NEXT/App.config @@ -146,19 +146,19 @@ - + - + - - + + diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index e5807f3c..d3e66756 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -87,16 +87,16 @@ ..\packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll - ..\packages\EgwProxy.Icoel.3.6.2205.2012\lib\EgwProxy.Icoel.dll + ..\packages\EgwProxy.Icoel.3.6.2205.2018\lib\EgwProxy.Icoel.dll - ..\packages\EgwProxy.MultiCncLib.3.6.2205.2012\lib\EgwProxy.MultiCncLib.dll + ..\packages\EgwProxy.MultiCncLib.3.6.2205.2319\lib\EgwProxy.MultiCncLib.dll - ..\packages\EgwProxy.OsaiCncLib.3.6.2205.2012\lib\EgwProxy.OsaiCncLib.dll + ..\packages\EgwProxy.OsaiCncLib.3.6.2205.2015\lib\EgwProxy.OsaiCncLib.dll - ..\packages\EgwProxy.OsaiCncLib.3.6.2205.2012\lib\EgwProxy.OsaiCncLib.XmlSerializers.dll + ..\packages\EgwProxy.OsaiCncLib.3.6.2205.2015\lib\EgwProxy.OsaiCncLib.XmlSerializers.dll False diff --git a/IOB-WIN-NEXT/IobFanuc.cs b/IOB-WIN-NEXT/IobFanuc.cs index 8a171a92..c3aef2d6 100644 --- a/IOB-WIN-NEXT/IobFanuc.cs +++ b/IOB-WIN-NEXT/IobFanuc.cs @@ -587,6 +587,22 @@ namespace IOB_WIN_NEXT // salvo valore answ = outputVal.ToString(); } + // 2022.05.23 gestione MACRO da testare (Jetco) + else if (memAddr.StartsWith("MACRO.")) + { + // recupero parametro... + int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr); + // processo parametro + stopwatch.Restart(); + double macroVal = 0; + FANUC_ref.F_Read_macro(cntAddr, ref macroVal); + if (utils.CRB("recTime")) + { + TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-MACRO", 5), stopwatch.ElapsedTicks); + } + // salvo valore + answ = macroVal.ToString(); + } // altrimenti se legge da area memoria specifica leggo da li... formto tipo STD.D.1604.DW else { diff --git a/IOB-WIN-NEXT/packages.config b/IOB-WIN-NEXT/packages.config index 7f91f314..37b775c1 100644 --- a/IOB-WIN-NEXT/packages.config +++ b/IOB-WIN-NEXT/packages.config @@ -2,9 +2,9 @@ - - - + + + From 1d0840a55783e733cdf194b59fd25a13ba8d1652 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:42:03 +0200 Subject: [PATCH 17/22] Versione aggiornata x test Giacovelli --- IOB-UT-NEXT/Objects.cs | 13 +++++++++++++ IOB-WIN-NEXT/IobGeneric.cs | 15 ++++++++------- IOB-WIN-NEXT/IobIcoelSoap.cs | 7 ++++--- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/IOB-UT-NEXT/Objects.cs b/IOB-UT-NEXT/Objects.cs index dbe3a6f0..5835abc6 100644 --- a/IOB-UT-NEXT/Objects.cs +++ b/IOB-UT-NEXT/Objects.cs @@ -140,6 +140,19 @@ namespace IOB_UT_NEXT /// public rawTransfType mesType { get; set; } = rawTransfType.ND; + /// + /// Costruttore oggetto + /// + /// + /// + /// + public BaseRawTransf(DateTime dataRif, object mesContent, rawTransfType mesType) + { + this.dataRif = dataRif; + this.mesContent = mesContent; + this.mesType = mesType; + } + #endregion Public Properties } diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 743edaa8..05bc8246 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -3434,13 +3434,12 @@ namespace IOB_WIN_NEXT } /// - /// Accumula in coda i valori RawData logga... + /// Accumula in coda i valori RawData + log /// - /// Dictionary pronto x invio - public void accodaRawData(Dictionary sendObj) + /// + /// + public void accodaRawData(IOB_UT_NEXT.rawTransfType mesType, object mesContent) { - // - /*-------------------------------- * nuova gestione coda dictionary * fixme todo da fare !!! @@ -3455,9 +3454,11 @@ namespace IOB_WIN_NEXT * * */ + // serializzo il valore... + BaseRawTransf newVal = new BaseRawTransf(DateTime.Now, mesContent, mesType); + string encodedVal = JsonConvert.SerializeObject(newVal); + QueueRawTransf.Enqueue(encodedVal); #if false - // mostro dati variati letti... - displayOtherData(val); // --> accodo (valore già formattato)! QueueFLog.Enqueue(encodedVal); // se abilitato controllo coda FLog (superiore a 0...) diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index d14ae42e..d1214c5c 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -117,14 +117,15 @@ namespace IOB_WIN_NEXT // se devo inviare impacchetto dati if (doSend) { +#if false // 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.rawTransfType.IcoelBatch, rawData); - + sendObj.Add(IOB_UT_NEXT.rawTransfType.IcoelBatch, rawData); +#endif // accodo per invio... - accodaRawData(sendObj); + accodaRawData(IOB_UT_NEXT.rawTransfType.IcoelBatch, currBatch); currBatchList = currBatch; } } From 9f7e7a1660b3662951cd146285f76a9a3c62e92c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 19:57:27 +0200 Subject: [PATCH 18/22] Aggiunta metodi accodamento RawTransf --- IOB-WIN-NEXT/App.config | 1 + IOB-WIN-NEXT/IobGeneric.cs | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/IOB-WIN-NEXT/App.config b/IOB-WIN-NEXT/App.config index 063a79cf..a3743cb8 100644 --- a/IOB-WIN-NEXT/App.config +++ b/IOB-WIN-NEXT/App.config @@ -39,6 +39,7 @@ + diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 05bc8246..29a6e276 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -759,6 +759,10 @@ namespace IOB_WIN_NEXT /// Coda massima ammessa per FLog (se <=0 disattivata...) /// protected int maxQueueFLog { get; set; } = utils.CRI("maxQueueFLog"); + /// + /// Coda massima ammessa per FLog (se <=0 disattivata...) + /// + protected int maxQueueRawTransf { get; set; } = utils.CRI("maxQueueRawTransf"); /// /// Valore MINIMO limite x decidere invio di dati come array Json @@ -3457,12 +3461,10 @@ namespace IOB_WIN_NEXT // serializzo il valore... BaseRawTransf newVal = new BaseRawTransf(DateTime.Now, mesContent, mesType); string encodedVal = JsonConvert.SerializeObject(newVal); - QueueRawTransf.Enqueue(encodedVal); -#if false // --> accodo (valore già formattato)! - QueueFLog.Enqueue(encodedVal); - // se abilitato controllo coda FLog (superiore a 0...) - if (maxQueueFLog > 0) + QueueRawTransf.Enqueue(encodedVal); + // se abilitato controllo coda Max (superiore a 0...) + if (maxQueueRawTransf > 0) { // se ho una coda superiore a max ammesso if (QueueFLog.Count > maxQueueFLog) @@ -3482,8 +3484,7 @@ namespace IOB_WIN_NEXT if (counterFLog > 9999) { counterFLog = 0; - } -#endif + } } /// From 60c4e6bd841e5573e47895cdc4a41e5ee726e9bc Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 May 2022 20:32:41 +0200 Subject: [PATCH 19/22] Vesrione x test in prod Giacovelli --- IOB-UT-NEXT/Enums.cs | 5 + IOB-UT-NEXT/Objects.cs | 27 ++++- IOB-WIN-NEXT/AdapterForm.cs | 2 +- IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini | 1 + IOB-WIN-NEXT/IobConfiguration.cs | 8 +- IOB-WIN-NEXT/IobGeneric.cs | 110 +++++++++++++++++++-- IOB-WIN-NEXT/IobIcoelSoap.cs | 7 -- 7 files changed, 140 insertions(+), 20 deletions(-) diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index 92572e53..cd652f31 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -514,6 +514,11 @@ namespace IOB_UT_NEXT /// SignIN, + /// + /// Salvataggio RawTransf (valori raw da decodificare a valle) + /// + RawTransf, + /// /// Salvataggio UserLog (valori log attività utente) /// diff --git a/IOB-UT-NEXT/Objects.cs b/IOB-UT-NEXT/Objects.cs index 5835abc6..e84e7529 100644 --- a/IOB-UT-NEXT/Objects.cs +++ b/IOB-UT-NEXT/Objects.cs @@ -118,8 +118,8 @@ namespace IOB_UT_NEXT } /// - /// Classe di base per trasferimento informazioni di tipo RawTransfer FixMe Todo Fare !!! - /// elimnare usando SDK MAPO + /// Classe di base per trasferimento informazioni di tipo RawTransfer + /// FixMe Todo Fare !!!: elimnare usando SDK MAPO /// public class BaseRawTransf { @@ -140,6 +140,16 @@ namespace IOB_UT_NEXT /// public rawTransfType mesType { get; set; } = rawTransfType.ND; + /// + /// Costruttore senza parametri + /// + public BaseRawTransf() + { + this.dataRif = DateTime.Now; + this.mesContent = ""; + this.mesType = rawTransfType.ND; + } + /// /// Costruttore oggetto /// @@ -156,6 +166,19 @@ namespace IOB_UT_NEXT #endregion Public Properties } + /// + /// Array valori tipo BaseRawTransf inviati come JSon + /// FixMe Todo Fare !!!: elimnare usando SDK MAPO + /// + public class rawTransfJsonPayload + { + #region Public Properties + + public List rawTransfData { get; set; } + + #endregion Public Properties + } + /// /// Cache a tempo valori INT /// diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index 728abef3..b165d947 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -1168,7 +1168,7 @@ namespace IOB_WIN_NEXT cpuType = fIni.ReadString("CNC", "CPUTYPE", ""), rack = (short)fIni.ReadInteger("CNC", "RACK", 0), slot = (short)fIni.ReadInteger("CNC", "SLOT", 0), - serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/")), + serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/"), fIni.ReadString("SERVER", "CMDRAWTRANSF", "/IOB/rawTransfJson/")), MAX_COUNTER_BLINK = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1")), BLINK_FILT = Convert.ToInt32(fIni.ReadString("BLINK", "BLINK_FILT", "0")), TCMaxDelayFactor = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_TC_FACTOR", "1.2").Replace(".", ",")), diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini index 16caef0b..6bf152f1 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_002.ini @@ -19,6 +19,7 @@ MPIP=http://192.168.1.14 MPURL=/MP/IO CMDBASE=/IOB/input/ CMDFLOG=/IOB/flog/ +CMDRAWTRANSF=/IOB/rawTransfJson/ CMDALIVE=/IOB CMDENABLED=/IOB/enabled/ CMDADV1=?valore= diff --git a/IOB-WIN-NEXT/IobConfiguration.cs b/IOB-WIN-NEXT/IobConfiguration.cs index 98af38be..b29b8739 100644 --- a/IOB-WIN-NEXT/IobConfiguration.cs +++ b/IOB-WIN-NEXT/IobConfiguration.cs @@ -147,7 +147,7 @@ namespace IOB_WIN_NEXT /// Comando x reboot /// Comando x check data avvio ODL /// Comando x forzare split ODL - public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDULOG_ = "/IOB/ulog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/") + public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDULOG_ = "/IOB/ulog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/", string CMDRAWTRANSFJSON_ = "/IOB/rawTransfJson/") { if (!string.IsNullOrEmpty(MPIP_)) { @@ -160,6 +160,7 @@ namespace IOB_WIN_NEXT MPURL = MPURL_; CMDBASE = CMDBASE_; CMDFLOG = CMDFLOG_; + CMDRAWTRANSF_JSON = CMDRAWTRANSFJSON_; CMDULOG = CMDULOG_; if (!string.IsNullOrEmpty(CMDBASE_)) { @@ -241,6 +242,11 @@ namespace IOB_WIN_NEXT /// public string CMDULOG { get; set; } = ""; + /// + /// comando base x Raw Transf LOG - salvataggio valori generici in modalità JSON payload come lista + /// + public string CMDRAWTRANSF_JSON { get; set; } = ""; + /// /// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista /// diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 29a6e276..8a69fcf9 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -1117,6 +1117,11 @@ namespace IOB_WIN_NEXT /// public int counterSigIN { get; set; } + /// + /// Contatore x invio dati RawTransf + /// + public int counterRawTransf { get; set; } + /// /// Contatore x invio dati UserLog /// @@ -2223,7 +2228,66 @@ namespace IOB_WIN_NEXT } } - // + /// + /// Processo la coda RawTransf... + /// + private void svuotaCodaRawTransf() + { + // verifico SE la coda abbia dei valori... + if (QueueRawTransf.Count > 0) + { + // invio pacchetto di dati (max da conf) + for (int i = 0; i < nMaxSend; i++) + { + // SE ho qualcosa in coda... + if (QueueRawTransf.Count > 0) + { + string currVal = ""; + if (MPOnline) + { + if (IobOnline) + { + List listaValori = new List(); + // se ho + di maxJsonData elementi --> invio un set di dati alla volta + if (QueueRawTransf.Count > maxJsonData) + { + // prendoi primi maxJsonDataValori + for (int j = 0; j < maxJsonData; j++) + { + QueueRawTransf.TryDequeue(out currVal); + listaValori.Add(currVal); + } + sendDataBlock(urlType.RawTransf, listaValori); + } + else + { + // invio in blocco + listaValori = QueueRawTransf.ToList(); + // invio + sendDataBlock(urlType.RawTransf, listaValori); + // svuoto! + QueueRawTransf = new ConcurrentQueue(); + } + } + else + { + break; + } + } + else + { + break; + } + } + else + { + break; + } + } + } + } + + /// /// Processo la coda UserLog... /// private void svuotaCodaULog() @@ -2313,6 +2377,7 @@ namespace IOB_WIN_NEXT // invio con thread separato... Task taskSigIN = Task.Run(() => svuotaCodaSignIN()); Task taskFLog = Task.Run(() => svuotaCodaFLog()); + Task taskRawTransf = Task.Run(() => svuotaCodaRawTransf()); Task taskULog = Task.Run(() => svuotaCodaULog()); } else @@ -2327,6 +2392,8 @@ namespace IOB_WIN_NEXT raiseRefresh(currDispData); // gestione queue FluxLog (invio, display) svuotaCodaFLog(); + // coda RawTransf + svuotaCodaRawTransf(); // coda UserLog svuotaCodaULog(); // refresh @@ -3467,23 +3534,23 @@ namespace IOB_WIN_NEXT if (maxQueueRawTransf > 0) { // se ho una coda superiore a max ammesso - if (QueueFLog.Count > maxQueueFLog) + if (QueueRawTransf.Count > maxQueueRawTransf) { // elimino valori iniziali fino a tornare al max ammesso... - while (QueueFLog.Count > maxQueueFLog) + while (QueueRawTransf.Count > maxQueueRawTransf) { string currVal = ""; - QueueFLog.TryDequeue(out currVal); - lgInfo($"Eliminazione da coda FLog per superamento maxLengh: {currVal}"); + QueueRawTransf.TryDequeue(out currVal); + lgInfo($"Eliminazione da coda RawTransf per superamento maxLengh: {currVal}"); } } } // loggo! - lgTrace(string.Format("[QUEUE-FLOG] {0}", encodedVal)); - counterFLog++; - if (counterFLog > 9999) + lgTrace(string.Format("[QUEUE-RTRANSF] {0}", encodedVal)); + counterRawTransf++; + if (counterRawTransf > 9999) { - counterFLog = 0; + counterRawTransf = 0; } } @@ -4221,6 +4288,27 @@ namespace IOB_WIN_NEXT } break; + case urlType.RawTransf: + BaseRawTransf currRTData = new BaseRawTransf(); + rawTransfJsonPayload fullRTObj = new rawTransfJsonPayload(); + fullRTObj.rawTransfData = new List(); + // inizio processando ogni valore + foreach (var item in elencoValori) + { + currRTData = JsonConvert.DeserializeObject(item); + fullRTObj.rawTransfData.Add(currRTData); + } + // conversione finale + try + { + answ = JsonConvert.SerializeObject(fullRTObj); + } + catch (Exception exc) + { + lgError($"RawTransf Errore in costruzione jsonPayload:{Environment.NewLine}{exc}"); + } + break; + case urlType.ULog: int numVal = 0; int matrOp = 0; @@ -5602,6 +5690,10 @@ namespace IOB_WIN_NEXT tipoComando = cIobConf.serverData.CMDBASE_JSON; break; + case urlType.RawTransf: + tipoComando = cIobConf.serverData.CMDRAWTRANSF_JSON; + break; + case urlType.ULog: tipoComando = cIobConf.serverData.CMDULOG_JSON; break; diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs index d1214c5c..68832884 100644 --- a/IOB-WIN-NEXT/IobIcoelSoap.cs +++ b/IOB-WIN-NEXT/IobIcoelSoap.cs @@ -117,13 +117,6 @@ namespace IOB_WIN_NEXT // se devo inviare impacchetto dati if (doSend) { -#if false - // 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.rawTransfType.IcoelBatch, rawData); -#endif // accodo per invio... accodaRawData(IOB_UT_NEXT.rawTransfType.IcoelBatch, currBatch); currBatchList = currBatch; From 1c3c1b8a1a1a6ae9a4c8dc3fb2754e3fd7424a11 Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Tue, 24 May 2022 12:58:47 +0200 Subject: [PATCH 20/22] Aggiunta appunti ICOEL --- EgwProxy.Icoel/Appunti.md | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 EgwProxy.Icoel/Appunti.md diff --git a/EgwProxy.Icoel/Appunti.md b/EgwProxy.Icoel/Appunti.md new file mode 100644 index 00000000..d2f134c1 --- /dev/null +++ b/EgwProxy.Icoel/Appunti.md @@ -0,0 +1,107 @@ +# Appunti impiego connesisoni ICOEL + +## Icoel SOAP + +Oltre ai metodi legati al batch, ci sono questi metodi x recuperare informazioni specifiche di produttività + +| Metodo | Descrizione | +| ---------- | ---------- | +| GetMachineRodsPMAsync() | velocità catena (carrellini / minuto) | +| GetMachineCupfill() | percentuale riempimento carrellini (100% = 1 frutto x ogni carrellino) | +| GetMachineTonnesPH() | valore tonnellate/ora di velocità impianto | +| GetMachineTotalFPM() | valore frutti per minuto | + + +## Icoel DB + +Appunti sulla gestione tabelle di frontiera + +### Products total + +/****** Script for SelectTopNRows command from SSMS ******/ +SELECT TOP (1000) [SizerBatchId] + ,[Index] + ,[Nome] + ,[Qualities] + ,[Grado] + ,[Calibro] + ,[NumeroFrutti] + ,[Decigrammi] + FROM [IcoelExport].[dbo].[ProductsTotals] + + +### Entrata Ciliegie + +SELECT * +FROM [frontiera].[dbo].[ENTRATACILIEGIE] + + + -- utilizzare codice e descrizione prodotto... + +### Fine lavorazione +select top 100 * +from ProductsTotals + +/* +SizerBatch id = id del batch da WS SOAP +Index = indice di prodotto FINITO, di cui ho il NOME +- prodotti da matrice: colonne = gradi, righe = taglie(sizes) +- grado a colore rosso +- do il nome prodotto rosse 26- (che sono da 22 a 26 in grado A) +- colonna qualities = è la "somma dei qualities" ovvero le colonne che passano nelcontrollo prodotto +- codice in 3 parametri, che sono a,b,c + - a = qualità interna (SEMPRE NULL x le ciliegie) + - b grado = qualità esterna del frutto, es rosse, nere, con stelo... ricircolo = scarto per cattiva disposizione + - c : calibri che mi definiscono la dimensione, tipicamente 22..32 + + + si scrive tutto quando è chiuso il lotto + inizialmente 1 solo lotto x entrambe le linee +*/ + +### Conferimento MES + + +SELECT * +FROM DettagliConferimentoMES +where FillingId = 31729 +order by PackId + + +/* +Numero lotto = sigla giorno +sigla lotto: incrementale giornaliero + +in particoalre x il prodotto grosso --> seleziono da + fornitori (es fornitori grossi) + +PackId = id univoco scatoletta +FillingId / FillingRow NON USATI: li posso ignorare, si applicano al caso "travaso" da bins ingresso / bins uscita "tipizzati" --> serve x precalibrare +scaricoId = operazione di scannerizzazione ( è il barcode letto) +codice a barre è letto x ogni etichetta di conferimento +codice e nome fornitore = grower +codice e descrizione prodotto : sono il GREZZO specifico +cdice prodotto grezzo è il "ceppo" / famiglia +sigla e numero lotto: colonna di entrata ciliegie (frontiera) +idem x data e qta entrata + + +*/ + +### Confezioni Mes + + +SELECT * +FROM DettagliConfezioniMES + + +pack id = singola cassetta/scatoal/cartone +ean = barcode in uscita +batch id / batch name = dati tracciabilità, legato ai lotti in entrata sul sizer +lane [1/2]sizerBatchId = lotti del sizer +pesoDecigram = peso netto confezionato (tolleranza +/-10g...20gr) + +tabella scritta dal momento in cui arriva il cartone/cassetta per iniziare riempimento + +dati live li vediamo dal sizer + +*/ \ No newline at end of file From 11365196914d414807cf1c3980a175bae63e5910 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 24 May 2022 15:08:15 +0200 Subject: [PATCH 21/22] Fix gestione contapezzi FANUC da MACRO --- IOB-WIN-NEXT/IobFanuc.cs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/IOB-WIN-NEXT/IobFanuc.cs b/IOB-WIN-NEXT/IobFanuc.cs index c3aef2d6..d3657864 100644 --- a/IOB-WIN-NEXT/IobFanuc.cs +++ b/IOB-WIN-NEXT/IobFanuc.cs @@ -212,7 +212,7 @@ namespace IOB_WIN_NEXT } catch (Exception exc) { - lgError(exc, "Errore in contapezzi FANUC"); + lgError(exc, "Errore in contapezzi FANUC 01"); } } // finisco INIT ADAPTER @@ -590,6 +590,7 @@ namespace IOB_WIN_NEXT // 2022.05.23 gestione MACRO da testare (Jetco) else if (memAddr.StartsWith("MACRO.")) { + lgTrace($"Decodifica memoria MACRO | memAddr: {memAddr}"); // recupero parametro... int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr); // processo parametro @@ -1028,7 +1029,6 @@ namespace IOB_WIN_NEXT { cntAddr = 6711; } - // processo parametro contapezzi (lavorati) stopwatch.Restart(); FANUC_ref.F_RW_Param_Integer(false, cntAddr, 3, ref outputVal); @@ -1036,22 +1036,38 @@ namespace IOB_WIN_NEXT { TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-PAR", 4), stopwatch.ElapsedTicks); } - // salvo ultimo conteggio rilevato int newVal = -1; Int32.TryParse(outputVal.ToString(), out newVal); contapezziPLC = newVal > -1 ? newVal : contapezziPLC; } + // 2022.05.23 gestione MACRO da testare (Jetco) + else if (memAddr.StartsWith("MACRO.")) + { + lgTrace($"Decodifica memoria MACRO | memAddr: {memAddr}"); + // recupero parametro... + int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr); + // processo parametro + stopwatch.Restart(); + double macroVal = 0; + FANUC_ref.F_Read_macro(cntAddr, ref macroVal); + if (utils.CRB("recTime")) + { + TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-MACRO", 5), stopwatch.ElapsedTicks); + } + // salvo ultimo conteggio rilevato + int newVal = -1; + Int32.TryParse($"{macroVal}", out newVal); + contapezziPLC = newVal > -1 ? newVal : contapezziPLC; + } // altrimenti se legge da area memoria specifica leggo da li... formto tipo STD.D.1604.DW else { memAddressFanuc areaCounter = new memAddressFanuc(memAddr); - if (isVerboseLog) { lgInfo("[0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType); } - // leggo! stopwatch.Restart(); // switch x tipo dati --> tipo lettura... e salvo ultimo conteggio rilevato @@ -1092,7 +1108,6 @@ namespace IOB_WIN_NEXT { TimingData.addResult(cIobConf.codIOB, string.Format("R-{0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType), stopwatch.ElapsedTicks); } - // salvo... int newVal = -1; Int32.TryParse(outputVal.ToString(), out newVal); @@ -1109,7 +1124,7 @@ namespace IOB_WIN_NEXT } catch (Exception exc) { - lgError(exc, "Errore in contapezzi FANUC"); + lgError(exc, "Errore in contapezzi FANUC 02"); connectionOk = false; } } From 1966ab5db346a8edce47eae0b3229fe19a519aeb Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 24 May 2022 16:01:39 +0200 Subject: [PATCH 22/22] =?UTF-8?q?Update=20x=20test=20lettura=20parametri?= =?UTF-8?q?=20velocit=C3=A0=20(da=20provare)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgwProxy.Icoel.Test/Program.cs | 25 +++++++++++++++++++++++++ EgwProxy.Icoel/Appunti.md | 4 ++-- EgwProxy.Icoel/Compac/ComClient.cs | 24 ++++++++++++++++++++++++ EgwProxy.Icoel/Connector.cs | 15 +++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/EgwProxy.Icoel.Test/Program.cs b/EgwProxy.Icoel.Test/Program.cs index 9f6bd3b5..46b82397 100644 --- a/EgwProxy.Icoel.Test/Program.cs +++ b/EgwProxy.Icoel.Test/Program.cs @@ -9,6 +9,19 @@ namespace EgwProxy.Icoel.Test { #region Internal Methods + /// + /// Mostra tutte le metriche di performance ricevute + /// + /// + internal static void DisplayPerfMeter(Dictionary perfMeter) + { + // mostra tutti i parametri rilevati... + foreach (var item in perfMeter) + { + Console.WriteLine(item.Key, $"{item.Value:N2}"); + } + } + /// /// Generazione di una list di info sui dati variety /// @@ -203,6 +216,17 @@ namespace EgwProxy.Icoel.Test Console.WriteLine("Premere un tasto x continuare..."); userInput = Console.ReadLine(); + + Console.WriteLine("------------ Parametri velocità rilevati ------------"); + var perfMeter = IcoelSizer.GetPerfMeters(); + if (perfMeter != null) + { + DisplayPerfMeter(perfMeter); + } + Console.WriteLine(); + Console.WriteLine("Premere un tasto x continuare..."); + userInput = Console.ReadLine(); + // solo attive Console.WriteLine("------------ solo attive ------------"); varList = IcoelSizer.GetVarietyList(); @@ -251,6 +275,7 @@ namespace EgwProxy.Icoel.Test } } + #endregion Private Methods } } \ No newline at end of file diff --git a/EgwProxy.Icoel/Appunti.md b/EgwProxy.Icoel/Appunti.md index d2f134c1..ae375519 100644 --- a/EgwProxy.Icoel/Appunti.md +++ b/EgwProxy.Icoel/Appunti.md @@ -6,10 +6,10 @@ Oltre ai metodi legati al batch, ci sono questi metodi x recuperare informazioni | Metodo | Descrizione | | ---------- | ---------- | -| GetMachineRodsPMAsync() | velocità catena (carrellini / minuto) | -| GetMachineCupfill() | percentuale riempimento carrellini (100% = 1 frutto x ogni carrellino) | | GetMachineTonnesPH() | valore tonnellate/ora di velocità impianto | | GetMachineTotalFPM() | valore frutti per minuto | +| GetMachineRodsPM() | velocità catena (carrellini / minuto) | +| GetMachineCupfill() | percentuale riempimento carrellini (100% = 1 frutto x ogni carrellino) | ## Icoel DB diff --git a/EgwProxy.Icoel/Compac/ComClient.cs b/EgwProxy.Icoel/Compac/ComClient.cs index 646d41af..587f5dd6 100644 --- a/EgwProxy.Icoel/Compac/ComClient.cs +++ b/EgwProxy.Icoel/Compac/ComClient.cs @@ -1,5 +1,6 @@ using EgwProxy.Icoel.SizerService; using System; +using System.Collections.Generic; using System.Runtime.Serialization; using System.ServiceModel; @@ -174,6 +175,29 @@ namespace EgwProxy.Icoel.Compac SSClient.AddBatch(batch); } + /// + /// Recupera elenco parametri performance impianto + /// + /// Dizionario delle variabili di performance dell'impianto in formato Dictionary + internal Dictionary GetPerfMeters() + { + Dictionary answ = new Dictionary(); + // indicata in tonnOra + double velTonnOra = SSClient.GetMachineTonnesPH(); + // velocità espressa in frutti/minuto + double velFruttiMinuto = SSClient.GetMachineTotalFPM(); + // percentuale riempimento carrellini + double percRiemp = SSClient.GetMachineCupfill(); + //// indicata in carrelli/minuto + //int[] velCarrMinuto = SSClient.GetMachineRodsPM(); + // accodo i valori ricavati + answ.Add("VelTonnOra", velTonnOra); + answ.Add("VelFruttiMinuto", velFruttiMinuto); + answ.Add("PercRiemp", percRiemp); + return answ; + } + + #endregion Internal Methods #region Private Properties diff --git a/EgwProxy.Icoel/Connector.cs b/EgwProxy.Icoel/Connector.cs index 30bb284e..e6776ae2 100644 --- a/EgwProxy.Icoel/Connector.cs +++ b/EgwProxy.Icoel/Connector.cs @@ -38,6 +38,21 @@ namespace EgwProxy.Icoel Client.CheckGrower(GrowerData.GrowerCode, GrowerData.GrowerName); } } + /// + /// Recupera array varie velocità rilevate + /// + /// Dictionary delle velocità rilevate sul sizer + public Dictionary GetPerfMeters() + { + Dictionary answ = new Dictionary(); + using (var Client = new ComClient(ipAddress, tcpPort)) + { + answ = Client.GetPerfMeters(); + } + return answ; + } + + /// /// Invia un lotto in coda produzione sul sizer