Files
MoonPro.net/MP-Tablet/ODL.aspx.cs
T

98 lines
2.9 KiB
C#

using MapoDb;
using SteamWare;
using System;
using System.Web.UI;
namespace MoonProTablet
{
public partial class ODL : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Session["TipoLink"] = "EditMacch";
checkConfProd();
}
}
/// <summary>
/// idx macchina selezionata
/// </summary>
public int idxMacchina
{
get
{
return memLayer.ML.IntSessionObj("IdxMacchina");
}
set
{
memLayer.ML.setSessionVal("IdxMacchina", value);
}
}
/// <summary>
/// verifica se sia necessario confermare la produzione PRIMA di operare sull'ODL
/// </summary>
private void checkConfProd()
{
// controllo ODL mancante, x cui SE ci fossero pezzi --> va fatto attrezzaggio ODL retrodatato
bool odlOk = false;
try
{
int idxODL = DataLayer.obj.taMSE.getByIdxMacchina(idxMacchina.ToString())[0].idxODL;
odlOk = (idxODL > 0);
}
catch(Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero ODL corrente da confermare per la macchina {0}{1}{2}", idxMacchina, Environment.NewLine, exc), tipoLog.ERROR);
}
// verifica se sia necessario confermare produzione
bool needConfProd = true;
int pz2conf = 0;
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd;
try
{
rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
pz2conf = rigaProd.pezziNonConfermati;
needConfProd = (pz2conf > 0);
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}{1}{2}", idxMacchina, Environment.NewLine, exc), tipoLog.ERROR);
}
// se necessario mostro warning...
if (needConfProd)
{
// SE mancasse ODL mostro info x poter caricare ODL retrodatato
if (odlOk)
{
lblWarningHead.Text = traduci("ConfProdBeforeContinueHead");
lblWarningBody.Text = traduci("ConfProdBeforeContinueBody");
lblNumPz2Conf.Text = string.Format("{0} pz NC", pz2conf);
}
else
{
lblWarningHead.Text = traduci("setOdlBeforeContinueHead");
lblWarningBody.Text = traduci("setOdlBeforeContinueBody");
lblNumPz2Conf.Text = string.Format("{0} pz NC", pz2conf);
}
}
divPz2Conf.Visible = needConfProd;
lbtFixOdl.Visible = !odlOk;
mod_ODL1.isEnabled = !needConfProd;
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
protected void lbtFixOdl_Click(object sender, EventArgs e)
{
Response.Redirect("~/fixODL");
}
}
}