From 3682d73e45eaccdb622645beab15825e3f1b85ef Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 9 Oct 2020 13:54:51 +0200 Subject: [PATCH 1/4] Update processo avvio sessioni --- IOB-WIN/DATA/CONF/EM63.json | 8 ++++---- IOB-WIN/IobFileEurom63.cs | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/IOB-WIN/DATA/CONF/EM63.json b/IOB-WIN/DATA/CONF/EM63.json index fc33289f..04b762c6 100644 --- a/IOB-WIN/DATA/CONF/EM63.json +++ b/IOB-WIN/DATA/CONF/EM63.json @@ -30,7 +30,7 @@ "Cycle": false, "Description": "Check Connection Status", "Max2Keep": 10, - "RetrySec": 30, + "RetrySec": 20, "SessionName": "SESS0000", "SessionType": "IsConnected", "StepOrder": 0, @@ -46,7 +46,7 @@ "Cycle": false, "Description": "Get ID data", "Max2Keep": 10, - "RetrySec": 30, + "RetrySec": 20, "SessionName": "SESS0001", "SessionType": "GetId", "StepOrder": 1, @@ -65,7 +65,7 @@ "2": { "Cycle": false, "Description": "Set DateTime on machine at start", - "RetrySec": 30, + "RetrySec": 20, "SessionName": "SESS0002", "SessionType": "SetDateTime", "ValidityMinutes": 0.0, @@ -85,7 +85,7 @@ "3": { "Cycle": false, "Description": "Abort All prev requests", - "RetrySec": 30, + "RetrySec": 20, "SessionName": "SESS0003", "SessionType": "AbortAll", "ValidityMinutes": 0.0, diff --git a/IOB-WIN/IobFileEurom63.cs b/IOB-WIN/IobFileEurom63.cs index 676df71d..25b83221 100644 --- a/IOB-WIN/IobFileEurom63.cs +++ b/IOB-WIN/IobFileEurom63.cs @@ -103,6 +103,23 @@ namespace IOB_WIN /// /// /// + protected bool checkRequest(Eurom63.Session session) + { + bool answ = false; + string fileName = ""; + if (session != null) + { + fileName = $"{BaseDir}\\{session.SessionName}.REQ"; + answ = File.Exists(fileName); + } + return answ; + } + + /// + /// Verifica se ci sia una risposta POSITIVA + /// + /// + /// protected bool checkResp(Eurom63.Session session) { bool answ = false; @@ -122,11 +139,6 @@ namespace IOB_WIN rawData = textReader.ReadToEnd(); } answ = rawData.Contains(session.RespOk); - if (!answ) - { - // se NON ok faccio pulizia... - cleanupSession(session); - } } } return answ; @@ -212,7 +224,7 @@ namespace IOB_WIN { DateTime adesso = DateTime.Now; // evito di richiedere SE non fosse già scaduta richiesta... - if (adesso > connectSession.RetryVeto) + if (adesso > connectSession.RetryVeto || !checkRequest(connectSession)) { // pulisco eventuali risp vecchie cleanupResp(connectSession.SessionName); From 70f896c7a87b75378fc4b72c14df2d71b1d6226b Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 9 Oct 2020 13:55:15 +0200 Subject: [PATCH 2/4] New release --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 23624676..695e558d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=720']) { + withEnv(['NEXT_BUILD_NUMBER=721']) { // 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' From e5e75f6098d06a95ef3f836e501492ffef47c23e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 9 Oct 2020 14:06:13 +0200 Subject: [PATCH 3/4] =?UTF-8?q?modifica=20modalit=C3=A0=20richiesta=20iniz?= =?UTF-8?q?iale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IOB-WIN/IobFileEurom63.cs | 35 +++++++++++++++++++++++++---------- Jenkinsfile | 2 +- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/IOB-WIN/IobFileEurom63.cs b/IOB-WIN/IobFileEurom63.cs index 25b83221..344af662 100644 --- a/IOB-WIN/IobFileEurom63.cs +++ b/IOB-WIN/IobFileEurom63.cs @@ -85,6 +85,25 @@ namespace IOB_WIN } } + /// + /// Effettua copia file richeiste + update timing + /// + /// + /// + private void copyRequestFiles(Eurom63.Session connectSession, DateTime adesso) + { + // processo richiesta + processSessionFile(connectSession); + if (adesso > connectSession.SessionValidUntil) + { + connectSession.Active = !connectSession.Cycle; + } + connectSession.Passed = false; + connectSession.SessionStarted = adesso; + connectSession.SessionValidUntil = adesso.AddMinutes(connectSession.ValidityMinutes); + connectSession.RetryVeto = adesso.AddSeconds(connectSession.RetrySec); + } + #endregion Private Methods #region Protected Methods @@ -219,6 +238,11 @@ namespace IOB_WIN connectSession.Active = connectSession.Cycle; connectSession.Passed = true; } + // verifico SE ci sia la richeista sennò la chiedo... + else if (!checkRequest(connectSession)) + { + copyRequestFiles(connectSession, adesso); + } // richiedo SE non ci fosse i dati CONNECT... else { @@ -228,16 +252,7 @@ namespace IOB_WIN { // pulisco eventuali risp vecchie cleanupResp(connectSession.SessionName); - // processo richiesta - processSessionFile(connectSession); - if (adesso > connectSession.SessionValidUntil) - { - connectSession.Active = !connectSession.Cycle; - } - connectSession.Passed = false; - connectSession.SessionStarted = adesso; - connectSession.SessionValidUntil = adesso.AddMinutes(connectSession.ValidityMinutes); - connectSession.RetryVeto = adesso.AddSeconds(connectSession.RetrySec); + copyRequestFiles(connectSession, adesso); } } } diff --git a/Jenkinsfile b/Jenkinsfile index 695e558d..78d5fa16 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=721']) { + withEnv(['NEXT_BUILD_NUMBER=722']) { // 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' From 9fff07135df92b5ddc30ad4586b86d503896961a Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 9 Oct 2020 14:34:02 +0200 Subject: [PATCH 4/4] commentato un cleanup in arresto job old --- IOB-WIN/IobFileEurom63.cs | 6 ++++-- Jenkinsfile | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/IOB-WIN/IobFileEurom63.cs b/IOB-WIN/IobFileEurom63.cs index 344af662..a379f428 100644 --- a/IOB-WIN/IobFileEurom63.cs +++ b/IOB-WIN/IobFileEurom63.cs @@ -113,8 +113,10 @@ namespace IOB_WIN var nextLevel = Eurom63.ComLevel.ChannelOk; var connectSession = confE63.ActiveSessions[3]; processSession(nextLevel, ref connectSession); +#if false // qui per sicurezza PULISCE TUTTO - cleanupFolder(); + cleanupFolder(); +#endif } /// @@ -225,6 +227,7 @@ namespace IOB_WIN { // controllo esistenza directory --> segno connected... connectionOk = Directory.Exists(BaseDir); + DateTime adesso = DateTime.Now; if (connectionOk) { // verifico se ci sia risp CONNECT @@ -246,7 +249,6 @@ namespace IOB_WIN // richiedo SE non ci fosse i dati CONNECT... else { - DateTime adesso = DateTime.Now; // evito di richiedere SE non fosse già scaduta richiesta... if (adesso > connectSession.RetryVeto || !checkRequest(connectSession)) { diff --git a/Jenkinsfile b/Jenkinsfile index 78d5fa16..b519a38b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=722']) { + withEnv(['NEXT_BUILD_NUMBER=723']) { // 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'