diff --git a/IOB-WIN/DATA/CONF/EM63.json b/IOB-WIN/DATA/CONF/EM63.json index e0bcf46f..f8f9aceb 100644 --- a/IOB-WIN/DATA/CONF/EM63.json +++ b/IOB-WIN/DATA/CONF/EM63.json @@ -108,7 +108,7 @@ "RetrySec": 30, "SessionName": "SESS0004", "SessionType": "GetStatus", - "ValidityMinutes": 1.0, + "ValidityMinutes": 5.0, "Max2Keep": 120, "StepOrder": 4, "FileList": [ @@ -128,7 +128,7 @@ "RetrySec": 30, "SessionName": "SESS0005", "SessionType": "GetProduction", - "ValidityMinutes": 1.0, + "ValidityMinutes": 5.0, "Max2Keep": 120, "StepOrder": 5, "FileList": [ diff --git a/IOB-WIN/IobFileEurom63.cs b/IOB-WIN/IobFileEurom63.cs index 2cbd8f94..a4631db4 100644 --- a/IOB-WIN/IobFileEurom63.cs +++ b/IOB-WIN/IobFileEurom63.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; @@ -41,12 +42,6 @@ namespace IOB_WIN /// protected int maxDelaySec = 59; - #endregion Protected Fields - - //protected int maxDelaySec = 3600 * 24; - - #region Public Constructors - /// /// Estende l'init della classe base... /// @@ -57,7 +52,7 @@ namespace IOB_WIN lgInfo("INIT IobFileEurom63"); appPath = Path.GetDirectoryName(Application.ExecutablePath); #if DEBUG - maxDelaySec = 60 * 24; + maxDelaySec = 60*60 * 24; #endif } @@ -79,7 +74,7 @@ namespace IOB_WIN if (!currSession.Active || currSession.SessionValidUntil < adesso) { // elimino TUTTE le risposte... - cleanupResp(); + cleanupResp(currSession.SessionName); // imposto livello... actLevel = Eurom63.ComLevel.ChannelOk; } @@ -358,8 +353,10 @@ namespace IOB_WIN default: break; } - - lgInfo("DONE checkCommStatus"); + if (utils.CRB("verbose")) + { + lgInfo($"DONE checkCommStatus | actLevel {actLevel}"); + } raiseRefresh(currDispData); } @@ -379,6 +376,7 @@ namespace IOB_WIN } } +#if false /// /// Pulizia folder da tutti i file RSP /// @@ -390,6 +388,7 @@ namespace IOB_WIN File.Delete(file); } } +#endif /// /// Pulizia folder dai file RSP della sessione @@ -482,13 +481,26 @@ namespace IOB_WIN string fileName = $"{BaseDir}\\{sessProd.SessionName}.DAT"; if (File.Exists(fileName)) { +#if false // leggo il file... string[] rawLines = File.ReadAllLines(fileName); int numRow = rawLines.Length; +#endif + + string rawData = ""; + using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + using (var textReader = new StreamReader(fileStream)) + { + rawData = textReader.ReadToEnd(); + } + // ora splitto in linee + string[] rawLines = Regex.Split(rawData, "\r\n|\r|\n"); + int numRow = rawLines.Length; + // devo avere almeno 2 righe... if (numRow >= 2) { - string[] statusData = rawLines[numRow - 1].Split(','); + string[] statusData = rawLines[1].Split(','); currPzCount = statusData[2].Trim(); // salvo se valido if (!string.IsNullOrEmpty(currPzCount)) @@ -608,13 +620,26 @@ namespace IOB_WIN string fileName = $"{BaseDir}\\{sessStatus.SessionName}.DAT"; if (File.Exists(fileName)) { +#if false // leggo il file... string[] rawLines = File.ReadAllLines(fileName); int numRow = rawLines.Length; +#endif + + string rawData = ""; + using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + using (var textReader = new StreamReader(fileStream)) + { + rawData = textReader.ReadToEnd(); + } + // ora splitto in linee + string[] rawLines = Regex.Split(rawData, "\r\n|\r|\n"); + int numRow = rawLines.Length; + // devo avere almeno 2 righe... if (numRow >= 2) { - string[] statusData = rawLines[numRow - 1].Split(','); + string[] statusData = rawLines[1].Split(','); currStatus = statusData[2].Trim(); if (!string.IsNullOrEmpty(currStatus)) { diff --git a/Jenkinsfile b/Jenkinsfile index 7b369ebf..6584cc93 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=710']) { + withEnv(['NEXT_BUILD_NUMBER=711']) { // env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'