diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 0caf6a62..34f9281d 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -980,16 +980,29 @@ namespace IOB_MAN } } } - else if (this.dgvManagedItems.Columns[e.ColumnIndex].Name == "plcOk") + else if (this.dgvManagedItems.Columns[e.ColumnIndex].Name == "lastPlcRead") { if (e.Value != null) { - bool isOk = false; - bool.TryParse(e.Value.ToString(), out isOk); - if (!isOk) + DateTime adesso = DateTime.Now; + DateTime lastRead = adesso.AddMinutes(-60); + DateTime.TryParse(e.Value.ToString(), out lastRead); + if (Math.Abs(adesso.Subtract(lastRead).TotalSeconds) > 180) { e.CellStyle.BackColor = Color.Red; } + else if (Math.Abs(adesso.Subtract(lastRead).TotalSeconds) > 120) + { + e.CellStyle.BackColor = Color.OrangeRed; + } + else if (Math.Abs(adesso.Subtract(lastRead).TotalSeconds) > 60) + { + e.CellStyle.BackColor = Color.Yellow; + } + else if (Math.Abs(adesso.Subtract(lastRead).TotalSeconds) > 15) + { + e.CellStyle.BackColor = Color.YellowGreen; + } else { e.CellStyle.BackColor = Color.White; diff --git a/IOB-MAN/iobAdapt.cs b/IOB-MAN/iobAdapt.cs index f8f95c6b..3ecb2b9f 100644 --- a/IOB-MAN/iobAdapt.cs +++ b/IOB-MAN/iobAdapt.cs @@ -88,19 +88,6 @@ namespace IOB_MAN } } /// - /// Determina se sia OK la comunicazione con il PLC, cioè non sia FERMO nella comunicazione per > 5 minuti - /// - [DisplayName("PlcOk")] - public bool plcOk - { - get - { - DateTime adesso = DateTime.Now; - bool plcOnline = Math.Abs(adesso.Subtract(currIobStatus.lastDataIn).TotalSeconds) < 300; - return plcOnline; - } - } - /// /// Counter dell'IOB /// [DisplayName("pz.IOB")] @@ -144,6 +131,31 @@ namespace IOB_MAN return currIobStatus.queueFlLen; } } + /// + /// Ultima data-ora di comunicazione calida con PLC + /// + [DisplayName("Last PLC read")] + public DateTime lastPlcRead + { + get + + { + return currIobStatus.lastDataIn; + } + } + /// + /// Determina se sia OK la comunicazione con il PLC, cioè non sia FERMO nella comunicazione per > 5 minuti + /// + [DisplayName("PlcOk")] + public bool plcOk + { + get + { + DateTime adesso = DateTime.Now; + bool plcOnline = Math.Abs(adesso.Subtract(currIobStatus.lastDataIn).TotalSeconds) < 300; + return plcOnline; + } + } } } diff --git a/Jenkinsfile b/Jenkinsfile index 64ffcc81..adb1fe3f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=686']) { + withEnv(['NEXT_BUILD_NUMBER=687']) { // 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'