3c8d4dbc3d
lav mecc OUT (2 complete)
1120 lines
39 KiB
C#
1120 lines
39 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using GMW_data;
|
|
|
|
namespace GMW.WebUserControls
|
|
{
|
|
public partial class mod_lavMeccOUT : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// flusso associato (hard coded) a FUSI
|
|
/// </summary>
|
|
protected string flusso = "LM";
|
|
/// <summary>
|
|
/// stato associato (hard coded) a FUSI
|
|
/// </summary>
|
|
protected string statoUDC = "Fin";
|
|
/// <summary>
|
|
/// tipo di evento associato alla creazione dell'UDC
|
|
/// </summary>
|
|
protected string eventoUDC = "UDC_FINITO";
|
|
/// <summary>
|
|
/// stringa degli UDC selezionati per consumo COMPLETO (nel formato #UDC1##UDC2#)
|
|
/// </summary>
|
|
protected string udcSelC
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj(string.Format("UdcSelC_{0}", uid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("UdcSelC_{0}", uid), value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// stringa degli UDC selezionati per consumo PARZIALE (nel formato #UDC1##UDC2#)
|
|
/// </summary>
|
|
protected string udcSelP
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj(string.Format("UdcSelP_{0}", uid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("UdcSelP_{0}", uid), value);
|
|
}
|
|
}
|
|
public event EventHandler eh_nuovaRicerca;
|
|
/// <summary>
|
|
/// stringa UID univoca
|
|
/// </summary>
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "_").Replace("-", "_");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
fixRicercaUdc();
|
|
calcolaPostazione();
|
|
traduciObj();
|
|
storicoVisibile = false;
|
|
fixStorico();
|
|
// imposto pos abilitata x cancellazione
|
|
mod_storicoAzioniOperatore1.idxPosizione2del = memLayer.ML.confReadInt("IdxPosizioneFiniti");
|
|
// se c'è imposto linea da sessione
|
|
if (currCodLinea != "")
|
|
{
|
|
checkSelDDL(currCodLinea, false);
|
|
MagClass.magazzino.taAL.updatePost(currCodLinea, postazione_name);
|
|
}
|
|
else
|
|
{
|
|
// resetto uso postazione...
|
|
MagClass.magazzino.taAL.resetPost(postazione_name);
|
|
}
|
|
}
|
|
doChecks();
|
|
mod_storicoAzioniOperatore1.eh_stampa += new EventHandler(mod_storicoAzioniOperatore1_eh_stampa);
|
|
}
|
|
/// <summary>
|
|
/// verifica se si debba mostrare un campo ricerca attivo...
|
|
/// </summary>
|
|
private void fixRicercaUdc()
|
|
{
|
|
if (memLayer.ML.isInSessionObject("valoreCercatoSTO"))
|
|
{
|
|
testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoSTO");
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// richiesta (ri)stampa UDC
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
void mod_storicoAzioniOperatore1_eh_stampa(object sender, EventArgs e)
|
|
{
|
|
MagClass.magazzino.stampaUdc(udcReq, postazione_printer, tipoCartellino.cartSterr, Request.UserHostName);
|
|
// registro ri-stampa UDC
|
|
DateTime adesso = DateTime.Now;
|
|
// calcolo particolare...
|
|
DS_magazzino.ElencoCartelliniRow rigaUDC;
|
|
string particolare = "";
|
|
try
|
|
{
|
|
rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
|
|
particolare = rigaUDC.Particolare;
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura OUT {0}", udcReq), tipoLog.EXCEPTION);
|
|
}
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, postazione_name, postazione_IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura OUT");
|
|
}
|
|
/// <summary>
|
|
/// udc da stampare
|
|
/// </summary>
|
|
protected string udcReq
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("udcSelSAO");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// controlla particolare selezionato
|
|
/// </summary>
|
|
private void checkParticolare()
|
|
{
|
|
if (currParticolare != "")
|
|
{
|
|
lblParticolareAttivo.Text = string.Format("Particolare selezionato <b>{0}</b>", currParticolare);
|
|
// aggiungo descrizione del particolare
|
|
string descr = "";
|
|
string disegno = "";
|
|
try
|
|
{
|
|
DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
|
|
descr = riga.DescParticolare;
|
|
disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
|
|
}
|
|
catch
|
|
{ }
|
|
lblDescrAttivo.Text = descr;
|
|
lblDisegno.Text = disegno;
|
|
}
|
|
else
|
|
{
|
|
lblParticolareAttivo.Text = "...";
|
|
lblDescrAttivo.Text = "";
|
|
lblDisegno.Text = "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua controlli visibilità
|
|
/// </summary>
|
|
private void doChecks()
|
|
{
|
|
checkBarcode();
|
|
checkStampa();
|
|
checkParticolare();
|
|
}
|
|
/// <summary>
|
|
/// sistemo labels oggetti
|
|
/// </summary>
|
|
private void traduciObj()
|
|
{
|
|
// labels
|
|
lblPostazione.Text = string.Format("{2}: {0} ({1})", postazione_name, postazione_IP, traduci("postazione"));
|
|
lblPrinter.Text = string.Format("{1}: {0}", postazione_printer, traduci("stampante"));
|
|
lblQta.Text = traduci("lblQuantitaTotale");
|
|
lblNote.Text = traduci("lblNote");
|
|
lblCurrentPage.Text = traduci(PagCorrente);
|
|
btnCerca.Text = traduci("btnSearch");
|
|
//txtBox
|
|
txtQta.Text = memLayer.ML.confReadString("QtaImballoSterr");
|
|
// buttons
|
|
btnStampa.Text = traduci("btnStampa");
|
|
btnEmptyNote.Text = traduci("btnEmptyNote");
|
|
// fix storico
|
|
fixStorico();
|
|
}
|
|
/// <summary>
|
|
/// restituisce il nome della pagina corrente
|
|
/// </summary>
|
|
protected string PagCorrente
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
Uri MyUrl = Request.Url;
|
|
string delimStr = "/";
|
|
char[] delimiter = delimStr.ToCharArray();
|
|
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
|
|
int n = finalUrl.Length;
|
|
answ = finalUrl[n - 1].ToString();
|
|
DataLayer_AnagGen.PermessiRow riga = (DataLayer_AnagGen.PermessiRow)user_std.UtSn.permessi.Select(string.Format("URL = '{0}'", answ))[0];
|
|
answ = riga.NOME;
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
/// <summary>
|
|
/// calcola postazione corrente (ip, name, printer)
|
|
/// </summary>
|
|
private void calcolaPostazione()
|
|
{
|
|
postazione_IP = Request.UserHostName;
|
|
postazione_name = dnsUtils.DetermineCompName(postazione_IP);
|
|
// cerco stampante x postazione
|
|
postazione_printer = "n.d.";
|
|
try
|
|
{
|
|
DS_Applicazione.ElencoPostazioniDataTable tabPost = DataProxy.obj.taElPost.getByCod(postazione_name);
|
|
if (tabPost.Rows.Count > 0)
|
|
{
|
|
postazione_printer = tabPost[0].stampante;
|
|
}
|
|
else
|
|
{
|
|
tabPost = DataProxy.obj.taElPost.getByCod("default");
|
|
postazione_printer = tabPost[0].stampante;
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
// mostro warning se postazione non configurata...
|
|
lblWarning.Visible = (postazione_printer == "n.d.");
|
|
}
|
|
/// <summary>
|
|
/// indica name della postazione corrente
|
|
/// </summary>
|
|
protected string postazione_name
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("postazione_name");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("postazione_name", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica ip della postazione corrente
|
|
/// </summary>
|
|
protected string postazione_IP
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("postazione_IP");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("postazione_IP", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica stampante associata alla postazione corrente
|
|
/// </summary>
|
|
protected string postazione_printer
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("postazione_printer");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("postazione_printer", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica il codice articolo correntemente selezionato
|
|
/// </summary>
|
|
protected string currParticolare
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj(string.Format("currParticolare_{0}", uid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("currParticolare_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// indica se i caratteri vadano forzati a maiuscoli
|
|
/// </summary>
|
|
public bool forceUppercase
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.confReadBool("forceUppercase");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// num pezzi dell'ultimo UDC del particolare generato
|
|
/// </summary>
|
|
public int pezziUdc
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// decodifica il tipo barcode acquisito
|
|
/// </summary>
|
|
public tipoCodiceBarcode tipoBCode
|
|
{
|
|
get
|
|
{
|
|
tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
|
|
int trovati = 0;
|
|
// controllo non si tratti di un comando...
|
|
string preCmd = memLayer.ML.confReadString("prefComandi");
|
|
if (barcodeIn.StartsWith(preCmd))
|
|
{
|
|
answ = tipoCodiceBarcode.Comando;
|
|
}
|
|
else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
|
|
{
|
|
answ = tipoCodiceBarcode.Particolare;
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
// cerco tra gitterbox (UDC)...
|
|
trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
|
|
if (trovati > 0)
|
|
{
|
|
answ = tipoCodiceBarcode.UDC;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// valore barcode
|
|
/// </summary>
|
|
public string barcodeIn
|
|
{
|
|
get
|
|
{
|
|
return txtBarcode.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtBarcode.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// qta pezzi TOTALE
|
|
/// </summary>
|
|
public int qta
|
|
{
|
|
get
|
|
{
|
|
int qta = 0;
|
|
try
|
|
{
|
|
qta = Convert.ToInt32(txtQta.Text.Trim());
|
|
}
|
|
catch
|
|
{ }
|
|
return qta;
|
|
}
|
|
set
|
|
{
|
|
txtQta.Text = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// controlla se ci sia un barcode
|
|
/// </summary>
|
|
private void checkBarcode()
|
|
{
|
|
if (barcodeIn != "")
|
|
{
|
|
lblMessaggi.Text = string.Format("Barcode digitato: {0}", barcodeIn);
|
|
switch (tipoBCode)
|
|
{
|
|
case tipoCodiceBarcode.Comando:
|
|
// verifico se il comando sia di tipo "seleziona linea"
|
|
string cmdSelLine = memLayer.ML.confReadString("cmdSelLine");
|
|
pnlAll.CssClass = "stileComandoOk";
|
|
if (barcodeIn.StartsWith(cmdSelLine))
|
|
{
|
|
// allora provo ad impostare la linea!
|
|
checkSelDDL(barcodeIn.Replace(cmdSelLine, ""), true);
|
|
}
|
|
break;
|
|
case tipoCodiceBarcode.Particolare:
|
|
// imposto il particolare corrente
|
|
currParticolare = barcodeIn;
|
|
impostaParticolare();
|
|
break;
|
|
case tipoCodiceBarcode.UDC:
|
|
// procedo solo se UDC esistente
|
|
if (MagClass.magazzino.checkUDC(barcodeIn))
|
|
{
|
|
// calcolo nuovo particolare
|
|
string newPart = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
|
|
if (testoRicerca != newPart)
|
|
{
|
|
// resetto precedente ricerca e deseleziono TUTTI gli UDC elencati SE è cambiato il particolare
|
|
udcSelC = string.Format("#{0}#", barcodeIn);
|
|
}
|
|
else
|
|
{
|
|
udcSelC = string.Format("{0}#{1}#", udcSelC, barcodeIn);
|
|
// se era presente in elenco "P" lo elimino
|
|
udcSelP = udcSelP.Replace(string.Format("#{0}#", barcodeIn), "");
|
|
}
|
|
updFiltroPart(newPart);
|
|
// imposto particolare!
|
|
currParticolare = newPart;
|
|
impostaParticolare();
|
|
}
|
|
|
|
break;
|
|
default:
|
|
lblMessaggi.Text += " - codice <b>non riconosciuto</b>!";
|
|
pnlAll.CssClass = "stileComandoND";
|
|
break;
|
|
}
|
|
barcodeIn = "";
|
|
}
|
|
else
|
|
{
|
|
lblMessaggi.Text = "...attesa barcode...";
|
|
}
|
|
//grView.DataBind();
|
|
txtBarcode.Focus();
|
|
}
|
|
/// <summary>
|
|
/// imposto i dati dal aprticolare corrente
|
|
/// </summary>
|
|
private void impostaParticolare()
|
|
{
|
|
// controllo esista il particolare scansionato
|
|
if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
|
|
{
|
|
currParticolare = "";
|
|
lblMessaggi.Text += " - codice particolare non valido / non trovato in RILPRO.";
|
|
pnlAll.CssClass = "stileComandoKo";
|
|
}
|
|
else
|
|
{
|
|
lblMessaggi.Text += " - impostato particolare!";
|
|
pnlAll.CssClass = "stileComandoOk";
|
|
}
|
|
// leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
|
|
if (pezziUdc > 0)
|
|
{
|
|
txtQta.Text = pezziUdc.ToString();
|
|
}
|
|
else // rimette default
|
|
{
|
|
txtQta.Text = memLayer.ML.confReadString("QtaImballoSterr");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// update del filtro su particolare x grview UDC caricati in linea
|
|
/// </summary>
|
|
/// <param name="newPart"></param>
|
|
private void updFiltroPart(string newPart)
|
|
{
|
|
if (testoRicerca != newPart)
|
|
{
|
|
// imposto filtraggio x particoalre nell'elenco degli UDC della linea...
|
|
testoRicerca = newPart;
|
|
// salvo UDC da selezionare come consumo COMPLETO
|
|
salvaCerca();
|
|
}
|
|
else
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// aggiorna tabella + focus a barcode
|
|
/// </summary>
|
|
private void doUpdate()
|
|
{
|
|
checkStampa();
|
|
grView.DataBind();
|
|
mod_storicoAzioniOperatore1.doUpdate();
|
|
txtBarcode.Focus();
|
|
}
|
|
/// <summary>
|
|
/// controllo l'abilitazioen alla stampa UDC:
|
|
/// - particolare ok
|
|
/// - qta > 0
|
|
/// - almeno 1 trattamento
|
|
/// altrimenti disabilito btn stampa
|
|
/// </summary>
|
|
private void checkStampa()
|
|
{
|
|
bool stampaOk = false;
|
|
//controllo siano inseriti valori qta
|
|
if (qta > 0)
|
|
{
|
|
// controllo ci siano particolare e ci sia selezionato almeno un UDC
|
|
if (currParticolare != "" && ((udcSelC.Replace("#", "").Length > 1) || (udcSelP.Replace("#", "").Length > 1)))
|
|
{
|
|
stampaOk = true;
|
|
}
|
|
}
|
|
btnStampa.Enabled = stampaOk;
|
|
}
|
|
/// <summary>
|
|
/// genera i barcode di
|
|
/// - trattamenti
|
|
/// - nuovo x pezzi liquidi
|
|
/// e lancia la relativa stampa
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnStampa_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
// calcolo postazione
|
|
calcolaPostazione();
|
|
// verifico postazione x procedere...
|
|
if (postazione_printer != "n.d.")
|
|
{
|
|
string newUdcChild = "";
|
|
int qta = memLayer.ML.confReadInt("QtaImballoSterr");
|
|
string noteTrim = txtNote.Text.Trim();
|
|
try
|
|
{
|
|
qta = Convert.ToInt32(txtQta.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
// effettuo controlli che cod_soggetto e cod particolare siano disponibili...
|
|
string codSogg = "";
|
|
string particolare = "";
|
|
try
|
|
{
|
|
codSogg = MagClass.magazzino.CodSoggCurrUser;
|
|
particolare = currParticolare;
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
if (codSogg != "" && particolare != "")
|
|
{
|
|
// genero cartellino
|
|
DateTime adesso = DateTime.Now;
|
|
string[] stringSeparators = new string[] { "#" };
|
|
try
|
|
{
|
|
// creo nuovo UDC sterrato OUT multiple
|
|
newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.confReadString("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.confReadInt("IdxPosizioneSterrati"), "IdxPosizioneSterrati", eventoUDC, noteTrim, "", adesso.Year, Request.UserHostName);
|
|
// registro creazione nuovo UDC
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, postazione_name, postazione_IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Sterrato, qta: {0} {1}", qta, noteTrim));
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
httpLog(string.Format("Errore creazione UDC Sterrato: {0}", exc), tipoLog.EXCEPTION);
|
|
}
|
|
// devo gestire associazione e consumo cartellini FUSI
|
|
if (newUdcChild != "")
|
|
{
|
|
string[] UDC_P;
|
|
// ASSOCIO tutti gli UDC consumati sia Parziali che Completi al nuovo UDC
|
|
if (udcSelP.Replace("#", "").Length > 1)
|
|
{
|
|
// associo
|
|
UDC_P = udcSelP.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
|
|
//UDC_P = SteamWare.StringSplitter.CSplitter.Split(udcSelP, "#", false, 0, SteamWare.StringSplitter.ComparisonMethod.Text);
|
|
associaUdc(newUdcChild, UDC_P);
|
|
}
|
|
if (udcSelC.Replace("#", "").Length > 1)
|
|
{
|
|
// associo
|
|
UDC_P = udcSelC.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
|
|
//UDC_P = SteamWare.StringSplitter.CSplitter.Split(udcSelC, "#", false, 0, SteamWare.StringSplitter.ComparisonMethod.Text);
|
|
associaUdc(newUdcChild, UDC_P);
|
|
// consumo gli UDC indicati come "C"
|
|
consumaUdc(UDC_P);
|
|
}
|
|
|
|
// ora stampo il nuovo cartellino!!!
|
|
MagClass.magazzino.stampaUdc(newUdcChild, postazione_printer, tipoCartellino.cartSterr, Request.UserHostName);
|
|
// incremento timing...
|
|
adesso = DateTime.Now;
|
|
adesso = adesso.AddSeconds(2);
|
|
// registro stampa nuovo UDC
|
|
MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, postazione_name, postazione_IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Sterrato");
|
|
}
|
|
// resetto
|
|
doResetData();
|
|
}
|
|
else
|
|
{
|
|
httpLog(string.Format("STERRATI OUT, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
|
|
Response.Redirect("~/login.aspx");
|
|
}
|
|
mod_storicoAzioniOperatore1.doUpdate();
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("~/menu.aspx");
|
|
}
|
|
doRefreshBloccoPost();
|
|
}
|
|
/// <summary>
|
|
/// effettua il consumo di tutti gli UDC inviati come array di stringhe
|
|
/// </summary>
|
|
/// <param name="UDC_P"></param>
|
|
private void consumaUdc(string[] UDC_P)
|
|
{
|
|
if (UDC_P.Length > 0)
|
|
{
|
|
// ciclo
|
|
foreach (string udc_p in UDC_P)
|
|
{
|
|
// se UDC è NON vuoto ed esiste
|
|
if (udc_p != "" && MagClass.magazzino.checkUDC(udc_p))
|
|
{
|
|
// se è consumabile (idxPosizione > 0)...
|
|
if (MagClass.magazzino.udcMpIsConsumabile(udc_p))
|
|
{
|
|
// consumo UDC
|
|
MagClass.magazzino.scaricaUdcMpWip(udc_p, Request.UserHostName);
|
|
// sposta UDC da posizione corrente a nessuna...
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
///associa nuovo UDC ad elenco UDC
|
|
/// </summary>
|
|
/// <param name="newUdcChild">UDC da associare come child</param>
|
|
/// <param name="UDC_P">vettorei di UDC da associare come parent</param>
|
|
private void associaUdc(string newUdcChild, string[] UDC_P)
|
|
{
|
|
if (UDC_P.Length > 0)
|
|
{
|
|
// ciclo
|
|
foreach (string udc_p in UDC_P)
|
|
{
|
|
// se UDC è NON vuoto ed esiste
|
|
if (udc_p != "" && MagClass.magazzino.checkUDC(udc_p))
|
|
{
|
|
MagClass.magazzino.associaUdcParent(newUdcChild, udc_p);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// wrapper per log con salvataggio dell'IP del chiamante
|
|
/// </summary>
|
|
/// <param name="_testoPre"></param>
|
|
/// <returns></returns>
|
|
public bool httpLog(string _testoPre)
|
|
{
|
|
bool answ = false;
|
|
string postazione_IP = "";
|
|
try
|
|
{
|
|
postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
|
|
}
|
|
catch
|
|
{ }
|
|
logger.lg.scriviLog(postazione_IP + _testoPre);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// wrapper per log con salvataggio dell'IP del chiamante
|
|
/// </summary>
|
|
/// <param name="_testoPre"></param>
|
|
/// <returns></returns>
|
|
public bool httpLog(string testoLog, tipoLog tipo)
|
|
{
|
|
bool answ = false;
|
|
string postazione_IP = "";
|
|
try
|
|
{
|
|
postazione_IP = string.Format(" | {0} | ", Request.UserHostName);
|
|
}
|
|
catch
|
|
{ }
|
|
logger.lg.scriviLog(postazione_IP + testoLog, tipo);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// effettua reset dati
|
|
/// </summary>
|
|
private void doResetData()
|
|
{
|
|
// resetto i dati QtaTot e particolare...
|
|
qta = 0;
|
|
currParticolare = "";
|
|
txtQta.Text = "";
|
|
testoRicerca = "";
|
|
salvaCerca();
|
|
doChecks();
|
|
}
|
|
/// <summary>
|
|
/// svuoto le note
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnEmptyNote_Click(object sender, EventArgs e)
|
|
{
|
|
txtNote.Text = "";
|
|
}
|
|
/// <summary>
|
|
/// toggle controllo storico
|
|
/// </summary>
|
|
private void fixStorico()
|
|
{
|
|
pnlSAO.Visible = storicoVisibile;
|
|
if (storicoVisibile)
|
|
{
|
|
btnShowHideStorico.Text = traduci("btnHideStorico");
|
|
}
|
|
else
|
|
{
|
|
btnShowHideStorico.Text = traduci("btnShowStorico");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// imposto visibilità pannelo storico
|
|
/// </summary>
|
|
protected bool storicoVisibile
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.BoolSessionObj(string.Format("showHist_{0}", this.ID));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("showHist_{0}", this.ID), value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// gestisco evento show/hide storico
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnShowHideStorico_Click(object sender, EventArgs e)
|
|
{
|
|
storicoVisibile = !storicoVisibile;
|
|
fixStorico();
|
|
}
|
|
/// <summary>
|
|
/// passo alla modalità IN
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnIn_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect("SterrTaglioIN.aspx");
|
|
}
|
|
|
|
/// <summary>
|
|
/// selezione di una linea da elenco DropDownList
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlLinea_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
checkSelDDL(ddlLinea.SelectedValue, true);
|
|
}
|
|
/// <summary>
|
|
/// tenta di selezionare la linea indicata
|
|
/// </summary>
|
|
/// <param name="p"></param>
|
|
private void checkSelDDL(string codLinea, bool doSave)
|
|
{
|
|
/*******************************************************
|
|
* controllo se la linea sia libera .. OVVERO:
|
|
* - nessuna postazione la occupa
|
|
* - è bloccata da + di "minutiBloccoLinea" (e quindi sovrascrivo)
|
|
*
|
|
*******************************************************/
|
|
bool lineaLibera = false;
|
|
try
|
|
{
|
|
DS_magazzino.AnagLineeRow riga = MagClass.magazzino.taAL.getByKey(codLinea)[0];
|
|
if (riga.codPostazione == "" || riga.codPostazione == postazione_name)
|
|
{
|
|
lineaLibera = true;
|
|
}
|
|
else
|
|
{
|
|
// controllo se è bloccata da tempo > minutiBloccoLinea --> ignoro blocco!
|
|
if (DateTime.Now >= riga.dtAccess.AddMinutes(memLayer.ML.confReadInt("minutiBloccoLinea")))
|
|
{
|
|
lineaLibera = true;
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
if (lineaLibera)
|
|
{
|
|
//...aggiorno ddl
|
|
try
|
|
{
|
|
ddlLinea.SelectedValue = codLinea;
|
|
pnlAll.CssClass = "stileAttesa";
|
|
}
|
|
catch
|
|
{
|
|
// mostro errore
|
|
lblMessaggi.Text = string.Format("Errore selezione linea: codice {0} non trovato!", codLinea);
|
|
pnlAll.CssClass = "stileComandoKo";
|
|
}
|
|
if (doSave)
|
|
{
|
|
refreshBloccoPost(codLinea);
|
|
// continuo
|
|
currCodLinea = codLinea;
|
|
testoRicerca = "";
|
|
grView.DataBind();
|
|
salvaCerca();
|
|
}
|
|
// salvo codice cella!
|
|
try
|
|
{
|
|
codCella = MagClass.magazzino.taAL.getByKey(currCodLinea)[0].CodCella;
|
|
idxCella = MagClass.magazzino.taCelle.getByCodCella(codCella)[0].IdxCella;
|
|
}
|
|
catch
|
|
{
|
|
codCella = "";
|
|
idxCella = 0;
|
|
}
|
|
doUpdate();
|
|
}
|
|
else
|
|
{
|
|
codCella = "";
|
|
idxCella = 0;
|
|
MagClass.magazzino.taAL.resetPost(postazione_name);
|
|
// mostro errore
|
|
lblMessaggi.Text = string.Format("Errore: linea {0} già impegnata, sbloccare postazione o attendere timeout!", codLinea);
|
|
pnlAll.CssClass = "stileComandoKo";
|
|
ddlLinea.DataBind();
|
|
ddlLinea.SelectedIndex = 0;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua refresh (su db) del blocco postazione
|
|
/// </summary>
|
|
/// <param name="codLinea"></param>
|
|
private void refreshBloccoPost(string codLinea)
|
|
{
|
|
// resetto usi linee precedenti..
|
|
MagClass.magazzino.taAL.resetPost(postazione_name);
|
|
// se la linea non è "base" = "Sel linea", finisce x "0"
|
|
if (codLinea.Substring(codLinea.Length - 1) != "0")
|
|
{
|
|
// salvo su DB che sto occupando linea...
|
|
MagClass.magazzino.taAL.updatePost(codLinea, postazione_name);
|
|
}
|
|
// ricarico elenco postazioni...
|
|
ddlLinea.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// CODICE cella associata alla linea corrente
|
|
/// </summary>
|
|
protected string codCella
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (memLayer.ML.isInSessionObject("codCella"))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("codCella");
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("codCella", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// IDX cella associata alla linea corrente
|
|
/// </summary>
|
|
protected int idxCella
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (memLayer.ML.isInSessionObject("IdxCellaLineaST_OUT"))
|
|
{
|
|
answ = memLayer.ML.IntSessionObj("IdxCellaLineaST_OUT");
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("IdxCellaLineaST_OUT", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// codice della linea corrente
|
|
/// </summary>
|
|
protected string currCodLinea
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
if (memLayer.ML.isInSessionObject(string.Format("LineaOut-{0}", uid)))
|
|
{
|
|
answ = memLayer.ML.StringSessionObj(string.Format("LineaOut-{0}", uid));
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("LineaOut-{0}", uid), value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// cambiato valore in ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtCerca_TextChanged(object sender, EventArgs e)
|
|
{
|
|
// se è nuovo il testo resetto
|
|
if (testoRicerca != SteamWare.memLayer.ML.StringSessionObj("valoreCercatoSTO"))
|
|
{
|
|
udcSelC = "";
|
|
udcSelP = "";
|
|
}
|
|
salvaCerca();
|
|
}
|
|
/// <summary>
|
|
/// pressione del button di ricerca
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnCerca_Click(object sender, EventArgs e)
|
|
{
|
|
salvaCerca();
|
|
}
|
|
|
|
/// <summary>
|
|
/// testo ricerca trimmato da spazi
|
|
/// </summary>
|
|
protected string testoRicerca
|
|
{
|
|
get
|
|
{
|
|
return txtCerca.Text.Trim();
|
|
}
|
|
set
|
|
{
|
|
txtCerca.Text = value;
|
|
}
|
|
}
|
|
protected void salvaCerca()
|
|
{
|
|
if (testoRicerca == "")
|
|
{
|
|
SteamWare.memLayer.ML.emptySessionVal("valoreCercatoSTO");
|
|
udcSelC = "";
|
|
udcSelP = "";
|
|
}
|
|
else
|
|
{
|
|
SteamWare.memLayer.ML.setSessionVal("valoreCercatoSTO", testoRicerca);
|
|
}
|
|
// raise dell'evento
|
|
if (eh_nuovaRicerca != null)
|
|
{
|
|
eh_nuovaRicerca(this, new EventArgs());
|
|
}
|
|
doUpdate();
|
|
}
|
|
protected void grView_PageIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
protected void grView_Sorted(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
/// <summary>
|
|
/// aggiorno ods al binding..
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ods_DataBinding(object sender, EventArgs e)
|
|
{
|
|
// fix dell'ODS
|
|
checkFixOds();
|
|
}
|
|
/// <summary>
|
|
/// verifica se attivo filtro company e imposta ods di conseguenza...
|
|
/// </summary>
|
|
private void checkFixOds()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// traduce gli header delle colonne
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
|
|
protected void rbl_DataBinding(object sender, EventArgs e)
|
|
{
|
|
RadioButtonList rbl = (RadioButtonList)sender;
|
|
if (udcSelC.IndexOf(rbl.ToolTip) >= 0)
|
|
{
|
|
rbl.SelectedValue = "C";
|
|
}
|
|
else if (udcSelP.IndexOf(rbl.ToolTip) >= 0)
|
|
{
|
|
rbl.SelectedValue = "P";
|
|
}
|
|
}
|
|
|
|
protected void rbl_DataBound(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected void rbl_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
RadioButtonList rbl = (RadioButtonList)sender;
|
|
if (rbl.SelectedValue == "C")
|
|
{
|
|
udcSelC = string.Format("{0}#{1}#", udcSelC, rbl.ToolTip);
|
|
// se era presente in elenco "P" lo elimino
|
|
udcSelP = udcSelP.Replace(string.Format("#{0}#", rbl.ToolTip), "");
|
|
}
|
|
else
|
|
{
|
|
udcSelP = string.Format("{0}#{1}#", udcSelP, rbl.ToolTip);
|
|
// se era presente in elenco "C" lo elimino
|
|
udcSelC = udcSelC.Replace(string.Format("#{0}#", rbl.ToolTip), "");
|
|
}
|
|
// calcolo il particolare da selezionare...
|
|
string newPart = DataProxy.obj.taCartellini.stp_getByUdc(rbl.ToolTip)[0].Particolare;
|
|
//testoRicerca = newPart;
|
|
updFiltroPart(newPart);
|
|
}
|
|
/// <summary>
|
|
/// fa su richiesta un refresh (aggiornando dataOra di blocco x cella/posizione ad esempio)
|
|
/// </summary>
|
|
public void doRefreshBloccoPost()
|
|
{
|
|
refreshBloccoPost(currCodLinea);
|
|
}
|
|
}
|
|
} |