Rivisto calcolo statistiche NEST

This commit is contained in:
Samuele E. Locatelli
2020-01-24 17:43:16 +01:00
parent ece2733ebb
commit c3839b5361
2 changed files with 64 additions and 11 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
</div>
</div>
<div class="form-group row py-0 mt-0 mb-1">
<label for="lblNumOrders" class="col-sm-4 col-form-label py-0">Num Orders</label>
<label for="lblNumOrders" class="col-sm-4 col-form-label py-0">Num KIT</label>
<div class="col-sm-8 font-weight-bold">
<asp:Label ID="lblNumOrders" runat="server" Text='<%# Eval("NumOrders") %>' />
</div>
+63 -10
View File
@@ -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<int> materialsList = new List<int>();
double num = 0;
double den = 1;
double currRatio = 0;
List<double> workRatio = new List<double>();
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: <b>{nestAnsw.EstimatedWorktime / 60:N2}</b> min | Processing Runtime <b>{nestAnsw.ProcessingRuntime / 60:N2}</b> min | Materials: <b>{materialsList.Count}</b> ");
sb.AppendLine($" - Bunks #: <b>{nestAnsw.BunkList.Count}</b> | Sheets #: <b>{totSheet}</b> | Carts #: <b>{nestAnsw.CartList.Count}</b> | Bins #: <b>{nestAnsw.BinList.Count}</b> | Kits #: <b>{totKit}</b> | Parts #: <b>{totPartNum}</b>");
sb.AppendLine($" - OEE: <b>{avgRatio:P1}</b> (min: <b>{minRatio:P1}</b> --> MAX: <b>{maxRatio:P1}</b>)");
// se ho duplicati indico:
if (partListNestDupl.Count > 0)
{
@@ -159,6 +201,17 @@ namespace NKC_WF.WebUserControls
}
}
/// <summary>
/// Effettua divisione evitando zeri a den...
/// </summary>
/// <param name="num"></param>
/// <param name="den"></param>
/// <returns></returns>
protected double ratioProt(double num, double den)
{
den = den == 0 ? 1 : den;
return num / den;
}
/// <summary>
/// Controlla se lo stato sia uguale a quello richiesto
/// </summary>
/// <param name="_status"></param>