diff --git a/NKC_WF/WebUserControls/cmp_batchDetail.ascx b/NKC_WF/WebUserControls/cmp_batchDetail.ascx index 26215d0..2904624 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetail.ascx +++ b/NKC_WF/WebUserControls/cmp_batchDetail.ascx @@ -24,7 +24,7 @@
- +
diff --git a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs index 29e1013..6ca3f13 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs @@ -3,10 +3,12 @@ using NKC_SDK; using SteamWare; using System; using System.Collections.Generic; +using System.Linq; using System.Text; namespace NKC_WF.WebUserControls { + public partial class cmp_batchDetail : System.Web.UI.UserControl { public event EventHandler eh_doRefresh; @@ -93,18 +95,58 @@ namespace NKC_WF.WebUserControls } catch { } - //il tot delle part è in bunk > Sheet > part - int totPartNum = 0; - foreach (var bunk in nestAnsw.BunkList) - { - foreach (var sheet in bunk.SheetList) - { - totPartNum += sheet.PartList.Count; - } - } + int totKit = 0; try { - sb.AppendLine($"NEST: EnvNum: {nestAnsw.EnvNum} | Worktime: {nestAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {nestAnsw.ProcessingRuntime / 60:N2} min | Bunks #: {nestAnsw.BunkList.Count} | Carts #: {nestAnsw.CartList.Count} | Parts #: {totPartNum}"); + foreach (var cart in nestAnsw.CartList) + { + totKit += cart.KitList.Count; + } + } + catch + { } + //il tot delle part è in bunk > Sheet > part + int totPartNum = 0; + int totSheet = 0; + List materialsList = new List(); + double num = 0; + double den = 1; + double currRatio = 0; + List workRatio = new List(); + try + { + foreach (var bunk in nestAnsw.BunkList) + { + totSheet += bunk.SheetList.Count; + foreach (var sheet in bunk.SheetList) + { + totPartNum += sheet.PartList.Count; + num = sheet.SurfaceWork > 0 ? sheet.SurfaceWork : 0; + den = sheet.SurfaceTotal > 0 ? sheet.SurfaceTotal : 1; + currRatio = ratioProt(num, den); + workRatio.Add(currRatio); + if (!materialsList.Contains(sheet.MatId)) + { + materialsList.Add(sheet.MatId); + } + } + } + } + catch + { } + try + { + // ordino le medie + workRatio.Sort(); + // elimino le + basse quanti materiali ci sono... + workRatio.RemoveRange(0, materialsList.Count); + double avgRatio = workRatio.Average(); + double minRatio = workRatio.Min(); + double maxRatio = workRatio.Max(); + sb.AppendLine($"NEST: EnvNum: {nestAnsw.EnvNum}"); + sb.AppendLine($" - Worktime: {nestAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {nestAnsw.ProcessingRuntime / 60:N2} min | Materials: {materialsList.Count} "); + sb.AppendLine($" - Bunks #: {nestAnsw.BunkList.Count} | Sheets #: {totSheet} | Carts #: {nestAnsw.CartList.Count} | Bins #: {nestAnsw.BinList.Count} | Kits #: {totKit} | Parts #: {totPartNum}"); + sb.AppendLine($" - OEE: {avgRatio:P1} (min: {minRatio:P1} --> MAX: {maxRatio:P1})"); // se ho duplicati indico: if (partListNestDupl.Count > 0) { @@ -159,6 +201,17 @@ namespace NKC_WF.WebUserControls } } /// + /// Effettua divisione evitando zeri a den... + /// + /// + /// + /// + protected double ratioProt(double num, double den) + { + den = den == 0 ? 1 : den; + return num / den; + } + /// /// Controlla se lo stato sia uguale a quello richiesto /// ///