139 lines
4.0 KiB
C#
139 lines
4.0 KiB
C#
using global::Microsoft.AspNetCore.Components;
|
|
|
|
namespace MP_TAB3.Components
|
|
{
|
|
public partial class ProdAdvDispl
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Conteggio dati produzione da mostrare
|
|
/// </summary>
|
|
[Parameter]
|
|
public ProdCounter CountData { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Classes
|
|
|
|
/// <summary>
|
|
/// Classe gesitone conteggi produzione
|
|
/// </summary>
|
|
public class ProdCounter
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// NUmero pezzi CONFERMATI
|
|
/// </summary>
|
|
public int numPzConf { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi ORDINATI
|
|
/// </summary>
|
|
public int numPzOrd { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi PRODOTTI
|
|
/// </summary>
|
|
public int numPzProd { get; set; } = 0;
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
#endregion Public Classes
|
|
|
|
#region Protected Fields
|
|
|
|
protected int nBlue = 0;
|
|
|
|
protected int nGray = 0;
|
|
|
|
protected int nGreen = 0;
|
|
|
|
protected int nYellow = 0;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// Numero pezzi per display BLU
|
|
/// </summary>
|
|
protected int NumBlue { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi per display GRIGIO
|
|
/// </summary>
|
|
protected int NumGray { get; set; } = 40;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi per display VERDE
|
|
/// </summary>
|
|
protected int NumGreen { get; set; } = 20;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi CONFERMATI
|
|
/// </summary>
|
|
protected int NumPzConf { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi ORDINATI
|
|
/// </summary>
|
|
protected int NumPzOrd { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi PRODOTTI
|
|
/// </summary>
|
|
protected int NumPzProd { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Numero pezzi per display GIALLO
|
|
/// </summary>
|
|
protected int NumYellow { get; set; } = 30;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
decimal denom = (decimal)CountData.numPzOrd / 100; //CountData.numPzProd > CountData.numPzOrd ? (decimal)CountData.numPzProd / 100 : (decimal)CountData.numPzOrd / 100;
|
|
denom = denom == 0 ? 1 : denom;
|
|
// calcolo se sono nel caso prod < ordinati o se sono andato OVER
|
|
if (CountData.numPzProd <= CountData.numPzOrd)
|
|
{
|
|
nGreen = (int)Math.Floor((decimal)CountData.numPzConf / denom);
|
|
nYellow = (int)Math.Floor((decimal)(CountData.numPzProd - CountData.numPzConf) / denom);
|
|
nGray = 100 - (nGreen + nYellow);
|
|
nBlue = 0;
|
|
}
|
|
else
|
|
{
|
|
// green: confermati verdi
|
|
nGreen = (int)Math.Floor((decimal)CountData.numPzConf / denom);
|
|
// gialli: extra prodotti fino a 100...
|
|
if (CountData.numPzProd < CountData.numPzOrd)
|
|
{
|
|
nYellow = (int)Math.Floor((decimal)(CountData.numPzProd - CountData.numPzConf) / denom);
|
|
}
|
|
else
|
|
{
|
|
nYellow = 100 - nGreen;
|
|
}
|
|
// blu: quanti sono "extra" e da confermare
|
|
nBlue = (int)Math.Floor((decimal)(CountData.numPzProd - CountData.numPzOrd) / denom);
|
|
nGray = 0;
|
|
}
|
|
|
|
// disegno!
|
|
NumGreen = nGreen;
|
|
NumYellow = nYellow;
|
|
NumGray = nGray;
|
|
NumBlue = nBlue;
|
|
// base.OnParametersSet();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |