Aggiunta decodifica watchdog

This commit is contained in:
Samuele E. Locatelli
2021-07-20 19:13:03 +02:00
parent 6f8dc47293
commit 385bf15d22
4 changed files with 57 additions and 29 deletions
+28 -5
View File
@@ -66,6 +66,7 @@ namespace AppData
public static string redProdMachClock = "NKC:PROD:MACH:CLOCK";
public static string redProdMachList = "NKC:PROD:MACH:LIST";
public static string redProdMachStateData = "NKC:PROD:MACH:STATE";
public static string redProdMachStateLive = "NKC:PROD:MACH:LIVE";
public static string redProdReq = "NKC:SERV:BUNKS";
public static string redProdStatDec = "NKC:PROD:MACH:STATDEC";
@@ -487,6 +488,29 @@ namespace AppData
return currData;
}
public static bool setMachLiveStatus(string machine, bool isLive)
{
string redKey = $"{redProdMachStateLive}:{machine}";
string redVal = $"{isLive}";
// salvo x 90 sec
bool done = memLayer.ML.setRSV(redKey, redVal, 90);
return done;
}
public static bool getMachLiveStatus(string machine)
{
bool isLive = false;
/// cerco in redis...
string redKey = $"{redProdMachStateLive}:{machine}";
string redVal = memLayer.ML.getRSV(redKey);
if (!string.IsNullOrEmpty(redVal))
{
bool.TryParse(redVal, out isLive);
}
return isLive;
}
/// <summary>
/// Salvo in Redis il SUCCESSIVO bunk da lavorare
/// </summary>
@@ -1914,7 +1938,6 @@ namespace AppData
public static List<MachineStatData> prodMachStateDataGet()
{
List<MachineStatData> answ = new List<MachineStatData>();
string redVal = memLayer.ML.getRSV(redProdMachStateData);
if (!string.IsNullOrEmpty(redVal))
{
@@ -1986,11 +2009,11 @@ namespace AppData
memLayer.ML.setRSV(clockDriftKey, $"{driftSec}");
break;
//case "01":
// // x ora lo ignoro ma so che ora la macchina è ALIVE...
// break;
case "01":
// savo status alive
ComLib.setMachLiveStatus(updateRecords.Machine, true);
break;
default:
DLMan.taStatLog.insert(item.DtRecord.AddMilliseconds(driftSec), updateRecords.Machine, item.Station, item.Code, item.Payload, 0);
break;
+1 -2
View File
@@ -11,7 +11,6 @@
<asp:HiddenField runat="server" ID="hfCss01" Value="secondary" />
<asp:HiddenField runat="server" ID="hfCss02" Value="secondary" />
<asp:HiddenField runat="server" ID="hfCss03" Value="secondary" />
<asp:HiddenField runat="server" ID="hfLive" Value="false" />
<div class="row" runat="server" id="divSelect">
<asp:DropDownList runat="server" ID="ddlMachine" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="ddlMachine_SelectedIndexChanged">
@@ -26,7 +25,7 @@
<asp:Timer ID="timerLoad" runat="server" Interval="2000" OnTick="timerLoad_Tick"></asp:Timer>
<div class="row small py-0" runat="server" id="divRuntime">
<div class="col-2 pr-0">
<asp:LinkButton runat="server" ID="lbtReset" class="btn btn-info btn-block text-center" OnClick="lbtReset_Click"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;<%: hfMachine.Value %> <i class="fa fa-check-circle text-success" aria-hidden="true" runat="server" visible='<%: isLive %>'></i> <i class="fa fa-times-circle text-danger" aria-hidden="true" runat="server" visible='<%: !isLive %>'></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtReset" class="btn btn-info btn-block text-center" OnClick="lbtReset_Click"><i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;<%: hfMachine.Value %>&nbsp;<i class="fa fa-link text-success" aria-hidden="true" runat="server" id="icnLiveOk"></i> <i class="fa fa-chain-broken text-danger" aria-hidden="true" runat="server" id="icnLiveKo"></i></asp:LinkButton>
</div>
<div class="col-10">
<div class="d-flex text-center">
+10 -13
View File
@@ -122,17 +122,6 @@ namespace NKC_WF.WebUserControls
#region Public Methods
public bool isLive
{
get
{
bool answ = false;
bool.TryParse(hfLive.Value, out answ);
return answ;
}
}
public void doUpdate()
{
// verifico status delle 3 parti e mostro relativo semaforo...
@@ -174,8 +163,16 @@ namespace NKC_WF.WebUserControls
hfStat03.Value = state03.Descript;
}
DS_App.StatusDecodeRow liveState = getState(currState, "LINE");
hfLive.Value = $"{liveState != null}";
icnLiveOk.Visible = false;
icnLiveKo.Visible = false;
if (ComLib.getMachLiveStatus(currMachine))
{
icnLiveOk.Visible = true;
}
else
{
icnLiveKo.Visible = true;
}
}
#endregion Public Methods
+18 -9
View File
@@ -113,15 +113,6 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfCss03;
/// <summary>
/// Controllo hfLive.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfLive;
/// <summary>
/// Controllo divSelect.
/// </summary>
@@ -175,5 +166,23 @@ namespace NKC_WF.WebUserControls
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtReset;
/// <summary>
/// Controllo icnLiveOk.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl icnLiveOk;
/// <summary>
/// Controllo icnLiveKo.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl icnLiveKo;
}
}