diff --git a/CVCncLib/CVCncLib.dll b/CVCncLib/CVCncLib.dll index 2b661b51..2f280067 100644 Binary files a/CVCncLib/CVCncLib.dll and b/CVCncLib/CVCncLib.dll differ diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 34f9281d..62d31704 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using SteamWare.Logger; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Configuration; using System.Diagnostics; using System.Drawing; @@ -200,7 +201,6 @@ namespace IOB_MAN private void ElencoIOB_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { - //updateStatus(); } private void ElencoIOB_AddingNew(object sender, System.ComponentModel.AddingNewEventArgs e) @@ -274,7 +274,8 @@ namespace IOB_MAN /// Avvio di un child process da parametro ARG /// /// - private void startChildProc(string procArg) + /// + private void startChildProc(string procArg, int indice = -1) { ProcessStartInfo psi = null; // da testare x aprire chiudere risorsa... @@ -296,9 +297,15 @@ namespace IOB_MAN newIob.startTime = adesso; newIob.pID = p.Id; newIob.isRunning = true; - // aggiungo a datasource - ElencoIOB.Add(newIob); - + // aggiungo a datasource, se indice -1 aggiungendo e basta, altrimenti alla posizione richiesta... + if (indice == -1) + { + ElencoIOB.Add(newIob); + } + else + { + ElencoIOB.Insert(indice, newIob); + } utils.lgInfo($"Avviato child process per {procArg} | pid: {p.Id}"); } @@ -449,21 +456,23 @@ namespace IOB_MAN private void processAutoRestart() { // verifico se ci siano processi (da ARGS LIST) NON running --> li riavvio! - List proc2restart = new List(); - List proc2close = new List(); + Dictionary proc2restart = new Dictionary(); + Dictionary proc2close = new Dictionary(); + int indice = 0; foreach (iobAdapt item in ElencoIOB.List) { // se NON comunica da troppo (ultima comunicazione è > 5 minuti fa...) if (!item.plcOk) { - proc2close.Add(item); + proc2close.Add(indice, item); } // se NON E' running if (!item.isRunning) { // segno da eliminare e riavviare - proc2restart.Add(item); + proc2restart.Add(indice, item); } + indice++; } // SE abilitato autorestart... @@ -473,26 +482,26 @@ namespace IOB_MAN foreach (var item in proc2close) { ElencoIOB.Remove(item); - utils.lgInfo($"Chiusura processo non in PLC-Online | IOB: {item.CodIOB} | pid: {item.pID}"); + utils.lgInfo($"Chiusura processo non in PLC-Online | IOB: {item.Value.CodIOB} | pid: {item.Value.pID}"); // chiudo! - closeSingleChild(item); + closeSingleChild(item.Value); } foreach (var item in proc2close) { // riavvio! - startChildProc(item.CodIOB); + startChildProc(item.Value.CodIOB, item.Key); } // se ho da riavviare... elimino! - foreach (var item in proc2restart) + foreach (var dictVal in proc2restart) { - ElencoIOB.Remove(item); - utils.lgInfo($"Chiusura processo non in running | IOB: {item.CodIOB} | pid: {item.pID}"); + ElencoIOB.Remove(dictVal.Value); + utils.lgInfo($"Chiusura processo non in running | IOB: {dictVal.Value.CodIOB} | pid: {dictVal.Value.pID}"); } // li faccio ripartire! foreach (var item in proc2restart) { - startChildProc(item.CodIOB); + startChildProc(item.Value.CodIOB, item.Key); } // update! @@ -743,8 +752,6 @@ namespace IOB_MAN int pid = -1; if (e.RowIndex >= 0) { - //dgvManagedItems.CurrentCell = dgvManagedItems.Rows[e.RowIndex].Cells[0]; - dgvManagedItems.Rows[e.RowIndex].Selected = true; using (var riga = dgvManagedItems.Rows[e.RowIndex]) { @@ -1078,7 +1085,7 @@ namespace IOB_MAN // verifico che sia già chiuso... if (((iobAdapt)ElencoIOB[riga.Index]).isRunning == false) { - startChildProc(((iobAdapt)ElencoIOB[riga.Index]).CodIOB); + startChildProc(((iobAdapt)ElencoIOB[riga.Index]).CodIOB, riga.Index); // rimuovo vecchia riga... ElencoIOB.RemoveAt(riga.Index); } diff --git a/Jenkinsfile b/Jenkinsfile index adb1fe3f..f7f35e40 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=687']) { + withEnv(['NEXT_BUILD_NUMBER=688']) { // env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'