From 389092cbb84f9d83ed415f9579d2112051107ca4 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 20 Dec 2019 11:28:03 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Ok=20modifica=20modalit=C3=A0=20invio=20pez?= =?UTF-8?q?zi=20e=20eventi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IOB-WIN/IobGeneric.cs | 37 +++++++++++++++++++++++++++++-------- IOB-WIN/IobSimula.cs | 8 ++++++-- Jenkinsfile | 2 +- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index fe4017f2..a97459eb 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -1296,6 +1297,7 @@ namespace IOB_WIN // verifico SE posso inviare dati if (checkIobEnabled) { + currDispData.semOut = Semaforo.SV; // verificare come gestire il task secondario senza interferenza (chiamate update su FORM da thread secondari danno errori) if (utils.CRB("sendDataByThread")) { @@ -1306,9 +1308,16 @@ namespace IOB_WIN else { // gestione queue SignalIN (invio, display) - svuotaCodaSignIN(); + svuotaCodaSignIN(); + currDispData.counter = contapezzi; + raiseRefresh(currDispData); + // provo a svuotare coda contapezzi + svuotaCodaContapezzi(); + currDispData.counter = contapezzi; + raiseRefresh(currDispData); // gestione queue FluxLog (invio, display) - svuotaCodaFLog(); + svuotaCodaFLog(); + raiseRefresh(currDispData); } } else @@ -1333,11 +1342,27 @@ namespace IOB_WIN } catch (Exception exc) { + lgError($"Errore in fase trySendValues{Environment.NewLine}{exc}"); currDispData.semOut = Semaforo.SR; } raiseRefresh(currDispData); - } - + } + + private void svuotaCodaContapezzi() + { + pzCntReload(true); + // se ho contapezzi OLTRE limite... + while (lastCountCNC > contapezzi + maxSendPzCountBlock) + { + // provo invio + trySendPzCountBlock(); + // aspetto x dare tempo calcolo + Thread.Sleep(300); + // rileggo + pzCntReload(true); + } + } + /// /// Effettua ciclo controllo richieste server /// @@ -3182,10 +3207,6 @@ namespace IOB_WIN { // rileggo qta da server... pzCntReload(true); -#if false - // incremento il contapezzi della quantità restituita e confermata - contapezzi += qtyAdded; -#endif lgInfo($"Inviato incremento contapezzi: send {numIncr} | resp {qtyAdded}"); // invio conferma contapezzi.. string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs index 080ecd06..e0968aba 100644 --- a/IOB-WIN/IobSimula.cs +++ b/IOB-WIN/IobSimula.cs @@ -285,7 +285,6 @@ namespace IOB_WIN if ((lastCountCNC - contapezzi) > minSendPzCountBlock) { trySendPzCountBlock(); - lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); sigPzCount = false; } // altrimenti invio 1 segnale @@ -298,13 +297,18 @@ namespace IOB_WIN B_input += (1 << 2); sigPzCount = true; contapezzi++; + // invio conferma contapezzi.. + string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); } else { + // rileggo qta da server... + pzCntReload(true); + string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); sigPzCount = false; } } - + lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } } } diff --git a/Jenkinsfile b/Jenkinsfile index 92e959f9..53b27653 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=610']) { + withEnv(['NEXT_BUILD_NUMBER=611']) { // env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' From 3cd0d744d56afef91e8b6c65a1ce623c968e66a1 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 20 Dec 2019 11:58:18 +0100 Subject: [PATCH 2/2] Correzione reinvii --- IOB-WIN/IobGeneric.cs | 14 ++++++-------- IOB-WIN/IobSimula.cs | 8 +++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index a97459eb..a585bd82 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -1350,16 +1350,16 @@ namespace IOB_WIN private void svuotaCodaContapezzi() { - pzCntReload(true); // se ho contapezzi OLTRE limite... - while (lastCountCNC > contapezzi + maxSendPzCountBlock) + while (lastCountCNC > contapezzi + minSendPzCountBlock) { + pzCntReload(true); // provo invio trySendPzCountBlock(); // aspetto x dare tempo calcolo Thread.Sleep(300); - // rileggo - pzCntReload(true); + //// rileggo + //pzCntReload(true); } } @@ -3186,8 +3186,8 @@ namespace IOB_WIN // verifico se la funzione SIA abilitata if (enableSendPzCountBlock) { - // rileggo qta da server... - pzCntReload(true); + //// rileggo qta da server... + //pzCntReload(true); int delta = lastCountCNC - contapezzi; // se è abilitata verifico differenza: se ho DELTA > minSendPzCountBlock --> invio un blocco <= maxSendPzCountBlock if (delta > minSendPzCountBlock) @@ -3205,8 +3205,6 @@ namespace IOB_WIN int.TryParse(resp, out qtyAdded); if (qtyAdded > 0) { - // rileggo qta da server... - pzCntReload(true); lgInfo($"Inviato incremento contapezzi: send {numIncr} | resp {qtyAdded}"); // invio conferma contapezzi.. string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs index e0968aba..1571aba3 100644 --- a/IOB-WIN/IobSimula.cs +++ b/IOB-WIN/IobSimula.cs @@ -302,13 +302,11 @@ namespace IOB_WIN } else { - // rileggo qta da server... - pzCntReload(true); string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); sigPzCount = false; } } - lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); + lgInfo($"S01: Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } } } @@ -361,8 +359,8 @@ namespace IOB_WIN if (!isMulti) { lastCountCNC += delta; + lgInfo($"S01: Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } - lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); // SOLO SE sono online... if (IobOnline) { @@ -390,7 +388,7 @@ namespace IOB_WIN sendContapezzi = true; // registro contapezzi contapezzi++; - lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); + lgInfo($"S01 Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } if (sendContapezzi) {