92 lines
2.6 KiB
C#
92 lines
2.6 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_BP_MaterialYeld : BaseUserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Batch corrente...
|
|
/// </summary>
|
|
public int BatchId
|
|
{
|
|
get
|
|
{
|
|
int answ = memLayer.ML.QSI("BatchId");
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public List<AppData.DTO.MaterialYeldStatsDTO> GetMatStatList()
|
|
{
|
|
DataLayer DLMan = new DataLayer();
|
|
MatStatList = new List<AppData.DTO.MaterialYeldStatsDTO>();
|
|
var statData = DLMan.GetYeldStatsFromMongoData(BatchId);
|
|
if (statData != null)
|
|
{
|
|
MatStatList = statData.ListByMaterial;
|
|
}
|
|
#if false
|
|
Random rnd = new Random();
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
var randDbl = rnd.NextDouble();
|
|
MatStatList.Add(new NKC_WF.DTO.MaterialStats() { MatCode = $"{i * 100:00000}", MatDescript = $"Descrizione {i:00}", TotSheets = rnd.Next(10), TotParts = 50 * rnd.Next(1, 5), YeldAvg = randDbl, YeldMin = randDbl / 2, YeldMax = 1 - (1 - randDbl) / 2 });
|
|
}
|
|
#endif
|
|
return MatStatList;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected List<AppData.DTO.MaterialYeldStatsDTO> MatStatList = new List<AppData.DTO.MaterialYeldStatsDTO>();
|
|
|
|
/// <summary>
|
|
/// Tabella dei dati di quante part siano presenti x foglio recuperato dai dati nesting da mongoDB
|
|
/// </summary>
|
|
protected Dictionary<int, int> SheetPartQty = new Dictionary<int, int>();
|
|
|
|
/// <summary>
|
|
/// Tabella dei dati di resa (Yeald) x foglio recuperato dai dati nesting da mongoDB
|
|
/// </summary>
|
|
protected Dictionary<int, double> SheetYeld = new Dictionary<int, double>();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Methods
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Legge da redis, se non trovasse legge da mongoDB e salva in redis come cache...
|
|
/// </summary>
|
|
private void ReloadData()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
}
|
|
} |