fix trim x prom ODL in ADM

This commit is contained in:
Samuele E. Locatelli
2020-12-09 18:03:34 +01:00
parent eb5436bfd3
commit 7752a776a0
+120 -120
View File
@@ -7,13 +7,13 @@ namespace MP_ADM.WebUserControls
{
public partial class mod_newPromessaODL : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
setDefaults();
}
}
#region Public Events
public event EventHandler eh_nuovoValore;
#endregion Public Events
#region Public Properties
/// <summary>
/// Testo conferma salvataggio (create/Edit)
@@ -31,50 +31,9 @@ namespace MP_ADM.WebUserControls
}
}
public void doSelPODL()
{
// se ho una promessa da clonare copio dati da quella...
int idxProm = 0;
try
{
if (memLayer.ML.isInSessionObject("idxProm2Clone"))
{
idxProm = memLayer.ML.IntSessionObj("idxProm2Clone");
}
else if (memLayer.ML.isInSessionObject("idxProm2Edit"))
{
idxProm = memLayer.ML.IntSessionObj("idxProm2Edit");
}
// provo a selezionare
var tPODL = DataLayerObj.taPODL.getByKey(idxProm);
if (tPODL.Rows.Count > 0)
{
var rPODL = tPODL[0];
txtSearch.Text = rPODL.CodArticolo;
ddlArticolo.DataBind();
ddlArticolo.SelectedValue = rPODL.CodArticolo;
ddlGruppi.DataBind();
ddlGruppi.SelectedValue = rPODL.CodGruppo;
txtNumPz.Text = rPODL.NumPezzi.ToString();
txtPzPallet.Text = rPODL.PzPallet.ToString();
txtPrio.Text = rPODL.Priorita.ToString();
if (memLayer.ML.cdvb("ADM_TC_MinSec"))
{
txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato);
}
else
{
txtTCmc.Text = rPODL.TCAssegnato.ToString("N3");
}
ddlMacchine.SelectedValue = rPODL.IdxMacchina;
txtKeyExt.Text = rPODL.KeyRichiesta;
// svuoto se ci fosse cloning......
memLayer.ML.emptySessionVal("idxProm2Clone");
}
}
catch
{ }
}
#endregion Public Properties
#region Private Methods
private void setDefaults()
{
@@ -102,16 +61,33 @@ namespace MP_ADM.WebUserControls
}
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
/// <summary>
/// mostro elenco ultimi 5 tempi e note...
/// </summary>
private void showLastTimeAndNote()
{
ddlArticolo.DataBind();
// update tempi ciclo!
grViewTempi.DataBind();
}
#region gestione eventi
#endregion Private Methods
public event EventHandler eh_nuovoValore;
#region Protected Methods
#endregion gestione eventi
/// <summary>
/// annullamento inserimento
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancel_Click(object sender, EventArgs e)
{
memLayer.ML.emptySessionVal("idxProm2Clone");
memLayer.ML.emptySessionVal("idxProm2Edit");
if (eh_nuovoValore != null)
{
eh_nuovoValore(this, new EventArgs());
}
}
/// <summary>
/// conferma inserimento TC
@@ -189,43 +165,13 @@ namespace MP_ADM.WebUserControls
}
/// <summary>
/// annullamento inserimento
/// reset della selezione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancel_Click(object sender, EventArgs e)
protected void btnReset_Click(object sender, EventArgs e)
{
memLayer.ML.emptySessionVal("idxProm2Clone");
memLayer.ML.emptySessionVal("idxProm2Edit");
if (eh_nuovoValore != null)
{
eh_nuovoValore(this, new EventArgs());
}
}
/// <summary>
/// aggiorno label min e centesimi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtTempoCiclo_TextChanged(object sender, EventArgs e)
{
#if false
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;
#endif
resetSelezione();
}
/// <summary>
@@ -238,25 +184,6 @@ namespace MP_ADM.WebUserControls
showLastTimeAndNote();
}
/// <summary>
/// mostro elenco ultimi 5 tempi e note...
/// </summary>
private void showLastTimeAndNote()
{
// update tempi ciclo!
grViewTempi.DataBind();
}
/// <summary>
/// selezione impianto
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e)
{
showLastTimeAndNote();
}
/// <summary>
/// selezione impianto
/// </summary>
@@ -268,22 +195,13 @@ namespace MP_ADM.WebUserControls
}
/// <summary>
/// reset della selezione
/// selezione impianto
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReset_Click(object sender, EventArgs e)
protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e)
{
resetSelezione();
}
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
grViewTempi.SelectedIndex = -1;
grViewTempi.DataBind();
showLastTimeAndNote();
}
/// <summary>
@@ -314,5 +232,87 @@ namespace MP_ADM.WebUserControls
}
txtPzPallet.Text = rigaOdl.PzPallet.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
setDefaults();
}
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
{
ddlArticolo.DataBind();
}
/// <summary>
/// aggiorno label min e centesimi
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtTempoCiclo_TextChanged(object sender, EventArgs e)
{
}
#endregion Protected Methods
#region Public Methods
public void doSelPODL()
{
// se ho una promessa da clonare copio dati da quella...
int idxProm = 0;
try
{
if (memLayer.ML.isInSessionObject("idxProm2Clone"))
{
idxProm = memLayer.ML.IntSessionObj("idxProm2Clone");
}
else if (memLayer.ML.isInSessionObject("idxProm2Edit"))
{
idxProm = memLayer.ML.IntSessionObj("idxProm2Edit");
}
// provo a selezionare
var tPODL = DataLayerObj.taPODL.getByKey(idxProm);
if (tPODL.Rows.Count > 0)
{
var rPODL = tPODL[0];
txtSearch.Text = rPODL.CodArticolo.Trim();
ddlArticolo.DataBind();
ddlArticolo.SelectedValue = rPODL.CodArticolo;
ddlGruppi.DataBind();
ddlGruppi.SelectedValue = rPODL.CodGruppo;
txtNumPz.Text = rPODL.NumPezzi.ToString();
txtPzPallet.Text = rPODL.PzPallet.ToString();
txtPrio.Text = rPODL.Priorita.ToString();
if (memLayer.ML.cdvb("ADM_TC_MinSec"))
{
txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato);
}
else
{
txtTCmc.Text = rPODL.TCAssegnato.ToString("N3");
}
ddlMacchine.SelectedValue = rPODL.IdxMacchina;
txtKeyExt.Text = rPODL.KeyRichiesta;
// svuoto se ci fosse cloning......
memLayer.ML.emptySessionVal("idxProm2Clone");
}
}
catch
{ }
}
/// <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
}
}