Cambio x setup focus() on pageload
This commit is contained in:
@@ -1,15 +1,26 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" Inherits="XPST.WebUserControls.mod_barcode" CodeBehind="mod_barcode.ascx.cs" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=txtInput.ClientID %>').focus();
|
||||
|
||||
// oggetto da legare all'update parziale ajax x sistemare btns & co
|
||||
var prm = Sys.WebForms.PageRequestManager.getInstance();
|
||||
prm.add_endRequest(function () {
|
||||
// re-bind jQuery events
|
||||
$('#<%=txtInput.ClientID %>').focus();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-8 col-md-9 col-lg-10">
|
||||
<asp:TextBox runat="server" ID="txtInput" CssClass="form-control form-control-lg" OnTextChanged="txtInput_TextChanged" TabIndex="1" AutoPostBack="true" />
|
||||
<asp:TextBox runat="server" ID="txtInput" CssClass="form-control form-control-lg" OnTextChanged="txtInput_TextChanged" TabIndex="1" AutoPostBack="true" />
|
||||
</div>
|
||||
<div class="col-4 col-md-3 col-lg-2">
|
||||
<asp:LinkButton ID="lbtCerca" runat="server" CssClass="btn btn-warning btn-lg btn-block text-uppercase"><i class="fa fa-search"></i> cerca</asp:LinkButton>
|
||||
<asp:LinkButton ID="lbtCerca" runat="server" CssClass="btn btn-warning btn-lg btn-block text-uppercase"><i class="fa fa-search"></i> cerca</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; font-size: 20pt;">
|
||||
<div class="ui-grid-solo">
|
||||
<asp:Panel runat="server" ID="pnlBarcodeBox" CssClass="">
|
||||
|
||||
@@ -19,5 +19,8 @@
|
||||
<label for="btnReload">Forza aggiornamento dati</label>
|
||||
<asp:Button ID="btnReload" runat="server" Text="Aggiorna" OnClick="btnReload_Click" CssClass="btn btn-lg btn-block btn-dark" />
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<%: string.Format("Caricati {0} Comandi | {1} Record BCode | DB ReLoadTime {2:N3}sec ", nComandi, nBCodeRec, lastUpdDuration.TotalSeconds) %>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
+348
-299
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -8,337 +9,385 @@ using XPS_data;
|
||||
|
||||
public partial class barcode : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
traduciObj();
|
||||
// registro che i valori in cache sono scaduti...
|
||||
lastDataRefresh = DateTime.Now.AddDays(-1);
|
||||
numDD = memLayer.ML.CRI("numDD");
|
||||
cacheValSec = memLayer.ML.CRI("cacheValSec");
|
||||
}
|
||||
// effettuo load valori...
|
||||
setupComandiBarcode();
|
||||
setupValoriBarcode();
|
||||
// registro eventi
|
||||
mod_barcode1.eh_comandoRegistrato += new EventHandler(mod_barcode1_eh_comandoRegistrato);
|
||||
mod_btnComandi1.eh_clickComando += new EventHandler(mod_btnComandi1_eh_clickComando);
|
||||
// Crea stopwatch.
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
// Avvio...
|
||||
stopwatch.Start();
|
||||
traduciObj();
|
||||
// registro che i valori in cache sono scaduti...
|
||||
lastDataRefresh = DateTime.Now.AddDays(-1);
|
||||
numDD = memLayer.ML.CRI("numDD");
|
||||
cacheValSec = memLayer.ML.CRI("cacheValSec");
|
||||
// registro
|
||||
stopwatch.Stop();
|
||||
lastUpdDuration = stopwatch.Elapsed;
|
||||
}
|
||||
/// <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)
|
||||
// effettuo load valori...
|
||||
setupComandiBarcode();
|
||||
setupValoriBarcode();
|
||||
// registro eventi
|
||||
mod_barcode1.eh_comandoRegistrato += new EventHandler(mod_barcode1_eh_comandoRegistrato);
|
||||
mod_btnComandi1.eh_clickComando += new EventHandler(mod_btnComandi1_eh_clickComando);
|
||||
}
|
||||
/// <summary>
|
||||
/// Numero comandi ammessi caricati
|
||||
/// </summary>
|
||||
public int nComandi
|
||||
{
|
||||
get
|
||||
{
|
||||
// chiamo metodo caricamento comandi in modulo barcode...
|
||||
mod_barcode1.loadBtnClickComando();
|
||||
return comandiAmmessiBCode.Count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Numero record BCode caricati
|
||||
/// </summary>
|
||||
public int nBCodeRec
|
||||
{
|
||||
get
|
||||
{
|
||||
return valoriAmmessiBCode.Count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Memorizzo durata ultimo update (lettura record...) come timespan
|
||||
/// </summary>
|
||||
public TimeSpan lastUpdDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
return (TimeSpan)memLayer.ML.objSessionObj("lastUpdDuration");
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("lastUpdDuration", value);
|
||||
}
|
||||
}
|
||||
/// <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()
|
||||
private void traduciObj()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta/recupera valore num gg da rileggere...
|
||||
/// </summary>
|
||||
public int numDD
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 85;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(txtNumDD.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta/recupera valore num gg da rileggere...
|
||||
/// </summary>
|
||||
public int numDD
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 85;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(txtNumDD.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtNumDD.Text = value.ToString();
|
||||
}
|
||||
txtNumDD.Text = value.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// logLevel impostato...
|
||||
/// </summary>
|
||||
public int logLevel
|
||||
}
|
||||
/// <summary>
|
||||
/// logLevel impostato...
|
||||
/// </summary>
|
||||
public int logLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 1;
|
||||
try
|
||||
{
|
||||
answ = memLayer.ML.CRI("_logLevel");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
int answ = 1;
|
||||
try
|
||||
{
|
||||
answ = memLayer.ML.CRI("_logLevel");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta/recupera valore num sec validità cache...
|
||||
/// </summary>
|
||||
public int cacheValSec
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta/recupera valore num sec validità cache...
|
||||
/// </summary>
|
||||
public int cacheValSec
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 55;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(txtCacheSec.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
int answ = 55;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(txtCacheSec.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtCacheSec.Text = value.ToString();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Variabile x controllo scadenza valori in cache
|
||||
/// </summary>
|
||||
protected DateTime lastDataRefresh
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Now.AddDays(-1);
|
||||
try
|
||||
{
|
||||
answ = Convert.ToDateTime(memLayer.ML.objCacheObj("lastBCodeDataRead"));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
// registro che i valori in cache sono scaduti...
|
||||
memLayer.ML.setCacheVal("lastBCodeDataRead", value);
|
||||
if (logLevel > 5) logger.lg.scriviLog("impostata validità cache");
|
||||
}
|
||||
txtCacheSec.Text = value.ToString();
|
||||
}
|
||||
protected bool cacheValida
|
||||
}
|
||||
/// <summary>
|
||||
/// Variabile x controllo scadenza valori in cache
|
||||
/// </summary>
|
||||
protected DateTime lastDataRefresh
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastDataRefresh).TotalSeconds < cacheValSec) answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
DateTime answ = DateTime.Now.AddDays(-1);
|
||||
try
|
||||
{
|
||||
answ = Convert.ToDateTime(memLayer.ML.objCacheObj("lastBCodeDataRead"));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco (da cache) dei valori ammessi x BCode
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> valoriAmmessiBCode
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
if (memLayer.ML.isInCacheObject("valoriAmmessiBCode") && cacheValida)
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("valoriAmmessiBCode");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setCacheVal("valoriAmmessiBCode", value);
|
||||
}
|
||||
// registro che i valori in cache sono scaduti...
|
||||
memLayer.ML.setCacheVal("lastBCodeDataRead", value);
|
||||
if (logLevel > 5) logger.lg.scriviLog("impostata validità cache");
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco (da cache) dei comandi ammessi x BCode
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> comandiAmmessiBCode
|
||||
}
|
||||
protected bool cacheValida
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
if (memLayer.ML.isInCacheObject("comandiAmmessiBCode"))
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("comandiAmmessiBCode");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setCacheVal("comandiAmmessiBCode", value);
|
||||
}
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastDataRefresh).TotalSeconds < cacheValSec) answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// effettuo il setup dei valori ammessi x il barcode...
|
||||
/// </summary>
|
||||
private void setupValoriBarcode()
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco (da cache) dei valori ammessi x BCode
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> valoriAmmessiBCode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (valoriAmmessiBCode.Count > 0)
|
||||
{
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.tabValori = valoriAmmessiBCode;
|
||||
if (logLevel > 5) logger.lg.scriviLog("Letti da cache VALORI Barcode", tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logLevel > 5) logger.lg.scriviLog("Inizio setup valori Barcode", tipoLog.INFO);
|
||||
Dictionary<string, string> valori = new Dictionary<string, string>();
|
||||
XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter taCommesse = new XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter();
|
||||
DS_applicazione.v_commesseDataTable _tabComm = taCommesse.getLastDD(numDD);
|
||||
// aggiungo i DDT...
|
||||
foreach (DS_applicazione.v_commesseRow riga in _tabComm)
|
||||
{
|
||||
// QUI formattazione campi mostrati a barcode
|
||||
// 2017.05.23 tolto stato...
|
||||
valori.Add(riga.Cod.ToString(), string.Format("{0} - {6}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>{4} colli ({5} kg)", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Colli, riga.Peso, riga.Ciclo));
|
||||
//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));
|
||||
}
|
||||
if (logLevel > 5) logger.lg.scriviLog("Caricato commesse per Barcode", tipoLog.INFO);
|
||||
// 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.getLastDD(numDD);
|
||||
// aggiungo colli (ULP)...
|
||||
foreach (DS_applicazione.v_ULPRow riga in _tabUlp)
|
||||
{
|
||||
// QUI formattazione campi mostrati a barcode
|
||||
// 2017.05.23 tolto stato...
|
||||
valori.Add(riga.Cod.ToString(), string.Format("{0} - {6}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>nr {4} items ({5} kg)", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Qta, riga.Peso, riga.CodCli));
|
||||
//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));
|
||||
}
|
||||
if (logLevel > 5) logger.lg.scriviLog("Caricato RIGHE per Barcode", tipoLog.INFO);
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.tabValori = valori;
|
||||
valoriAmmessiBCode = valori;
|
||||
lastDataRefresh = DateTime.Now;
|
||||
logger.lg.scriviLog("Letti da DB VALORI Barcode", tipoLog.INFO);
|
||||
}
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
if (memLayer.ML.isInCacheObject("valoriAmmessiBCode") && cacheValida)
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("valoriAmmessiBCode");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// carico da tab i comandi ammessi per il barcode...
|
||||
/// </summary>
|
||||
private void setupComandiBarcode()
|
||||
set
|
||||
{
|
||||
if (comandiAmmessiBCode.Count > 0)
|
||||
{
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.comandiAmmessi = comandiAmmessiBCode;
|
||||
if (logLevel > 5) logger.lg.scriviLog("Letti da cache COMANDI Barcode", tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
comandiAmmessiBCode = comandi;
|
||||
logger.lg.scriviLog("Letti da DB COMANDI Barcode", tipoLog.INFO);
|
||||
}
|
||||
memLayer.ML.setCacheVal("valoriAmmessiBCode", value);
|
||||
}
|
||||
/// <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)
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco (da cache) dei comandi ammessi x BCode
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> comandiAmmessiBCode
|
||||
{
|
||||
get
|
||||
{
|
||||
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();
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
if (memLayer.ML.isInCacheObject("comandiAmmessiBCode"))
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("comandiAmmessiBCode");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// eseguo il comando
|
||||
/// </summary>
|
||||
private void eseguiComando()
|
||||
set
|
||||
{
|
||||
// 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...
|
||||
memLayer.ML.setCacheVal("comandiAmmessiBCode", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// effettuo il setup dei valori ammessi x il barcode...
|
||||
/// </summary>
|
||||
private void setupValoriBarcode()
|
||||
{
|
||||
if (valoriAmmessiBCode.Count > 0)
|
||||
{
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.tabValori = valoriAmmessiBCode;
|
||||
if (logLevel > 5) logger.lg.scriviLog("Letti da cache VALORI Barcode", tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Crea stopwatch.
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
// Avvio...
|
||||
stopwatch.Start();
|
||||
//processo
|
||||
if (logLevel > 5) logger.lg.scriviLog("Inizio setup valori Barcode", tipoLog.INFO);
|
||||
Dictionary<string, string> valori = new Dictionary<string, string>();
|
||||
XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter taCommesse = new XPS_data.DS_applicazioneTableAdapters.v_commesseTableAdapter();
|
||||
DS_applicazione.v_commesseDataTable _tabComm = taCommesse.getLastDD(numDD);
|
||||
// aggiungo i DDT...
|
||||
foreach (DS_applicazione.v_commesseRow riga in _tabComm)
|
||||
{
|
||||
// QUI formattazione campi mostrati a barcode
|
||||
// 2017.05.23 tolto stato...
|
||||
valori.Add(riga.Cod.ToString(), string.Format("{0} - {6}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>{4} colli ({5} kg)", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Colli, riga.Peso, riga.Ciclo));
|
||||
//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));
|
||||
}
|
||||
if (logLevel > 5) logger.lg.scriviLog("Caricato commesse per Barcode", tipoLog.INFO);
|
||||
// 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.getLastDD(numDD);
|
||||
// aggiungo colli (ULP)...
|
||||
foreach (DS_applicazione.v_ULPRow riga in _tabUlp)
|
||||
{
|
||||
// QUI formattazione campi mostrati a barcode
|
||||
// 2017.05.23 tolto stato...
|
||||
valori.Add(riga.Cod.ToString(), string.Format("{0} - {6}<br/><b>{1}</b> DDT {2} del {3:dd MMM yyyy}<br/>nr {4} items ({5} kg)", riga.Cod, riga.Cliente, riga.DDT, riga.DataDDT, riga.Qta, riga.Peso, riga.CodCli));
|
||||
//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));
|
||||
}
|
||||
if (logLevel > 5) logger.lg.scriviLog("Caricato RIGHE per Barcode", tipoLog.INFO);
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.tabValori = valori;
|
||||
valoriAmmessiBCode = valori;
|
||||
lastDataRefresh = DateTime.Now;
|
||||
logger.lg.scriviLog("Letti da DB VALORI Barcode", tipoLog.INFO);
|
||||
stopwatch.Start();
|
||||
lastUpdDuration = stopwatch.Elapsed;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// carico da tab i comandi ammessi per il barcode...
|
||||
/// </summary>
|
||||
private void setupComandiBarcode()
|
||||
{
|
||||
if (comandiAmmessiBCode.Count > 0)
|
||||
{
|
||||
// assegno valori al barcode...
|
||||
mod_barcode1.comandiAmmessi = comandiAmmessiBCode;
|
||||
if (logLevel > 5) logger.lg.scriviLog("Letti da cache COMANDI Barcode", tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
comandiAmmessiBCode = comandi;
|
||||
logger.lg.scriviLog("Letti da DB COMANDI Barcode", tipoLog.INFO);
|
||||
}
|
||||
}
|
||||
/// <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();
|
||||
if (msg2show != "") mod_barcode1.txtInput2show = msg2show;
|
||||
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;
|
||||
}
|
||||
|
||||
protected void btnReload_Click(object sender, EventArgs e)
|
||||
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
|
||||
{
|
||||
// resetto tutto!
|
||||
comandiAmmessiBCode = new Dictionary<string, string>();
|
||||
valoriAmmessiBCode = new Dictionary<string, string>();
|
||||
lastDataRefresh = DateTime.Now.AddDays(-1);
|
||||
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;
|
||||
}
|
||||
|
||||
protected void btnReload_Click(object sender, EventArgs e)
|
||||
{
|
||||
// resetto tutto!
|
||||
comandiAmmessiBCode = new Dictionary<string, string>();
|
||||
valoriAmmessiBCode = new Dictionary<string, string>();
|
||||
lastDataRefresh = DateTime.Now.AddDays(-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user