NON permette conferma se ODL è 0
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user