From 53fd77bb8d582a109404499e9da79301efd29029 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 1 Jul 2021 17:50:58 +0200 Subject: [PATCH] aggiunto try-catch x decifrare status --- AppData/ComLib.cs | 2 +- NKC_WF/WebUserControls/cmp_MachSem.ascx | 20 +++---- NKC_WF/WebUserControls/cmp_MachSem.ascx.cs | 62 ++++++---------------- 3 files changed, 28 insertions(+), 56 deletions(-) diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs index 7cd288b..3a8468e 100644 --- a/AppData/ComLib.cs +++ b/AppData/ComLib.cs @@ -297,7 +297,7 @@ namespace AppData // forzo (ri)lettura... tabPlace = DLMan.taPlac.GetData(); rawData = JsonConvert.SerializeObject(tabPlace); - memLayer.ML.setRSV(redProdMachList, rawData, 600); + memLayer.ML.setRSV(redProdMachList, rawData); } // cerco di nuovoitem foundItem = tabPlace.Where(x => x.PlaceCod == machine).ToList(); diff --git a/NKC_WF/WebUserControls/cmp_MachSem.ascx b/NKC_WF/WebUserControls/cmp_MachSem.ascx index 5222e0a..c38c808 100644 --- a/NKC_WF/WebUserControls/cmp_MachSem.ascx +++ b/NKC_WF/WebUserControls/cmp_MachSem.ascx @@ -2,15 +2,15 @@ - - - + + + - - - + + +
@@ -23,23 +23,23 @@ -
+
 <%: hfMachine.Value %>
-
+
 <%: traduci("print") %> | <%: hfCode01.Value %>
<%: hfStat01.Value %>
-
+
 <%: traduci("CNC") %> | <%: hfCode02.Value %>
<%: hfStat02.Value %>
-
+
 <%: traduci("unload") %> | <%: hfCode03.Value %>
<%: hfStat03.Value %>
diff --git a/NKC_WF/WebUserControls/cmp_MachSem.ascx.cs b/NKC_WF/WebUserControls/cmp_MachSem.ascx.cs index a63fdac..409c0cb 100644 --- a/NKC_WF/WebUserControls/cmp_MachSem.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MachSem.ascx.cs @@ -69,17 +69,22 @@ namespace NKC_WF.WebUserControls { // recupero dati DS_App.StatusDecodeRow thisState = null; - var currInfo = currState.Where(x => x.Machine == currMachine).FirstOrDefault(); - var lastState = currInfo.Records.Where(x => x.Station == name).OrderByDescending(x => x.DtRecord).FirstOrDefault(); - if (lastState == null) + try { - // aggiungo ND - } - else - { - // verifico la decodifica x ognuno - thisState = ComLib.checkStationDecode(name, lastState.Code); + var currInfo = currState.Where(x => x.Machine == currMachine).FirstOrDefault(); + var lastState = currInfo.Records.Where(x => x.Station == name).OrderByDescending(x => x.DtRecord).FirstOrDefault(); + if (lastState == null) + { + // aggiungo ND + } + else + { + // verifico la decodifica x ognuno + thisState = ComLib.checkStationDecode(name, lastState.Code); + } } + catch + { } return thisState; } @@ -118,13 +123,13 @@ namespace NKC_WF.WebUserControls { // verifico status delle 3 parti e mostro relativo semaforo... hfCode01.Value = "00"; - hfCss01.Value = "dark"; + hfCss01.Value = "secondary"; hfStat01.Value = "UNKNOWN"; hfCode02.Value = "00"; - hfCss02.Value = "dark"; + hfCss02.Value = "secondary"; hfStat02.Value = "UNKNOWN"; hfCode03.Value = "00"; - hfCss03.Value = "dark"; + hfCss03.Value = "secondary"; hfStat03.Value = "UNKNOWN"; // leggo da redis lo status @@ -154,39 +159,6 @@ namespace NKC_WF.WebUserControls hfCss03.Value = state03.Css; hfStat03.Value = state03.Descript; } - - // imposto nuovi eventi FAKE... - - //// FIXME TODO: fake.... - //DateTime adesso = DateTime.Now; - //int numsec = adesso.Second; - //hfCss01.Value = "success"; - //hfCss02.Value = "warning"; - //hfCss03.Value = "danger"; - //hfStat01.Value = $"{adesso.Second - 1 % 10:00}"; - //hfStat02.Value = $"{adesso.Second + 3 % 10:00}"; - //hfStat03.Value = $"{adesso.Second + 1 % 10:00}"; - //switch (numsec % 3) - //{ - // case 1: - // hfCss01.Value = "warning"; - // hfCss02.Value = "danger"; - // hfCss03.Value = "success"; - // break; - - // case 2: - // hfCss01.Value = "danger"; - // hfCss02.Value = "success"; - // hfCss03.Value = "warning"; - // break; - - // case 0: - // default: - // hfCss01.Value = "success"; - // hfCss02.Value = "warning"; - // hfCss03.Value = "danger"; - // break; - //} } #endregion Public Methods