diff --git a/CVCncLib/testSam.dll b/CVCncLib/testSam.dll index 532646be..43028d01 100644 Binary files a/CVCncLib/testSam.dll and b/CVCncLib/testSam.dll differ diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index 8bf0dc1a..81e14e38 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -449,6 +449,10 @@ namespace IOB_WIN } } /// + /// Data/ora ultima volta che IOB è stato dichairato online + /// + public DateTime lastIobOnline = DateTime.Now.AddHours(-1); + /// /// Dizionario di VC da trattare come TimeSeries (con conf decodificata + processing successivo...) /// protected Dictionary TSVC_Data = new Dictionary(); @@ -978,7 +982,7 @@ namespace IOB_WIN { // NON AGGIORNO contapezzi = lastCountCNC; - lgInfo(string.Format("Errore lettura ODL: {0} - uso lastCountCNC --> {1}", lastIdxODL, contapezzi)); + lgInfo($"Errore lettura ODL (vuoto) resta tutto invariato contapezzi: {contapezzi} | lastCountCNC {lastCountCNC}"); } else { @@ -2759,6 +2763,7 @@ namespace IOB_WIN { // non controllo x meno... dtVetoCheckIOB = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 5); + lastIobOnline = DateTime.Now; } } catch @@ -3143,9 +3148,7 @@ namespace IOB_WIN /// - invio in blocco pezzi /// - aggiornamento del contapezzi (passato come ref) x nuovo valore post invio /// - /// - /// - public void trySendPzCountBlock(ref int contapezzi, int lastCountCNC) + public void trySendPzCountBlock() { // in primis HA SENSO procedere SOLO SE server MP è Online... if (MPOnline) @@ -3155,10 +3158,12 @@ namespace IOB_WIN { int numIncr = 0; int qtyAdded = 0; - int delta = lastCountCNC - contapezzi; // verifico se la funzione SIA abilitata if (enableSendPzCountBlock) { + // 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) { @@ -3175,8 +3180,12 @@ 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; + contapezzi += qtyAdded; +#endif lgInfo($"Inviato incremento contapezzi: send {numIncr} | resp {qtyAdded}"); } } @@ -3974,6 +3983,12 @@ namespace IOB_WIN if (answ.Contains("OK")) { currDispData.semOut = Semaforo.SV; + // se oltre 1 min NON era online --> check pezzi! + if (DateTime.Now.Subtract(lastIobOnline).TotalMinutes > 1) + { + pzCntReload(true); + } + lastIobOnline = DateTime.Now; } else { @@ -4040,6 +4055,12 @@ namespace IOB_WIN string answ = callUrl(lastUrl, false); // loggo! lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ)); + // se oltre 1 min NON era online --> check pezzi! + if (DateTime.Now.Subtract(lastIobOnline).TotalMinutes > 1) + { + pzCntReload(true); + } + lastIobOnline = DateTime.Now; // se "OK" verde, altrimenti errore --> ROSSO if (answ == "OK") { diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs index 984e9015..bb0baed8 100644 --- a/IOB-WIN/IobSiemensTorri.cs +++ b/IOB-WIN/IobSiemensTorri.cs @@ -208,7 +208,7 @@ namespace IOB_WIN // verifico se variato contapezzi... e se passato ritardo minimo... if ((lastCountCNC - contapezzi) > minSendPzCountBlock) { - trySendPzCountBlock(ref contapezzi, lastCountCNC); + trySendPzCountBlock(); // salvo nuovo contapezzi (incremento di 1...) contapezzi++; // salvo in semaforo! diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs index 9a7454f7..d27fd014 100644 --- a/IOB-WIN/IobSimula.cs +++ b/IOB-WIN/IobSimula.cs @@ -277,7 +277,7 @@ namespace IOB_WIN // invio SOLO SE sono OLTRE i numSim pz e li invio TUTTI in blocco if ((lastCountCNC - contapezzi) > minSendPzCountBlock) { - trySendPzCountBlock(ref contapezzi, lastCountCNC); + trySendPzCountBlock(); lgInfo($"Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}"); } } @@ -325,9 +325,9 @@ namespace IOB_WIN } else if (bit2.wait <= 0) { - // salvo nuovo contapezziPLC (incremento RAND 0..3) + // salvo nuovo contapezziPLC (incremento RAND 0..5) var rand = new Random(); - int delta = rand.Next(0, 3); + int delta = rand.Next(1, 5); if (!isMulti) { lastCountCNC += delta; @@ -344,8 +344,12 @@ namespace IOB_WIN // se NON Multi fa contapezzi... else { - // segnalo BIT (1 pz) - B_input += (1 << 2); + // SE NON SONO GIA' OLTRE il contapezzi + if (contapezzi < lastCountCNC) + { + // segnalo BIT (1 pz) + B_input += (1 << 2); + } } // decremento duration bit2.duration--; diff --git a/Jenkinsfile b/Jenkinsfile index 21efa889..dcfd3945 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=608']) { + withEnv(['NEXT_BUILD_NUMBER=609']) { // 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'