From c7463e43582b08d12b795854dd954075c20f8715 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 19 Mar 2024 18:13:51 +0100 Subject: [PATCH 1/5] Fix test grafici --- NKC_WF/site/PlannerReports.aspx.cs | 3 +- NKC_WF/site/TestChart.aspx | 22 +++++++++ NKC_WF/site/TestChart.aspx.cs | 52 +++++++++++++++++++++ NKC_WF/site/TestChart.aspx.designer.cs | 62 ++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 NKC_WF/site/TestChart.aspx create mode 100644 NKC_WF/site/TestChart.aspx.cs create mode 100644 NKC_WF/site/TestChart.aspx.designer.cs diff --git a/NKC_WF/site/PlannerReports.aspx.cs b/NKC_WF/site/PlannerReports.aspx.cs index 2baa2a7..1ffd810 100644 --- a/NKC_WF/site/PlannerReports.aspx.cs +++ b/NKC_WF/site/PlannerReports.aspx.cs @@ -80,7 +80,8 @@ namespace NKC_WF.site // verifica se ci sia VETO x update da redis string rawVal = memLayer.ML.getRSV(ComLib.redVetoDayStats); if (string.IsNullOrEmpty(rawVal)) - { // effettuo calcolo statistiche + { + // effettuo calcolo statistiche Stopwatch stopWatchLap = new Stopwatch(); stopWatchLap.Start(); // se non c'è effettua ricalcolo x i giorni necessari (da ultimo ricalcolo oppure da valore web.config) diff --git a/NKC_WF/site/TestChart.aspx b/NKC_WF/site/TestChart.aspx new file mode 100644 index 0000000..86852ad --- /dev/null +++ b/NKC_WF/site/TestChart.aspx @@ -0,0 +1,22 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/SiteContent.master" AutoEventWireup="true" CodeBehind="TestChart.aspx.cs" Inherits="NKC_WF.site.TestChart" %> + +<%@ Register Src="~/WebUserControls/cmp_BatchStatsPlot.ascx" TagPrefix="uc1" TagName="cmp_BatchStatsPlot" %> +<%@ Register Src="~/WebUserControls/cmp_DailyStatsPlot.ascx" TagPrefix="uc1" TagName="cmp_DailyStatsPlot" %> + + + + +

Chart Js test

