191 lines
4.8 KiB
C#
191 lines
4.8 KiB
C#
using MapoDb;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
|
|
namespace MoonProTablet
|
|
{
|
|
public partial class ODL : System.Web.UI.Page
|
|
{
|
|
/// <summary>
|
|
/// idx macchina selezionata
|
|
/// </summary>
|
|
public string idxMacchinaSession
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("IdxMacchina");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxMacchina", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...)
|
|
/// </summary>
|
|
protected bool isMulti
|
|
{
|
|
get
|
|
{
|
|
return DataLayer.isMulti(idxMacchinaSession);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// idx macchina selezionata
|
|
/// </summary>
|
|
public string idxMacchina
|
|
{
|
|
get
|
|
{
|
|
string answ = memLayer.ML.StringSessionObj("IdxMacchina");
|
|
// verifoc: se multi uso selettore tendina...
|
|
if (isMulti)
|
|
{
|
|
if (ddlSubMacc.SelectedValue == "")
|
|
{
|
|
ddlSubMacc.DataBind();
|
|
}
|
|
if (ddlSubMacc.SelectedValue != "")
|
|
{
|
|
answ = ddlSubMacc.SelectedValue;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxMacchina", value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Se la machcina è MULTI --> mostro selettore
|
|
/// </summary>
|
|
private void fixSelMacc()
|
|
{
|
|
divSelMacc.Visible = isMulti;
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
checkAll();
|
|
}
|
|
}
|
|
|
|
private void checkAll()
|
|
{
|
|
fixSelMacc();
|
|
Session["TipoLink"] = "EditMacch";
|
|
// imposto idxMacchina x subControl...
|
|
mod_ODL1.idxMacchina = idxMacchina;
|
|
checkConfProd();
|
|
mod_ODL1.checkAll();
|
|
}
|
|
|
|
/// <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.taODL.getByMacchina(idxMacchina)[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)[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;
|
|
divWarn.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");
|
|
}
|
|
|
|
|
|
protected void ddlSubMacc_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
subMaccSel = ddlSubMacc.SelectedValue;
|
|
checkAll();
|
|
}
|
|
|
|
|
|
protected void ddlSubMacc_DataBound(object sender, EventArgs e)
|
|
{
|
|
// se ho in memoria un valore LO REIMPOSTO...
|
|
if (subMaccSel != "")
|
|
{
|
|
// provo a preselezionare...
|
|
try
|
|
{
|
|
ddlSubMacc.SelectedValue = subMaccSel;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Sotto sistema (macchina) selezionato
|
|
/// </summary>
|
|
public string subMaccSel
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("subMaccSel");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("subMaccSel", value);
|
|
}
|
|
}
|
|
}
|
|
} |