163 lines
6.6 KiB
C#
163 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using XPS_data;
|
|
|
|
public partial class barcode : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
traduciObj();
|
|
setupComandiBarcode();
|
|
setupValoriBarcode();
|
|
mod_barcode1.eh_comandoRegistrato += new EventHandler(mod_barcode1_eh_comandoRegistrato);
|
|
mod_btnComandi1.eh_clickComando += new EventHandler(mod_btnComandi1_eh_clickComando);
|
|
}
|
|
/// <summary>
|
|
/// inviato un comando dai link buttons
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
void mod_btnComandi1_eh_clickComando(object sender, EventArgs e)
|
|
{
|
|
// chiamo metodo caricamento comandi in modulo barcode...
|
|
mod_barcode1.loadBtnClickComando();
|
|
}
|
|
|
|
private void traduciObj()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// effettuo il setup dei valori ammessi x il barcode...
|
|
/// </summary>
|
|
private void setupValoriBarcode()
|
|
{
|
|
XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter taCommesse = new XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter();
|
|
DS_applicazione.v_commesseDataTable _tabComm = taCommesse.GetData();
|
|
Dictionary<string, string> valori = new Dictionary<string, string>();
|
|
// aggiungo i DDT...
|
|
foreach (DS_applicazione.v_commesseRow riga in _tabComm)
|
|
{
|
|
// QUI formattazione campi mostrati a barcode
|
|
valori.Add(riga.Cod.ToString(), string.Format("{0} - {7}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>{4} colli ({5} kg)<br /><b>{6}</b>", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Colli, riga.Peso, riga.Stato, riga.Ciclo));
|
|
}
|
|
// ora aggiungo i singoli ULP...
|
|
XPS_data.DS_applicazioneTableAdapters.v_ULPTableAdapter taULP = new XPS_data.DS_applicazioneTableAdapters.v_ULPTableAdapter();
|
|
DS_applicazione.v_ULPDataTable _tabUlp = taULP.GetData();
|
|
// aggiungo colli (ULP)...
|
|
foreach (DS_applicazione.v_ULPRow riga in _tabUlp)
|
|
{
|
|
// QUI formattazione campi mostrati a barcode
|
|
valori.Add(riga.Cod.ToString(), string.Format("{0} - {7}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>nr {4} items ({5} kg)<br /><b>{6}</b>", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Qta, riga.Peso, riga.Stato, riga.CodCli));
|
|
}
|
|
// assegno valori al barcode...
|
|
mod_barcode1.tabValori = valori;
|
|
}
|
|
/// <summary>
|
|
/// carico da tab i comandi ammessi per il barcode...
|
|
/// </summary>
|
|
private void setupComandiBarcode()
|
|
{
|
|
XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taTrEv2St = new XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter();
|
|
DS_applicazione.TraEv2StatiDataTable _tabTran = taTrEv2St.getByCodMappa("E_BC");
|
|
Dictionary<string, string> comandi = new Dictionary<string, string>();
|
|
foreach (DS_applicazione.TraEv2StatiRow riga in _tabTran)
|
|
{
|
|
comandi.Add(riga.CodEvento, user_std.UtSn.Traduci(riga.text2show));
|
|
}
|
|
// impongo i comandi al barcode...
|
|
mod_barcode1.comandiAmmessi = comandi;
|
|
}
|
|
/// <summary>
|
|
/// il barcode ha registrato un evento...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
void mod_barcode1_eh_comandoRegistrato(object sender, EventArgs e)
|
|
{
|
|
switch (stateMachine.st.azioneComando(mod_barcode1.comandoRegistrato))
|
|
{
|
|
case tipoAzione.annulla:
|
|
mod_barcode1.resetMe();
|
|
break;
|
|
case tipoAzione.conferma:
|
|
// se input completo eseguo...
|
|
if (mod_barcode1.comandoRegistrato.currCmdIn != "" && mod_barcode1.comandoRegistrato.valore != "")
|
|
{
|
|
eseguiComando();
|
|
}
|
|
else // altrimenti warning... e rimetto valori precedenti
|
|
{
|
|
mod_barcode1.txtRich2show = user_std.UtSn.Traduci("codObjUnknown");
|
|
mod_barcode1.comandoRegistrato.currCmdIn = mod_barcode1.comandoRegistrato.prevCmdIn;
|
|
mod_barcode1.comandoRegistrato.descrComando = mod_barcode1.comandoRegistrato.descrComandoPrev;
|
|
mod_barcode1.txtInput2show = mod_barcode1.comandoRegistrato.descrComandoPrev;
|
|
}
|
|
break;
|
|
case tipoAzione.esegui:
|
|
// se ho auto conferma eseguo!
|
|
if (memLayer.ML.confReadBool("autoConfCmd"))
|
|
{
|
|
mod_barcode1.comandoRegistrato.prevCmdIn = mod_barcode1.comandoRegistrato.currCmdIn;
|
|
mod_barcode1.comandoRegistrato.currCmdIn = "ok";
|
|
eseguiComando();
|
|
}
|
|
else
|
|
{
|
|
if (mod_barcode1.comandoRegistrato.valore != "")
|
|
{
|
|
mod_barcode1.txtRich2show = user_std.UtSn.Traduci("pleaseConfirm");
|
|
}
|
|
else
|
|
{
|
|
mod_barcode1.txtRich2show = user_std.UtSn.Traduci("codObjUnknown");
|
|
}
|
|
}
|
|
break;
|
|
case tipoAzione.noAct:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
mod_btnComandi1.updateBtn();
|
|
}
|
|
/// <summary>
|
|
/// eseguo il comando
|
|
/// </summary>
|
|
private void eseguiComando()
|
|
{
|
|
// in primis: sono in esecuzione, x cui il comando è valido...
|
|
string msg2show = "";
|
|
string currState = "";
|
|
DS_applicazione.IstObjRow rigaIstObj;
|
|
// calcolo lo stato dell'oggetto...
|
|
try
|
|
{
|
|
rigaIstObj = XPS_data.XPS.obj.taObj.getByIdxObj(mod_barcode1.comandoRegistrato.valore)[0];
|
|
currState = rigaIstObj.CodStato;
|
|
}
|
|
catch
|
|
{ }
|
|
tipoEsito esito = stateMachine.st.doAction("E_Stati", mod_barcode1.comandoRegistrato.valore, currState, mod_barcode1.comandoRegistrato.prevCmdIn);
|
|
if (esito == tipoEsito.ok)
|
|
{
|
|
msg2show = string.Format("{0}: {1}", mod_barcode1.comandoRegistrato.valore, user_std.UtSn.Traduci("chgStateDone"));
|
|
}
|
|
else if (esito == tipoEsito.error)
|
|
{
|
|
msg2show = user_std.UtSn.Traduci("cannotStateChange");
|
|
}
|
|
else
|
|
{
|
|
msg2show = user_std.UtSn.Traduci("unknownCmd");
|
|
}
|
|
// reset e mostro output...
|
|
mod_barcode1.resetMe();
|
|
if (msg2show != "") mod_barcode1.txtInput2show = msg2show;
|
|
}
|
|
|
|
}
|