+ + + Reload + + + + + + + + + +
diff --git a/NKC_WF/site/TestChart.aspx.cs b/NKC_WF/site/TestChart.aspx.cs new file mode 100644 index 0000000..c10fca0 --- /dev/null +++ b/NKC_WF/site/TestChart.aspx.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class TestChart : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + setGraph(); + } + + private void setGraph() + { + cmp_BatchStatsPlot.Visible = false; + cmp_DailyStatsPlot.Visible = false; + Random rnd = new Random(); + switch (ddlChart.SelectedValue) + { + case "1": + int numRec = rnd.Next(50, 250); + cmp_BatchStatsPlot.PlotType = "Yeld"; + cmp_BatchStatsPlot.ShowLast = numRec; + cmp_BatchStatsPlot.Legend = $"PROVA | {numRec} | {DateTime.Now:HH:mm:ss}"; + cmp_BatchStatsPlot.Visible = true; + break; + case "2": + cmp_DailyStatsPlot.PlaceCod = "[ALL]"; + cmp_DailyStatsPlot.PlotType = "OEE"; + cmp_DailyStatsPlot.DateStart = DateTime.Today.AddMonths(-1); + cmp_DailyStatsPlot.DateEnd = DateTime.Today; + cmp_DailyStatsPlot.Visible = true; + break; + case "3": + break; + default: + break; + } + uplBody.Update(); + } + + protected void lbtRefreshData_Click(object sender, EventArgs e) + { + setGraph(); + } + } +} \ No newline at end of file diff --git a/NKC_WF/site/TestChart.aspx.designer.cs b/NKC_WF/site/TestChart.aspx.designer.cs new file mode 100644 index 0000000..79ebf0a --- /dev/null +++ b/NKC_WF/site/TestChart.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class TestChart + { + + /// + /// uplBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel uplBody; + + /// + /// lbtRefreshData control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtRefreshData; + + /// + /// ddlChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlChart; + + /// + /// cmp_BatchStatsPlot control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_BatchStatsPlot cmp_BatchStatsPlot; + + /// + /// cmp_DailyStatsPlot control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_DailyStatsPlot cmp_DailyStatsPlot; + } +} From 1d3ef904021863b64acb947123e8d991b8553a6a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 20 Mar 2024 07:18:24 +0100 Subject: [PATCH 2/5] Inizio fix gestione report su pagine distinte --- .../WebUserControls/cmp_BatchStatsList.ascx | 2 +- .../cmp_BatchStatsList.ascx.cs | 1 + .../WebUserControls/cmp_DailyStatsList.ascx | 2 +- .../cmp_DailyStatsList.ascx.cs | 1 + NKC_WF/site/PlannerReports.aspx.cs | 22 +++ NKC_WF/site/PlannerReports01.aspx | 42 ++++ NKC_WF/site/PlannerReports01.aspx.cs | 185 +++++++++++++++++ NKC_WF/site/PlannerReports01.aspx.designer.cs | 62 ++++++ NKC_WF/site/PlannerReports02.aspx | 43 ++++ NKC_WF/site/PlannerReports02.aspx.cs | 187 ++++++++++++++++++ NKC_WF/site/PlannerReports02.aspx.designer.cs | 62 ++++++ NKC_WF/site/PlannerReports03.aspx | 42 ++++ NKC_WF/site/PlannerReports03.aspx.cs | 187 ++++++++++++++++++ NKC_WF/site/PlannerReports03.aspx.designer.cs | 62 ++++++ 14 files changed, 898 insertions(+), 2 deletions(-) create mode 100644 NKC_WF/site/PlannerReports01.aspx create mode 100644 NKC_WF/site/PlannerReports01.aspx.cs create mode 100644 NKC_WF/site/PlannerReports01.aspx.designer.cs create mode 100644 NKC_WF/site/PlannerReports02.aspx create mode 100644 NKC_WF/site/PlannerReports02.aspx.cs create mode 100644 NKC_WF/site/PlannerReports02.aspx.designer.cs create mode 100644 NKC_WF/site/PlannerReports03.aspx create mode 100644 NKC_WF/site/PlannerReports03.aspx.cs create mode 100644 NKC_WF/site/PlannerReports03.aspx.designer.cs diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx index f0197a9..edb0072 100644 --- a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx @@ -39,7 +39,7 @@
<%: traduci("PlotGraph") %>
- +
diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs index 031d1ad..cb02dd7 100644 --- a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs @@ -152,6 +152,7 @@ namespace NKC_WF.WebUserControls hlDownload.Visible = fileExist; } cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh; + doUpdate(); } protected void txtNumShow_TextChanged(object sender, EventArgs e) diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx index eb01c6d..fd456f8 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx @@ -38,7 +38,7 @@
<%: traduci("PlotGraph") %>
- +
diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs index 3b3da1e..ce98755 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs @@ -186,6 +186,7 @@ namespace NKC_WF.WebUserControls hlDownload.Visible = fileExist; } cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh; + doUpdate(); } protected void txtDateEnd_TextChanged(object sender, EventArgs e) diff --git a/NKC_WF/site/PlannerReports.aspx.cs b/NKC_WF/site/PlannerReports.aspx.cs index 1ffd810..608a0ef 100644 --- a/NKC_WF/site/PlannerReports.aspx.cs +++ b/NKC_WF/site/PlannerReports.aspx.cs @@ -124,6 +124,7 @@ namespace NKC_WF.site cmp_SheetsStats.Visible = false; cmp_BatchStatsList.Visible = false; cmp_DailyStatsList.Visible = false; +#if false switch (cmp_reportSelector.SelReport) { case ReportType.BatchStats: @@ -138,6 +139,27 @@ namespace NKC_WF.site cmp_DailyStatsList.Visible = true; break; + case ReportType.ND: + default: + lblInstruction.Visible = true; + break; + } +#endif + + switch (cmp_reportSelector.SelReport) + { + case ReportType.BatchStats: + Response.Redirect("PlannerReports02"); + break; + + case ReportType.BatchUnloadPreview: + cmp_SheetsStats.Visible = true; + break; + + case ReportType.DailyReport: + Response.Redirect("PlannerReports03"); + break; + case ReportType.ND: default: lblInstruction.Visible = true; diff --git a/NKC_WF/site/PlannerReports01.aspx b/NKC_WF/site/PlannerReports01.aspx new file mode 100644 index 0000000..77dae01 --- /dev/null +++ b/NKC_WF/site/PlannerReports01.aspx @@ -0,0 +1,42 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PlannerReports01.aspx.cs" Inherits="NKC_WF.site.PlannerReports01" %> + +<%@ Register Src="~/WebUserControls/cmp_SheetsStats.ascx" TagPrefix="uc1" TagName="cmp_SheetsStats" %> +<%@ Register Src="~/WebUserControls/cmp_reportSelector.ascx" TagPrefix="uc1" TagName="cmp_reportSelector" %> + + + + +
+
+
+
+
+
+
+

Reports

+
+
+ + + +
+
+
+
+
+
+
+ Reload +
+
+
+
+ +
+
+
+
+
+
+
+
diff --git a/NKC_WF/site/PlannerReports01.aspx.cs b/NKC_WF/site/PlannerReports01.aspx.cs new file mode 100644 index 0000000..37c0190 --- /dev/null +++ b/NKC_WF/site/PlannerReports01.aspx.cs @@ -0,0 +1,185 @@ +using AppData; +using NKC_WF.WebUserControls; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class PlannerReports01 : BasePage + { + #region Public Properties + + /// + /// Batch corrente... + /// + public int BatchId + { + get + { + int answ = 0; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("BatchId"))) + { + answ = memLayer.ML.QSI("BatchId"); + } + else + { + answ = savedBatchId; + } + return answ; + } + } + + /// + /// Limite orario preview... + /// + public int MaxHour + { + get + { + int answ = -1; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("MaxHour"))) + { + answ = memLayer.ML.QSI("MaxHour"); + } + return answ; + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Update interfaccia + /// + public void doUpdate() + { + if (BatchId > 0) + { + cmp_reportSelector.SelReport = ReportType.BatchUnloadPreview; + // Imposto BatchID... + cmp_SheetsStats.BatchID = BatchId; + cmp_SheetsStats.MaxHour = MaxHour; + } + updateDisplay(); + } + + #endregion Public Methods + + #region Protected Properties + + protected int savedBatchId + { + get + { + return ComLib.getCurrBatchId(PlaceCod); + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected void lbtRefreshData_Click(object sender, EventArgs e) + { + TryUpdateModel(); + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + cmp_reportSelector.eh_doRefresh += Cmp_reportSelector_eh_doRefresh; + } + + #endregion Protected Methods + + #region Private Methods + + private void Cmp_reportSelector_eh_doRefresh(object sender, EventArgs e) + { + // display in base al report selezionato + updateDisplay(); + } + + private void TryUpdateModel() + { + Thread.Sleep(50); + DateTime oggi = DateTime.Today; + // verifica se ci sia VETO x update da redis + string rawVal = memLayer.ML.getRSV(ComLib.redVetoDayStats); + if (string.IsNullOrEmpty(rawVal)) + { + // effettuo calcolo statistiche + Stopwatch stopWatchLap = new Stopwatch(); + stopWatchLap.Start(); + // se non c'è effettua ricalcolo x i giorni necessari (da ultimo ricalcolo oppure da + // valore web.config) + int numDays = memLayer.ML.CRI("repNumDayPre"); + // verifico ultimo record... + var tabLast = DLMan.taDayStats.getLast(); + try + { + // se vuoto: 90gg + if (tabLast == null || tabLast.Count == 0) + { + numDays = 90; + } + else + { + var lastRec = tabLast[0]; + // calcolo x eccesso la differenza in giorni + var dayDiff = Math.Ceiling(oggi.Subtract(lastRec.DataRif).TotalDays + 1); + int numDayLast = (int)dayDiff; + numDays = numDays > numDayLast ? numDays : numDayLast; + } + } + catch + { } + // verifico ultimo giorno disponibile... + DateTime DateEnd = oggi.AddDays(1); + DateTime DateStart = DateEnd.AddDays(-numDays); + DLMan.taDayStats.ProductionUpdate(DateStart, DateEnd, "*", true); + int vetoRecalcMin = memLayer.ML.CRI("repVetoRecalcMin"); + memLayer.ML.setRSV(ComLib.redVetoDayStats, $"Recalc Done | {DateStart} --> {DateEnd}", 60 * vetoRecalcMin); + stopWatchLap.Stop(); + lgInfo($"DayStats DB ProductionUpdate: effettuato ricalcolo statistiche | periodo {DateStart} --> {DateEnd} | elapsed: {stopWatchLap.Elapsed.TotalMilliseconds} ms | veto ricalcolo per {vetoRecalcMin} minuti"); + } + } + + private void updateDisplay() + { + //cmp_SheetsStats.Visible = false; + switch (cmp_reportSelector.SelReport) + { + case ReportType.BatchStats: + Response.Redirect("PlannerReports02"); + break; + + case ReportType.BatchUnloadPreview: + Response.Redirect("PlannerReports01"); + break; + + case ReportType.DailyReport: + Response.Redirect("PlannerReports03"); + break; + + case ReportType.ND: + default: + break; + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/NKC_WF/site/PlannerReports01.aspx.designer.cs b/NKC_WF/site/PlannerReports01.aspx.designer.cs new file mode 100644 index 0000000..d695208 --- /dev/null +++ b/NKC_WF/site/PlannerReports01.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class PlannerReports01 + { + + /// + /// uplBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel uplBody; + + /// + /// cmp_reportSelector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_reportSelector cmp_reportSelector; + + /// + /// UpdateProgressDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdateProgress UpdateProgressDisplay; + + /// + /// lbtRefreshData control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtRefreshData; + + /// + /// cmp_SheetsStats control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_SheetsStats cmp_SheetsStats; + } +} diff --git a/NKC_WF/site/PlannerReports02.aspx b/NKC_WF/site/PlannerReports02.aspx new file mode 100644 index 0000000..5c20d96 --- /dev/null +++ b/NKC_WF/site/PlannerReports02.aspx @@ -0,0 +1,43 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PlannerReports02.aspx.cs" Inherits="NKC_WF.site.PlannerReports02" %> + +<%@ Register Src="~/WebUserControls/cmp_reportSelector.ascx" TagPrefix="uc1" TagName="cmp_reportSelector" %> +<%@ Register Src="~/WebUserControls/cmp_BatchStatsList.ascx" TagPrefix="uc1" TagName="cmp_BatchStatsList" %> + + + + +
+
+
+
+
+
+
+

Reports

+
+
+ + + +
+
+
+
+
+
+
+ Reload +
+
+
+
+ +
+
+
+
+
+
+
+
+ diff --git a/NKC_WF/site/PlannerReports02.aspx.cs b/NKC_WF/site/PlannerReports02.aspx.cs new file mode 100644 index 0000000..b13a235 --- /dev/null +++ b/NKC_WF/site/PlannerReports02.aspx.cs @@ -0,0 +1,187 @@ +using AppData; +using NKC_WF.WebUserControls; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class PlannerReports02 : BasePage + { + #region Public Properties + + /// + /// Batch corrente... + /// + public int BatchId + { + get + { + int answ = 0; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("BatchId"))) + { + answ = memLayer.ML.QSI("BatchId"); + } + else + { + answ = savedBatchId; + } + return answ; + } + } + + /// + /// Limite orario preview... + /// + public int MaxHour + { + get + { + int answ = -1; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("MaxHour"))) + { + answ = memLayer.ML.QSI("MaxHour"); + } + return answ; + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Update interfaccia + /// + public void doUpdate() + { +#if false + if (BatchId > 0) + { + cmp_reportSelector.SelReport = ReportType.BatchUnloadPreview; + // Imposto BatchID... + cmp_SheetsStats.BatchID = BatchId; + cmp_SheetsStats.MaxHour = MaxHour; + } +#endif + updateDisplay(); + } + + #endregion Public Methods + + #region Protected Properties + + protected int savedBatchId + { + get + { + return ComLib.getCurrBatchId(PlaceCod); + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected void lbtRefreshData_Click(object sender, EventArgs e) + { + TryUpdateModel(); + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + cmp_reportSelector.eh_doRefresh += Cmp_reportSelector_eh_doRefresh; + } + + #endregion Protected Methods + + #region Private Methods + + private void Cmp_reportSelector_eh_doRefresh(object sender, EventArgs e) + { + // display in base al report selezionato + updateDisplay(); + } + + private void TryUpdateModel() + { + Thread.Sleep(50); + DateTime oggi = DateTime.Today; + // verifica se ci sia VETO x update da redis + string rawVal = memLayer.ML.getRSV(ComLib.redVetoDayStats); + if (string.IsNullOrEmpty(rawVal)) + { + // effettuo calcolo statistiche + Stopwatch stopWatchLap = new Stopwatch(); + stopWatchLap.Start(); + // se non c'è effettua ricalcolo x i giorni necessari (da ultimo ricalcolo oppure da + // valore web.config) + int numDays = memLayer.ML.CRI("repNumDayPre"); + // verifico ultimo record... + var tabLast = DLMan.taDayStats.getLast(); + try + { + // se vuoto: 90gg + if (tabLast == null || tabLast.Count == 0) + { + numDays = 90; + } + else + { + var lastRec = tabLast[0]; + // calcolo x eccesso la differenza in giorni + var dayDiff = Math.Ceiling(oggi.Subtract(lastRec.DataRif).TotalDays + 1); + int numDayLast = (int)dayDiff; + numDays = numDays > numDayLast ? numDays : numDayLast; + } + } + catch + { } + // verifico ultimo giorno disponibile... + DateTime DateEnd = oggi.AddDays(1); + DateTime DateStart = DateEnd.AddDays(-numDays); + DLMan.taDayStats.ProductionUpdate(DateStart, DateEnd, "*", true); + int vetoRecalcMin = memLayer.ML.CRI("repVetoRecalcMin"); + memLayer.ML.setRSV(ComLib.redVetoDayStats, $"Recalc Done | {DateStart} --> {DateEnd}", 60 * vetoRecalcMin); + stopWatchLap.Stop(); + lgInfo($"DayStats DB ProductionUpdate: effettuato ricalcolo statistiche | periodo {DateStart} --> {DateEnd} | elapsed: {stopWatchLap.Elapsed.TotalMilliseconds} ms | veto ricalcolo per {vetoRecalcMin} minuti"); + } + } + + private void updateDisplay() + { + //cmp_SheetsStats.Visible = false; + switch (cmp_reportSelector.SelReport) + { + case ReportType.BatchStats: + Response.Redirect("PlannerReports02"); + break; + + case ReportType.BatchUnloadPreview: + Response.Redirect("PlannerReports01"); + break; + + case ReportType.DailyReport: + Response.Redirect("PlannerReports03"); + break; + + case ReportType.ND: + default: + break; + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/NKC_WF/site/PlannerReports02.aspx.designer.cs b/NKC_WF/site/PlannerReports02.aspx.designer.cs new file mode 100644 index 0000000..3f9f143 --- /dev/null +++ b/NKC_WF/site/PlannerReports02.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class PlannerReports02 + { + + /// + /// uplBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel uplBody; + + /// + /// cmp_reportSelector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_reportSelector cmp_reportSelector; + + /// + /// UpdateProgressDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdateProgress UpdateProgressDisplay; + + /// + /// lbtRefreshData control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtRefreshData; + + /// + /// cmp_BatchStatsList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_BatchStatsList cmp_BatchStatsList; + } +} diff --git a/NKC_WF/site/PlannerReports03.aspx b/NKC_WF/site/PlannerReports03.aspx new file mode 100644 index 0000000..e2f8830 --- /dev/null +++ b/NKC_WF/site/PlannerReports03.aspx @@ -0,0 +1,42 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PlannerReports03.aspx.cs" Inherits="NKC_WF.site.PlannerReports03" %> + +<%@ Register Src="~/WebUserControls/cmp_reportSelector.ascx" TagPrefix="uc1" TagName="cmp_reportSelector" %> +<%@ Register Src="~/WebUserControls/cmp_DailyStatsList.ascx" TagPrefix="uc1" TagName="cmp_DailyStatsList" %> + + + + +
+
+
+
+
+
+
+

Reports

+
+
+ + + +
+
+
+
+
+
+
+ Reload +
+
+
+
+ +
+
+
+
+
+
+
+
diff --git a/NKC_WF/site/PlannerReports03.aspx.cs b/NKC_WF/site/PlannerReports03.aspx.cs new file mode 100644 index 0000000..f460e52 --- /dev/null +++ b/NKC_WF/site/PlannerReports03.aspx.cs @@ -0,0 +1,187 @@ +using AppData; +using NKC_WF.WebUserControls; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class PlannerReports03 : BasePage + { + #region Public Properties + + /// + /// Batch corrente... + /// + public int BatchId + { + get + { + int answ = 0; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("BatchId"))) + { + answ = memLayer.ML.QSI("BatchId"); + } + else + { + answ = savedBatchId; + } + return answ; + } + } + + /// + /// Limite orario preview... + /// + public int MaxHour + { + get + { + int answ = -1; + if (!string.IsNullOrEmpty(memLayer.ML.QSS("MaxHour"))) + { + answ = memLayer.ML.QSI("MaxHour"); + } + return answ; + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Update interfaccia + /// + public void doUpdate() + { +#if false + if (BatchId > 0) + { + cmp_reportSelector.SelReport = ReportType.BatchUnloadPreview; + // Imposto BatchID... + cmp_SheetsStats.BatchID = BatchId; + cmp_SheetsStats.MaxHour = MaxHour; + } +#endif + updateDisplay(); + } + + #endregion Public Methods + + #region Protected Properties + + protected int savedBatchId + { + get + { + return ComLib.getCurrBatchId(PlaceCod); + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected void lbtRefreshData_Click(object sender, EventArgs e) + { + TryUpdateModel(); + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + cmp_reportSelector.eh_doRefresh += Cmp_reportSelector_eh_doRefresh; + } + + #endregion Protected Methods + + #region Private Methods + + private void Cmp_reportSelector_eh_doRefresh(object sender, EventArgs e) + { + // display in base al report selezionato + updateDisplay(); + } + + private void TryUpdateModel() + { + Thread.Sleep(50); + DateTime oggi = DateTime.Today; + // verifica se ci sia VETO x update da redis + string rawVal = memLayer.ML.getRSV(ComLib.redVetoDayStats); + if (string.IsNullOrEmpty(rawVal)) + { + // effettuo calcolo statistiche + Stopwatch stopWatchLap = new Stopwatch(); + stopWatchLap.Start(); + // se non c'è effettua ricalcolo x i giorni necessari (da ultimo ricalcolo oppure da + // valore web.config) + int numDays = memLayer.ML.CRI("repNumDayPre"); + // verifico ultimo record... + var tabLast = DLMan.taDayStats.getLast(); + try + { + // se vuoto: 90gg + if (tabLast == null || tabLast.Count == 0) + { + numDays = 90; + } + else + { + var lastRec = tabLast[0]; + // calcolo x eccesso la differenza in giorni + var dayDiff = Math.Ceiling(oggi.Subtract(lastRec.DataRif).TotalDays + 1); + int numDayLast = (int)dayDiff; + numDays = numDays > numDayLast ? numDays : numDayLast; + } + } + catch + { } + // verifico ultimo giorno disponibile... + DateTime DateEnd = oggi.AddDays(1); + DateTime DateStart = DateEnd.AddDays(-numDays); + DLMan.taDayStats.ProductionUpdate(DateStart, DateEnd, "*", true); + int vetoRecalcMin = memLayer.ML.CRI("repVetoRecalcMin"); + memLayer.ML.setRSV(ComLib.redVetoDayStats, $"Recalc Done | {DateStart} --> {DateEnd}", 60 * vetoRecalcMin); + stopWatchLap.Stop(); + lgInfo($"DayStats DB ProductionUpdate: effettuato ricalcolo statistiche | periodo {DateStart} --> {DateEnd} | elapsed: {stopWatchLap.Elapsed.TotalMilliseconds} ms | veto ricalcolo per {vetoRecalcMin} minuti"); + } + } + + private void updateDisplay() + { + //cmp_SheetsStats.Visible = false; + switch (cmp_reportSelector.SelReport) + { + case ReportType.BatchStats: + Response.Redirect("PlannerReports02"); + break; + + case ReportType.BatchUnloadPreview: + Response.Redirect("PlannerReports01"); + break; + + case ReportType.DailyReport: + Response.Redirect("PlannerReports03"); + break; + + case ReportType.ND: + default: + break; + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/NKC_WF/site/PlannerReports03.aspx.designer.cs b/NKC_WF/site/PlannerReports03.aspx.designer.cs new file mode 100644 index 0000000..39e58a9 --- /dev/null +++ b/NKC_WF/site/PlannerReports03.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class PlannerReports03 + { + + /// + /// uplBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel uplBody; + + /// + /// cmp_reportSelector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_reportSelector cmp_reportSelector; + + /// + /// UpdateProgressDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdateProgress UpdateProgressDisplay; + + /// + /// lbtRefreshData control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtRefreshData; + + /// + /// cmp_DailyStatsList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_DailyStatsList cmp_DailyStatsList; + } +} From 2d7cbf7d60debae545d07310ca6e24f434046823 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 20 Mar 2024 07:18:34 +0100 Subject: [PATCH 3/5] Completo review pagine x gestioen report su pag diverse --- NKC_WF/NKC_WF.csproj | 25 +++ NKC_WF/Web.config | 19 +- .../WebUserControls/cmp_BatchStatsPlot.ascx | 43 ++-- .../cmp_BatchStatsPlot.ascx.cs | 5 +- .../WebUserControls/cmp_DailyStatsPlot.ascx | 63 ++++-- .../cmp_DailyStatsPlot.ascx.cs | 19 +- .../WebUserControls/cmp_reportSelector.ascx | 2 +- NKC_WF/site/PlannerReports.aspx.cs | 4 +- NKC_WF/site/PlannerReports01.aspx | 42 ---- NKC_WF/site/PlannerReports01.aspx.cs | 185 ------------------ NKC_WF/site/PlannerReports01.aspx.designer.cs | 62 ------ ...s02.aspx => PlannerReportsBatchStats.aspx} | 2 +- ...px.cs => PlannerReportsBatchStats.aspx.cs} | 8 +- ...PlannerReportsBatchStats.aspx.designer.cs} | 2 +- ...s03.aspx => PlannerReportsDailyStats.aspx} | 2 +- ...px.cs => PlannerReportsDailyStats.aspx.cs} | 8 +- ...PlannerReportsDailyStats.aspx.designer.cs} | 2 +- 17 files changed, 131 insertions(+), 362 deletions(-) delete mode 100644 NKC_WF/site/PlannerReports01.aspx delete mode 100644 NKC_WF/site/PlannerReports01.aspx.cs delete mode 100644 NKC_WF/site/PlannerReports01.aspx.designer.cs rename NKC_WF/site/{PlannerReports02.aspx => PlannerReportsBatchStats.aspx} (95%) rename NKC_WF/site/{PlannerReports02.aspx.cs => PlannerReportsBatchStats.aspx.cs} (95%) rename NKC_WF/site/{PlannerReports02.aspx.designer.cs => PlannerReportsBatchStats.aspx.designer.cs} (97%) rename NKC_WF/site/{PlannerReports03.aspx => PlannerReportsDailyStats.aspx} (95%) rename NKC_WF/site/{PlannerReports03.aspx.cs => PlannerReportsDailyStats.aspx.cs} (95%) rename NKC_WF/site/{PlannerReports03.aspx.designer.cs => PlannerReportsDailyStats.aspx.designer.cs} (97%) diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 14b5393..b8f6702 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -324,6 +324,7 @@ + @@ -479,6 +480,8 @@ + + @@ -486,6 +489,7 @@ + @@ -1053,6 +1057,20 @@ PlannerReports.aspx + + PlannerReportsBatchStats.aspx + ASPXCodeBehind + + + PlannerReportsBatchStats.aspx + + + PlannerReportsDailyStats.aspx + ASPXCodeBehind + + + PlannerReportsDailyStats.aspx + PlantMgmt.aspx ASPXCodeBehind @@ -1116,6 +1134,13 @@ StackManager.aspx + + TestChart.aspx + ASPXCodeBehind + + + TestChart.aspx + Unauth.aspx ASPXCodeBehind diff --git a/NKC_WF/Web.config b/NKC_WF/Web.config index 3007385..eee89ae 100644 --- a/NKC_WF/Web.config +++ b/NKC_WF/Web.config @@ -36,8 +36,9 @@ - + @@ -110,18 +111,20 @@ - - + + + value="Data Source=SQL2016PROD;Initial Catalog=Sauder_NKC2_Prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;"/> + value="Data Source=SQL2016PROD;Initial Catalog=Sauder_NKC2_Prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;"/> + value="Data Source=SQL2016PROD;Initial Catalog=Sauder_NKC2_Prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;"/> diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx index 01140e1..9f22600 100644 --- a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx +++ b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx @@ -24,7 +24,7 @@ var labelsTS = dataTS.map(function (item) { return item['x']; }); - //console.log('labels data', labels); + //console.log('labels data', labelsTS); var myOptions = { responsive: true, @@ -42,15 +42,17 @@ }; // recupero obj chart + //console.log('ctx ID: ', document.getElementById('myChartTS')); var ctx = document.getElementById('myChartTS').getContext('2d'); + var sLeg = document.getElementById('<%=hfLegend.ClientID %>').value; var chart = new Chart(ctx, { type: 'line', data: { labels: labelsTS, datasets: [{ - label: '<%=hfLegend.Value %>', + label: sLeg, borderColor: 'rgb(7, 173, 236)', lineTension: 0, //steppedLine: false, @@ -66,22 +68,31 @@ } // effettuo plotting grafico TimeSerie! function plotTS() { - //console.log("api/BatchStats/<%=hfShowLast.Value %>?PlotType=<%=hfPlotType.Value%>"); - // caricamento pagina - $.ajax({ - type: "GET", - url: "../api/BatchStats/<%=hfShowLast.Value %>?PlotType=<%=hfPlotType.Value%>", - contentType: "application/json; charset=utf-8", - dataType: "json", - success: OnSuccess_, - error: OnErrorCall_ - }); + var hfSL = document.getElementById('<%=hfShowLast.ClientID %>'); + if (hfSL != null) { + var lastNum = document.getElementById('<%=hfShowLast.ClientID %>').value ?? ""; + var plotType = document.getElementById('<%=hfPlotType.ClientID %>').value ?? ""; + //console.log("../api/BatchStats/"+lastNum+"?PlotType="+plotType); + // caricamento pagina + $.ajax({ + type: "GET", + url: "../api/BatchStats/" + lastNum + "?PlotType=" + plotType, + contentType: "application/json; charset=utf-8", + dataType: "json", + success: OnSuccess_, + error: OnErrorCall_ + }); + } } // funzione di drawing ad OGNI pageload! function pageLoad() { - // chiamo recupero dati + plot della TS - plotTS(); - //console.log('pageLoad!'); + try { + console.log('pageLoad BatchStats! | ID: <%= this.ID %> '); + plotTS(); + } + catch (error) { + console.log(error); + } } - \ No newline at end of file + diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs index 8f7422f..49921d7 100644 --- a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs @@ -53,10 +53,7 @@ namespace NKC_WF.WebUserControls #region Protected Methods - protected void Page_Load(object sender, EventArgs e) - { - } - + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx b/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx index d4fed9a..922a56f 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx +++ b/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx @@ -4,11 +4,10 @@
-

Batch Stats Plot

+

Daily Stats Plot

- <%----%>
@@ -23,6 +22,7 @@
+ \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx.cs b/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx.cs index d2d73eb..a80341c 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_DailyStatsPlot.ascx.cs @@ -1,21 +1,11 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { public partial class cmp_DailyStatsPlot : System.Web.UI.UserControl { - #region Protected Fields - - protected string dateFormat = "yyyy-MM-dd"; - - #endregion Protected Fields - #region Public Properties public DateTime DateEnd @@ -84,11 +74,14 @@ namespace NKC_WF.WebUserControls #endregion Public Properties + #region Protected Fields + + protected string dateFormat = "yyyy-MM-dd"; + + #endregion Protected Fields + #region Protected Methods - protected void Page_Load(object sender, EventArgs e) - { - } #endregion Protected Methods } diff --git a/NKC_WF/WebUserControls/cmp_reportSelector.ascx b/NKC_WF/WebUserControls/cmp_reportSelector.ascx index 94767bf..a49c46b 100644 --- a/NKC_WF/WebUserControls/cmp_reportSelector.ascx +++ b/NKC_WF/WebUserControls/cmp_reportSelector.ascx @@ -5,7 +5,7 @@ <%: traduci("RepBatchPreview") %>
-
+
<%: traduci("BatchPreviewStats") %>
-
+
Create CSV diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs index cb02dd7..ec98ba8 100644 --- a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs @@ -142,7 +142,7 @@ namespace NKC_WF.WebUserControls { if (!Page.IsPostBack) { - cmp_numRow.numRow = 25; + cmp_numRow.numRow = 15; grView.PageSize = cmp_numRow.numRow; divGraph.Visible = false; divType.Visible = false; diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx index fd456f8..c8df180 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx @@ -9,10 +9,10 @@
-
+
<%: traduci("DayProdStats") %>
-
+
Create CSV diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs index ce98755..4ddf803 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs @@ -174,7 +174,7 @@ namespace NKC_WF.WebUserControls { if (!Page.IsPostBack) { - cmp_numRow.numRow = 25; + cmp_numRow.numRow = 15; grView.PageSize = cmp_numRow.numRow; divGraph.Visible = false; divType.Visible = false; diff --git a/NKC_WF/WebUserControls/cmp_SheetsStats.ascx b/NKC_WF/WebUserControls/cmp_SheetsStats.ascx index d3c56b4..c5ac9d2 100644 --- a/NKC_WF/WebUserControls/cmp_SheetsStats.ascx +++ b/NKC_WF/WebUserControls/cmp_SheetsStats.ascx @@ -14,15 +14,6 @@