diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index fe4017f2..a585bd82 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() + { + // se ho contapezzi OLTRE limite... + while (lastCountCNC > contapezzi + minSendPzCountBlock) + { + pzCntReload(true); + // provo invio + trySendPzCountBlock(); + // aspetto x dare tempo calcolo + Thread.Sleep(300); + //// rileggo + //pzCntReload(true); + } + } + /// /// Effettua ciclo controllo richieste server /// @@ -3161,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) @@ -3180,12 +3205,6 @@ namespace IOB_WIN int.TryParse(resp, out qtyAdded); if (qtyAdded > 0) { - // 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..1571aba3 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,16 @@ namespace IOB_WIN B_input += (1 << 2); sigPzCount = true; contapezzi++; + // invio conferma contapezzi.. + string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); } else { + string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}"); sigPzCount = false; } } - + lgInfo($"S01: Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } } } @@ -357,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) { @@ -386,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) { 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'