From 9aa4f0c60c6571c5eaee9f705fbc56b62b60c4d3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 6 Oct 2021 13:29:47 +0200 Subject: [PATCH] Review display pezzi/ora --- NKC_WF/Controllers/DayStatsController.cs | 8 +- .../WebUserControls/cmp_DailyStatsList.ascx | 109 +++++++++++++----- .../cmp_DailyStatsList.ascx.cs | 21 +++- .../cmp_DailyStatsList.ascx.designer.cs | 13 ++- 4 files changed, 117 insertions(+), 34 deletions(-) diff --git a/NKC_WF/Controllers/DayStatsController.cs b/NKC_WF/Controllers/DayStatsController.cs index 45c2f9f..85496b1 100644 --- a/NKC_WF/Controllers/DayStatsController.cs +++ b/NKC_WF/Controllers/DayStatsController.cs @@ -72,6 +72,7 @@ namespace NKC_WF.Controllers foreach (var item in tabDati.OrderBy(x => x.DataOraRif)) { decimal value = 0; + decimal denom = 1; switch (PlotType) { case "AvailTime": @@ -90,9 +91,14 @@ namespace NKC_WF.Controllers value = item.MinRun; break; + case "AvgPartsHour": + denom = item.MinRun != 0 ? item.MinRun : 1; + value = item.ItmProd / denom * 100; + break; + default: case "OEE": - decimal denom = item.MinDisp != 0 ? item.MinDisp : 1; + denom = item.MinDisp != 0 ? item.MinDisp : 1; value = item.MinRun / denom * 100; break; } diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx index fe68ebc..caf5eda 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx @@ -9,33 +9,71 @@
-
+
<%: traduci("DayProdStats") %>
-
- <%: traduci("PlotGraph") %> - - - - - - - - -  |  - <%: traduci("Machine") %> - - - - - -  |  - <%: traduci("DateStart") %>: -   - <%: traduci("DateEnd") %>: - -  |  +
+
+
+
+
+ <%: traduci("PlotType") %> +
+ + + + + + + + +
+
+
+
+
+ <%: traduci("PlotGraph") %> +
+ +
+
+
+
+
+ <%: traduci("Machine") %> +
+ + + + + +
+
+
+
+
+ <%: traduci("DtStart") %> +
+ +
+
+
+
+
+ <%: traduci("DtEnd") %> +
+ +
+
+
+ <%--
+
+ # +
+
--%> +
+
@@ -51,15 +89,28 @@ - - - - - + + + + + + + + + + + + + + + + + + diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs index 42fae3f..24e8200 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.cs @@ -102,7 +102,7 @@ namespace NKC_WF.WebUserControls cmp_numRow.numRow = 10; grView.PageSize = cmp_numRow.numRow; divGraph.Visible = false; - ddlType.Visible = false; + divType.Visible = false; DateEnd = DateTime.Today.AddDays(1); DateStart = DateEnd.AddDays(-10); } @@ -131,7 +131,7 @@ namespace NKC_WF.WebUserControls public void doUpdate() { divGraph.Visible = chkPlotGraph.Checked; - ddlType.Visible = chkPlotGraph.Checked; + divType.Visible = chkPlotGraph.Checked; if (chkPlotGraph.Checked) { updateGraph(); @@ -139,6 +139,23 @@ namespace NKC_WF.WebUserControls grView.DataBind(); } + public double ratioCalc(object _num, object _den) + { + double answ = 0; + double num = 0; + double den = 1; + double.TryParse($"{_num}", out num); + double.TryParse($"{_den}", out den); + den = den != 0 ? den : 1; + try + { + answ = (num / den); + } + catch + { } + return answ; + } + public string ratioFix(object _num, object _den) { string answ = ""; diff --git a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.designer.cs index 68e8d36..05771f6 100644 --- a/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_DailyStatsList.ascx.designer.cs @@ -33,13 +33,13 @@ namespace NKC_WF.WebUserControls protected global::NKC_WF.WebUserControls.cmp_DailyStatsPlot cmp_DailyStatsPlot; /// - /// chkPlotGraph control. + /// divType control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.CheckBox chkPlotGraph; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divType; /// /// ddlType control. @@ -50,6 +50,15 @@ namespace NKC_WF.WebUserControls /// protected global::System.Web.UI.WebControls.DropDownList ddlType; + /// + /// chkPlotGraph control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkPlotGraph; + /// /// ddlMachine control. ///