163 lines
5.1 KiB
C#
163 lines
5.1 KiB
C#
using SteamWare;
|
|
using System;
|
|
|
|
namespace MP_ADM.WebUserControls
|
|
{
|
|
public partial class mod_newOdl : BaseUserControl
|
|
{
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// mostro elenco ultimi 5 tempi e note...
|
|
/// </summary>
|
|
private void showLastTimeAndNote()
|
|
{
|
|
// update tempi ciclo!
|
|
grViewTempi.DataBind();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// annullamento inserimento
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
raiseNewVal();
|
|
}
|
|
|
|
/// <summary>
|
|
/// conferma inserimento TC
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
// controllo se ho tutti i valori ok...
|
|
string CodArticolo = "";
|
|
string IdxMacchina = "";
|
|
int numPezzi = 0;
|
|
int pzPallet = 1;
|
|
decimal TCiclo = 0;
|
|
|
|
try
|
|
{
|
|
CodArticolo = ddlArticolo.SelectedValue;
|
|
IdxMacchina = ddlMacchine.SelectedValue;
|
|
//IdxMacchina = txtMacchina.Text.Trim();
|
|
// se IdxMacchina è vuoto metto null...
|
|
if (IdxMacchina == "")
|
|
{
|
|
IdxMacchina = "0";
|
|
}
|
|
numPezzi = Convert.ToInt32(txtPezzi.Text.Trim());
|
|
TCiclo = Convert.ToDecimal(txtTempoCiclo.Text.Trim().Replace(".", ","));
|
|
pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim());
|
|
DataLayerObj.taODL.InsertQuery(CodArticolo, DataLayerObj.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim());
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire l'ODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4}", CodArticolo, IdxMacchina, numPezzi, TCiclo, pzPallet), tipoLog.ERROR);
|
|
}
|
|
raiseNewVal();
|
|
}
|
|
|
|
/// <summary>
|
|
/// reset della selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
/// <summary>
|
|
/// selezione articolo
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
showLastTimeAndNote();
|
|
}
|
|
|
|
/// <summary>
|
|
/// selezione impianto
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
showLastTimeAndNote();
|
|
}
|
|
|
|
/// <summary>
|
|
/// evento selezione riga: salvo tempo e qta nei campi input...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grViewTempi_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// ricavo i dati selezionati
|
|
int idxOdl = 0;
|
|
try
|
|
{
|
|
idxOdl = Convert.ToInt32(grViewTempi.SelectedValue);
|
|
}
|
|
catch
|
|
{ }
|
|
MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0];
|
|
// precompilo dati pezzi/tempi
|
|
txtPezzi.Text = rigaOdl.NumPezzi.ToString();
|
|
txtTempoCiclo.Text = rigaOdl.TCAssegnato.ToString("0.00");
|
|
txtPzPallet.Text = rigaOdl.PzPallet.ToString();
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// aggiorno label min e centesimi
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtTempoCiclo_TextChanged(object sender, EventArgs e)
|
|
{
|
|
string text = "";
|
|
string txtMinCent = txtTempoCiclo.Text.Trim().Replace(".", ",");
|
|
int min = 0;
|
|
int sec = 0;
|
|
try
|
|
{
|
|
// cerco di convertire in min/sec
|
|
min = Convert.ToInt32(Math.Floor(Convert.ToDouble(txtMinCent)));
|
|
sec = Convert.ToInt32((Convert.ToDouble(txtMinCent) - min) * 60);
|
|
text = string.Format("{0}:{1:00}", min, sec);
|
|
}
|
|
catch
|
|
{ }
|
|
lblMinSec.Text = text;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
|
/// </summary>
|
|
public void resetSelezione()
|
|
{
|
|
grViewTempi.SelectedIndex = -1;
|
|
grViewTempi.DataBind();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |