226 lines
5.0 KiB
C#
226 lines
5.0 KiB
C#
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
|
|
{
|
|
public partial class mod_regScarti : System.Web.UI.UserControl
|
|
{
|
|
|
|
/// <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)
|
|
{
|
|
checkAll();
|
|
}
|
|
}
|
|
|
|
private void checkAll()
|
|
{
|
|
#if false
|
|
fixSelMacc();
|
|
#endif
|
|
checkOdl();
|
|
lblOut.Text = "";
|
|
switchBtnConferma(false);
|
|
lbtShowScarti.Visible = odlOk;
|
|
lblConfScarti.Visible = !odlOk;
|
|
}
|
|
/// <summary>
|
|
/// Verifica se abbia un ODL ATTIVO
|
|
/// </summary>
|
|
private void checkOdl()
|
|
{
|
|
lbtShowScarti.Visible = odlOk;
|
|
lblConfScarti.Visible = !odlOk;
|
|
lblMancaODL.Visible = !odlOk;
|
|
}
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...)
|
|
/// </summary>
|
|
#if false
|
|
protected bool isMulti
|
|
{
|
|
get
|
|
{
|
|
return DataLayer.isMulti(idxMacchinaSession);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Se la machcina è MULTI --> mostro selettore
|
|
/// </summary>
|
|
private void fixSelMacc()
|
|
{
|
|
divSelMacc.Visible = isMulti;
|
|
}
|
|
#endif
|
|
/// <summary>
|
|
/// restituisce css disabled SE odl NON OK...
|
|
/// </summary>
|
|
public string cssBtnConf
|
|
{
|
|
get
|
|
{
|
|
return odlOk ? "" : "disabled";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Verifica ODL OK (ovvero caricato x macchina...)
|
|
/// </summary>
|
|
public bool odlOk
|
|
{
|
|
get
|
|
{
|
|
bool answ = true;
|
|
// carico i dati preliminari: ODL
|
|
int idxOdl = 0; // userò ODL del turno
|
|
try
|
|
{
|
|
idxOdl = DataLayer.obj.taODL.getByMacchinaAperto(idxMacchina)[0].IdxODL;
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog(string.Format("Errore a recuperare ODL per la macchina {0}", idxMacchina), tipoLog.ERROR);
|
|
}
|
|
// se ODL > 0 è ok!!!
|
|
answ = (idxOdl > 0);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// idx macchina selezionata
|
|
/// </summary>
|
|
public string idxMacchina
|
|
{
|
|
get
|
|
{
|
|
string answ = memLayer.ML.StringSessionObj("IdxMacchina");
|
|
return answ;
|
|
}
|
|
#if false
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxMacchina", value);
|
|
}
|
|
#endif
|
|
}
|
|
#if false
|
|
/// <summary>
|
|
/// idx macchina selezionata
|
|
/// </summary>
|
|
public string idxMacchinaSession
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("IdxMacchina");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxMacchina", value);
|
|
}
|
|
}
|
|
#endif
|
|
/// <summary>
|
|
/// cambio stato visibilità pannello e testo button
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtShowContr_Click(object sender, EventArgs e)
|
|
{
|
|
switchBtnConferma(!divDetail.Visible);
|
|
}
|
|
/// <summary>
|
|
/// determina comportamento btn conferma
|
|
/// </summary>
|
|
private void switchBtnConferma(bool showConf)
|
|
{
|
|
divDetail.Visible = showConf;
|
|
if (showConf)
|
|
{
|
|
lblShowScarti.Text = "Nascondi SCARTI";
|
|
}
|
|
else
|
|
{
|
|
lblShowScarti.Text = "Registra SCARTI";
|
|
// sollevo evento!
|
|
if (eh_reset != null)
|
|
{
|
|
eh_reset(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// salvo produzione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtSalva_Click(object sender, EventArgs e)
|
|
{
|
|
#if false
|
|
// salvo controllo KO
|
|
DataLayer.obj.taRC.insertQuery(idxMacchina, DataLayer.MatrOpr, false, txtNote.Text.Trim(), DateTime.Now);
|
|
#endif
|
|
// sollevo evento!
|
|
if (eh_newVal != null)
|
|
{
|
|
eh_newVal(this, new EventArgs());
|
|
}
|
|
resetControlli();
|
|
}
|
|
|
|
private void resetControlli()
|
|
{
|
|
txtNote.Text = "";
|
|
// nascondo!
|
|
switchBtnConferma(false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sotto sistema (macchina) selezionato
|
|
/// </summary>
|
|
public string subMaccSel
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("subMaccSel");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("subMaccSel", value);
|
|
}
|
|
}
|
|
|
|
protected void lbtOK_Click(object sender, EventArgs e)
|
|
{
|
|
#if false
|
|
// Salvo controllo come OK
|
|
DataLayer.obj.taRC.insertQuery(idxMacchina, DataLayer.MatrOpr, true, "", DateTime.Now);
|
|
#endif
|
|
// sollevo evento!
|
|
if (eh_newVal != null)
|
|
{
|
|
eh_newVal(this, new EventArgs());
|
|
}
|
|
resetControlli();
|
|
}
|
|
|
|
}
|
|
} |