diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c9e3f18a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CA1051: Non dichiarare campi di istanza visibili +dotnet_diagnostic.CA1051.severity = none diff --git a/IOB-MAN/GlobalSuppressions.cs b/IOB-MAN/GlobalSuppressions.cs new file mode 100644 index 00000000..03cc8e7a --- /dev/null +++ b/IOB-MAN/GlobalSuppressions.cs @@ -0,0 +1,48 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.btnMaximixeAll_Click(System.Object,System.EventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.btnMinimizeAll_Click(System.Object,System.EventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.checkIstance(IOB_MAN.iobAdapt,System.Collections.Generic.List{IOB_MAN.iobAdapt},System.Diagnostics.Process[])~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.chiudiChildSel")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.closeAllChild(System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.dgvManagedItems_CellDoubleClick(System.Object,System.Windows.Forms.DataGridViewCellEventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.forceCheckTimer_Tick(System.Object,System.EventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.IOBManPanel.MainTimer_Tick(System.Object,System.EventArgs)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.deserializeVal(System.String)~System.Object")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.getRCnt(System.String)~System.Int32")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.getRedisInfoData~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.getRKeys(StackExchange.Redis.RedisKey[])~StackExchange.Redis.RedisValue[]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.getRSV(System.String)~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redCountKey(System.String)~System.Int32")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redDelKey(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redFlushKey(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redGetCounterByKey(System.String,IOB_MAN.RedisIobCache.kvpOrderBy)~System.Collections.Generic.List{System.Collections.Generic.KeyValuePair{System.String,System.Int32}}")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redGetHash(System.String)~System.Collections.Generic.KeyValuePair{System.String,System.String}[]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redGetHashDict(System.String)~System.Collections.Generic.Dictionary{System.String,System.String}")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redGetHashField(System.String,System.String)~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redHash(System.String)~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redHashPresent(StackExchange.Redis.RedisKey)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redHashPresentSz(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redKeyPresent(StackExchange.Redis.RedisKey)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redKeyPresentSz(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redSaveHash(System.String,System.Collections.Generic.KeyValuePair{System.String,System.String}[])~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redSaveHash(System.String,System.Collections.Generic.KeyValuePair{System.String,System.String}[],System.Double)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redSaveHashDict(System.String,System.Collections.Generic.Dictionary{System.String,System.String})~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redSaveHashDict(System.String,System.Collections.Generic.Dictionary{System.String,System.String},System.Double)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redSaveHashList(System.String,System.Collections.Generic.List{System.Collections.Generic.KeyValuePair{System.String,System.String}})~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.redServInfo~StackExchange.Redis.IServer[]")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.resetRCnt(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.serializeVal(System.Object)~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.setRCntD(System.String)~System.Int64")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.setRCntI(System.String)~System.Int64")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.setRKeys(System.Collections.Generic.KeyValuePair{StackExchange.Redis.RedisKey,StackExchange.Redis.RedisValue}[])~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.setRSV(System.String,System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.RedisIobCache.setRSV(System.String,System.String,System.Int32)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.utils.CRB(System.String)~System.Boolean")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.utils.CRC(System.String)~System.Char")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.utils.CRI(System.String)~System.Int32")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~M:IOB_MAN.utils.CRS(System.String)~System.String")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "", Scope = "member", Target = "~P:IOB_MAN.RedisIobCache.numRecRedis")] diff --git a/IOB-MAN/IOB-MAN.csproj b/IOB-MAN/IOB-MAN.csproj index 2d4e7aa6..cd5b18c9 100644 --- a/IOB-MAN/IOB-MAN.csproj +++ b/IOB-MAN/IOB-MAN.csproj @@ -148,6 +148,7 @@ VersGen.cs + Form diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index ed0d3a82..22c869eb 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -28,10 +28,6 @@ namespace IOB_MAN #endregion - /// - /// Token x cancellazione thread - /// - private CancellationTokenSource _cts; /// /// Context x sync thread /// @@ -245,7 +241,7 @@ namespace IOB_MAN if (!chkAutoRestart.Checked) { tOutAutocheck--; - txtTOutAutoCheck.Text = (tOutAutocheck / (1000 / (utils.CRI("checkPeriod")))).ToString(); + txtTOutAutoCheck.Text = $"{(tOutAutocheck / (1000 / (utils.CRI("checkPeriod"))))}"; } } else @@ -352,7 +348,7 @@ namespace IOB_MAN foreach (DataGridViewRow riga in dgvManagedItems.SelectedRows) { // chiudo! - int.TryParse(riga.Cells["pID"].Value.ToString(), out pid); + _ = int.TryParse(riga.Cells["pID"].Value.ToString(), out pid); if (pid >= 0) { @@ -380,7 +376,7 @@ namespace IOB_MAN /// /// /// - public Process myGetProcByID(Process[] processlist, int id) + public static Process myGetProcByID(Process[] processlist, int id) { return processlist.FirstOrDefault(pr => pr.Id == id); } @@ -602,7 +598,7 @@ namespace IOB_MAN closeAllChild(true); closeTimers(); } - + private void closeTimers() { MainTimer.Dispose(); diff --git a/IOB-MAN/RedisMan.cs b/IOB-MAN/RedisMan.cs index e04b6dfa..3f8cf416 100644 --- a/IOB-MAN/RedisMan.cs +++ b/IOB-MAN/RedisMan.cs @@ -68,7 +68,7 @@ namespace IOB_MAN /// /// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto... /// - public string redHash(string keyName) + public static string redHash(string keyName) { keyName = keyName.Replace("\\", "_"); string answ = keyName; diff --git a/IOB-WIN.sln b/IOB-WIN.sln index 864178fa..4eb8c2e4 100644 --- a/IOB-WIN.sln +++ b/IOB-WIN.sln @@ -18,6 +18,11 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CVCncLib", "CVCncLib\CVCncL EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-MAN", "IOB-MAN\IOB-MAN.csproj", "{8DFE2AC9-611D-44D5-8E8F-204DCF01EDF8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B52E3E86-1B82-4F4D-982C-0C8909CD2A28}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CMS-FANUC|Any CPU = CMS-FANUC|Any CPU diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index a7b139d4..ffdb3565 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -1177,8 +1177,6 @@ namespace IOB_WIN // init max queue maxEvQueue = 1; maxFlQueue = 1; - // forzo check allarmi.. - iobObj.forceAlarmCheck(); try { diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index db321294..f16d2357 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -472,13 +472,6 @@ namespace IOB_WIN { dtAvvioAdp = DateTime.Now; if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index 02c80d39..8b8d1b7c 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -265,7 +265,7 @@ namespace IOB_WIN /// /// Verifica se sia in modalità DEMO avanzata (campionamento da set di valori ammessi...) /// - public bool DemoInSample + public static bool DemoInSample { get { @@ -291,7 +291,7 @@ namespace IOB_WIN /// /// Verifica se sia in modalità DEMO x dati OUTPUT /// - public bool DemoOut + public static bool DemoOut { get { @@ -1712,10 +1712,10 @@ namespace IOB_WIN /// /// processa dataLayer e se necessario salva/mostra /// - public void checkSavePersDataLayer() + public static void checkSavePersDataLayer() { } - public void resetDebugConsole() + public static void resetDebugConsole() { } @@ -2090,7 +2090,7 @@ namespace IOB_WIN /// dimensione singolo slot in byte /// indirizzo bit: numero riga x calcolo indice bit /// - protected otherData decodeBitData(string linea, char separator, int ByteNum, int memSize, int BitNum) + protected static otherData decodeBitData(string linea, char separator, int ByteNum, int memSize, int BitNum) { string[] valori = linea.Split(separator); int shift = 0; @@ -2153,19 +2153,12 @@ namespace IOB_WIN #endregion - /// - /// effettua ogni log period una rilettura di TUTTI gli allarmi... - /// - public virtual void forceAlarmCheck() - { - } - #region IOB METHODS /// /// Valore del num max invii consecutivi da coda... /// - protected int nMaxSend + protected static int nMaxSend { get { @@ -2675,7 +2668,7 @@ namespace IOB_WIN /// /// Reset dei webclients /// - public void resetwebClients() + public static void resetWebClients() { utils.resetWebClients(); } @@ -2811,7 +2804,7 @@ namespace IOB_WIN // se NON OK riprovo ANCORA 1 volta... if (!answ) { - resetwebClients(); + resetWebClients(); Thread.Sleep(rand.Next(500, 1000)); callResp = callUrl(urlAlive, false); answ = (callResp == "OK"); @@ -2908,7 +2901,7 @@ namespace IOB_WIN // se NON OK riprovo ANCORA 1 volta... if (!answ) { - resetwebClients(); + resetWebClients(); Thread.Sleep(rand.Next(250, 1000)); callResp = callUrl(urlIobEnabled, false); answ = (callResp == "OK"); @@ -3787,7 +3780,7 @@ namespace IOB_WIN } /// - /// Effettua processing del recupero delle speed (RPM, feedrate) degli assi + /// Effettua processing degli allarmi CNC SE disponibili /// public void processCncAlarms() { diff --git a/IOB-WIN/IobKawasaki.cs b/IOB-WIN/IobKawasaki.cs index 833cf7b6..300a048e 100644 --- a/IOB-WIN/IobKawasaki.cs +++ b/IOB-WIN/IobKawasaki.cs @@ -317,7 +317,7 @@ namespace IOB_WIN KAWASAKI_ref = new KRcc.Commu(connPar); //KAWASAKI_ref = new KRcc.Commu("TCP 192.168.0.92"); // disconnetto e connetto... - if (isVerboseLog) + if (isVerboseLog) { lgInfo("KAWASAKI: tryDisconnect"); } @@ -326,7 +326,7 @@ namespace IOB_WIN //lgInfo("KAWASAKI: tryConnect"); //tryConnect(); lgInfo("End init Adapter KAWASAKI"); - if (isVerboseLog) + if (isVerboseLog) { lgInfo("KAWASAKI CONNESSIONE AVVENUTA"); } @@ -433,13 +433,6 @@ namespace IOB_WIN if (connectionOk) { if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } @@ -902,46 +895,57 @@ namespace IOB_WIN lastWarnODL = DateTime.Now; } } - if (currODL != null && currODL != "" && currODL != "0") + if (!string.IsNullOrEmpty(currODL)) { - // ora processo il contapezzi... - // controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture - if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) + if (currODL != "0") { - // se sono differenti MOSTRO... - if (lastCountCNC != contapezzi) + // ora processo il contapezzi... + // controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture + if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) { - // registro contapezzi - lgInfo(string.Format("Differenza Contapezzi: READ: {0} | Interno {1}", lastCountCNC, contapezzi)); - } - // verifico se variato contapezzi... e se passato ritardo minimo... - if (lastCountCNC > contapezzi) - { - // salvo nuovo contapezzi (incremento di 1...) - contapezzi++; - // salvo in semaforo! - B_input += (1 << 2); - // registro contapezzi - lgInfo(string.Format("Contapezzi KAWASAKI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); - } + // se sono differenti MOSTRO... + if (lastCountCNC != contapezzi) + { + // registro contapezzi + lgInfo($"Differenza Contapezzi CNC/IOB: lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); + } + // verifico se variato contapezzi... e se passato ritardo minimo... + if (lastCountCNC > contapezzi) + { + // salvo nuovo contapezzi (incremento di 1...) + contapezzi++; + // salvo in semaforo! + B_input += (1 << 2); + // registro contapezzi + lgInfo(string.Format("Contapezzi KAWASAKI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); + } + else if (contapezzi > lastCountCNC) + { + lgInfo($"Contapezzi IOB > CNC --> NON INVIO (CNC: {lastCountCNC} < IOB: {contapezzi})"); + } - // invio a server contapezzi (aggiornato) - string retVal = utils.callUrl(urlSetPzCount + contapezzi.ToString()); - // verifica se tutto OK - if (retVal != "OK") - { - // errore salvataggio contapezzi - lgInfo(string.Format("Errore salvataggio Contapezzi KAWASAKI {0} | Contapezzi interno {1} | Errore salvataggio: {2}", lastCountCNC, contapezzi, retVal)); + // invio a server contapezzi (aggiornato) + string retVal = utils.callUrl(urlSetPzCount + contapezzi.ToString()); + // verifica se tutto OK + if (retVal != "OK") + { + // errore salvataggio contapezzi + lgInfo(string.Format("Errore salvataggio Contapezzi KAWASAKI {0} | Contapezzi interno {1} | Errore salvataggio: {2}", lastCountCNC, contapezzi, retVal)); + } + // resetto timer... + lastPzCountSend = DateTime.Now; } - // resetto timer... - lastPzCountSend = DateTime.Now; + } + else + { + lgError("Attenzione non trovato ODL --> currODL = 0"); } } else { if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) { - lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi KAWASAKI {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); + lgError(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi KAWASAKI {0} | Contapezzi interno {1}", lastCountCNC, contapezzi)); // resetto timer... lastPzCountSend = DateTime.Now; } diff --git a/IOB-WIN/IobMTC.cs b/IOB-WIN/IobMTC.cs index f9725df7..edc29584 100644 --- a/IOB-WIN/IobMTC.cs +++ b/IOB-WIN/IobMTC.cs @@ -820,13 +820,6 @@ namespace IOB_WIN if (connectionOk) { if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } @@ -868,14 +861,6 @@ namespace IOB_WIN #region Metodi specifici (da verificare/completare in implementazione) - /// - /// controllo allarmi - /// - public override void forceAlarmCheck() - { - // controllo tutta la memoria allarmi SE richiesto - } - /// /// Effettua vero processing contapezzi /// diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs index 90b0ae65..e5cef0cd 100644 --- a/IOB-WIN/IobOSAI.cs +++ b/IOB-WIN/IobOSAI.cs @@ -43,24 +43,29 @@ namespace IOB_WIN pzCountDelay = utils.CRI("pzCountDelay"); lastPzCountSend = DateTime.Now; lastWarnODL = DateTime.Now; - - // inizializzo correttamente aree memoria secondo CONF - iniFileName - IniFile fIni = new IniFile(IOBConf.iniFileName); - - // fix enable prgName - enablePrgName = fIni.ReadBoolean("CNC", "GETPRGNAME", true); - - // effettuo lettura della conf sigLUT... cercando 1:1 i bit... - string currBit = ""; - string memArea = ""; - for (int i = 0; i < 8; i++) + if (IOBConf != null) { - currBit = string.Format("BIT{0}", i); - memArea = fIni.ReadString("MEMORY", currBit, ""); - // se trovo un valore... - if (memArea != "") + // inizializzo correttamente aree memoria secondo CONF - iniFileName + if (!string.IsNullOrEmpty(IOBConf.iniFileName)) { - signLUT.Add(currBit, memArea); + IniFile fIni = new IniFile(IOBConf.iniFileName); + + // fix enable prgName + enablePrgName = fIni.ReadBoolean("CNC", "GETPRGNAME", true); + + // effettuo lettura della conf sigLUT... cercando 1:1 i bit... + string currBit = ""; + string memArea = ""; + for (int i = 0; i < 8; i++) + { + currBit = string.Format("BIT{0}", i); + memArea = fIni.ReadString("MEMORY", currBit, ""); + // se trovo un valore... + if (!string.IsNullOrEmpty(memArea)) + { + signLUT.Add(currBit, memArea); + } + } } } @@ -84,13 +89,13 @@ namespace IOB_WIN } parentForm.commPlcActive = false; - if (isVerboseLog) + if (isVerboseLog) { lgInfo(string.Format("INIT OSAI_ref da CncLib come {0}", IOBConf.tipoIob)); } // disconnetto e connetto... - if (isVerboseLog) + if (isVerboseLog) { lgInfo("OSAI: tryDisconnect"); } @@ -124,7 +129,7 @@ namespace IOB_WIN try { // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area) - if (cIobConf.optPar.Count > 0 && getOptPar("PZCOUNT_MODE") != "") + if (cIobConf.optPar.Count > 0 && !string.IsNullOrEmpty(getOptPar("PZCOUNT_MODE"))) { if (getOptPar("PZCOUNT_MODE").StartsWith("OVAR")) { @@ -234,13 +239,6 @@ namespace IOB_WIN { dtAvvioAdp = DateTime.Now; if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } @@ -346,7 +344,7 @@ namespace IOB_WIN { currODL = utils.callUrl(urlGetCurrODL); // solo SE HO un ODL... - if (currODL == "" || currODL == "0") + if (string.IsNullOrEmpty(currODL) || currODL == "0") { if (periodicLog) { @@ -368,7 +366,7 @@ namespace IOB_WIN lastWarnODL = DateTime.Now; } } - if (currODL != null && currODL != "" && currODL != "0") + if (!string.IsNullOrEmpty(currODL) && currODL != "0") { // controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay)) @@ -474,7 +472,7 @@ namespace IOB_WIN try { // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area) - if (cIobConf.optPar.Count > 0 && getOptPar("PZCOUNT_MODE") != "") + if (cIobConf.optPar.Count > 0 && !string.IsNullOrEmpty(getOptPar("PZCOUNT_MODE"))) { string memAddr = getOptPar("PZCOUNT_MODE"); if (memAddr.StartsWith("STD")) diff --git a/IOB-WIN/IobOmron.cs b/IOB-WIN/IobOmron.cs index 1632452c..c3d6b3f6 100644 --- a/IOB-WIN/IobOmron.cs +++ b/IOB-WIN/IobOmron.cs @@ -271,17 +271,10 @@ namespace IOB_WIN // imposto i parametri... setParamPlc(); connectionOk = true; - // refresh stato allarmi!!! + // refresh stato connessione!!! if (connectionOk) { if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } @@ -323,13 +316,6 @@ namespace IOB_WIN #region Metodi specifici (da verificare/completare in implementazione) - /// - /// controllo allarmi - /// - public override void forceAlarmCheck() - { - // controllo tutta la memoria allarmi SE richiesto - } /// /// Oggetto per lettura PESO rilevato (DM20-21) /// diff --git a/IOB-WIN/IobSiemens.cs b/IOB-WIN/IobSiemens.cs index 1cdc37dc..ab49b901 100644 --- a/IOB-WIN/IobSiemens.cs +++ b/IOB-WIN/IobSiemens.cs @@ -993,13 +993,6 @@ namespace IOB_WIN if (connectionOk) { if (adpRunning) - { - // carico status allarmi (completo) - lgInfo("Inizio refresh completo stato allarmi..."); - forceAlarmCheck(); - lgInfo("Completato refresh completo stato allarmi!"); - } - else { lgInfo("Connessione OK"); } diff --git a/IOB-WIN/IobWPS.cs b/IOB-WIN/IobWPS.cs index 384e07ee..2ddad2dd 100644 --- a/IOB-WIN/IobWPS.cs +++ b/IOB-WIN/IobWPS.cs @@ -72,11 +72,11 @@ namespace IOB_WIN lgInfo("BEGIN reloadAdapterConf"); // inizializzo LUT decodifica string jsonConf = getOptPar("LUT_CONF"); - if (jsonConf != "") + if (!string.IsNullOrEmpty(jsonConf)) { StreamReader reader = new StreamReader($"DATA/CONF/{jsonConf}"); string jsonData = reader.ReadToEnd(); - if (jsonData != "") + if (!string.IsNullOrEmpty(jsonData)) { try { @@ -246,7 +246,7 @@ namespace IOB_WIN element = driver.FindElement(By.Id(item.val)); cVal = element.Text; // verifico nome o key... - if (item.name != "") + if (!string.IsNullOrEmpty(item.name)) { cKey = item.name; } diff --git a/IOB-WIN/MainForm.cs b/IOB-WIN/MainForm.cs index b102489e..87d0f348 100644 --- a/IOB-WIN/MainForm.cs +++ b/IOB-WIN/MainForm.cs @@ -401,6 +401,11 @@ namespace IOB_WIN lg = LogManager.GetCurrentClassLogger(); displayTaskAndLog("MainForm Starting"); + // salvo versione SW! + lgInfo("------------------------------------- STARTUP DATA -----------------------------------------------"); + lgInfo($"APP Mode : {lblApp.Text}"); + lgInfo($"Versione : {lblVers.Text}"); + lgInfo("--------------------------------------------------------------------------------------------------"); // se abilitato autoload conf leggo file corretto... if (utils.CRB("autoLoadConf")) diff --git a/Jenkinsfile b/Jenkinsfile index cef7a30d..00914b8f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=671']) { + withEnv(['NEXT_BUILD_NUMBER=672']) { // env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'