From 5c75d5f12895436cde63297d2906a57b7c1c7e9e Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Thu, 26 May 2022 18:49:45 +0200 Subject: [PATCH 1/4] Update IOB-WIN x permettere compilazione (di base) --- IOB-WIN-NEXT/IobIcoelDb.cs | 79 ++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/IOB-WIN-NEXT/IobIcoelDb.cs b/IOB-WIN-NEXT/IobIcoelDb.cs index c412b536..3da0998c 100644 --- a/IOB-WIN-NEXT/IobIcoelDb.cs +++ b/IOB-WIN-NEXT/IobIcoelDb.cs @@ -29,21 +29,15 @@ namespace IOB_WIN_NEXT * 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) + * - lanciare sync e verifica stato sync */ + string connEntrataFrontiera = utils.CRS("EntrataFrontiera"); + string connTrackerLotti = utils.CRS("TrackerLotti"); + string connExportIcoel = utils.CRS("ExportIcoel"); + string connSyncState = utils.CRS("SyncState"); + + dbProxy = new DbProxy(connEntrataFrontiera, connTrackerLotti, connExportIcoel, connSyncState); -#if false - IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort); -#endif lastPING = DateTime.Now.AddHours(-1); } @@ -60,6 +54,7 @@ namespace IOB_WIN_NEXT { B_input = 1; currDispData.semIn = Semaforo.SV; +#if false if (currBatchList == null) { // se nullo --> provo a leggere! @@ -68,10 +63,8 @@ namespace IOB_WIN_NEXT if (currBatch != null) { currBatchList = currBatch; -#if false // accodo invio! string rawBatch = JsonConvert.SerializeObject(currBatch); -#endif accodaRawData(IOB_UT_NEXT.rawTransfType.IcoelBatch, currBatch); } } @@ -83,6 +76,7 @@ namespace IOB_WIN_NEXT B_input = 3; } } +#endif } else { @@ -98,6 +92,9 @@ namespace IOB_WIN_NEXT { // valore non presente in vers default... se gestito fare override Dictionary outVal = new Dictionary(); + + // mettere conteggio dei record trasferiti?!? +#if false // recupero da libreria il dizionario dei performance parameters... var perfParamDict = IcoelSizer.GetPerfMeters(); foreach (var item in perfParamDict) @@ -105,6 +102,7 @@ namespace IOB_WIN_NEXT saveValue(ref outVal, item.Value, item.Key); } +#endif lastReadPLC = DateTime.Now; return outVal; } @@ -142,6 +140,51 @@ namespace IOB_WIN_NEXT public override void processCustomTaskLF() { lgInfo($"Richiesto processCustomTaskLF"); + + // fare processing DB secondo il seguente scehma: + + /* + * + EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState")); + Console.WriteLine(); + Console.WriteLine("--- SyncState ---"); + bool needRedo = true; + var elencoSyncState = dbProxy.DataController.SyncStateGetAll(); + while (needRedo) + { + Console.WriteLine(" --- PRE --- "); + if (elencoSyncState != null) + { + foreach (var item in elencoSyncState) + { + Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}"); + // verifico se serva redo.. + } + } + Console.WriteLine(); + Console.WriteLine("Premere un tasto x continuare..."); + Console.ReadKey(); + Stopwatch sw = new Stopwatch(); + sw.Start(); + elencoSyncState = dbProxy.DataController.SyncStateDoImportAll(); + sw.Stop(); + Console.WriteLine($" process time: {sw.ElapsedMilliseconds} ms "); + Console.WriteLine(" --- POST --- "); + if (elencoSyncState != null) + { + foreach (var item in elencoSyncState) + { + Console.WriteLine($"TAB: {item.TableName} | IdxIN / IdxLocal {item.LastIdxIn} / {item.LastIdx} | NumIn / NumLocal {item.NumRecIn} / {item.NumRec}"); + // verifico se serva redo.. + } + } + // processo + needRedo = testNeedRedo(elencoSyncState); + } + * + * + * */ + #if false var currBatch = IcoelSizer.GetCurrentBatch(); if (currBatch != null) @@ -255,7 +298,7 @@ namespace IOB_WIN_NEXT protected Dictionary currBatchList { get; set; } #endif - protected Connector IcoelSizer { get; set; } + protected EgwProxy.Icoel.DbProxy dbProxy { get; set; } #endregion Protected Properties @@ -266,6 +309,7 @@ namespace IOB_WIN_NEXT /// protected void refreshVarietyData() { +#if false ///determina se recuperare SOLO varietà attive o tutte bool soloAttive = false; var varList = IcoelSizer.GetVarietyList(soloAttive); @@ -274,7 +318,8 @@ namespace IOB_WIN_NEXT var varietyData = IcoelSizer.GetLayoutForVarietyList(varList); // invio dai al server IO - } + } +#endif lastReadPLC = DateTime.Now; } From 99adc168fd5e68ef4e6f61a82a0842e691469622 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 28 May 2022 12:17:19 +0200 Subject: [PATCH 2/4] Inserimento obj ed enum da SDK --- IOB-UT-NEXT/Enums.cs | 4 +++- IOB-UT-NEXT/Objects.cs | 4 +++- IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index cd652f31..8a07e576 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -525,6 +525,7 @@ namespace IOB_UT_NEXT ULog } +#if false /// /// Tipologia dato Raw Transfer (derivare da MapoSdk e togliere qui) /// @@ -544,5 +545,6 @@ namespace IOB_UT_NEXT /// Icoel: Variety + layout info relative /// IcoelVarInfo - } + } +#endif } \ No newline at end of file diff --git a/IOB-UT-NEXT/Objects.cs b/IOB-UT-NEXT/Objects.cs index a26c3fa3..7ee9ae69 100644 --- a/IOB-UT-NEXT/Objects.cs +++ b/IOB-UT-NEXT/Objects.cs @@ -117,6 +117,7 @@ namespace IOB_UT_NEXT #endregion Public Methods } +#if false /// /// Classe di base per trasferimento informazioni di tipo RawTransfer /// FixMe Todo Fare !!!: elimnare usando SDK MAPO @@ -164,7 +165,7 @@ namespace IOB_UT_NEXT } #endregion Public Properties - } + } /// /// Array valori tipo BaseRawTransf inviati come JSon @@ -178,6 +179,7 @@ namespace IOB_UT_NEXT #endregion Public Properties } +#endif /// /// Cache a tempo valori INT diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 9020100b..60a702f1 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -105,8 +105,8 @@ False ExtLib\krcc.dll - - ..\packages\MapoSDK.6.14.2204.2616\lib\MapoSDK.dll + + ..\packages\MapoSDK.6.14.2205.2808\lib\MapoSDK.dll ..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll From dab327c5678c3712f8e9580980241698cb50feab Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 28 May 2022 12:17:27 +0200 Subject: [PATCH 3/4] Bozza conf IobWinDb --- IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.ini | 77 +++++++++++++++++++++ IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.json | 40 +++++++++++ 2 files changed, 117 insertions(+) create mode 100644 IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.ini create mode 100644 IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.json diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.ini new file mode 100644 index 00000000..decae0b2 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.ini @@ -0,0 +1,77 @@ +;Configurazione IOB-WIN +[IOB] +;Accesso gestione sync DB x sync ICOEL --> MoonPro_ISF --> MoonPro_IS +CNCTYPE=IcoelDb +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/ +CMDRAWTRANSF=/IOB/rawTransfJson/ +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=TRUE +FORCE_DYN_DATA=TRUE +ENABLE_DATA_FILTER=TRUE +ENABLE_CLI_RESTART=TRUE +VETO_SIG_IN=TRUE + +; clock base (da 10ms) +timerIntMs=10 + +; conf parametri memoria READ/WRITE +PARAM_CONF=GIACO_ICOEL_003.json + +[BRANCH] +NAME=master \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.json new file mode 100644 index 00000000..0a64c117 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ICOEL_003.json @@ -0,0 +1,40 @@ +{ + "mMapWrite": { + + }, + "mMapRead": { + "VelTonnOra": { + "name": "VelTonnOra", + "description": "Velocità Impianto Tonnellate / Ora", + "memAddr": "VelTonnOra", + "tipoMem": "Real", + "index": 0, + "size": 0, + "func": "MEDIAN", + "period": 60, + "factor": 1 + }, + "VelFruttiMinuto": { + "name": "VelFruttiMinuto", + "description": "Velocità Impianto Frutti / Minuto", + "memAddr": "VelFruttiMinuto", + "tipoMem": "Real", + "index": 0, + "size": 0, + "func": "MEDIAN", + "period": 60, + "factor": 1 + }, + "PercRiemp": { + "name": "PercRiemp", + "description": "Percentuale riempimento carrelli", + "memAddr": "PercRiemp", + "tipoMem": "Real", + "index": 0, + "size": 0, + "func": "MEDIAN", + "period": 60, + "factor": 1 + } + } +} From ac0c0a8d62e9b6388c5149466824641a2929d352 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 28 May 2022 12:27:00 +0200 Subject: [PATCH 4/4] Update SDK Icoel parte DB x init MoonPro_ISF --- .../Controllers/DbController.cs | 48 +++++++++++-------- EgwProxy.Icoel.Test/Program.cs | 9 +++- EgwProxy.Icoel/DbProxy.cs | 12 ++++- 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/EgwProxy.Icoel.DataLayer/Controllers/DbController.cs b/EgwProxy.Icoel.DataLayer/Controllers/DbController.cs index 48d25a99..0727fdb5 100644 --- a/EgwProxy.Icoel.DataLayer/Controllers/DbController.cs +++ b/EgwProxy.Icoel.DataLayer/Controllers/DbController.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; /*------------------------------------------------ * Aggiunto fix come da link seguente: - * + * * https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded - * + * * I solved this by adding an using stament on top of my DBContext class, like so: * using SqlProviderServices= System.Data.Entity.SqlServer.SqlProviderServices; * @@ -21,18 +21,15 @@ namespace EgwProxy.Icoel.DataLayer.Controllers /// public class DbController : IDisposable { - #region Private Fields - +#if false private static EntrataDbContext dbEntrataCtx; private static ExportDbContext dbExportCtx; private static TrackerDbContext dbTrackerCtx; +#endif private static SyncStateDbContext dbSyncStateCtx; private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - #endregion Private Fields - - #region Public Constructors - +#if false /// /// Avvio dell'oggetto gestione DB con le 3 stringhe di connessione specifiche /// @@ -51,11 +48,16 @@ namespace EgwProxy.Icoel.DataLayer.Controllers dbSyncStateCtx = new SyncStateDbContext(connSyncState); Log.Info("Avviata classe dbSyncStateCtx"); } - - #endregion Public Constructors - - - #region Public Methods +#endif + /// + /// Avvio dell'oggetto gestione DB con stringa di connessione specifica + /// + /// Connessione DB locale di SYNC + public DbController(string connSyncState) + { + dbSyncStateCtx = new SyncStateDbContext(connSyncState); + Log.Info("Avviata classe dbSyncStateCtx"); + } /// /// Dispose classe @@ -63,12 +65,15 @@ namespace EgwProxy.Icoel.DataLayer.Controllers public void Dispose() { // Clear database context +#if false dbEntrataCtx.Dispose(); dbExportCtx.Dispose(); dbTrackerCtx.Dispose(); +#endif dbSyncStateCtx.Dispose(); } +#if false /// /// Elenco record Entrata Merce (Frontiera) /// @@ -137,9 +142,11 @@ namespace EgwProxy.Icoel.DataLayer.Controllers return dbResult; } +#endif /// - /// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi restitusice in output la tab di SyncState x verificare lo stato + /// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi + /// restitusice in output la tab di SyncState x verificare lo stato /// /// public List SyncStateDoImportAll() @@ -155,7 +162,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers } /// - /// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi restitusice in output la tab di SyncState x verificare lo stato + /// Esegue una volta la stored di ImportAll (x recupero dati da DB esterni) e poi + /// restitusice in output la tab di SyncState x verificare lo stato /// /// public List SyncStateDoExportAll() @@ -184,6 +192,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers return dbResult; } + +#if false /// /// Elenco record DettConfezioni (da Icoel TrackerLotti) /// @@ -220,7 +230,8 @@ namespace EgwProxy.Icoel.DataLayer.Controllers /// /// Elenco dettaglio conferimento x PackId (da Icoel TrackerLotti) - /// ATTENZIONE: in caso di mancata associazione lotto ingresso con lavorazione corrente la vista restituisce nuovo (possibile lavorare senza lotto ingresso e senza tracking) + /// ATTENZIONE: in caso di mancata associazione lotto ingresso con lavorazione corrente la + /// vista restituisce nuovo (possibile lavorare senza lotto ingresso e senza tracking) /// /// idx da cui partire a recuperare /// @@ -236,7 +247,6 @@ namespace EgwProxy.Icoel.DataLayer.Controllers return dbResult; } - - #endregion Public Methods +#endif } -} +} \ No newline at end of file diff --git a/EgwProxy.Icoel.Test/Program.cs b/EgwProxy.Icoel.Test/Program.cs index 07e069cf..f04bcf35 100644 --- a/EgwProxy.Icoel.Test/Program.cs +++ b/EgwProxy.Icoel.Test/Program.cs @@ -226,7 +226,10 @@ namespace EgwProxy.Icoel.Test string userInput = ""; Console.WriteLine("------------ Test DB ------------"); - EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState")); +#if false + EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("EntrataFrontiera"), ReadSetting("TrackerLotti"), ReadSetting("ExportIcoel"), ReadSetting("SyncState")); +#endif + EgwProxy.Icoel.DbProxy dbProxy = new DbProxy(ReadSetting("SyncState")); Console.WriteLine(); Console.WriteLine("--- SyncState ---"); bool needRedo = true; @@ -266,6 +269,7 @@ namespace EgwProxy.Icoel.Test Console.WriteLine("Premere un tasto x continuare..."); Console.ReadKey(); +#if false Console.WriteLine("--- Entrata Frontiera ---"); var elencoBarcode = dbProxy.DataController.EntrateGetLast(10); if (elencoBarcode != null) @@ -317,7 +321,8 @@ namespace EgwProxy.Icoel.Test } Console.WriteLine(); Console.WriteLine("Premere un tasto x continuare..."); - userInput = Console.ReadLine(); + userInput = Console.ReadLine(); +#endif // oggetto x connessione al sizer icoel Connector IcoelSizer = new Connector(ReadSetting("IndirizzoIpSizer"), ReadSetting("SizerTcpPort")); diff --git a/EgwProxy.Icoel/DbProxy.cs b/EgwProxy.Icoel/DbProxy.cs index 772b6536..a9045a63 100644 --- a/EgwProxy.Icoel/DbProxy.cs +++ b/EgwProxy.Icoel/DbProxy.cs @@ -17,6 +17,7 @@ namespace EgwProxy.Icoel /// public DbController DataController { get; set; } +#if false /// /// Inizializzazione proxy /// @@ -24,9 +25,18 @@ namespace EgwProxy.Icoel /// stringa connesisone DB Tracker /// stringa connesisone DB Export /// Connessione DB locale di SYNC - public DbProxy(string connEntrata, string connTracker, string connExport, string connSyncState) + public DbProxy(string connEntrata, string connTracker, string connExport, string connSyncState) { DataController = new DbController(connEntrata, connTracker, connExport, connSyncState); + } +#endif + /// + /// Inizializzazione proxy + /// + /// Connessione DB locale di SYNC + public DbProxy(string connSyncState) + { + DataController = new DbController(connSyncState); } } }