aggiunto try-catch x decifrare status

This commit is contained in:
Samuele Locatelli
2021-07-01 17:50:58 +02:00
parent c9128811be
commit 53fd77bb8d
3 changed files with 28 additions and 56 deletions
+1 -1
View File
@@ -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();
+10 -10
View File
@@ -2,15 +2,15 @@
<asp:HiddenField runat="server" ID="hfMachine" Value="NE00" />
<asp:HiddenField runat="server" ID="hfMachClass" Value="light" />
<asp:HiddenField runat="server" ID="hfStat01" Value="UNK" />
<asp:HiddenField runat="server" ID="hfStat02" Value="UNK" />
<asp:HiddenField runat="server" ID="hfStat03" Value="UNK" />
<asp:HiddenField runat="server" ID="hfStat01" Value="N.A." />
<asp:HiddenField runat="server" ID="hfStat02" Value="N.A." />
<asp:HiddenField runat="server" ID="hfStat03" Value="N.A." />
<asp:HiddenField runat="server" ID="hfCode01" Value="00" />
<asp:HiddenField runat="server" ID="hfCode02" Value="00" />
<asp:HiddenField runat="server" ID="hfCode03" Value="00" />
<asp:HiddenField runat="server" ID="hfCss01" Value="default" />
<asp:HiddenField runat="server" ID="hfCss02" Value="default" />
<asp:HiddenField runat="server" ID="hfCss03" Value="default" />
<asp:HiddenField runat="server" ID="hfCss01" Value="secondary" />
<asp:HiddenField runat="server" ID="hfCss02" Value="secondary" />
<asp:HiddenField runat="server" ID="hfCss03" Value="secondary" />
<div class="row" runat="server" id="divSelect">
<asp:DropDownList runat="server" ID="ddlMachine" CssClass="form-control" AutoPostBack="True" OnSelectedIndexChanged="ddlMachine_SelectedIndexChanged">
@@ -23,23 +23,23 @@
<asp:UpdatePanel runat="server" ID="upnlTitle" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="timerLoad" runat="server" Interval="2000" OnTick="timerLoad_Tick"></asp:Timer>
<div class="row small" runat="server" id="divRuntime">
<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 %></asp:LinkButton>
</div>
<div class="col-10">
<div class="d-flex text-center">
<div class="p-2 bg-<%: hfCss01.Value %> flex-fill">
<div class="py-1 px-2 table-<%: hfCss01.Value %> flex-fill">
<b><i class="fa fa-qrcode" aria-hidden="true"></i>&nbsp;<%: traduci("print") %>&nbsp;|&nbsp;<%: hfCode01.Value %></b><div class="small">
<%: hfStat01.Value %>
</div>
</div>
<div class="p-2 bg-<%: hfCss02.Value %> flex-fill">
<div class="py-1 px-2 table-<%: hfCss02.Value %> flex-fill">
<b><i class="fa fa-cogs" aria-hidden="true"></i>&nbsp;<%: traduci("CNC") %>&nbsp;|&nbsp;<%: hfCode02.Value %></b><div class="small">
<%: hfStat02.Value %>
</div>
</div>
<div class="p-2 bg-<%: hfCss03.Value %> flex-fill">
<div class="py-1 px-2 bg-<%: hfCss03.Value %> flex-fill">
<b><i class="fa fa-hand-rock-o" aria-hidden="true"></i>&nbsp;<%: traduci("unload") %>&nbsp;|&nbsp;<%: hfCode03.Value %></b><div class="small">
<%: hfStat03.Value %>
</div>
+17 -45
View File
@@ -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