Fix vari x machine unload (era lento)

This commit is contained in:
Samuele E. Locatelli
2020-08-11 18:47:51 +02:00
parent 47b97945ab
commit 75cad66da7
4 changed files with 77 additions and 59 deletions
+1 -1
View File
@@ -1439,7 +1439,7 @@ namespace AppData
// salvo in redis
cachedCurrBunkTab = tabBunk;
}
if (tabBunk.Count > 0)
if (tabBunk != null && tabBunk.Count > 0)
{
answ = tabBunk[0];
}
@@ -18,7 +18,7 @@ namespace NKC_WF.WebUserControls
if (hfBatchId.Value != value.ToString())
{
hfBatchId.Value = value.ToString();
doUpdate();
//doUpdate();
}
}
get
+38 -33
View File
@@ -9,46 +9,51 @@
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div class="mx-0">
<div class="card text-center" style="width: 100%;">
<h4 class="card-header bg-secondary text-light"><%: traduci("MachineUnload") %> <sub>(<%: hfBatchID.Value %>)</sub></h4>
<div class="card-body py-1 bg-dark">
<asp:UpdatePanel runat="server" ID="upnlStats" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="hfBatchID" runat="server" />
<asp:HiddenField ID="hfSheetID" runat="server" />
<uc1:cmp_MU_stats runat="server" ID="cmp_MU_stats" />
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-2 pr-0">
<asp:UpdatePanel runat="server" ID="upnlBins" UpdateMode="Conditional">
<%-- <asp:UpdatePanel runat="server" ID="upnlMain" UpdateMode="Always">
<ContentTemplate>--%>
<div class="card text-center" style="width: 100%;">
<h4 class="card-header bg-secondary text-light"><%: traduci("MachineUnload") %> <sub>(<%: hfBatchID.Value %>)</sub></h4>
<div class="card-body py-1 bg-dark">
<asp:UpdatePanel runat="server" ID="upnlStats" UpdateMode="Conditional">
<ContentTemplate>
<uc1:cmp_MU_bins runat="server" ID="cmp_MU_bins" />
<asp:HiddenField ID="hfBatchID" runat="server" />
<asp:HiddenField ID="hfSheetID" runat="server" />
<uc1:cmp_MU_stats runat="server" ID="cmp_MU_stats" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-8 py-0 my-0 px-0">
<asp:UpdatePanel runat="server" ID="upnlDrawings" UpdateMode="Conditional">
<div class="row">
<div class="col-2 pr-0">
<asp:UpdatePanel runat="server" ID="upnlBins" UpdateMode="Always">
<ContentTemplate>
<uc1:cmp_MU_bins runat="server" ID="cmp_MU_bins" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-8 py-0 my-0 px-0">
<asp:UpdatePanel runat="server" ID="upnlDrawings" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="timerSvg" runat="server" Interval="3000" OnTick="timerSvg_Tick"></asp:Timer>
<uc1:cmp_MU_svgViewer runat="server" ID="cmp_MU_svgViewer" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-2 pl-0">
<asp:UpdatePanel runat="server" ID="upnlCarts" UpdateMode="Conditional">
<ContentTemplate>
<uc1:cmp_MU_carts runat="server" ID="cmp_MU_carts" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel runat="server" ID="upnlSuggest" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="timerSvg" runat="server" Interval="2000" OnTick="timerSvg_Tick"></asp:Timer>
<uc1:cmp_MU_svgViewer runat="server" ID="cmp_MU_svgViewer" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-2 pl-0">
<asp:UpdatePanel runat="server" ID="upnlCarts" UpdateMode="Conditional">
<ContentTemplate>
<uc1:cmp_MU_carts runat="server" ID="cmp_MU_carts" />
<uc1:cmp_MU_suggestions runat="server" ID="cmp_MU_suggestions" Visible="false" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel runat="server" ID="upnlSuggest" UpdateMode="Conditional">
<ContentTemplate>
<uc1:cmp_MU_suggestions runat="server" ID="cmp_MU_suggestions" Visible="false" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<%--</ContentTemplate>
</asp:UpdatePanel>--%>
</div>
</asp:Content>
+37 -24
View File
@@ -53,56 +53,68 @@ namespace NKC_WF
private void doUpdate()
{
// imposto dati correnti
setCurrData();
// aggiorno child
cmp_MU_stats.BatchId = BatchId;
cmp_MU_bins.BatchId = BatchId;
cmp_MU_carts.BatchId = BatchId;
cmp_MU_svgViewer.BatchId = BatchId;
cmp_MU_svgViewer.SheetId = SheetId;
bool doUpdate = setCurrData();
if (doUpdate)
{
// aggiorno child
cmp_MU_stats.BatchId = BatchId;
cmp_MU_bins.BatchId = BatchId;
cmp_MU_carts.BatchId = BatchId;
cmp_MU_svgViewer.BatchId = BatchId;
cmp_MU_svgViewer.SheetId = SheetId;
}
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// Imposta dati correnti (Bunk / Sheet) indicando SE fare update
/// </summary>
private void setCurrData()
private bool setCurrData()
{
bool needUpdate = false;
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
if (BatchId != currBunk.BatchID)
{
BatchId = currBunk.BatchID;
needUpdate = true;
}
DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId);
if (currSheet != null)
{
SheetId = currSheet.SheetID;
if (SheetId != currSheet.SheetID)
{
SheetId = currSheet.SheetID;
needUpdate = true;
}
}
}
else
{
BatchId = 0;
}
return needUpdate;
}
protected void timerSvg_Tick(object sender, EventArgs e)
{
// in base al num di sec dell'ora decido cosa aggiornare...
int counter = numWaitSvg;
// ogni 10 generale
if (counter % 10 == 0)
{
doUpdate();
}
// ogni 5 stats
else if (counter % 5 == 0)
// ogni 2 sec bin/cart
doUpdate();
if (counter % 5 == 0)
{
cmp_MU_stats.doUpdate();
upnlStats.DataBind();
}
// ogni 2 sec bin/cart
else if (counter % 2 == 0)
{
cmp_MU_carts.doUpdate();
cmp_MU_bins.doUpdate();
}
//if (counter % 2 == 0)
//{
cmp_MU_carts.doUpdate();
upnlCarts.DataBind();
cmp_MU_bins.doUpdate();
upnlCarts.DataBind();
//}
incrNumWait();
}
/// <summary>
@@ -131,6 +143,7 @@ namespace NKC_WF
if (numWaitSvg > 10)
{
memLayer.ML.resetRCnt(redProdReq);
Response.Redirect(Request.RawUrl);
}
memLayer.ML.setRCntI(redProdReq);
}