diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index 9a3372e3..fbf23b18 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -86,6 +86,10 @@ namespace IOB_WIN #region utils ed helpers + /// + /// Log verboso da configurazione (SOLO CHAIVE "verbose"... + /// + public bool isVerboseLog { get; set; } = utils.CRB("verbose"); /// /// Stringa corrente di log... /// @@ -136,7 +140,7 @@ namespace IOB_WIN catch (Exception exc) { lgError($"Errore in esecuzione logWatcher{Environment.NewLine}--> {value}"); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgError($"{exc}"); } @@ -162,7 +166,7 @@ namespace IOB_WIN catch (Exception exc) { lgError($"Errore in esecuzione taskWatcher{Environment.NewLine}--> {value}"); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgError($"{exc}"); } diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index 03d30f0f..65a3ce97 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -203,13 +203,13 @@ namespace IOB_WIN // aggiungo referenza obj FANUC FANUC_ref = (FANUC)Runtime.NC; - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("FANUC_ref da CncLib"); } // disconnetto e connetto... - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("FANUC: tryDisconnect"); } @@ -361,7 +361,7 @@ namespace IOB_WIN { memAddressFanuc areaCounter = new memAddressFanuc(memAddr); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType); } @@ -943,7 +943,7 @@ namespace IOB_WIN { memAddressFanuc areaCounter = new memAddressFanuc(memAddr); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType); } @@ -966,13 +966,13 @@ namespace IOB_WIN case "DW": uint valDW = 0; FANUC_ref.F_RW_DWord(false, areaCounter.mType, areaCounter.mPos, ref valDW); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[1] valDW contapezzi: {0}", valDW); } outputVal = valDW; - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[2] outputVal contapezzi: {0}", outputVal); } @@ -988,7 +988,7 @@ namespace IOB_WIN // salvo... Int32.TryParse(outputVal.ToString(), out lastCountCNC); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[3] lastCountCNC contapezzi: {0}", lastCountCNC); } @@ -1091,7 +1091,7 @@ namespace IOB_WIN { memAddressFanuc areaCounter = new memAddressFanuc(memAddr); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType); } @@ -1114,13 +1114,13 @@ namespace IOB_WIN case "DW": uint valDW = 0; FANUC_ref.F_RW_DWord(false, areaCounter.mType, areaCounter.mPos, ref valDW); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[1] valDW PAR: {0}", valDW); } outputVal = valDW; - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[2] outputVal PAR: {0}", outputVal); } @@ -1136,7 +1136,7 @@ namespace IOB_WIN // salvo... answ = outputVal.ToString(); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[3] PAR letto: {0} | {1}", varName, answ); } diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index 9ead1a4e..13b15a13 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -60,6 +60,10 @@ namespace IOB_WIN /// Indica impianto IN SETUP (fino a quando SMETTE di esserlo...) /// protected bool inSetup = false; + /// + /// Log verboso da configurazione (SOLO CHAIVE "verbose"... + /// + public bool isVerboseLog { get; set; } = utils.CRB("verbose"); /// /// Indicazione VETO invio a server sino alla data-ora indicata /// @@ -1920,7 +1924,7 @@ namespace IOB_WIN // ora trimmo vettore al solo numero VERO dei valori caricati... Array.Resize(ref vettoreConf, numRiga); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo(string.Format("Fine caricamento vettore di {0} variabili per file {1}", numRiga, nomeFile)); } diff --git a/IOB-WIN/IobKawasaki.cs b/IOB-WIN/IobKawasaki.cs index 0d5e3805..34dfac94 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 (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("KAWASAKI: tryDisconnect"); } @@ -326,7 +326,7 @@ namespace IOB_WIN //lgInfo("KAWASAKI: tryConnect"); //tryConnect(); lgInfo("End init Adapter KAWASAKI"); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("KAWASAKI CONNESSIONE AVVENUTA"); } @@ -745,7 +745,7 @@ namespace IOB_WIN { memAreaSiemens areaCounter = new memAreaSiemens(memAddr); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[0] area memoria: {1}.{2}.{3}", memAddr, areaCounter.DbNum, areaCounter.indiceMem, areaCounter.tipoMem); } @@ -770,7 +770,7 @@ namespace IOB_WIN } // salvo... Int32.TryParse(outputVal.ToString(), out lastCountCNC); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[2] outputVal contapezzi: {0}", outputVal); lgInfo("[3] lastCountCNC contapezzi: {0}", lastCountCNC); diff --git a/IOB-WIN/IobMTC.cs b/IOB-WIN/IobMTC.cs index 95ae617b..82b43842 100644 --- a/IOB-WIN/IobMTC.cs +++ b/IOB-WIN/IobMTC.cs @@ -473,7 +473,7 @@ namespace IOB_WIN if (newValue != null) { - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo($"Richiesta checkSaveItem per {newValue} | id: {newValue.DataItemId} | CDATA: {newValue.CDATA}"); } @@ -538,7 +538,7 @@ namespace IOB_WIN double newVal = 0; if (newValue != null) { - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo($"Richiesta checkSaveSample per {newValue} | id: {newValue.DataItemId} | CDATA: {newValue.CDATA}"); } @@ -560,7 +560,7 @@ namespace IOB_WIN // controllo SE ho DeadBand... if (dataItemMem[newValue.DataItemId].thresholdDeadBand > 0) { - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo($"Test deadband: oldVal: {oldVal} | newVal: {newVal}"); } @@ -676,6 +676,7 @@ namespace IOB_WIN descr = itemTranslation("C", dataItem.DataItemId); locTStamp = dataItem.Timestamp.ToLocalTime(); sVal = $"CONDITION: {locTStamp.ToString()} | descr: {descr} | Id: {dataItem.DataItemId} | | Name: {dataItem.Name} | Val: {dataItem.CDATA}"; + // condizion verboso SEMPRE! lgInfo(sVal); DateTime tStamp = dataItem.Timestamp; var time2 = tStamp.ToLocalTime(); @@ -702,7 +703,10 @@ namespace IOB_WIN descr = itemTranslation("E", dataItem.DataItemId); locTStamp = dataItem.Timestamp.ToLocalTime(); sVal = $"EVENT: {locTStamp.ToString()} | descr: {descr} | Id: {dataItem.DataItemId} | Name: {dataItem.Name} | Val: {dataItem.CDATA}"; - lgInfo(sVal); + if (isVerboseLog) + { + lgInfo(sVal); + } DateTime tStamp = dataItem.Timestamp; var time2 = tStamp.ToLocalTime(); // verifico se salvare @@ -728,7 +732,10 @@ namespace IOB_WIN descr = itemTranslation("S", dataItem.DataItemId); locTStamp = dataItem.Timestamp.ToLocalTime(); sVal = $"SAMPLE: {locTStamp.ToString()} | descr: {descr} | Id: {dataItem.DataItemId} | | Name: {dataItem.Name} | Val: {dataItem.CDATA}"; - lgInfo(sVal); + if (isVerboseLog) + { + lgInfo(sVal); + } DateTime tStamp = dataItem.Timestamp; var time2 = tStamp.ToLocalTime(); // verifico se salvare @@ -740,7 +747,7 @@ namespace IOB_WIN } else { - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo($"NON ACCODATO sample poiché verifica variazione SAMPLE ha dato esito negativo", false); } diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs index db52fd87..c7946623 100644 --- a/IOB-WIN/IobOSAI.cs +++ b/IOB-WIN/IobOSAI.cs @@ -83,13 +83,13 @@ namespace IOB_WIN } parentForm.commPlcActive = false; - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo(string.Format("INIT OSAI_ref da CncLib come {0}", IOBConf.tipoIob)); } // disconnetto e connetto... - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("OSAI: tryDisconnect"); } diff --git a/IOB-WIN/IobOmron.cs b/IOB-WIN/IobOmron.cs index c48cc83e..1632452c 100644 --- a/IOB-WIN/IobOmron.cs +++ b/IOB-WIN/IobOmron.cs @@ -267,8 +267,8 @@ namespace IOB_WIN parentForm.commPlcActive = true; short esitoLink = doConnect(); lgInfo($"szStatusConnection OMRON, esitoLink: {esitoLink}"); - parentForm.commPlcActive = false; - // imposto i parametri... + parentForm.commPlcActive = false; + // imposto i parametri... setParamPlc(); connectionOk = true; // refresh stato allarmi!!! @@ -712,7 +712,7 @@ namespace IOB_WIN { // controllo i parametri... ne gestisco 4... foreach (var item in updatedPar) - { + { lgInfo($"Richiesti processing plcWriteParams per {item.name} | valore richiesto {item.reqValue} | valore attuale {item.value}"); string readBackVal = ""; switch (item.uid) @@ -738,10 +738,10 @@ namespace IOB_WIN break; default: break; - } - // SE non corrispondessero LOGGO ERRORE... - if (item.value != readBackVal) - { + } + // SE non corrispondessero LOGGO ERRORE... + if (item.value != readBackVal) + { lgError($"Errore in plcWriteParams: uid {item.uid} | Wrote {item.value} | ReadBack {readBackVal}"); } } @@ -781,40 +781,40 @@ namespace IOB_WIN OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.DM, 0, 8, out memReadDM); OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.WR, 0, 8, out memReadWR); - if (utils.CRB("verbose")) - { - lgInfo("Effettuata lettura dati CIO"); - foreach (var item in memReadCIO_IN) - { - lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); - } - lgInfo("Effettuata lettura dati DM"); - foreach (var item in memReadDM) - { - lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); - } - lgInfo("Effettuata lettura dati WR"); - foreach (var item in memReadWR) - { - lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); + if (isVerboseLog) + { + lgInfo("Effettuata lettura dati CIO"); + foreach (var item in memReadCIO_IN) + { + lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); + } + lgInfo("Effettuata lettura dati DM"); + foreach (var item in memReadDM) + { + lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); + } + lgInfo("Effettuata lettura dati WR"); + foreach (var item in memReadWR) + { + lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); } } short[] respDM20; short[] respDM22; OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.DM, 20, 2, out respDM20); OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.DM, 22, 2, out respDM22); - if (utils.CRB("verbose")) - { - // legge delle coppie di valori INT, vanno trasformati in HEX e POI accodati, dove il primo è x 1 e il secondo x 10000 (in pratica va in testa) - lgInfo("Effettuata lettura dati respDM20"); - foreach (var item in respDM20) - { - lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); - } - lgInfo("Effettuata lettura dati respDM22"); - foreach (var item in respDM22) - { - lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); + if (isVerboseLog) + { + // legge delle coppie di valori INT, vanno trasformati in HEX e POI accodati, dove il primo è x 1 e il secondo x 10000 (in pratica va in testa) + lgInfo("Effettuata lettura dati respDM20"); + foreach (var item in respDM20) + { + lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); + } + lgInfo("Effettuata lettura dati respDM22"); + foreach (var item in respDM22) + { + lgInfo($"Valori: {item} --> {baseUtils.binaryForm(item)}"); } } } diff --git a/IOB-WIN/IobSiemens.cs b/IOB-WIN/IobSiemens.cs index 2da971eb..61b8cba3 100644 --- a/IOB-WIN/IobSiemens.cs +++ b/IOB-WIN/IobSiemens.cs @@ -818,7 +818,7 @@ namespace IOB_WIN { currPLC = new Plc(parametri.tipoCpu, parametri.ipAdrr, parametri.rack, parametri.slot); // disconnetto e connetto... - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("SIEMENS: tryDisconnect"); } @@ -829,7 +829,7 @@ namespace IOB_WIN lgInfo("SIEMENS: tryConnect"); tryConnect(); lgInfo("End init Adapter SIEMENS"); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("S7+ CONNESSIONE AVVENUTA"); } @@ -1048,7 +1048,7 @@ namespace IOB_WIN { memAreaSiemens areaCounter = new memAreaSiemens(memAddr); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[0] area memoria: {1}.{2}.{3}", memAddr, areaCounter.DbNum, areaCounter.indiceMem, areaCounter.tipoMem); } @@ -1076,7 +1076,7 @@ namespace IOB_WIN } // salvo... Int32.TryParse(outputVal.ToString(), out lastCountCNC); - if (utils.CRB("verbose")) + if (isVerboseLog) { lgInfo("[2] outputVal contapezzi: {0}", outputVal); lgInfo("[3] lastCountCNC contapezzi: {0}", lastCountCNC); diff --git a/Jenkinsfile b/Jenkinsfile index a25b5fc8..0ff6591c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=575']) { + withEnv(['NEXT_BUILD_NUMBER=576']) { // env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'