Fix di tutte le chiamate x setup ODL
This commit is contained in:
@@ -3,156 +3,156 @@ using System;
|
||||
|
||||
namespace MoonPro_site.WebUserControls
|
||||
{
|
||||
public partial class mod_newOdl : System.Web.UI.UserControl
|
||||
public partial class mod_newOdl : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <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());
|
||||
MapoDb.DataLayer.obj.taODL.InsertQuery(CodArticolo, 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);
|
||||
}
|
||||
// segnalo update
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// annullamento inserimento
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// selezione articolo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
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>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(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();
|
||||
}
|
||||
/// <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 = MapoDb.DataLayer.obj.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();
|
||||
}
|
||||
}
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <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());
|
||||
MapoDb.DataLayer.obj.taODL.InsertQuery(CodArticolo, MapoDb.DataLayer.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);
|
||||
}
|
||||
// segnalo update
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// annullamento inserimento
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// selezione articolo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
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>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(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();
|
||||
}
|
||||
/// <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 = MapoDb.DataLayer.obj.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,7 @@
|
||||
using MapoDb;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace MoonProTablet.WebUserControls
|
||||
{
|
||||
@@ -59,7 +55,7 @@ namespace MoonProTablet.WebUserControls
|
||||
decimal tCiclo = numMin + ((decimal)numSec) / 60;
|
||||
string note = txtNote.Text.Trim();
|
||||
// insert su DB
|
||||
DataLayer.obj.taODL.insertProvv(ddlArticolo.SelectedValue, idxMacchina, numPz, tCiclo, note);
|
||||
DataLayer.obj.taODL.insertProvv(ddlArticolo.SelectedValue, MapoDb.DataLayer.MatrOpr, idxMacchina, numPz, tCiclo, note);
|
||||
// calcolo stringa macchina e articolo...
|
||||
var rMacchina = DataLayer.obj.taMacchine.GetByIdx(idxMacchina)[0];
|
||||
var rArticolo = DataLayer.obj.taAnagArt.getByCod(ddlArticolo.SelectedValue)[0];
|
||||
@@ -68,7 +64,7 @@ namespace MoonProTablet.WebUserControls
|
||||
// invio email notifica creazione ODL PROVVISORIO (da riconciliare...)
|
||||
string subject = "Effettuato attrezzaggio con ODL provvisorio";
|
||||
string oggetto = string.Format("E' stato effettuato unattrezzaggio con ODL provvisorio.<br/>Macchina: <b>{0}</b><br>Articolo: <b>{1}</b><br>Lanciati <b>{2}</b> pezzi con T.Ciclo <b>{3:N3}</b> (min.cent) / <b>{4}:{5}</b> (min:sec).<br><br>Note operatore: <b>{6}</b>", macchina, articolo, numPz, tCiclo, numMin, numSec, note);
|
||||
gestEmail.geAuth.mandaEmail(memLayer.ML.confReadString("_fromEmail"), memLayer.ML.confReadString("_adminEmail"), subject, oggetto);
|
||||
gestEmail.geAuth.mandaEmail(memLayer.ML.confReadString("_fromEmail"), memLayer.ML.confReadString("_adminEmail"), subject, oggetto);
|
||||
// sollevo evento!
|
||||
if (eh_newVal != null)
|
||||
{
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace MoonProTablet.WebUserControls
|
||||
try
|
||||
{
|
||||
idxODL = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0].IdxODL;
|
||||
DataLayer.obj.taODL.splitODL(idxODL, idxMacchina, TCAssegnato(idxODL), string.Format("inizio attrezzaggio, Sospensione ODL {0}, generato residuo con pari TCiclo: {1}", idxODL, TCAssegnato(idxODL)), false);
|
||||
DataLayer.obj.taODL.splitODL(idxODL, DataLayer.MatrOpr, idxMacchina, TCAssegnato(idxODL), string.Format("inizio attrezzaggio, Sospensione ODL {0}, generato residuo con pari TCiclo: {1}", idxODL, TCAssegnato(idxODL)), false);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -354,7 +354,7 @@ namespace MoonProTablet.WebUserControls
|
||||
if (EnableRPO)
|
||||
{
|
||||
// creo nuovo ODL da promessa ed associo
|
||||
DataLayer.obj.taODL.inizioSetupPromessa(idxODLSel, idxMacchina, TCRichAttr, txtNote.Text);
|
||||
DataLayer.obj.taODL.inizioSetupPromessa(idxODLSel, DataLayer.MatrOpr, idxMacchina, TCRichAttr, txtNote.Text);
|
||||
// salvo ODL attrezzato
|
||||
idxODL_curr = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0].IdxODL;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ namespace MoonProTablet.WebUserControls
|
||||
else
|
||||
{
|
||||
// avvio NUOVO ODL
|
||||
DataLayer.obj.taODL.inizioSetup(idxODLSel, idxMacchina, TCRichAttr, txtNote.Text);
|
||||
DataLayer.obj.taODL.inizioSetup(idxODLSel, DataLayer.MatrOpr, idxMacchina, TCRichAttr, txtNote.Text);
|
||||
// salvo ODL Current
|
||||
idxODL_curr = idxODLSel;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ namespace MoonProTablet.WebUserControls
|
||||
int idxODL = DataLayer.obj.taODL.getByMacchina(idxMacchina)[0].IdxODL;
|
||||
int idxEvento = 1; // !!!HARD CODED
|
||||
// aggiorno (se necessario) note e tempo setup
|
||||
DataLayer.obj.taODL.updateSetup(idxODL, TCRichAttr, txtNote.Text);
|
||||
DataLayer.obj.taODL.updateSetup(idxODL, DataLayer.MatrOpr, TCRichAttr, txtNote.Text);
|
||||
// controllo se TC Assegnato != TCRichiesto allora invio email x verifiche...
|
||||
DS_ProdTempi.ODLRow rigaOdl = DataLayer.obj.taODL.getByIdx(idxODL, false)[0];
|
||||
if (rigaOdl.TCAssegnato != TCRichAttr)
|
||||
@@ -448,7 +448,7 @@ namespace MoonProTablet.WebUserControls
|
||||
try
|
||||
{
|
||||
// effettuo split su nuovo ODL
|
||||
DataLayer.obj.taODL.splitODL(idxODL, idxMacchina, TCAssegnato(idxODL), string.Format("Fine Produzione, Sospensione ODL {0}, generato residuo con pari TCiclo: {1}", idxODL, TCAssegnato(idxODL)), false);
|
||||
DataLayer.obj.taODL.splitODL(idxODL, DataLayer.MatrOpr, idxMacchina, TCAssegnato(idxODL), string.Format("Fine Produzione, Sospensione ODL {0}, generato residuo con pari TCiclo: {1}", idxODL, TCAssegnato(idxODL)), false);
|
||||
|
||||
// processo chiusura setup
|
||||
processaEvento(idxEvento, String.Format("Registrata fine produzione per ODL {0}, nuovo ODL per quantità residua", idxODL), idxODL);
|
||||
@@ -538,7 +538,7 @@ namespace MoonProTablet.WebUserControls
|
||||
confermaProdOdl(false);
|
||||
|
||||
// effettuo split su nuovo ODL
|
||||
DataLayer.obj.taODL.splitODL(currODL, idxMacchina, TCRichAttr, txtNote.Text, true);
|
||||
DataLayer.obj.taODL.splitODL(currODL, DataLayer.MatrOpr, idxMacchina, TCRichAttr, txtNote.Text, true);
|
||||
|
||||
// resetto ODL su redis...
|
||||
DataLayer.emptyCurrODL(idxMacchina);
|
||||
|
||||
Reference in New Issue
Block a user