NON permette conferma se ODL è 0

This commit is contained in:
Samuele E. Locatelli
2017-07-28 10:33:10 +02:00
parent 4ea316d8dc
commit f505261e5c
3 changed files with 250 additions and 228 deletions
+1 -2
View File
@@ -2,8 +2,7 @@
<div data-role="content">
<div class="ui-grid-a">
<div class="ui-block-a" data-role="content">
<asp:Button runat="server" ID="btnShowConfProd" Text="Mostra Conferma" data-role="button" data-iconpos="bottom" data-icon="check"
data-theme="b" data-inline="false" OnClick="btnShowConfProd_Click" Width="100%" />
<asp:Button runat="server" ID="btnShowConfProd" Text="Mostra Conferma" data-role="button" data-iconpos="bottom" data-icon="check" data-theme="b" data-inline="false" OnClick="btnShowConfProd_Click" Width="100%" />
</div>
<div class="ui-block-b" data-role="content">
<asp:Button runat="server" ID="btnSalva" Text="Conferma Produzione" data-role="button" data-iconpos="bottom" data-icon="plus"
+214 -190
View File
@@ -5,187 +5,211 @@ using System.Web.UI;
namespace MoonProTablet.WebUserControls
{
public partial class mod_confProd : System.Web.UI.UserControl
public partial class mod_confProd : System.Web.UI.UserControl
{
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_inserting;
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_newVal;
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_reset;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_inserting;
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_newVal;
/// <summary>
/// registrato nuovo valore
/// </summary>
public event EventHandler eh_reset;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
{
lblOut.Text = "";
switchBtnConferma(false);
btnShowConfProd.Visible = odlOk;
}
}
/// <summary>
/// Verifica ODL OK (ovvero caricato x macchina...)
/// </summary>
protected bool odlOk
{
get
{
bool answ = true;
// carico i dati preliminari: ODL
int idxOdl = 0; // userò ODL del turno
try
{
if (!Page.IsPostBack)
{
lblOut.Text = "";
switchBtnConferma(false);
}
idxOdl = DataLayer.obj.taMSE.getByIdxMacchina(idxMacchina.ToString())[0].idxODL;
}
/// <summary>
/// idx macchina selezionata
/// </summary>
public int idxMacchina
catch
{
get
{
return memLayer.ML.IntSessionObj("IdxMacchina");
}
set
{
memLayer.ML.setSessionVal("IdxMacchina", value);
}
logger.lg.scriviLog(string.Format("Errore a recuperare ODL per la macchina {0}", idxMacchina), tipoLog.ERROR);
}
/// <summary>
/// cambio stato visibilità pannello e testo button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnShowConfProd_Click(object sender, EventArgs e)
// se ODL > 0 è ok!!!
answ = (idxOdl > 0);
return answ;
}
}
/// <summary>
/// idx macchina selezionata
/// </summary>
public int idxMacchina
{
get
{
return memLayer.ML.IntSessionObj("IdxMacchina");
}
set
{
memLayer.ML.setSessionVal("IdxMacchina", value);
}
}
/// <summary>
/// cambio stato visibilità pannello e testo button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnShowConfProd_Click(object sender, EventArgs e)
{
switchBtnConferma(!txtNumPezzi.Enabled);
}
/// <summary>
/// determina comportamento btn conferma
/// </summary>
private void switchBtnConferma(bool showConf)
{
txtNumPezzi.Enabled = showConf;
txtNumScarti.Enabled = showConf;
//txtPzBuoni.Visible = showConf;
btnSalva.Visible = showConf;
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd;
rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
try
{
txtNumPezzi.Text = rigaProd.pezziNonConfermati.ToString();
txtNumScarti.Text = "0";
txtPzBuoni.Text = numPzConfermati.ToString();
// sollevo evento!
if (eh_inserting != null)
{
switchBtnConferma(!txtNumPezzi.Enabled);
eh_inserting(this, new EventArgs());
}
/// <summary>
/// determina comportamento btn conferma
/// </summary>
private void switchBtnConferma(bool showConf)
}
catch
{
txtNumPezzi.Text = "0";
logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}", idxMacchina), tipoLog.ERROR);
}
if (showConf)
{
btnShowConfProd.Text = "Nascondi Conferma";
}
else
{
btnShowConfProd.Text = "Mostra Conferma";
// sollevo evento!
if (eh_reset != null)
{
txtNumPezzi.Enabled = showConf;
txtNumScarti.Enabled = showConf;
//txtPzBuoni.Visible = showConf;
btnSalva.Visible = showConf;
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd;
rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
try
{
txtNumPezzi.Text = rigaProd.pezziNonConfermati.ToString();
txtNumScarti.Text = "0";
txtPzBuoni.Text = numPzConfermati.ToString();
// sollevo evento!
if (eh_inserting != null)
{
eh_inserting(this, new EventArgs());
}
}
catch
{
txtNumPezzi.Text = "0";
logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}", idxMacchina), tipoLog.ERROR);
}
if (showConf)
{
btnShowConfProd.Text = "Nascondi Conferma";
}
else
{
btnShowConfProd.Text = "Mostra Conferma";
// sollevo evento!
if (eh_reset != null)
{
eh_reset(this, new EventArgs());
}
}
eh_reset(this, new EventArgs());
}
/// <summary>
/// Numero pezzi PRODOTTI
/// </summary>
protected int numPzProdotti
}
}
/// <summary>
/// Numero pezzi PRODOTTI
/// </summary>
protected int numPzProdotti
{
get
{
int answ = 0;
try
{
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtNumPezzi.Text);
}
catch
{ }
return answ;
}
answ = Convert.ToInt32(txtNumPezzi.Text);
}
/// <summary>
/// Numero pezzi SCARTATI
/// </summary>
protected int numPzScarto
catch
{ }
return answ;
}
}
/// <summary>
/// Numero pezzi SCARTATI
/// </summary>
protected int numPzScarto
{
get
{
int answ = 0;
try
{
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtNumScarti.Text);
}
catch
{ }
return answ;
}
answ = Convert.ToInt32(txtNumScarti.Text);
}
/// <summary>
/// Numero pezzi confermati (buoni - scarto)
/// </summary>
protected int numPzConfermati
{
get
{
return numPzProdotti - numPzScarto;
}
}
/// <summary>
/// salvo produzione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSalva_Click(object sender, EventArgs e)
{
if (memLayer.ML.confReadInt("modoConfProd") == 2)
{
confermaPerTurni();
}
else
{
confermaPerGiorni();
}
// refresh tabella dati tablet...
DataLayer.obj.taMSE.getByRefreshData(memLayer.ML.confReadInt("refrMSE_0"));
// mostro output
lblOut.Text = string.Format("Confermata la produzione per {0} pezzi! ({1} scarto)", numPzConfermati, numPzScarto);
// cambio button conferma...
switchBtnConferma(!txtNumPezzi.Enabled);
// sollevo evento!
if (eh_newVal != null)
{
eh_newVal(this, new EventArgs());
}
}
/// <summary>
/// effettua conferma per giorni della produzione
/// </summary>
private void confermaPerGiorni()
{
// vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo...
catch
{ }
return answ;
}
}
/// <summary>
/// Numero pezzi confermati (buoni - scarto)
/// </summary>
protected int numPzConfermati
{
get
{
return numPzProdotti - numPzScarto;
}
}
/// <summary>
/// salvo produzione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSalva_Click(object sender, EventArgs e)
{
if (memLayer.ML.confReadInt("modoConfProd") == 2)
{
confermaPerTurni();
}
else
{
confermaPerGiorni();
}
// refresh tabella dati tablet...
DataLayer.obj.taMSE.getByRefreshData(memLayer.ML.confReadInt("refrMSE_0"));
// mostro output
lblOut.Text = string.Format("Confermata la produzione per {0} pezzi! ({1} scarto)", numPzConfermati, numPzScarto);
// cambio button conferma...
switchBtnConferma(!txtNumPezzi.Enabled);
// sollevo evento!
if (eh_newVal != null)
{
eh_newVal(this, new EventArgs());
}
}
/// <summary>
/// effettua conferma per giorni della produzione
/// </summary>
private void confermaPerGiorni()
{
// vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo...
#if false
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
// chiamo stored stp_ConfermaProduzCompleta(idxMacchina,MatrApp,dataFrom,dataTo,pezziConf)
DataLayer.obj.taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina.ToString(), DataLayer.MatrOpr, rigaProd.DataFrom, rigaProd.DataTo, numPzConfermati, memLayer.ML.confReadInt("modoConfProd"));
#endif
DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto);
}
/// <summary>
/// effettua conferma per turni della produzione
/// </summary>
private void confermaPerTurni()
{
// vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo...
DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto);
}
/// <summary>
/// effettua conferma per turni della produzione
/// </summary>
private void confermaPerTurni()
{
// vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo...
#if false
// carico i dati preliminari: ODL
int idxOdl = 0; // userò ODL del turno
@@ -288,32 +312,32 @@ namespace MoonProTablet.WebUserControls
logger.lg.scriviLog(string.Format("Errore nella chiamata a stored di conferma dati!{0}{1}", Environment.NewLine, exc), tipoLog.ERROR);
}
#endif
DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto);
}
/// <summary>
/// update post modifica pz buoni
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumPezzi_TextChanged(object sender, EventArgs e)
{
updatePzBuoni();
}
/// <summary>
/// aggiorna visualizzazione pz buoni /prodotti - scarti)
/// </summary>
private void updatePzBuoni()
{
txtPzBuoni.Text = numPzConfermati.ToString();
}
/// <summary>
/// update post modifica pz scarto
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumScarti_TextChanged(object sender, EventArgs e)
{
updatePzBuoni();
}
DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto);
}
/// <summary>
/// update post modifica pz buoni
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumPezzi_TextChanged(object sender, EventArgs e)
{
updatePzBuoni();
}
/// <summary>
/// aggiorna visualizzazione pz buoni /prodotti - scarti)
/// </summary>
private void updatePzBuoni()
{
txtPzBuoni.Text = numPzConfermati.ToString();
}
/// <summary>
/// update post modifica pz scarto
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumScarti_TextChanged(object sender, EventArgs e)
{
updatePzBuoni();
}
}
}
+35 -36
View File
@@ -1,96 +1,95 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace MoonProTablet.WebUserControls
{
namespace MoonProTablet.WebUserControls {
public partial class mod_confProd {
/// <summary>
/// btnShowConfProd control.
/// Controllo btnShowConfProd.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnShowConfProd;
/// <summary>
/// btnSalva control.
/// Controllo btnSalva.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSalva;
/// <summary>
/// lblNumPezzi control.
/// Controllo lblNumPezzi.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumPezzi;
/// <summary>
/// txtNumPezzi control.
/// Controllo txtNumPezzi.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNumPezzi;
/// <summary>
/// lblNumScarti control.
/// Controllo lblNumScarti.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumScarti;
/// <summary>
/// txtNumScarti control.
/// Controllo txtNumScarti.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNumScarti;
/// <summary>
/// lblPzBuoni control.
/// Controllo lblPzBuoni.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPzBuoni;
/// <summary>
/// txtPzBuoni control.
/// Controllo txtPzBuoni.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPzBuoni;
/// <summary>
/// lblOut control.
/// Controllo lblOut.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblOut;
}