From f505261e5c2e61fb037a9e005488cdfbd2025ceb Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 28 Jul 2017 10:33:10 +0200 Subject: [PATCH] =?UTF-8?q?NON=20permette=20conferma=20se=20ODL=20=C3=A8?= =?UTF-8?q?=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MP-Tablet/WebUserControls/mod_confProd.ascx | 3 +- .../WebUserControls/mod_confProd.ascx.cs | 404 ++++++++++-------- .../mod_confProd.ascx.designer.cs | 71 ++- 3 files changed, 250 insertions(+), 228 deletions(-) diff --git a/MP-Tablet/WebUserControls/mod_confProd.ascx b/MP-Tablet/WebUserControls/mod_confProd.ascx index d7df5b68..ba7b0507 100644 --- a/MP-Tablet/WebUserControls/mod_confProd.ascx +++ b/MP-Tablet/WebUserControls/mod_confProd.ascx @@ -2,8 +2,7 @@
- +
+ /// registrato nuovo valore + /// + public event EventHandler eh_inserting; + /// + /// registrato nuovo valore + /// + public event EventHandler eh_newVal; + /// + /// registrato nuovo valore + /// + public event EventHandler eh_reset; + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) { - /// - /// registrato nuovo valore - /// - public event EventHandler eh_inserting; - /// - /// registrato nuovo valore - /// - public event EventHandler eh_newVal; - /// - /// registrato nuovo valore - /// - public event EventHandler eh_reset; - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) + if (!Page.IsPostBack) + { + lblOut.Text = ""; + switchBtnConferma(false); + btnShowConfProd.Visible = odlOk; + } + } + /// + /// Verifica ODL OK (ovvero caricato x macchina...) + /// + 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; } - /// - /// idx macchina selezionata - /// - 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); } - /// - /// cambio stato visibilità pannello e testo button - /// - /// - /// - protected void btnShowConfProd_Click(object sender, EventArgs e) + // se ODL > 0 è ok!!! + answ = (idxOdl > 0); + return answ; + } + } + /// + /// idx macchina selezionata + /// + public int idxMacchina + { + get + { + return memLayer.ML.IntSessionObj("IdxMacchina"); + } + set + { + memLayer.ML.setSessionVal("IdxMacchina", value); + } + } + /// + /// cambio stato visibilità pannello e testo button + /// + /// + /// + protected void btnShowConfProd_Click(object sender, EventArgs e) + { + switchBtnConferma(!txtNumPezzi.Enabled); + } + /// + /// determina comportamento btn conferma + /// + 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()); } - /// - /// determina comportamento btn conferma - /// - 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()); } - /// - /// Numero pezzi PRODOTTI - /// - protected int numPzProdotti + } + } + /// + /// Numero pezzi PRODOTTI + /// + 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); } - /// - /// Numero pezzi SCARTATI - /// - protected int numPzScarto + catch + { } + return answ; + } + } + /// + /// Numero pezzi SCARTATI + /// + 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); } - /// - /// Numero pezzi confermati (buoni - scarto) - /// - protected int numPzConfermati - { - get - { - return numPzProdotti - numPzScarto; - } - } - /// - /// salvo produzione - /// - /// - /// - 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()); - } - } - /// - /// effettua conferma per giorni della produzione - /// - private void confermaPerGiorni() - { - // vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo... + catch + { } + return answ; + } + } + /// + /// Numero pezzi confermati (buoni - scarto) + /// + protected int numPzConfermati + { + get + { + return numPzProdotti - numPzScarto; + } + } + /// + /// salvo produzione + /// + /// + /// + 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()); + } + } + /// + /// effettua conferma per giorni della produzione + /// + 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); - } - /// - /// effettua conferma per turni della produzione - /// - private void confermaPerTurni() - { - // vecchia chiamata esplicita, uso metodo datalayer (singleton) nuovo... + DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto); + } + /// + /// effettua conferma per turni della produzione + /// + 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); - } - /// - /// update post modifica pz buoni - /// - /// - /// - protected void txtNumPezzi_TextChanged(object sender, EventArgs e) - { - updatePzBuoni(); - } - /// - /// aggiorna visualizzazione pz buoni /prodotti - scarti) - /// - private void updatePzBuoni() - { - txtPzBuoni.Text = numPzConfermati.ToString(); - } - /// - /// update post modifica pz scarto - /// - /// - /// - protected void txtNumScarti_TextChanged(object sender, EventArgs e) - { - updatePzBuoni(); - } + DataLayer.obj.confermaProdMacchina(idxMacchina.ToString(), memLayer.ML.confReadInt("modoConfProd"), numPzConfermati, numPzScarto); } + /// + /// update post modifica pz buoni + /// + /// + /// + protected void txtNumPezzi_TextChanged(object sender, EventArgs e) + { + updatePzBuoni(); + } + /// + /// aggiorna visualizzazione pz buoni /prodotti - scarti) + /// + private void updatePzBuoni() + { + txtPzBuoni.Text = numPzConfermati.ToString(); + } + /// + /// update post modifica pz scarto + /// + /// + /// + protected void txtNumScarti_TextChanged(object sender, EventArgs e) + { + updatePzBuoni(); + } + } } \ No newline at end of file diff --git a/MP-Tablet/WebUserControls/mod_confProd.ascx.designer.cs b/MP-Tablet/WebUserControls/mod_confProd.ascx.designer.cs index b3402f63..01c961c5 100644 --- a/MP-Tablet/WebUserControls/mod_confProd.ascx.designer.cs +++ b/MP-Tablet/WebUserControls/mod_confProd.ascx.designer.cs @@ -1,96 +1,95 @@ //------------------------------------------------------------------------------ -// -// This code was generated by a tool. +// +// Codice generato da uno strumento. // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// //------------------------------------------------------------------------------ -namespace MoonProTablet.WebUserControls -{ - - +namespace MoonProTablet.WebUserControls { + + public partial class mod_confProd { /// - /// btnShowConfProd control. + /// Controllo btnShowConfProd. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Button btnShowConfProd; /// - /// btnSalva control. + /// Controllo btnSalva. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Button btnSalva; /// - /// lblNumPezzi control. + /// Controllo lblNumPezzi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblNumPezzi; /// - /// txtNumPezzi control. + /// Controllo txtNumPezzi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtNumPezzi; /// - /// lblNumScarti control. + /// Controllo lblNumScarti. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblNumScarti; /// - /// txtNumScarti control. + /// Controllo txtNumScarti. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtNumScarti; /// - /// lblPzBuoni control. + /// Controllo lblPzBuoni. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblPzBuoni; /// - /// txtPzBuoni control. + /// Controllo txtPzBuoni. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtPzBuoni; /// - /// lblOut control. + /// Controllo lblOut. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblOut; }