diff --git a/GMW/WebUserControls/mod_FusiSterr.ascx.cs b/GMW/WebUserControls/mod_FusiSterr.ascx.cs
index 42fd8b74..180bd3a6 100644
--- a/GMW/WebUserControls/mod_FusiSterr.ascx.cs
+++ b/GMW/WebUserControls/mod_FusiSterr.ascx.cs
@@ -5,859 +5,859 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_FusiSterr : System.Web.UI.UserControl
+ public partial class mod_FusiSterr : System.Web.UI.UserControl
+ {
+
+ ///
+ /// flusso associato (hard coded) a sterrati
+ ///
+ protected string flusso = "ST";
+ ///
+ /// stato associato (hard coded) a sterrati
+ ///
+ protected string statoUDC = "FusSter";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_STTA";
+ ///
+ /// tipo di evento associato alla modifica qta dell'UDC
+ ///
+ protected string eventoUDC_qta = "UDC_QTY";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
-
- ///
- /// flusso associato (hard coded) a sterrati
- ///
- protected string flusso = "ST";
- ///
- /// stato associato (hard coded) a sterrati
- ///
- protected string statoUDC = "FusSter";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_STTA";
- ///
- /// tipo di evento associato alla modifica qta dell'UDC
- ///
- protected string eventoUDC_qta = "UDC_QTY";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
- {
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
- }
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- qta = 0;
- // imposto destAL
- destAL = AlByCella;
- traduciObj();
- idxCella = Postazione.currIdxCella;
- checkNumKeyIn();
- }
- setVisibility();
- doChecks();
- }
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
- }
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
- {
- get
- {
- int answ = 0;
- if (memLayer.ML.isInSessionObject("IdxCellaLineaFS"))
- {
- answ = memLayer.ML.IntSessionObj("IdxCellaLineaFS");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("IdxCellaLineaFS", value);
- }
- }
- ///
- /// Codice AL associato alla cella corrente...
- ///
- protected string AlByCella
- {
- get
- {
- string answ = "";
- try
- {
- // tolto 2015.06.25
- //// se avesse perso codice cella rimando a pagina default...
- //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
- answ = string.Format("ALS00{0}", Postazione.currCodCella);
- // controllo se esista AL sennò lo creo...
- if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
- {
- MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
- }
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// Codice AL target
- ///
- protected string destAL
- {
- get
- {
- return lblAL.Text.Trim();
- }
- set
- {
- lblAL.Text = value;
- }
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- bool fatto = false;
- // 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;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Fusi Sterratura Taglio {0}", udcReq), tipoLog.EXCEPTION);
- }
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Fusi - Sterratura Taglio");
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica UDC correntemente selezionato
- ///
- protected string currUDC
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
- string udcDest = checkCreaUDC();
-
- break;
- case tipoCodiceBarcode.UDC:
- // non fa nulla
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- txtBarcode.Focus();
- }
-
- ///
- /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
- ///
- ///
- ///
- private string checkCreaUDC()
- {
- string udcDest = "";
- DateTime adesso = DateTime.Now;
- // verifico se ho già quel particolare tra quelli dell'AL...
- try
- {
- udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
- }
- catch
- {
- udcDest = "";
- }
- if (udcDest == "")
- {
- try
- {
- // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
- udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
- // associo UDC a AL...
- MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in creazione UDC temp Fusi Sterrati Taglio x travaso: {0}{1}", Environment.NewLine, exc));
- }
- }
- if (udcDest != "")
- {
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("partAdded");
- }
- else
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.warningText = traduci("ErroreUdcDest");
- }
- grViewDest.DataBind();
- return udcDest;
- }
-
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- destAL = AlByCella;
- setVisibility();
- checkStampa();
- grViewDest.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - udc da consumo totale/parziale
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- //controllo siano inseriti valori qta
- if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
- {
- // controllo ci siano particolare
- if (currParticolare != "")
- {
- stampaOk = true;
- txtNote.Focus();
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- string[] stringSeparators = new string[] { "#" };
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- DateTime adesso = DateTime.Now;
- string noteTrim = txtNote.Text.Trim();
- string lineaCesta = string.Format("{0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
- noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
-
- // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
- if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
- {
- // aggiorno note e posizione da temp a definitiva x UDC...
- MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Fusi Sterr Taglio, qta: {0} {1}", qta, ""));
- // metto attributo FC
- MagClass.magazzino.taAtt2UDC.Insert(currUDC, "FS", "", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // tolgo UDC da AL corrente...
- MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
-
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
- // incremento timing...
- adesso = adesso.AddSeconds(2);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Fusione-Sterratura-Taglio");
- // svuoto campo cesta...
- numCesta = "";
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("FST, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- }
-
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- grViewDest.SelectedIndex = -1;
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
-
- ///
- /// effettua refresh (su db) del blocco postazione
- ///
- ///
- 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);
- }
- }
-
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
- ///
- /// evento selezione grView destinazione: ricarico dati!
- ///
- ///
- ///
- protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
- {
- // ricarico dati dell'UDC come particolare e quantità...
- currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
- if (MagClass.magazzino.checkUDC(currUDC))
- {
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
- qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
- }
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- doChecks();
- doUpdate();
- // fisso focus su note!
- txtNote.Focus();
- }
- ///
- /// sistema modalità input
- ///
- private void setVisibility()
- {
- bool showBtn = false;
- // ora controllo btn quantità
- if (grViewDest.SelectedIndex >= 0)
- {
- showBtn = true;
- }
- divQta.Visible = showBtn;
- }
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- grViewDest.SelectedIndex = -1;
- qta = 0;
- currUDC = "";
- currParticolare = "";
- setVisibility();
- doUpdate();
- }
- ///
- /// update Qty x UDC selezionato...
- ///
- ///
- ///
- protected void lbtUpdQty_Click(object sender, EventArgs e)
- {
- aggiornaQta();
- }
-
- private void aggiornaQta()
- {
- MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
- currUDC = "";
- currParticolare = "";
- grViewDest.SelectedIndex = -1;
- setVisibility();
- doUpdate();
- }
- ///
- /// Numero cesta inserito
- ///
- public string numCesta
- {
- get
- {
- return txtCesta.Text.Trim();
- }
- set
- {
- txtCesta.Text = value;
- }
- }
- ///
- /// evento cambio num cesta/grappolo
- ///
- ///
- ///
- protected void txtCesta_TextChanged(object sender, EventArgs e)
- {
- txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
- doUpdate();
- }
- ///
- /// fornisce in output la corretta classe css x icona
- ///
- ///
- ///
- public string cssGlyphByQty(object _qta)
- {
- string answ = "glyphicon glyphicon-pencil";
- int qtaUDC = 0;
- try
- {
- qtaUDC = Convert.ToInt32(_qta);
- }
- catch { }
- if (qtaUDC > 0)
- {
- answ = "glyphicon glyphicon-print";
- }
- return answ;
- }
- ///
- /// determina se sia possibile cancellare un record, se qta > 0
- ///
- ///
- ///
- public bool canDelete(object _qta)
- {
- bool answ = false;
- try
- {
- answ = Convert.ToInt32(_qta) == 0;
- }
- catch
- { }
- return answ;
- }
-
- ///
- /// evento cambio qta
- ///
- ///
- ///
- protected void txtQta_TextChanged(object sender, EventArgs e)
- {
- aggiornaQta();
- }
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
}
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ qta = 0;
+ // imposto destAL
+ destAL = AlByCella;
+ traduciObj();
+ idxCella = Postazione.currIdxCella;
+ checkNumKeyIn();
+ }
+ setVisibility();
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaFS"))
+ {
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaFS");
+ }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaFS", value);
+ }
+ }
+ ///
+ /// Codice AL associato alla cella corrente...
+ ///
+ protected string AlByCella
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ // tolto 2015.06.25
+ //// se avesse perso codice cella rimando a pagina default...
+ //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
+ answ = string.Format("ALS00{0}", Postazione.currCodCella);
+ // controllo se esista AL sennò lo creo...
+ if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
+ {
+ MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// Codice AL target
+ ///
+ protected string destAL
+ {
+ get
+ {
+ return lblAL.Text.Trim();
+ }
+ set
+ {
+ lblAL.Text = value;
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Fusi Sterratura Taglio {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Fusi - Sterratura Taglio");
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica UDC correntemente selezionato
+ ///
+ protected string currUDC
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
+ string udcDest = checkCreaUDC();
+
+ break;
+ case tipoCodiceBarcode.UDC:
+ // non fa nulla
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
+ txtBarcode.Focus();
+ }
+
+ ///
+ /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
+ ///
+ ///
+ ///
+ private string checkCreaUDC()
+ {
+ string udcDest = "";
+ DateTime adesso = DateTime.Now;
+ // verifico se ho già quel particolare tra quelli dell'AL...
+ try
+ {
+ udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
+ }
+ catch
+ {
+ udcDest = "";
+ }
+ if (udcDest == "")
+ {
+ try
+ {
+ // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
+ udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
+ // associo UDC a AL...
+ MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in creazione UDC temp Fusi Sterrati Taglio x travaso: {0}{1}", Environment.NewLine, exc));
+ }
+ }
+ if (udcDest != "")
+ {
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("partAdded");
+ }
+ else
+ {
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.warningText = traduci("ErroreUdcDest");
+ }
+ grViewDest.DataBind();
+ return udcDest;
+ }
+
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ destAL = AlByCella;
+ setVisibility();
+ checkStampa();
+ grViewDest.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - udc da consumo totale/parziale
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ //controllo siano inseriti valori qta
+ if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
+ {
+ // controllo ci siano particolare
+ if (currParticolare != "")
+ {
+ stampaOk = true;
+ txtNote.Focus();
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ string[] stringSeparators = new string[] { "#" };
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ DateTime adesso = DateTime.Now;
+ string noteTrim = txtNote.Text.Trim();
+ string lineaCesta = string.Format("{0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
+ noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
+
+ // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
+ if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
+ {
+ // aggiorno note e posizione da temp a definitiva x UDC...
+ MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
+
+ if (OpAuth.isAuth)
+ {
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
+ }
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Fusi Sterr Taglio, qta: {0} {1}", qta, ""));
+ // metto attributo FC
+ MagClass.magazzino.taAtt2UDC.Insert(currUDC, "FS", "", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // tolgo UDC da AL corrente...
+ MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
+
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
+ // incremento timing...
+ adesso = adesso.AddSeconds(2);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Fusione-Sterratura-Taglio");
+ // svuoto campo cesta...
+ numCesta = "";
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("FST, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ grViewDest.SelectedIndex = -1;
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+
+ ///
+ /// effettua refresh (su db) del blocco postazione
+ ///
+ ///
+ 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);
+ }
+ }
+
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+ ///
+ /// evento selezione grView destinazione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // ricarico dati dell'UDC come particolare e quantità...
+ currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
+ if (MagClass.magazzino.checkUDC(currUDC))
+ {
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
+ qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
+ }
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ doChecks();
+ doUpdate();
+ // fisso focus su note!
+ txtNote.Focus();
+ }
+ ///
+ /// sistema modalità input
+ ///
+ private void setVisibility()
+ {
+ bool showBtn = false;
+ // ora controllo btn quantità
+ if (grViewDest.SelectedIndex >= 0)
+ {
+ showBtn = true;
+ }
+ divQta.Visible = showBtn;
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ grViewDest.SelectedIndex = -1;
+ qta = 0;
+ currUDC = "";
+ currParticolare = "";
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// update Qty x UDC selezionato...
+ ///
+ ///
+ ///
+ protected void lbtUpdQty_Click(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+
+ private void aggiornaQta()
+ {
+ MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
+ currUDC = "";
+ currParticolare = "";
+ grViewDest.SelectedIndex = -1;
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// Numero cesta inserito
+ ///
+ public string numCesta
+ {
+ get
+ {
+ return txtCesta.Text.Trim();
+ }
+ set
+ {
+ txtCesta.Text = value;
+ }
+ }
+ ///
+ /// evento cambio num cesta/grappolo
+ ///
+ ///
+ ///
+ protected void txtCesta_TextChanged(object sender, EventArgs e)
+ {
+ txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
+ doUpdate();
+ }
+ ///
+ /// fornisce in output la corretta classe css x icona
+ ///
+ ///
+ ///
+ public string cssGlyphByQty(object _qta)
+ {
+ string answ = "glyphicon glyphicon-pencil";
+ int qtaUDC = 0;
+ try
+ {
+ qtaUDC = Convert.ToInt32(_qta);
+ }
+ catch { }
+ if (qtaUDC > 0)
+ {
+ answ = "glyphicon glyphicon-print";
+ }
+ return answ;
+ }
+ ///
+ /// determina se sia possibile cancellare un record, se qta > 0
+ ///
+ ///
+ ///
+ public bool canDelete(object _qta)
+ {
+ bool answ = false;
+ try
+ {
+ answ = Convert.ToInt32(_qta) == 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ ///
+ /// evento cambio qta
+ ///
+ ///
+ ///
+ protected void txtQta_TextChanged(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_PostFinMultOUT.ascx.cs b/GMW/WebUserControls/mod_PostFinMultOUT.ascx.cs
index 8815c869..d043014d 100644
--- a/GMW/WebUserControls/mod_PostFinMultOUT.ascx.cs
+++ b/GMW/WebUserControls/mod_PostFinMultOUT.ascx.cs
@@ -131,7 +131,7 @@ namespace GMW.WebUserControls
if (currParticolare != "")
{
lblParticolareAttivo.Text = string.Format("{0}", currParticolare);
- if(lbtShowAllImb.Visible) lblPart.Text = currParticolare;
+ if (lbtShowAllImb.Visible) lblPart.Text = currParticolare;
// aggiungo descrizione del particolare
string descr = "";
string disegno = "";
@@ -240,7 +240,7 @@ namespace GMW.WebUserControls
int answ = 0;
try
{
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, true)[0].Qta;
}
catch
{ }
@@ -274,7 +274,7 @@ namespace GMW.WebUserControls
string answ = "";
try
{
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].CodImballo;
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, true)[0].CodImballo;
}
catch
{ }
diff --git a/GMW/WebUserControls/mod_PostRX_NT.ascx.cs b/GMW/WebUserControls/mod_PostRX_NT.ascx.cs
index c603abef..e7501fda 100644
--- a/GMW/WebUserControls/mod_PostRX_NT.ascx.cs
+++ b/GMW/WebUserControls/mod_PostRX_NT.ascx.cs
@@ -7,420 +7,420 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_PostRX_NT : System.Web.UI.UserControl
+ public partial class mod_PostRX_NT : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a RX
+ ///
+ protected string flusso = "RX";
+ ///
+ /// stato associato (hard coded) a Controllato RX
+ ///
+ protected string statoUDC = "ContrRx";
+ ///
+ /// codice evento dell'UDC che si crea
+ ///
+ protected string codEventoUdc = "UDC_RX";
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a RX
- ///
- protected string flusso = "RX";
- ///
- /// stato associato (hard coded) a Controllato RX
- ///
- protected string statoUDC = "ContrRx";
- ///
- /// codice evento dell'UDC che si crea
- ///
- protected string codEventoUdc = "UDC_RX";
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ currParticolare = ""; Postazione.messaggiText = "";
+ lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus);
+ lblLinFus.Text = lineaFus;
+ Postazione.warningText = "";
+ fixTipoInput();
+ fixCella();
+ traduciObj();
+ }
+ doChecks();
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ qta = Convert.ToInt32(txtQta.Text.Trim());
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// data fusione impostata SALVATA SU DB...
+ ///
+ public DateTime dataFus
+ {
+ get
+ {
+ DateTime answ = Convert.ToDateTime("1900-01-01");
+ try
{
- if (!Page.IsPostBack)
- {
- currParticolare = ""; Postazione.messaggiText = "";
- lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus);
- lblLinFus.Text = lineaFus;
- Postazione.warningText = "";
- fixTipoInput();
- fixCella();
- traduciObj();
- }
- doChecks();
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// data fusione impostata SALVATA SU DB...
- ///
- public DateTime dataFus
- {
- get
- {
- DateTime answ = Convert.ToDateTime("1900-01-01");
- try
- {
- answ = Convert.ToDateTime(utils.obj.RTVal(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea));
- }
- catch
- { }
- return answ;
- }
- set
- {
- utils.obj.taRTPV.upsert(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea, string.Format("{0:yyyy/MM/dd HH:mm}", value));
- lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", value);
- }
+ answ = Convert.ToDateTime(utils.obj.RTVal(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea));
}
- ///
- /// LINEA fusione impostata SALVATA SU DB...
- ///
- public string lineaFus
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ utils.obj.taRTPV.upsert(user_std.pagCorrente, "dataFus" + Postazione.currCodLinea, string.Format("{0:yyyy/MM/dd HH:mm}", value));
+ lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", value);
+ }
+ }
+ ///
+ /// LINEA fusione impostata SALVATA SU DB...
+ ///
+ public string lineaFus
+ {
+ get
+ {
+ string answ = "";
+ try
{
- get
- {
- string answ = "";
- try
- {
- answ = utils.obj.RTVal(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea);
- }
- catch
- { }
- return answ;
- }
- set
- {
- utils.obj.taRTPV.upsert(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea, value);
- lblLinFus.Text = value;
- }
+ answ = utils.obj.RTVal(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea);
}
- ///
- /// aggiorna visualizzazioen dati particolare
- ///
- private void updatePart()
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ utils.obj.taRTPV.upsert(user_std.pagCorrente, "lineaFus" + Postazione.currCodLinea, value);
+ lblLinFus.Text = value;
+ }
+ }
+ ///
+ /// aggiorna visualizzazioen dati particolare
+ ///
+ private void updatePart()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- if (currParticolare != "")
+ 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 = "";
+ }
+ }
+ ///
+ /// sistema modalità input
+ ///
+ private void fixTipoInput()
+ {
+ bool barcodeEnabled = false;
+ if (rblInputMode.SelectedValue.ToUpper() == "BARCODE")
+ {
+ barcodeEnabled = true;
+ }
+ Postazione.messaggiText = traduci("attesaInput");
+ Postazione.warningText = "";
+ divElenco.Visible = !barcodeEnabled;
+ divBarcode.Visible = barcodeEnabled;
+ doUpdate();
+ }
+ ///
+ /// verifica se si debab mostrare un campo ricerca UDC attivo...
+ ///
+ private void fixCella()
+ {
+ lblIdxCella.Text = Postazione.currIdxCella.ToString();
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ MagClass.magazzino.stampaAL(udcReq, Postazione.printer, Request.UserHostName);
+ // registro ri-stampa UDC
+ MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, "", "creaAL", "Ri-Stampato AL Rx NT");
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ bool okDTL = false;
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
+ switch (MagClass.tipoBCode_L5(barcodeIn))
+ {
+ case tipoCodiceBarcode.DateTime:
+ // imposto NUOVA dataora fusione...
+ okDTL = getDateTimeLine(false);
+ if (okDTL)
{
- lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), 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;
+ Postazione.messaggiText = traduci("SetDataFus");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
}
else
{
- lblParticolareAttivo.Text = "...";
- lblDescrAttivo.Text = "";
- lblDisegno.Text = "";
+ Postazione.messaggiText = traduci("ERR-BCD-004");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
- }
- ///
- /// sistema modalità input
- ///
- private void fixTipoInput()
- {
- bool barcodeEnabled = false;
- if (rblInputMode.SelectedValue.ToUpper() == "BARCODE")
+ break;
+ case tipoCodiceBarcode.DateTimeLine:
+ okDTL = getDateTimeLine(true);
+ if (okDTL)
{
- barcodeEnabled = true;
- }
- Postazione.messaggiText = traduci("attesaInput");
- Postazione.warningText = "";
- divElenco.Visible = !barcodeEnabled;
- divBarcode.Visible = barcodeEnabled;
- doUpdate();
- }
- ///
- /// verifica se si debab mostrare un campo ricerca UDC attivo...
- ///
- private void fixCella()
- {
- lblIdxCella.Text = Postazione.currIdxCella.ToString();
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- MagClass.magazzino.stampaAL(udcReq, Postazione.printer, Request.UserHostName);
- // registro ri-stampa UDC
- MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, "", "creaAL", "Ri-Stampato AL Rx NT");
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
-
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- bool okDTL = false;
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("{0}: {1}", traduci("BCodeIns"), barcodeIn);
- switch (MagClass.tipoBCode_L5(barcodeIn))
- {
- case tipoCodiceBarcode.DateTime:
- // imposto NUOVA dataora fusione...
- okDTL = getDateTimeLine(false);
- if (okDTL)
- {
- Postazione.messaggiText = traduci("SetDataFus");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-004");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.DateTimeLine:
- okDTL = getDateTimeLine(true);
- if (okDTL)
- {
- Postazione.messaggiText = traduci("SetDataFus");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- Postazione.messaggiText = traduci("ERR-BCD-004");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText = traduci("partNotFound");
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- }
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- if (pezziUdc > 0)
- {
- qta = pezziUdc;
- }
- else // rimette default
- {
- qta = memLayer.ML.cdvi("QtaImballoRX");
- }
- break;
- default:
- Postazione.warningText = traduci("ERR-UNK-001");
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
+ Postazione.messaggiText = traduci("SetDataFus");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
}
else
{
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
+ Postazione.messaggiText = traduci("ERR-BCD-004");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoKo";
}
- doUpdate();
- }
- ///
- /// recupera da barcode dataOra e linea fusione (SE presenti)
- ///
- ///
- ///
- private bool getDateTimeLine(bool readline)
- {
- bool okData = false;
- bool okLinea = false;
- DateTime oldDataFus = new DateTime(1900, 1, 1);
- // imposto NUOVA dataora fusione...
- string newData = "";
- string newLinea = "";
- // tento di recuperare e verifico validità dei 2 valori separatamente...
- try
+ break;
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
{
- newData = barcodeIn.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(0, 10);
- if (newData != "")
- {
- dataFus = DateTime.ParseExact(newData, "yyMMddHHmm", CultureInfo.InvariantCulture);
- okData = true;
- }
- }
- catch
- {
- dataFus = oldDataFus;
- }
- if (readline)
- {
- if (okData)
- {
- try
- {
- newLinea = barcodeIn.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(10, barcodeIn.Length - 10 - memLayer.ML.AppConf["prefDateTime"].Length);
- if ((newLinea != "") && (DataProxy.obj.taElPost.getByCod(newLinea).Rows.Count > 0))
- {
- lineaFus = newLinea;
- okLinea = true;
- }
- else
- {
- lineaFus = "";
- dataFus = oldDataFus;
- }
- }
- catch
- {
- lineaFus = "";
- dataFus = oldDataFus;
- }
- }
- else
- {
- lineaFus = "";
- }
+ currParticolare = "";
+ Postazione.messaggiText = traduci("partNotFound");
+ Postazione.CssClass = "stileComandoKo";
}
else
{
- okLinea = true;
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
}
- // registro se necessario attributi sui vari UDC che fossero caricati...
- int numUdcCella = 0;
- DS_magazzino.v_UdcDetailDataTable tabUdcIn = new DS_magazzino.v_UdcDetailDataTable();
- try
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ if (pezziUdc > 0)
{
- tabUdcIn = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(Postazione.currIdxCella);
- numUdcCella = tabUdcIn.Rows.Count;
+ qta = pezziUdc;
}
- catch
- { }
- if (numUdcCella > 0)
+ else // rimette default
{
- DateTime adesso = DateTime.Now;
- foreach (DS_magazzino.v_UdcDetailRow riga in tabUdcIn)
- {
- // 2014.07.10 aggiungo attributo della data di fusione...
- MagClass.magazzino.taAtt2UDC.upsertVal(riga.UDC, "DF", string.Format("{0:yyyy/MM/dd HH:mm}", dataFus), adesso, MagClass.magazzino.CodSoggCurrUser);
- // 2015.06.03 aggiunto attributo linea fusione!
- MagClass.magazzino.taAtt2UDC.upsertVal(riga.UDC, "LF", string.Format("{1} - {0:yy/MM/dd HH:mm}", dataFus, lineaFus), adesso, MagClass.magazzino.CodSoggCurrUser);
- }
+ qta = memLayer.ML.cdvi("QtaImballoRX");
}
- return okData && okLinea;
+ break;
+ default:
+ Postazione.warningText = traduci("ERR-UNK-001");
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ doUpdate();
+ }
+ ///
+ /// recupera da barcode dataOra e linea fusione (SE presenti)
+ ///
+ ///
+ ///
+ private bool getDateTimeLine(bool readline)
+ {
+ bool okData = false;
+ bool okLinea = false;
+ DateTime oldDataFus = new DateTime(1900, 1, 1);
+ // imposto NUOVA dataora fusione...
+ string newData = "";
+ string newLinea = "";
+ // tento di recuperare e verifico validità dei 2 valori separatamente...
+ try
+ {
+ newData = barcodeIn.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(0, 10);
+ if (newData != "")
{
- fixCella();
- grView.DataBind();
- // fix dataFus
- lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus);
- updatePart();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- verificaBtnStampa();
- txtBarcode.Focus();
+ dataFus = DateTime.ParseExact(newData, "yyMMddHHmm", CultureInfo.InvariantCulture);
+ okData = true;
}
+ }
+ catch
+ {
+ dataFus = oldDataFus;
+ }
+ if (readline)
+ {
+ if (okData)
+ {
+ try
+ {
+ newLinea = barcodeIn.Replace(memLayer.ML.AppConf["prefDateTime"], "").Substring(10, barcodeIn.Length - 10 - memLayer.ML.AppConf["prefDateTime"].Length);
+ if ((newLinea != "") && (DataProxy.obj.taElPost.getByCod(newLinea).Rows.Count > 0))
+ {
+ lineaFus = newLinea;
+ okLinea = true;
+ }
+ else
+ {
+ lineaFus = "";
+ dataFus = oldDataFus;
+ }
+ }
+ catch
+ {
+ lineaFus = "";
+ dataFus = oldDataFus;
+ }
+ }
+ else
+ {
+ lineaFus = "";
+ }
+ }
+ else
+ {
+ okLinea = true;
+ }
+ // registro se necessario attributi sui vari UDC che fossero caricati...
+ int numUdcCella = 0;
+ DS_magazzino.v_UdcDetailDataTable tabUdcIn = new DS_magazzino.v_UdcDetailDataTable();
+ try
+ {
+ tabUdcIn = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(Postazione.currIdxCella);
+ numUdcCella = tabUdcIn.Rows.Count;
+ }
+ catch
+ { }
+ if (numUdcCella > 0)
+ {
+ DateTime adesso = DateTime.Now;
+ foreach (DS_magazzino.v_UdcDetailRow riga in tabUdcIn)
+ {
+ // 2014.07.10 aggiungo attributo della data di fusione...
+ MagClass.magazzino.taAtt2UDC.upsertVal(riga.UDC, "DF", string.Format("{0:yyyy/MM/dd HH:mm}", dataFus), adesso, MagClass.magazzino.CodSoggCurrUser);
+ // 2015.06.03 aggiunto attributo linea fusione!
+ MagClass.magazzino.taAtt2UDC.upsertVal(riga.UDC, "LF", string.Format("{1} - {0:yy/MM/dd HH:mm}", dataFus, lineaFus), adesso, MagClass.magazzino.CodSoggCurrUser);
+ }
+ }
+ return okData && okLinea;
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ fixCella();
+ grView.DataBind();
+ // fix dataFus
+ lblDTFus.Text = string.Format("{0:ddd dd/MM/yyyy, HH:mm}", dataFus);
+ updatePart();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ verificaBtnStampa();
+ txtBarcode.Focus();
+ }
#if false
///
/// wrapper per log con salvataggio dell'IP del chiamante
@@ -445,323 +445,323 @@ namespace GMW.WebUserControls
return answ;
}
#endif
- ///
- /// effettua reset dati
- ///
- private void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- doChecks();
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// traduce gli header delle colonne
- ///
- ///
- ///
- 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} / 6", totRecord);
- }
- else
- {
- lblNumRec.Text = "";
- }
- }
- ///
- /// cambiato tipo di richiesta di input
- ///
- ///
- ///
- protected void rblInputMode_SelectedIndexChanged(object sender, EventArgs e)
- {
- fixTipoInput();
- }
- ///
- /// salvo il particolare selezionato...
- ///
- ///
- ///
- protected void lbtAddPart_Click(object sender, EventArgs e)
- {
- // imposto il particolare corrente
- currParticolare = ddlPart.SelectedValue;
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- if (pezziUdc > 0)
- {
- qta = pezziUdc;
- }
- else // rimette default
- {
- qta = memLayer.ML.cdvi("QtaImballoRX");
- }
- doUpdate();
- }
- ///
- /// creo il nuovo UDC da particolare corrente!
- ///
- ///
- ///
- protected void lbtAddUdc_Click(object sender, EventArgs e)
- {
- // controlli preliminari
- if (Postazione.currCodCella != "")
- {
- if (currParticolare != "")
- {
- if (qta > 0)
- {
- checkCreaUDC();
- }
- else
- {
- Postazione.warningText = traduci("ErroreNoQta");
- Postazione.CssClass = "stileComandoKo";
- }
- }
- else
- {
- Postazione.warningText = traduci("ErroreNoPart");
- Postazione.CssClass = "stileComandoKo";
- }
- }
- else
- {
- Postazione.warningText = traduci("ErroreNoSelLinea");
- Postazione.CssClass = "stileComandoKo";
- }
- doUpdate();
- }
- ///
- /// crea eventualmente UDC per particolare
- ///
- ///
- ///
- private void checkCreaUDC()
- {
- string newUdcChild = "";
- string noteTrim = "";
- DateTime adesso = DateTime.Now;
- // verifico se ho già quel particolare tra quelli inseriti in linea...
- try
- {
- newUdcChild = DataProxy.obj.taCartellini.getByParticolareIdxPosIdxCella(currParticolare, memLayer.ML.cdvi("IdxPosizioneRxTemp"), Postazione.currIdxCella)[0].UDC;
- }
- catch
- {
- newUdcChild = "";
- }
- if (newUdcChild == "")
- {
- // controllo NON ci siano troppi UDC in posizione... da capienza ed assegnati
- DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga;
- bool piena = false;
- try
- {
- riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0];
- if (riga.UdcAssegnati >= riga.Capienza) piena = true;
- }
- catch
- {
- }
- if (!piena)
- {
- try
- {
- // creo nuovo UDC RX
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoRX"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneRxTemp"), "IdxPosizioneRxTemp", codEventoUdc, noteTrim, "", adesso.Year, Request.UserHostName);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in creazione UDC temp RX: {0}{1}", Environment.NewLine, exc));
- }
- }
- else
- {
- Postazione.warningText = traduci("ErroreAL-Full");
- doUpdate();
- }
- }
- else
- {
- // aggiorno quantità!
- MagClass.magazzino.taCartellini.updateQty(newUdcChild, MagClass.magazzino.CodSoggCurrUser, "U", codEventoUdc, qta);
- }
- if (newUdcChild != "")
- {
- // lo posiziono nella cella corrente...
- MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), newUdcChild, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("partAdded");
-
- // 2014.07.10 aggiungo attributo della data di fusione...
- MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "DF", string.Format("{0:yyyy/MM/dd HH:mm}", dataFus), adesso, MagClass.magazzino.CodSoggCurrUser);
- // 2015.06.03 aggiunto attributo linea fusione!
- MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "LF", string.Format("{1} - {0:yy/MM/dd HH:mm}", dataFus, lineaFus), adesso, MagClass.magazzino.CodSoggCurrUser);
-
- currParticolare = "";
- doUpdate();
- }
- }
- ///
- /// evento selezione: ricarico dati!
- ///
- ///
- ///
- protected void grView_SelectedIndexChanged(object sender, EventArgs e)
- {
- // ricarico dati dell'UDC come particolare e quantità...
- string UDC = grView.SelectedDataKey["UDC"].ToString();
- if (MagClass.magazzino.checkUDC(UDC))
- {
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Particolare;
- qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Qta);
- }
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- doUpdate();
- }
- ///
- /// Numero cesta inserito
- ///
- public string numCesta
- {
- get
- {
- return txtCesta.Text.Trim();
- }
- set
- {
- txtCesta.Text = value;
- }
- }
- ///
- /// evento cambio num cesta/grappolo
- ///
- ///
- ///
- protected void txtCesta_TextChanged(object sender, EventArgs e)
- {
- txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
- doUpdate();
- }
- ///
- /// verifica visibilità btn stampa UDC
- ///
- private void verificaBtnStampa()
- {
- bool showBtnStampa = false;
- // se ho ALMENO 1 UDC
- DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga;
- bool hasUdc = false;
- try
- {
- riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0];
- if (riga.UdcAssegnati > 0) hasUdc = true;
- }
- catch
- {
- }
- if (hasUdc)
- {
- // se ho num cesta...
- if (numCesta != "")
- {
- showBtnStampa = true;
- }
- }
- divNote.Visible = showBtnStampa;
- }
- ///
- /// genera e stampa AL
- ///
- ///
- ///
- protected void lbtGeneraAl_Click(object sender, EventArgs e)
- {
- // verifico postazione sia valida...
- if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
- {
- /* generazione e stampa AL */
- string AL = "";
- string noteTrim = txtNote.Text.Trim();
- // creazione AL ed associazione UDC / spostamento...
- try
- {
- AL = MagClass.magazzino.creaAssociaAlRxNt(tipoAL.AL_RxNt, Postazione.currCodCella, MagClass.magazzino.CodSoggCurrUser, DateTime.Now.Year, numCesta, noteTrim);
- }
- catch
- { }
- // lancio stampa
- MagClass.magazzino.stampaAL(AL, Postazione.printer, Request.UserHostName);
- // registro creazione AL
- MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, AL, "", "creaAL", string.Format("Creato AL RX su linea {0}, note: {1} ", Postazione.currCodLinea, noteTrim));
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("cartAlStampato");
- txtCesta.Text = "";
- // resetto particolare...
- currParticolare = "";
- doUpdate();
- }
- else
- {
- // ricarico che mi manca postazione!
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = traduci("ERR-POS-001");
- Postazione.messaggiText = "";
- Response.Redirect(user_std.pagCorrente);
- }
- }
+ ///
+ /// effettua reset dati
+ ///
+ private void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ doChecks();
}
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// traduce gli header delle colonne
+ ///
+ ///
+ ///
+ 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} / 6", totRecord);
+ }
+ else
+ {
+ lblNumRec.Text = "";
+ }
+ }
+ ///
+ /// cambiato tipo di richiesta di input
+ ///
+ ///
+ ///
+ protected void rblInputMode_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ fixTipoInput();
+ }
+ ///
+ /// salvo il particolare selezionato...
+ ///
+ ///
+ ///
+ protected void lbtAddPart_Click(object sender, EventArgs e)
+ {
+ // imposto il particolare corrente
+ currParticolare = ddlPart.SelectedValue;
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ if (pezziUdc > 0)
+ {
+ qta = pezziUdc;
+ }
+ else // rimette default
+ {
+ qta = memLayer.ML.cdvi("QtaImballoRX");
+ }
+ doUpdate();
+ }
+ ///
+ /// creo il nuovo UDC da particolare corrente!
+ ///
+ ///
+ ///
+ protected void lbtAddUdc_Click(object sender, EventArgs e)
+ {
+ // controlli preliminari
+ if (Postazione.currCodCella != "")
+ {
+ if (currParticolare != "")
+ {
+ if (qta > 0)
+ {
+ checkCreaUDC();
+ }
+ else
+ {
+ Postazione.warningText = traduci("ErroreNoQta");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ }
+ else
+ {
+ Postazione.warningText = traduci("ErroreNoPart");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ }
+ else
+ {
+ Postazione.warningText = traduci("ErroreNoSelLinea");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ doUpdate();
+ }
+ ///
+ /// crea eventualmente UDC per particolare
+ ///
+ ///
+ ///
+ private void checkCreaUDC()
+ {
+ string newUdcChild = "";
+ string noteTrim = "";
+ DateTime adesso = DateTime.Now;
+ // verifico se ho già quel particolare tra quelli inseriti in linea...
+ try
+ {
+ newUdcChild = DataProxy.obj.taCartellini.getByParticolareIdxPosIdxCella(currParticolare, memLayer.ML.cdvi("IdxPosizioneRxTemp"), Postazione.currIdxCella)[0].UDC;
+ }
+ catch
+ {
+ newUdcChild = "";
+ }
+ if (newUdcChild == "")
+ {
+ // controllo NON ci siano troppi UDC in posizione... da capienza ed assegnati
+ DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga;
+ bool piena = false;
+ try
+ {
+ riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0];
+ if (riga.UdcAssegnati >= riga.Capienza) piena = true;
+ }
+ catch
+ {
+ }
+ if (!piena)
+ {
+ try
+ {
+ // creo nuovo UDC RX
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoRX"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneRxTemp"), "IdxPosizioneRxTemp", codEventoUdc, noteTrim, "", adesso.Year, Request.UserHostName);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in creazione UDC temp RX: {0}{1}", Environment.NewLine, exc));
+ }
+ }
+ else
+ {
+ Postazione.warningText = traduci("ErroreAL-Full");
+ doUpdate();
+ }
+ }
+ else
+ {
+ // aggiorno quantità!
+ MagClass.magazzino.taCartellini.updateQty(newUdcChild, MagClass.magazzino.CodSoggCurrUser, "U", codEventoUdc, qta);
+ }
+ if (newUdcChild != "")
+ {
+ // lo posiziono nella cella corrente...
+ MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), newUdcChild, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("partAdded");
+
+ // 2014.07.10 aggiungo attributo della data di fusione...
+ MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "DF", string.Format("{0:yyyy/MM/dd HH:mm}", dataFus), adesso, MagClass.magazzino.CodSoggCurrUser);
+ // 2015.06.03 aggiunto attributo linea fusione!
+ MagClass.magazzino.taAtt2UDC.upsertVal(newUdcChild, "LF", string.Format("{1} - {0:yy/MM/dd HH:mm}", dataFus, lineaFus), adesso, MagClass.magazzino.CodSoggCurrUser);
+
+ currParticolare = "";
+ doUpdate();
+ }
+ }
+ ///
+ /// evento selezione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // ricarico dati dell'UDC come particolare e quantità...
+ string UDC = grView.SelectedDataKey["UDC"].ToString();
+ if (MagClass.magazzino.checkUDC(UDC))
+ {
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Particolare;
+ qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(UDC)[0].Qta);
+ }
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ doUpdate();
+ }
+ ///
+ /// Numero cesta inserito
+ ///
+ public string numCesta
+ {
+ get
+ {
+ return txtCesta.Text.Trim();
+ }
+ set
+ {
+ txtCesta.Text = value;
+ }
+ }
+ ///
+ /// evento cambio num cesta/grappolo
+ ///
+ ///
+ ///
+ protected void txtCesta_TextChanged(object sender, EventArgs e)
+ {
+ txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
+ doUpdate();
+ }
+ ///
+ /// verifica visibilità btn stampa UDC
+ ///
+ private void verificaBtnStampa()
+ {
+ bool showBtnStampa = false;
+ // se ho ALMENO 1 UDC
+ DS_magazzino.V_statoCelleCapienzaAssegnatiRow riga;
+ bool hasUdc = false;
+ try
+ {
+ riga = MagClass.magazzino.taStatoCelle.getByIdxCella(Postazione.currIdxCella)[0];
+ if (riga.UdcAssegnati > 0) hasUdc = true;
+ }
+ catch
+ {
+ }
+ if (hasUdc)
+ {
+ // se ho num cesta...
+ if (numCesta != "")
+ {
+ showBtnStampa = true;
+ }
+ }
+ divNote.Visible = showBtnStampa;
+ }
+ ///
+ /// genera e stampa AL
+ ///
+ ///
+ ///
+ protected void lbtGeneraAl_Click(object sender, EventArgs e)
+ {
+ // verifico postazione sia valida...
+ if (Postazione.name != "" && Postazione.IP != "" && Postazione.currCodCella != "")
+ {
+ /* generazione e stampa AL */
+ string AL = "";
+ string noteTrim = txtNote.Text.Trim();
+ // creazione AL ed associazione UDC / spostamento...
+ try
+ {
+ AL = MagClass.magazzino.creaAssociaAlRxNt(tipoAL.AL_RxNt, Postazione.currCodCella, MagClass.magazzino.CodSoggCurrUser, DateTime.Now.Year, numCesta, noteTrim);
+ }
+ catch
+ { }
+ // lancio stampa
+ MagClass.magazzino.stampaAL(AL, Postazione.printer, Request.UserHostName);
+ // registro creazione AL
+ MagClass.magazzino.taSAO.insertQuery(DateTime.Now, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, AL, "", "creaAL", string.Format("Creato AL RX su linea {0}, note: {1} ", Postazione.currCodLinea, noteTrim));
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("cartAlStampato");
+ txtCesta.Text = "";
+ // resetto particolare...
+ currParticolare = "";
+ doUpdate();
+ }
+ else
+ {
+ // ricarico che mi manca postazione!
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = traduci("ERR-POS-001");
+ Postazione.messaggiText = "";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs b/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs
index e6016cc3..723f0977 100644
--- a/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs
+++ b/GMW/WebUserControls/mod_SterrTagOUT.ascx.cs
@@ -6,926 +6,926 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_SterrTagOUT : System.Web.UI.UserControl
+ public partial class mod_SterrTagOUT : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a FUSI
+ ///
+ protected string flusso = "ST";
+ ///
+ /// stato associato (hard coded) a FUSI
+ ///
+ protected string statoUDC = "Sterr";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_STTA";
+ ///
+ /// stringa degli UDC selezionati per consumo COMPLETO (nel formato #UDC1##UDC2#)
+ ///
+ protected string udcSelC
{
- ///
- /// flusso associato (hard coded) a FUSI
- ///
- protected string flusso = "ST";
- ///
- /// stato associato (hard coded) a FUSI
- ///
- protected string statoUDC = "Sterr";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_STTA";
- ///
- /// stringa degli UDC selezionati per consumo COMPLETO (nel formato #UDC1##UDC2#)
- ///
- protected string udcSelC
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UdcSelC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UdcSelC_{0}", uid), value);
+ }
+ }
+ ///
+ /// stringa degli UDC selezionati per consumo PARZIALE (nel formato #UDC1##UDC2#)
+ ///
+ 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;
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
+ {
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ fixRicercaUdc();
+ traduciObj();
+ idxCella = Postazione.currIdxCella;
+ }
+ doChecks();
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaST_OUT"))
{
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UdcSelC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UdcSelC_{0}", uid), value);
- }
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaST_OUT");
}
- ///
- /// stringa degli UDC selezionati per consumo PARZIALE (nel formato #UDC1##UDC2#)
- ///
- protected string udcSelP
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaST_OUT", value);
+ }
+ }
+ ///
+ /// verifica se si debba mostrare un campo ricerca attivo...
+ ///
+ private void fixRicercaUdc()
+ {
+ if (memLayer.ML.isInSessionObject("valoreCercatoSTO"))
+ {
+ testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoSTO");
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura OUT {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura OUT");
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UdcSelP_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UdcSelP_{0}", uid), value);
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- public event EventHandler eh_nuovaRicerca;
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ // labels
+ btnCerca.Text = traduci("btnSearch");
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
{
- if (!Page.IsPostBack)
- {
- fixRicercaUdc();
- traduciObj();
- idxCella = Postazione.currIdxCella;
- }
- doChecks();
+ answ = tipoCodiceBarcode.Comando;
}
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
{
- 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);
- }
+ answ = tipoCodiceBarcode.Particolare;
}
- ///
- /// verifica se si debba mostrare un campo ricerca attivo...
- ///
- private void fixRicercaUdc()
+ else
{
- if (memLayer.ML.isInSessionObject("valoreCercatoSTO"))
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
{
- testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoSTO");
+ answ = tipoCodiceBarcode.UDC;
}
+ }
+ catch
+ {
+ }
}
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
{
- bool fatto = false;
- // 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;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura OUT {0}", udcReq), tipoLog.EXCEPTION);
- }
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura OUT");
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
+ qta = Convert.ToInt32(txtQta.Text.Trim());
}
- ///
- /// udc da stampare
- ///
- protected string udcReq
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
{
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- // labels
- btnCerca.Text = traduci("btnSearch");
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["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;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // 2014.02.13: tolto perché NON si vuole particolare OUT diverso da IN
+ case tipoCodiceBarcode.Particolare:
+ // 2014.02.13: tolto perché NON si vuole particolare OUT diverso da IN
#if false
// imposto il particolare corrente
currParticolare = barcodeIn;
impostaParticolare();
#endif
- 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:
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- else
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
{
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- }
- //grView.DataBind();
- txtBarcode.Focus();
- }
- ///
- /// imposto i dati dal particolare corrente
- ///
- private void impostaParticolare()
- {
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += " - impostato particolare!";
- Postazione.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.cdv("QtaImballoSterr");
- }
- }
- ///
- /// update del filtro su particolare x grview UDC caricati in linea
- ///
- ///
- 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();
- }
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- checkStampa();
- grView.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - udc da consumo totale/parziale
- /// altrimenti disabilito btn stampa
- ///
- 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;
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- string[] stringSeparators = new string[] { "#" };
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // controllo UDC in ingresso, che siano tutti con uguale particolare e DIVERSO da ""
- string partUdcIn = "";
- try
- {
- string fullUdc = string.Format("{0}#{1}", udcSelC, udcSelP);
- // ciclo tutti gli UDC consumati P e C e verifico loro particolare
- if (fullUdc.Replace("#", "").Length > 1)
- {
- string[] elencoUDC;
- elencoUDC = fullUdc.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
- partUdcIn = checkPartUDC(elencoUDC);
- }
- }
- catch
- { }
- if (partUdcIn != "")
- {
- // controllo da distinta base coerenza particolare IN/OUT
- bool partDistintaOk = false;
- try
- {
- if (MagClass.magazzino.taPartIO.GetData(currParticolare, partUdcIn, true)[0].Trovati > 0) partDistintaOk = true;
- }
- catch
- { }
- if (partDistintaOk)
- {
- string newUdcChild = "";
- int qta = memLayer.ML.cdvi("QtaImballoSterr");
- string noteTrim = txtNote.Text.Trim();
- noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
- 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;
- try
- {
- // creo nuovo UDC sterrato OUT multiple
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("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");
- }
- }
- else
- {
- httpLog(string.Format("STERRATI OUT, Errore controllo coerenza particolari da distinta base!"), tipoLog.ERROR);
- Postazione.messaggiText += "Errore particolari UDC da controllo distinta base";
- Postazione.CssClass = "stileComandoND";
- }
- }
- else
- {
- httpLog(string.Format("STERRATI OUT, Errore controllo coerenza elenco aprticolari IN!"), tipoLog.ERROR);
- Postazione.messaggiText += "Errore particolari UDC da consumare non coerenti";
- Postazione.CssClass = "stileComandoND";
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// effettua il consumo di tutti gli UDC inviati come array di stringhe
- ///
- ///
- 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...
- }
- }
- }
- }
- }
- ///
- ///associa nuovo UDC ad elenco UDC
- ///
- /// UDC da associare come child
- /// vettore di UDC da associare come parent
- 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);
- }
- }
- }
- }
- ///
- /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
- ///
- /// vettore di UDC da verificare
- private string checkPartUDC(string[] UDC_P)
- {
- string answ = "";
- if (UDC_P.Length > 0)
- {
- // imposto il primo particolare...
- answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
- // ciclo
- foreach (string udc_p in UDC_P)
- {
- if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
- }
- }
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- testoRicerca = "";
- salvaCerca();
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- }
- ///
- /// passo alla modalità IN
- ///
- ///
- ///
- protected void btnIn_Click(object sender, EventArgs e)
- {
- Response.Redirect("SterrTaglioIN.aspx");
- }
-
- ///
- /// effettua refresh (su db) del blocco postazione
- ///
- ///
- 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);
- }
- }
- ///
- /// cambiato valore in ricerca
- ///
- ///
- ///
- protected void txtCerca_TextChanged(object sender, EventArgs e)
- {
- // se è nuovo il testo resetto
- if (testoRicerca != SteamWare.memLayer.ML.StringSessionObj("valoreCercatoSTO"))
- {
- udcSelC = "";
- udcSelP = "";
- }
- salvaCerca();
- }
- ///
- /// effettuato reset
- ///
- ///
- ///
- protected void lnkReset_Click(object sender, EventArgs e)
- {
- testoRicerca = "";
- salvaCerca();
- }
- ///
- /// pressione del button di ricerca
- ///
- ///
- ///
- protected void btnCerca_Click(object sender, EventArgs e)
- {
- salvaCerca();
- }
-
- ///
- /// testo ricerca trimmato da spazi
- ///
- protected string testoRicerca
- {
- get
- {
- return txtCerca.Text.Trim();
- }
- set
- {
- txtCerca.Text = value;
- }
- }
- ///
- /// salvo ricerca particolare
- ///
- 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();
- }
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
- ///
- /// traduce gli header delle colonne
- ///
- ///
- ///
- 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)
- {
-
- }
-
- ///
- /// selezione UDC da elenco
- ///
- ///
- ///
- protected void rbl_SelectedIndexChanged(object sender, EventArgs e)
- {
- RadioButtonList rbl = (RadioButtonList)sender;
- if (rbl.SelectedValue == "C")
- {
- udcSelC = string.Format("{0}#{1}#", udcSelC, rbl.ToolTip);
+ // 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}#", rbl.ToolTip), "");
+ udcSelP = udcSelP.Replace(string.Format("#{0}#", barcodeIn), "");
+ }
+ updFiltroPart(newPart);
+ // imposto particolare!
+ currParticolare = newPart;
+ impostaParticolare();
+ }
+
+ break;
+ default:
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ //grView.DataBind();
+ txtBarcode.Focus();
+ }
+ ///
+ /// imposto i dati dal particolare corrente
+ ///
+ private void impostaParticolare()
+ {
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
+ {
+ currParticolare = "";
+ Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ Postazione.messaggiText += " - impostato particolare!";
+ Postazione.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.cdv("QtaImballoSterr");
+ }
+ }
+ ///
+ /// update del filtro su particolare x grview UDC caricati in linea
+ ///
+ ///
+ 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();
+ }
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ checkStampa();
+ grView.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - udc da consumo totale/parziale
+ /// altrimenti disabilito btn stampa
+ ///
+ 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;
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ string[] stringSeparators = new string[] { "#" };
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // controllo UDC in ingresso, che siano tutti con uguale particolare e DIVERSO da ""
+ string partUdcIn = "";
+ try
+ {
+ string fullUdc = string.Format("{0}#{1}", udcSelC, udcSelP);
+ // ciclo tutti gli UDC consumati P e C e verifico loro particolare
+ if (fullUdc.Replace("#", "").Length > 1)
+ {
+ string[] elencoUDC;
+ elencoUDC = fullUdc.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
+ partUdcIn = checkPartUDC(elencoUDC);
+ }
+ }
+ catch
+ { }
+ if (partUdcIn != "")
+ {
+ // controllo da distinta base coerenza particolare IN/OUT
+ bool partDistintaOk = false;
+ try
+ {
+ if (MagClass.magazzino.taPartIO.GetData(currParticolare, partUdcIn, true)[0].Trovati > 0) partDistintaOk = true;
+ }
+ catch
+ { }
+ if (partDistintaOk)
+ {
+ string newUdcChild = "";
+ int qta = memLayer.ML.cdvi("QtaImballoSterr");
+ string noteTrim = txtNote.Text.Trim();
+ noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
+ 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;
+ try
+ {
+ // creo nuovo UDC sterrato OUT multiple
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("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
{
- 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;
- updFiltroPart(newPart);
- // imposto particolare!
- currParticolare = newPart;
- checkParticolare();
- impostaParticolare();
- checkStampa();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
+ httpLog(string.Format("STERRATI OUT, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
}
+ }
+ else
+ {
+ httpLog(string.Format("STERRATI OUT, Errore controllo coerenza particolari da distinta base!"), tipoLog.ERROR);
+ Postazione.messaggiText += "Errore particolari UDC da controllo distinta base";
+ Postazione.CssClass = "stileComandoND";
+ }
}
+ else
+ {
+ httpLog(string.Format("STERRATI OUT, Errore controllo coerenza elenco aprticolari IN!"), tipoLog.ERROR);
+ Postazione.messaggiText += "Errore particolari UDC da consumare non coerenti";
+ Postazione.CssClass = "stileComandoND";
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// effettua il consumo di tutti gli UDC inviati come array di stringhe
+ ///
+ ///
+ 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...
+ }
+ }
+ }
+ }
+ }
+ ///
+ ///associa nuovo UDC ad elenco UDC
+ ///
+ /// UDC da associare come child
+ /// vettore di UDC da associare come parent
+ 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);
+ }
+ }
+ }
+ }
+ ///
+ /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
+ ///
+ /// vettore di UDC da verificare
+ private string checkPartUDC(string[] UDC_P)
+ {
+ string answ = "";
+ if (UDC_P.Length > 0)
+ {
+ // imposto il primo particolare...
+ answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
+ // ciclo
+ foreach (string udc_p in UDC_P)
+ {
+ if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
+ }
+ }
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ testoRicerca = "";
+ salvaCerca();
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ }
+ ///
+ /// passo alla modalità IN
+ ///
+ ///
+ ///
+ protected void btnIn_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("SterrTaglioIN.aspx");
+ }
+
+ ///
+ /// effettua refresh (su db) del blocco postazione
+ ///
+ ///
+ 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);
+ }
+ }
+ ///
+ /// cambiato valore in ricerca
+ ///
+ ///
+ ///
+ protected void txtCerca_TextChanged(object sender, EventArgs e)
+ {
+ // se è nuovo il testo resetto
+ if (testoRicerca != SteamWare.memLayer.ML.StringSessionObj("valoreCercatoSTO"))
+ {
+ udcSelC = "";
+ udcSelP = "";
+ }
+ salvaCerca();
+ }
+ ///
+ /// effettuato reset
+ ///
+ ///
+ ///
+ protected void lnkReset_Click(object sender, EventArgs e)
+ {
+ testoRicerca = "";
+ salvaCerca();
+ }
+ ///
+ /// pressione del button di ricerca
+ ///
+ ///
+ ///
+ protected void btnCerca_Click(object sender, EventArgs e)
+ {
+ salvaCerca();
+ }
+
+ ///
+ /// testo ricerca trimmato da spazi
+ ///
+ protected string testoRicerca
+ {
+ get
+ {
+ return txtCerca.Text.Trim();
+ }
+ set
+ {
+ txtCerca.Text = value;
+ }
+ }
+ ///
+ /// salvo ricerca particolare
+ ///
+ 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();
+ }
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+ ///
+ /// traduce gli header delle colonne
+ ///
+ ///
+ ///
+ 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)
+ {
}
+
+ ///
+ /// selezione UDC da elenco
+ ///
+ ///
+ ///
+ 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;
+ updFiltroPart(newPart);
+ // imposto particolare!
+ currParticolare = newPart;
+ checkParticolare();
+ impostaParticolare();
+ checkStampa();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_anime.ascx.cs b/GMW/WebUserControls/mod_anime.ascx.cs
index a9e99f11..452a6f79 100644
--- a/GMW/WebUserControls/mod_anime.ascx.cs
+++ b/GMW/WebUserControls/mod_anime.ascx.cs
@@ -204,7 +204,7 @@ namespace GMW.WebUserControls
int answ = 0;
try
{
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
catch
{
diff --git a/GMW/WebUserControls/mod_animeMult.ascx.cs b/GMW/WebUserControls/mod_animeMult.ascx.cs
index 356d301c..79126f4b 100644
--- a/GMW/WebUserControls/mod_animeMult.ascx.cs
+++ b/GMW/WebUserControls/mod_animeMult.ascx.cs
@@ -5,690 +5,690 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_animeMult : System.Web.UI.UserControl
+ public partial class mod_animeMult : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a Anime EXT
+ ///
+ protected string flusso = "AN";
+ ///
+ /// stato associato (hard coded) a Anime EXT
+ ///
+ protected string statoUDC = "AnimExt";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a Anime EXT
- ///
- protected string flusso = "AN";
- ///
- /// stato associato (hard coded) a Anime EXT
- ///
- protected string statoUDC = "AnimExt";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
- {
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
- }
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- traduciObj();
- checkNumKeyIn();
- }
- doChecks();
- }
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- bool fatto = false;
- // 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;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC AnimeExt {0}", udcReq), tipoLog.EXCEPTION);
- }
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Anime Mult");
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoAnime");
- txtQtaUDC.Text = "0";
- txtNumUDC.Text = "0";
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
-
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare) && TermClass.Ter.isAnima(barcodeIn)) // è un particolare... ed un anima...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qtaUDC
- {
- get
- {
- int qtaUDC = 0;
- try
- {
- qtaUDC = Convert.ToInt32(txtQtaUDC.Text.Trim());
- }
- catch
- { }
- return qtaUDC;
- }
- set
- {
- txtQtaUDC.Text = value.ToString();
- }
- }
- ///
- /// num UDC
- ///
- public int numUDC
- {
- get
- {
- int numUDC = 0;
- try
- {
- numUDC = Convert.ToInt32(txtNumUDC.Text.Trim());
- }
- catch
- { }
- return numUDC;
- }
- set
- {
- txtNumUDC.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-ANM-001");
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.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.cdv("QtaImballoAnime");
- }
- break;
- case tipoCodiceBarcode.UDC:
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // recupero il particolare dai dati del cartellino preesistente
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
- // controllo esista!!!
- bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
- // controllo sia anima!!!
- bool isAnima = TermClass.Ter.isAnima(currParticolare);
- // controllo esista il particolare e sia anima
- if (partExists && isAnima)
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-ANM-001");
- Postazione.CssClass = "stileComandoKo";
- }
- }
-
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- currParticolare = "";
- qta = 0;
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- doUpdate();
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- updatePart();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- checkStampa();
- txtBarcode.Focus();
- }
- ///
- /// aggiorna visualizzazioen dati particolare
- ///
- private void updatePart()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), 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 = "";
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - almeno 1 trattamento
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- //controllo siano inseriti valori qta
- if (qta > 0 && qtaUDC > 0 && numUDC > 0)
- {
- // controllo ci siano particolare e qta tornino (numUdc x qtaUdc = qtaTOT)
- if (currParticolare != "" && ((numUDC * qtaUDC) == qta))
- {
- stampaOk = true;
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void lbtStampaUDC_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- string newUdcChild = "";
- int qta = memLayer.ML.cdvi("QtaImballoAnime");
- string noteTrim = txtNote.Text.Trim();
- try
- {
- qta = Convert.ToInt32(txtQtaUDC.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 != "")
- {
- for (int i = 0; i < numUDC; i++)
- {
- // genero cartellino anima
- DateTime adesso = DateTime.Now;
- try
- {
- // creo nuovo UDC anime multiple
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoAnime"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneAnimeExt"), "IdxPosizioneAnimeExt", "UDC_ANIMA", noteTrim, "", adesso.Year, Request.UserHostName);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Anime EX, qta: {0} {1}", qta, noteTrim));
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC anime mult: {0}", exc), tipoLog.EXCEPTION);
- }
- // se ho cart liquidi genero (se non ci sono) cart trattamenti
- if (newUdcChild != "")
- {
- /***************************************************************************************
- * dopo che l'ho creato lo sposto da post anime ext a post anime int (NO UPDATE AS400...)
- * IdxPosizioneAnimeExt --> IdxPosizioneAnime
- * !!! DEVO CALCOLARE LA CELLA !!! parto dal blocco calcolato da tab transizioni
- ***************************************************************************************/
- int idxBloccoTo = StateMachine.SM.getIdxBloccoTo("UDC_ANIMA", memLayer.ML.cdvi("IdxPosizioneAnimeExt"));
- int idxCellaTo = 0;
- try
- {
- idxCellaTo = MagClass.magazzino.taCelle.getByIdxBlocco(idxBloccoTo)[0].IdxCella;
- }
- catch
- { }
- if (idxCellaTo != 0)
- {
- MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), newUdcChild, idxCellaTo, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
- // incremento timing...
- adesso = DateTime.Now;
- adesso = adesso.AddSeconds(1);
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "spostaUDC", "Sposta UDC Anime EXT in Int");
-
- }
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartAnime, 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 Anime EXT");
- }
- }
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("ANIME MULTIPLE, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
-
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- private void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
-
-
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
}
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ traduciObj();
+ checkNumKeyIn();
+ }
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC AnimeExt {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Anime Mult");
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoAnime");
+ txtQtaUDC.Text = "0";
+ txtNumUDC.Text = "0";
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare) && TermClass.Ter.isAnima(barcodeIn)) // è un particolare... ed un anima...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qtaUDC
+ {
+ get
+ {
+ int qtaUDC = 0;
+ try
+ {
+ qtaUDC = Convert.ToInt32(txtQtaUDC.Text.Trim());
+ }
+ catch
+ { }
+ return qtaUDC;
+ }
+ set
+ {
+ txtQtaUDC.Text = value.ToString();
+ }
+ }
+ ///
+ /// num UDC
+ ///
+ public int numUDC
+ {
+ get
+ {
+ int numUDC = 0;
+ try
+ {
+ numUDC = Convert.ToInt32(txtNumUDC.Text.Trim());
+ }
+ catch
+ { }
+ return numUDC;
+ }
+ set
+ {
+ txtNumUDC.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
+ {
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-ANM-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.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.cdv("QtaImballoAnime");
+ }
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // recupero il particolare dai dati del cartellino preesistente
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ // controllo esista!!!
+ bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
+ // controllo sia anima!!!
+ bool isAnima = TermClass.Ter.isAnima(currParticolare);
+ // controllo esista il particolare e sia anima
+ if (partExists && isAnima)
+ {
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.CssClass = "stileComandoOk";
+ }
+ else
+ {
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-ANM-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ }
+
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ currParticolare = "";
+ qta = 0;
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
+ doUpdate();
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ updatePart();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ checkStampa();
+ txtBarcode.Focus();
+ }
+ ///
+ /// aggiorna visualizzazioen dati particolare
+ ///
+ private void updatePart()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), 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 = "";
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - almeno 1 trattamento
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ //controllo siano inseriti valori qta
+ if (qta > 0 && qtaUDC > 0 && numUDC > 0)
+ {
+ // controllo ci siano particolare e qta tornino (numUdc x qtaUdc = qtaTOT)
+ if (currParticolare != "" && ((numUDC * qtaUDC) == qta))
+ {
+ stampaOk = true;
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void lbtStampaUDC_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ string newUdcChild = "";
+ int qta = memLayer.ML.cdvi("QtaImballoAnime");
+ string noteTrim = txtNote.Text.Trim();
+ try
+ {
+ qta = Convert.ToInt32(txtQtaUDC.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 != "")
+ {
+ for (int i = 0; i < numUDC; i++)
+ {
+ // genero cartellino anima
+ DateTime adesso = DateTime.Now;
+ try
+ {
+ // creo nuovo UDC anime multiple
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoAnime"), "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneAnimeExt"), "IdxPosizioneAnimeExt", "UDC_ANIMA", noteTrim, "", adesso.Year, Request.UserHostName);
+
+ if (OpAuth.isAuth)
+ {
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
+ }
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Anime EX, qta: {0} {1}", qta, noteTrim));
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC anime mult: {0}", exc), tipoLog.EXCEPTION);
+ }
+ // se ho cart liquidi genero (se non ci sono) cart trattamenti
+ if (newUdcChild != "")
+ {
+ /***************************************************************************************
+ * dopo che l'ho creato lo sposto da post anime ext a post anime int (NO UPDATE AS400...)
+ * IdxPosizioneAnimeExt --> IdxPosizioneAnime
+ * !!! DEVO CALCOLARE LA CELLA !!! parto dal blocco calcolato da tab transizioni
+ ***************************************************************************************/
+ int idxBloccoTo = StateMachine.SM.getIdxBloccoTo("UDC_ANIMA", memLayer.ML.cdvi("IdxPosizioneAnimeExt"));
+ int idxCellaTo = 0;
+ try
+ {
+ idxCellaTo = MagClass.magazzino.taCelle.getByIdxBlocco(idxBloccoTo)[0].IdxCella;
+ }
+ catch
+ { }
+ if (idxCellaTo != 0)
+ {
+ MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), newUdcChild, idxCellaTo, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
+ // incremento timing...
+ adesso = DateTime.Now;
+ adesso = adesso.AddSeconds(1);
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "spostaUDC", "Sposta UDC Anime EXT in Int");
+
+ }
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartAnime, 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 Anime EXT");
+ }
+ }
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("ANIME MULTIPLE, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ private void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+
+
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_finitiFc.ascx.cs b/GMW/WebUserControls/mod_finitiFc.ascx.cs
index 6ddf1d82..cff7a16b 100644
--- a/GMW/WebUserControls/mod_finitiFc.ascx.cs
+++ b/GMW/WebUserControls/mod_finitiFc.ascx.cs
@@ -5,502 +5,502 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_finitiFc : System.Web.UI.UserControl
+ public partial class mod_finitiFc : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a FINITI
+ ///
+ protected string flusso = "FI";
+ ///
+ /// stato associato (hard coded) a FINITI
+ ///
+ protected string statoUDC = "Fin";
+ ///
+ /// attributo per Fuoriciclo
+ ///
+ protected string attrFC = "FC";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a FINITI
- ///
- protected string flusso = "FI";
- ///
- /// stato associato (hard coded) a FINITI
- ///
- protected string statoUDC = "Fin";
- ///
- /// attributo per Fuoriciclo
- ///
- protected string attrFC = "FC";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ traduciObj();
+ checkNumKeyIn();
+ }
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lo metto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finiti {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finiti Mult");
+ doUpdate();
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ lblPart.Text = currParticolare;
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ qtaUDC = memLayer.ML.cdvi("QtaImballoFiniti");
+ numUDC = 1;
+ refreshQta();
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- if (!Page.IsPostBack)
- {
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- traduciObj();
- checkNumKeyIn();
- }
- doChecks();
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lo metto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// cod imballo dell'ultimo UDC del particolare generato
+ ///
+ public string lastCodImb
+ {
+ get
+ {
+ string answ = "";
+ try
{
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].CodImballo;
}
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
{
- bool fatto = false;
- // registro ri-stampa UDC
- DateTime adesso = DateTime.Now;
- // calcolo particolare...
- DS_magazzino.ElencoCartelliniRow rigaUDC;
- string particolare = "";
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ // controllo se sia un finito Tipo P
+ else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qtaUDC
+ {
+ get
+ {
+ int _qtaUDC = 0;
+ try
+ {
+ _qtaUDC = Convert.ToInt32(txtQtaUDC.Text.Trim());
+ }
+ catch
+ { }
+ return _qtaUDC;
+ }
+ set
+ {
+ txtQtaUDC.Text = value.ToString();
+ refreshQta();
+ }
+ }
+ ///
+ /// num UDC
+ ///
+ public int numUDC
+ {
+ get
+ {
+ int numUDC = 0;
+ try
+ {
+ numUDC = Convert.ToInt32(txtNumUDC.Text.Trim());
+ }
+ catch
+ { }
+ return numUDC;
+ }
+ set
+ {
+ txtNumUDC.Text = value.ToString();
+ refreshQta();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Comando:
+ if (barcodeIn == memLayer.ML.cdv("cmdReset"))
+ {
+ currParticolare = "";
+ Response.Redirect(PagCorrente);
+ }
+ break;
+ case tipoCodiceBarcode.Imballo:
+ // cerco di selezionare!
try
{
- rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
- particolare = rigaUDC.Particolare;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ ddlImballi.SelectedValue = barcodeIn;
}
catch
{
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finiti {0}", udcReq), tipoLog.EXCEPTION);
+ Postazione.warningText = traduci("ERR-IMB-001");
+ Postazione.CssClass = "stileComandoKo";
}
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finiti Mult");
- doUpdate();
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
+ break;
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
{
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
- lblPart.Text = 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;
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-FIN-001");
+ Postazione.CssClass = "stileComandoKo";
}
else
{
- lblParticolareAttivo.Text = "...";
- lblDescrAttivo.Text = "";
- lblDisegno.Text = "";
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.CssClass = "stileComandoOk";
}
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ if (pezziUdc > 0)
+ {
+ qtaUDC = pezziUdc;
+ }
+ else // rimette default
+ {
+ qtaUDC = memLayer.ML.cdvi("QtaImballoFiniti");
+ }
+ if (lastCodImb != "")
+ {
+ selezionaImballo();
+ }
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // recupero il particolare dai dati del cartellino preesistente
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ // controllo esista!!!
+ bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
+ // controllo sia anima!!!
+ bool isPart = TermClass.Ter.isParticolare(currParticolare);
+ // controllo esista il particolare e sia anima
+ if (partExists && isPart)
+ {
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.CssClass = "stileComandoOk";
+ }
+ else
+ {
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-FIN-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ }
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ currParticolare = "";
+ qta = 0;
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- qtaUDC = memLayer.ML.cdvi("QtaImballoFiniti");
- numUDC = 1;
- refreshQta();
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
-
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// cod imballo dell'ultimo UDC del particolare generato
- ///
- public string lastCodImb
- {
- get
- {
- string answ = "";
- try
- {
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].CodImballo;
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- // controllo se sia un finito Tipo P
- else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qtaUDC
- {
- get
- {
- int _qtaUDC = 0;
- try
- {
- _qtaUDC = Convert.ToInt32(txtQtaUDC.Text.Trim());
- }
- catch
- { }
- return _qtaUDC;
- }
- set
- {
- txtQtaUDC.Text = value.ToString();
- refreshQta();
- }
- }
- ///
- /// num UDC
- ///
- public int numUDC
- {
- get
- {
- int numUDC = 0;
- try
- {
- numUDC = Convert.ToInt32(txtNumUDC.Text.Trim());
- }
- catch
- { }
- return numUDC;
- }
- set
- {
- txtNumUDC.Text = value.ToString();
- refreshQta();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Comando:
- if (barcodeIn == memLayer.ML.cdv("cmdReset"))
- {
- currParticolare = "";
- Response.Redirect(PagCorrente);
- }
- break;
- case tipoCodiceBarcode.Imballo:
- // cerco di selezionare!
- try
- {
- ddlImballi.SelectedValue = barcodeIn;
- }
- catch
- {
- Postazione.warningText = traduci("ERR-IMB-001");
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-FIN-001");
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.CssClass = "stileComandoOk";
- }
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- if (pezziUdc > 0)
- {
- qtaUDC = pezziUdc;
- }
- else // rimette default
- {
- qtaUDC = memLayer.ML.cdvi("QtaImballoFiniti");
- }
- if (lastCodImb != "")
- {
- selezionaImballo();
- }
- break;
- case tipoCodiceBarcode.UDC:
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // recupero il particolare dai dati del cartellino preesistente
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
- // controllo esista!!!
- bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
- // controllo sia anima!!!
- bool isPart = TermClass.Ter.isParticolare(currParticolare);
- // controllo esista il particolare e sia anima
- if (partExists && isPart)
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-FIN-001");
- Postazione.CssClass = "stileComandoKo";
- }
- }
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- currParticolare = "";
- qta = 0;
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
+ barcodeIn = "";
+ }
#if false
else
{
@@ -508,298 +508,298 @@ namespace GMW.WebUserControls
Postazione.CssClass = "stileAttesa";
}
#endif
- doUpdate();
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
+ doUpdate();
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ updatePart();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ checkStampa();
+ txtBarcode.Focus();
+ }
+ ///
+ /// aggiorna visualizzazioen dati particolare
+ ///
+ private void updatePart()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- updatePart();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- checkStampa();
- txtBarcode.Focus();
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// aggiorna visualizzazioen dati particolare
- ///
- private void updatePart()
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qtaUDC > 0
+ /// - almeno 1 UDC
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ //controllo siano inseriti valori qta
+ if (qtaUDC > 0 && numUDC > 0)
+ {
+ // controllo ci siano particolare e qta tornino (numUdc x qtaUdc = qtaTOT)
+ if (currParticolare != "")
{
- if (currParticolare != "")
+ stampaOk = true;
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void lbtStampaUDC_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ string newUdcChild = "";
+ string noteTrim = string.Format("{0}{1}{2}", traduci("fuoriciclo"), Environment.NewLine, txtNote.Text.Trim());
+ // 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 != "")
+ {
+ for (int i = 0; i < numUDC; i++)
{
- lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), currParticolare);
- // aggiungo descrizione del particolare
- string descr = "";
- string disegno = "";
+ // genero cartellino liquidi
+ DateTime adesso = DateTime.Now;
+ try
+ {
+ string codImballo = "";
try
{
- DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
- descr = riga.DescParticolare;
- disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
+ codImballo = ddlImballi.SelectedValue;
}
catch
- { }
- lblDescrAttivo.Text = descr;
- lblDisegno.Text = disegno;
- }
- else
- {
- lblParticolareAttivo.Text = "...";
- lblDescrAttivo.Text = "";
- lblDisegno.Text = "";
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qtaUDC > 0
- /// - almeno 1 UDC
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- //controllo siano inseriti valori qta
- if (qtaUDC > 0 && numUDC > 0)
- {
- // controllo ci siano particolare e qta tornino (numUdc x qtaUdc = qtaTOT)
- if (currParticolare != "")
{
- stampaOk = true;
+ codImballo = memLayer.ML.cdv("CodImballoFiniti");
}
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void lbtStampaUDC_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ // se NON HA selezionato prendo default...
+ if (codImballo == "" || codImballo == "-")
{
- string newUdcChild = "";
- string noteTrim = string.Format("{0}{1}{2}", traduci("fuoriciclo"), Environment.NewLine, txtNote.Text.Trim());
- // 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 != "")
- {
- for (int i = 0; i < numUDC; i++)
- {
- // genero cartellino liquidi
- DateTime adesso = DateTime.Now;
- try
- {
- string codImballo = "";
- try
- {
- codImballo = ddlImballi.SelectedValue;
- }
- catch
- {
- codImballo = memLayer.ML.cdv("CodImballoFiniti");
- }
- // se NON HA selezionato prendo default...
- if (codImballo == "" || codImballo == "-")
- {
- codImballo = memLayer.ML.cdv("CodImballoFiniti");
- }
- // creo nuovo UDC del trattamento liquidi
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, codImballo, "U", codSogg, qtaUDC, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFiniti"), "IdxPosizioneFiniti", "UDC_FINITO", noteTrim, "", adesso.Year, Request.UserHostName);
+ codImballo = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ // creo nuovo UDC del trattamento liquidi
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, codImballo, "U", codSogg, qtaUDC, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFiniti"), "IdxPosizioneFiniti", "UDC_FINITO", noteTrim, "", adesso.Year, Request.UserHostName);
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Finiti, qta: {0} {1}", qtaUDC, noteTrim));
- // inserisco attributo fuoriciclo
- MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, attrFC, "", DateTime.Now, codSogg);
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC finiti: {0}", exc), tipoLog.EXCEPTION);
- }
- // se ho cart stampo!
- if (newUdcChild != "")
- {
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartFiniti, Request.UserHostName);
- // incremento timing...
- adesso = DateTime.Now;
- adesso = adesso.AddSeconds(1);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Finiti");
- }
- }
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("FINITI, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
+ if (OpAuth.isAuth)
{
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
}
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Finiti, qta: {0} {1}", qtaUDC, noteTrim));
+ // inserisco attributo fuoriciclo
+ MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, attrFC, "", DateTime.Now, codSogg);
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC finiti: {0}", exc), tipoLog.EXCEPTION);
+ }
+ // se ho cart stampo!
+ if (newUdcChild != "")
+ {
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartFiniti, Request.UserHostName);
+ // incremento timing...
+ adesso = DateTime.Now;
+ adesso = adesso.AddSeconds(1);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Finiti");
+ }
}
- else
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
{
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
+ OpAuth.stopAuth();
+ needsRedirect = true;
}
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("FINITI, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
}
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
+ else
{
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- private void doResetData()
- {
- // resetto i dati QtaUdc, numUdc, QtaTot e particolare...
- qtaUDC = 0;
- numUDC = 1;
- refreshQta();
- currParticolare = "";
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// aggiornata qta UDC: aggiorno totale!
- ///
- ///
- ///
- protected void txtQtaUDC_TextChanged(object sender, EventArgs e)
- {
- refreshQta();
- }
- ///
- /// aggiorna qta totale
- ///
- private void refreshQta()
- {
- qta = qtaUDC * numUDC;
- }
- ///
- /// aggiornato num UDC: aggiorno totale!
- ///
- ///
- ///
- protected void txtNumUDC_TextChanged(object sender, EventArgs e)
- {
- refreshQta();
- }
- ///
- /// preseleziono (se possibile) imballo...
- ///
- ///
- ///
- protected void ddlImballi_DataBound(object sender, EventArgs e)
- {
- selezionaImballo();
- }
- ///
- /// seleziona imballo corretto
- ///
- private void selezionaImballo()
- {
- string codImb = "";
- // cerco se c'è un imballo x particolare corrente...
- if (currParticolare != "")
- {
- codImb = lastCodImb;
- }
- else
- {
- codImb = memLayer.ML.cdv("CodImballoFiniti");
- }
- try
- {
- // preseleziono
- ddlImballi.SelectedValue = codImb;
- }
- catch
- { }
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
}
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
}
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ private void doResetData()
+ {
+ // resetto i dati QtaUdc, numUdc, QtaTot e particolare...
+ qtaUDC = 0;
+ numUDC = 1;
+ refreshQta();
+ currParticolare = "";
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// aggiornata qta UDC: aggiorno totale!
+ ///
+ ///
+ ///
+ protected void txtQtaUDC_TextChanged(object sender, EventArgs e)
+ {
+ refreshQta();
+ }
+ ///
+ /// aggiorna qta totale
+ ///
+ private void refreshQta()
+ {
+ qta = qtaUDC * numUDC;
+ }
+ ///
+ /// aggiornato num UDC: aggiorno totale!
+ ///
+ ///
+ ///
+ protected void txtNumUDC_TextChanged(object sender, EventArgs e)
+ {
+ refreshQta();
+ }
+ ///
+ /// preseleziono (se possibile) imballo...
+ ///
+ ///
+ ///
+ protected void ddlImballi_DataBound(object sender, EventArgs e)
+ {
+ selezionaImballo();
+ }
+ ///
+ /// seleziona imballo corretto
+ ///
+ private void selezionaImballo()
+ {
+ string codImb = "";
+ // cerco se c'è un imballo x particolare corrente...
+ if (currParticolare != "")
+ {
+ codImb = lastCodImb;
+ }
+ else
+ {
+ codImb = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ try
+ {
+ // preseleziono
+ ddlImballi.SelectedValue = codImb;
+ }
+ catch
+ { }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_fusiTK.ascx.cs b/GMW/WebUserControls/mod_fusiTK.ascx.cs
index 4ab4b2b9..0bae9e87 100644
--- a/GMW/WebUserControls/mod_fusiTK.ascx.cs
+++ b/GMW/WebUserControls/mod_fusiTK.ascx.cs
@@ -5,628 +5,628 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_fusiTK : System.Web.UI.UserControl
+ public partial class mod_fusiTK : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a FUSI
+ ///
+ protected string flusso = "FU";
+ ///
+ /// stato associato (hard coded) a FUSI
+ ///
+ protected string statoUDC = "Fusi";
+ ///
+ /// attributo per indicazione LINEA di produzione/consumo
+ ///
+ protected string attrLINEA = "LI";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a FUSI
- ///
- protected string flusso = "FU";
- ///
- /// stato associato (hard coded) a FUSI
- ///
- protected string statoUDC = "Fusi";
- ///
- /// attributo per indicazione LINEA di produzione/consumo
- ///
- protected string attrLINEA = "LI";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ traduciObj();
+ checkNumKeyIn();
+ }
+ doChecks();
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ // default: qta a zero
+ decimal qtaPart = 0;
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ try
{
- if (!Page.IsPostBack)
+ qtaPart = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ if ((qtaPart > 0) && (qta == 0))
+ {
+ qta = Convert.ToInt32(qtaPart);
+ }
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Fusi {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Fusi");
+ doUpdate();
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ qta = memLayer.ML.cdvi("QtaImballoFusi");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ // controllo se sia un FUSO Tipo P
+ else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
{
- traduciObj();
- checkNumKeyIn();
+ answ = tipoCodiceBarcode.UDC;
}
- doChecks();
- if (currParticolare != "")
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
{
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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;
- // default: qta a zero
- decimal qtaPart = 0;
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- try
- {
- qtaPart = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
- }
- catch
- { }
- if ((qtaPart > 0) && (qta == 0))
- {
- qta = Convert.ToInt32(qtaPart);
- }
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-FUS-001");
+ Postazione.CssClass = "stileComandoKo";
}
else
{
- lblParticolareAttivo.Text = "...";
- lblDescrAttivo.Text = "";
- lblDisegno.Text = "";
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.CssClass = "stileComandoOk";
}
- }
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
+ // default: qta a zero
+ decimal qtaPart = 0;
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ try
{
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
+ qtaPart = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
+ catch
+ { }
+ if (qtaPart > 0)
+ {
+ qta = Convert.ToInt32(qtaPart);
+ }
+ else // rimette default
+ {
+ qta = memLayer.ML.cdvi("QtaImballoFusi");
+ }
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // recupero il particolare dai dati del cartellino preesistente
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ // controllo esista!!!
+ bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
+ // controllo sia anima!!!
+ bool isPart = TermClass.Ter.isParticolare(currParticolare);
+ // controllo esista il particolare e sia anima
+ if (partExists && isPart)
+ {
+ Postazione.messaggiText += traduci("partSelected");
+ Postazione.CssClass = "stileComandoOk";
+ }
+ else
+ {
+ currParticolare = "";
+ Postazione.messaggiText += traduci("ERR-FUS-001");
+ Postazione.CssClass = "stileComandoKo";
+ }
+ }
+
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ currParticolare = "";
+ qta = 0;
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += traduci("ERR-BCD-001");
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
+ barcodeIn = "";
+ }
+ doUpdate();
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ updatePart();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ checkStampa();
+ txtBarcode.Focus();
+ }
+ ///
+ /// aggiorna visualizzazioen dati particolare
+ ///
+ private void updatePart()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- bool fatto = false;
- // registro ri-stampa UDC
- DateTime adesso = DateTime.Now;
- // calcolo particolare...
- DS_magazzino.ElencoCartelliniRow rigaUDC;
+ 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 = "";
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ if (currParticolare != "" && qta > 0)
+ {
+ stampaOk = true;
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void lbtStampaUDC_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ // se linea non selezionata ERRORE!!!
+ if (Postazione.currCodLinea == "W3000" || Postazione.currCodLinea == "")
+ {
+ Postazione.messaggiText += " - Attenzione, IMPOSTARE LINEA!";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ string newUdcChild = "";
+ string noteTrim = txtNote.Text.Trim();
+ // effettuo controlli che cod_soggetto e cod particolare siano disponibili...
+ string codSogg = "";
string particolare = "";
try
{
- rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
- particolare = rigaUDC.Particolare;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ codSogg = MagClass.magazzino.CodSoggCurrUser;
+ particolare = currParticolare;
}
catch
{
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Fusi {0}", udcReq), tipoLog.EXCEPTION);
}
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Fusi");
- doUpdate();
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
+ if (codSogg != "" && particolare != "")
{
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- qta = memLayer.ML.cdvi("QtaImballoFusi");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
+ // genero cartellino liquidi
+ DateTime adesso = DateTime.Now;
+ try
+ {
+ // aggiungo codice linea alle note
+ noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
+ // creo nuovo UDC del trattamento liquidi
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoFusi"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFusi"), "IdxPosizioneFusi", "UDC_FUSI", noteTrim, "", adesso.Year, Request.UserHostName);
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- public int pezziUdc
- {
- get
- {
- int answ = 0;
- try
+ if (OpAuth.isAuth)
{
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
}
- catch
- { }
- return answ;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- // controllo se sia un FUSO Tipo P
- else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-FUS-001");
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.CssClass = "stileComandoOk";
- }
- // default: qta a zero
- decimal qtaPart = 0;
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- try
- {
- qtaPart = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
- }
- catch
- { }
- if (qtaPart > 0)
- {
- qta = Convert.ToInt32(qtaPart);
- }
- else // rimette default
- {
- qta = memLayer.ML.cdvi("QtaImballoFusi");
- }
- break;
- case tipoCodiceBarcode.UDC:
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // recupero il particolare dai dati del cartellino preesistente
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
- // controllo esista!!!
- bool partExists = DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count != 0;
- // controllo sia anima!!!
- bool isPart = TermClass.Ter.isParticolare(currParticolare);
- // controllo esista il particolare e sia anima
- if (partExists && isPart)
- {
- Postazione.messaggiText += traduci("partSelected");
- Postazione.CssClass = "stileComandoOk";
- }
- else
- {
- currParticolare = "";
- Postazione.messaggiText += traduci("ERR-FUS-001");
- Postazione.CssClass = "stileComandoKo";
- }
- }
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- currParticolare = "";
- qta = 0;
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += traduci("ERR-BCD-001");
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- doUpdate();
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- updatePart();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- checkStampa();
- txtBarcode.Focus();
- }
- ///
- /// aggiorna visualizzazioen dati particolare
- ///
- private void updatePart()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("{0} {1}", traduci("particSel"), 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 = "";
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- if (currParticolare != "" && qta > 0)
- {
- stampaOk = true;
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void lbtStampaUDC_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- // se linea non selezionata ERRORE!!!
- if (Postazione.currCodLinea == "W3000" || Postazione.currCodLinea == "")
- {
- Postazione.messaggiText += " - Attenzione, IMPOSTARE LINEA!";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- string newUdcChild = "";
- string noteTrim = txtNote.Text.Trim();
- // 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 liquidi
- DateTime adesso = DateTime.Now;
- try
- {
- // aggiungo codice linea alle note
- noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
- // creo nuovo UDC del trattamento liquidi
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoFusi"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFusi"), "IdxPosizioneFusi", "UDC_FUSI", noteTrim, "", adesso.Year, Request.UserHostName);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Fusi - qta:{0} {1}", qta, noteTrim));
- // per ora attributo linea tolto, messo nelle note...
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Fusi - qta:{0} {1}", qta, noteTrim));
+ // per ora attributo linea tolto, messo nelle note...
#if false
// salvo attributo linea con UDC
MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, attrLINEA, Postazione.currCodLinea, DateTime.Now, codSogg);
#endif
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC Fusi: {0}", exc), tipoLog.EXCEPTION);
- }
- // se ho cart stampo!
- if (newUdcChild != "")
- {
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartFusi, Request.UserHostName);
- // incremento timing...
- adesso = DateTime.Now;
- adesso = adesso.AddSeconds(1);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Fusi");
- }
- }
- else
- {
- httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
-
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC Fusi: {0}", exc), tipoLog.EXCEPTION);
+ }
+ // se ho cart stampo!
+ if (newUdcChild != "")
+ {
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartFusi, Request.UserHostName);
+ // incremento timing...
+ adesso = DateTime.Now;
+ adesso = adesso.AddSeconds(1);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Fusi");
+ }
}
else
{
- Response.Redirect("~/menu.aspx");
+ httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
}
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- doUpdate();
+
+ }
}
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
+ else
{
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
}
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
-
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
+ doUpdate();
}
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_lavMeccOUT.ascx.cs b/GMW/WebUserControls/mod_lavMeccOUT.ascx.cs
index e4504f11..969ee106 100644
--- a/GMW/WebUserControls/mod_lavMeccOUT.ascx.cs
+++ b/GMW/WebUserControls/mod_lavMeccOUT.ascx.cs
@@ -6,513 +6,513 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_lavMeccOUT : System.Web.UI.UserControl
+ public partial class mod_lavMeccOUT : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a FUSI
+ ///
+ protected string flusso = "FI";
+ ///
+ /// stato associato (hard coded) a FUSI
+ ///
+ protected string statoUDC = "Fin";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_FINITO";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ ///
+ /// stringa degli UDC selezionati per consumo COMPLETO (nel formato #UDC1##UDC2#)
+ ///
+ protected string udcSelC
{
- ///
- /// flusso associato (hard coded) a FUSI
- ///
- protected string flusso = "FI";
- ///
- /// stato associato (hard coded) a FUSI
- ///
- protected string statoUDC = "Fin";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_FINITO";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- ///
- /// stringa degli UDC selezionati per consumo COMPLETO (nel formato #UDC1##UDC2#)
- ///
- protected string udcSelC
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UdcSelC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UdcSelC_{0}", uid), value);
+ }
+ }
+ ///
+ /// stringa degli UDC selezionati per consumo PARZIALE (nel formato #UDC1##UDC2#)
+ ///
+ 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;
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
+ {
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ fixRicercaUdc();
+ traduciObj();
+ idxCella = Postazione.currIdxCella;
+ checkNumKeyIn();
+ }
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaLM_OUT"))
{
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UdcSelC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UdcSelC_{0}", uid), value);
- }
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaLM_OUT");
}
- ///
- /// stringa degli UDC selezionati per consumo PARZIALE (nel formato #UDC1##UDC2#)
- ///
- 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;
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
- {
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
- }
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- fixRicercaUdc();
- traduciObj();
- idxCella = Postazione.currIdxCella;
- checkNumKeyIn();
- }
- doChecks();
- }
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
- }
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
- {
- get
- {
- int answ = 0;
- if (memLayer.ML.isInSessionObject("IdxCellaLineaLM_OUT"))
- {
- answ = memLayer.ML.IntSessionObj("IdxCellaLineaLM_OUT");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("IdxCellaLineaLM_OUT", value);
- }
- }
- ///
- /// verifica se si debba mostrare un campo ricerca attivo...
- ///
- private void fixRicercaUdc()
- {
- if (memLayer.ML.isInSessionObject("valoreCercatoLMO"))
- {
- testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoLMO");
- }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaLM_OUT", value);
+ }
+ }
+ ///
+ /// verifica se si debba mostrare un campo ricerca attivo...
+ ///
+ private void fixRicercaUdc()
+ {
+ if (memLayer.ML.isInSessionObject("valoreCercatoLMO"))
+ {
+ testoRicerca = memLayer.ML.StringSessionObj("valoreCercatoLMO");
+ }
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finito LM OUT {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finito LM OUT");
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ lblPart.Text = currParticolare;
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- bool fatto = false;
- // registro ri-stampa UDC
- DateTime adesso = DateTime.Now;
- // calcolo particolare...
- DS_magazzino.ElencoCartelliniRow rigaUDC;
- string particolare = "";
+ 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 = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ // labels
+ btnCerca.Text = traduci("btnSearch");
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoFiniti");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
+ {
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// cod imballo dell'ultimo UDC del particolare generato
+ ///
+ public string lastCodImb
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].CodImballo;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Comando:
+ if (barcodeIn == memLayer.ML.cdv("cmdReset"))
+ {
+ currParticolare = "";
+ Response.Redirect(PagCorrente);
+ }
+ break;
+ case tipoCodiceBarcode.Imballo:
+ // cerco di selezionare!
try
{
- rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
- particolare = rigaUDC.Particolare;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ ddlImballi.SelectedValue = barcodeIn;
}
catch
{
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Finito LM OUT {0}", udcReq), tipoLog.EXCEPTION);
+ Postazione.warningText = traduci("ERR-IMB-001");
+ Postazione.CssClass = "stileComandoKo";
}
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Finito LM OUT");
- // raise dell'evento
- if (eh_reqUpdate != null)
+ 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))
{
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
- {
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
- lblPart.Text = currParticolare;
- // aggiungo descrizione del particolare
- string descr = "";
- string disegno = "";
- try
+ // calcolo nuovo particolare
+ string newPart = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ // 2015.09.25 salvo barcode UDC SSE NON E' un finito (flusso = "FI") --> dovrebbe evitare poi di avere relazioni UDC tra finito --> finito con consumo di uno x creazione altro...
+ if (barcodeIn.IndexOf(flusso) < 0)
+ {
+ if (testoRicerca != newPart)
{
- 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 = "";
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- // labels
- btnCerca.Text = traduci("btnSearch");
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoFiniti");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// cod imballo dell'ultimo UDC del particolare generato
- ///
- public string lastCodImb
- {
- get
- {
- string answ = "";
- try
- {
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].CodImballo;
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
+ // resetto precedente ricerca e deseleziono TUTTI gli UDC elencati SE è cambiato il particolare
+ udcSelC = string.Format("#{0}#", barcodeIn);
}
else
{
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
+ udcSelC = string.Format("{0}#{1}#", udcSelC, barcodeIn);
+ // se era presente in elenco "P" lo elimino
+ udcSelP = udcSelP.Replace(string.Format("#{0}#", barcodeIn), "");
}
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Comando:
- if (barcodeIn == memLayer.ML.cdv("cmdReset"))
- {
- currParticolare = "";
- Response.Redirect(PagCorrente);
- }
- break;
- case tipoCodiceBarcode.Imballo:
- // cerco di selezionare!
- try
- {
- ddlImballi.SelectedValue = barcodeIn;
- }
- catch
- {
- Postazione.warningText = traduci("ERR-IMB-001");
- Postazione.CssClass = "stileComandoKo";
- }
- 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;
- // 2015.09.25 salvo barcode UDC SSE NON E' un finito (flusso = "FI") --> dovrebbe evitare poi di avere relazioni UDC tra finito --> finito con consumo di uno x creazione altro...
- if (barcodeIn.IndexOf(flusso) < 0)
- {
- 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);
- //tolto x richiesta di quel pelato di Gian 2014.02.11
+ }
+ updFiltroPart(newPart);
+ //tolto x richiesta di quel pelato di Gian 2014.02.11
#if false
// imposto particolare!
currParticolare = newPart;
impostaParticolare();
#endif
- }
-
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
}
+
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
#if false
else
{
@@ -520,666 +520,666 @@ namespace GMW.WebUserControls
Postazione.CssClass = "stileAttesa";
}
#endif
- //grView.DataBind();
- txtBarcode.Focus();
- }
- ///
- /// imposto i dati dal particolare corrente
- ///
- private void impostaParticolare()
+ //grView.DataBind();
+ txtBarcode.Focus();
+ }
+ ///
+ /// imposto i dati dal particolare corrente
+ ///
+ private void impostaParticolare()
+ {
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
+ {
+ currParticolare = "";
+ Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ Postazione.messaggiText += " - impostato particolare!";
+ Postazione.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.cdv("QtaImballoFiniti");
+ }
+ if (lastCodImb != "")
+ {
+ selezionaImballo();
+ }
+ }
+ ///
+ /// update del filtro su particolare x grview UDC caricati in linea
+ ///
+ ///
+ 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();
+ }
+ }
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ checkStampa();
+ grView.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - udc da consumo totale/parziale
+ /// altrimenti disabilito btn stampa
+ ///
+ 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)))
{
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += " - impostato particolare!";
- Postazione.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.cdv("QtaImballoFiniti");
- }
- if (lastCodImb != "")
- {
- selezionaImballo();
- }
+ stampaOk = true;
}
- ///
- /// update del filtro su particolare x grview UDC caricati in linea
- ///
- ///
- private void updFiltroPart(string newPart)
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ string[] stringSeparators = new string[] { "#" };
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
{
- if (testoRicerca != newPart)
+ // controllo UDC in ingresso, che siano tutti con uguale particolare e DIVERSO da ""
+ string partUdcIn = "";
+ try
+ {
+ string fullUdc = string.Format("{0}#{1}", udcSelC, udcSelP);
+ // ciclo tutti gli UDC consumati P e C e verifico loro particolare
+ if (fullUdc.Replace("#", "").Length > 1)
{
- // imposto filtraggio x particoalre nell'elenco degli UDC della linea...
- testoRicerca = newPart;
- // salvo UDC da selezionare come consumo COMPLETO
- salvaCerca();
- }
- else
- {
- doUpdate();
- }
- }
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- checkStampa();
- grView.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - udc da consumo totale/parziale
- /// altrimenti disabilito btn stampa
- ///
- 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;
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- string[] stringSeparators = new string[] { "#" };
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- // controllo UDC in ingresso, che siano tutti con uguale particolare e DIVERSO da ""
- string partUdcIn = "";
- try
- {
- string fullUdc = string.Format("{0}#{1}", udcSelC, udcSelP);
- // ciclo tutti gli UDC consumati P e C e verifico loro particolare
- if (fullUdc.Replace("#", "").Length > 1)
- {
- string[] elencoUDC;
- elencoUDC = fullUdc.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
- partUdcIn = checkPartUDC(elencoUDC);
- }
- }
- catch
- { }
- if (partUdcIn != "")
- {
- // controllo da distinta base coerenza particolare IN/OUT
- bool partDistintaOk = false;
- try
- {
- if (MagClass.magazzino.taPartIO.GetData(currParticolare, partUdcIn, true)[0].Trovati > 0) partDistintaOk = true;
- }
- catch
- { }
- if (partDistintaOk)
- {
- string newUdcChild = "";
- int qta = memLayer.ML.cdvi("QtaImballoFiniti");
- string noteTrim = txtNote.Text.Trim();
- // 2014.05.08 tolto e spostato in classe postazione gestione NOME LINEA x note, da verificare...
-#if false
- string nomeLinea = ddlLinea.SelectedItem.Text;
-#endif
- noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
- 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;
- try
- {
- string codImballo = "";
- try
- {
- codImballo = ddlImballi.SelectedValue;
- }
- catch
- {
- codImballo = memLayer.ML.cdv("CodImballoFiniti");
- }
- // se NON HA selezionato prendo default...
- if (codImballo == "" || codImballo == "-")
- {
- codImballo = memLayer.ML.cdv("CodImballoFiniti");
- }
- // creo nuovo UDC FINITO OUT multiple
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, codImballo, "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFiniti"), "IdxPosizioneFiniti", eventoUDC, noteTrim, "", adesso.Year, Request.UserHostName);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Finito LM OUT, qta: {0} {1}", qta, noteTrim));
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC Finito LM OUT: {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.cartFiniti, 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 Finito LM OUT");
- }
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("Finiti LM OUT, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- httpLog(string.Format("Finiti LM OUT, Errore controllo coerenza particolari da distinta base!"), tipoLog.ERROR);
- Postazione.messaggiText += "Errore particolari UDC da controllo distinta base";
- Postazione.CssClass = "stileComandoND";
- }
- }
- else
- {
- httpLog(string.Format("Finiti LM OUT, Errore controllo coerenza elenco particolari IN!"), tipoLog.ERROR);
- Postazione.messaggiText += "Errore particolari UDC da consumare non coerenti";
- Postazione.CssClass = "stileComandoND";
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- }
- ///
- /// effettua il consumo di tutti gli UDC inviati come array di stringhe
- ///
- ///
- 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...
- }
- }
- }
- }
- }
- ///
- ///associa nuovo UDC ad elenco UDC
- ///
- /// UDC da associare come child
- /// vettore di UDC da associare come parent
- 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, true);
- }
- }
- }
- }
- ///
- /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
- ///
- /// vettore di UDC da verificare
- private string checkPartUDC(string[] UDC_P)
- {
- string answ = "";
- if (UDC_P.Length > 0)
- {
- // imposto il primo particolare...
- answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
- // ciclo
- foreach (string udc_p in UDC_P)
- {
- if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
- }
- }
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- testoRicerca = "";
- salvaCerca();
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// passo alla modalità IN
- ///
- ///
- ///
- protected void btnIn_Click(object sender, EventArgs e)
- {
- Response.Redirect("LavorMeccIN.aspx");
- }
-
- ///
- /// effettua refresh (su db) del blocco postazione
- ///
- ///
- 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);
- }
- }
- ///
- /// CODICE cella associata alla linea corrente
- ///
- protected string codCella
- {
- get
- {
- string answ = "";
- if (memLayer.ML.isInSessionObject("codCellaLM"))
- {
- answ = memLayer.ML.StringSessionObj("codCellaLM");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("codCellaLM", value);
- }
- }
- ///
- /// codice della linea corrente
- ///
- 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);
- }
- }
- ///
- /// cambiato valore in ricerca
- ///
- ///
- ///
- protected void txtCerca_TextChanged(object sender, EventArgs e)
- {
- // se è nuovo il testo resetto
- if (testoRicerca != SteamWare.memLayer.ML.StringSessionObj("valoreCercatoLMO"))
- {
- udcSelC = "";
- udcSelP = "";
- }
- salvaCerca();
- }
- ///
- /// effettuato reset
- ///
- ///
- ///
- protected void lnkReset_Click(object sender, EventArgs e)
- {
- testoRicerca = "";
- salvaCerca();
- }
- ///
- /// pressione del button di ricerca
- ///
- ///
- ///
- protected void btnCerca_Click(object sender, EventArgs e)
- {
- salvaCerca();
- }
-
- ///
- /// testo ricerca trimmato da spazi
- ///
- protected string testoRicerca
- {
- get
- {
- return txtCerca.Text.Trim();
- }
- set
- {
- txtCerca.Text = value;
- }
- }
- ///
- /// salvo ricerca particolare
- ///
- protected void salvaCerca()
- {
- if (testoRicerca == "")
- {
- SteamWare.memLayer.ML.emptySessionVal("valoreCercatoLMO");
- udcSelC = "";
- udcSelP = "";
- }
- else
- {
- SteamWare.memLayer.ML.setSessionVal("valoreCercatoLMO", 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();
- }
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
- ///
- /// traduce gli header delle colonne
- ///
- ///
- ///
- 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)
- {
-
- }
- ///
- /// selezione UDC da elenco
- ///
- ///
- ///
- 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;
- updFiltroPart(newPart);
- checkStampa();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
-
- ///
- /// preseleziono (se possibile) imballo...
- ///
- ///
- ///
- protected void ddlImballi_DataBound(object sender, EventArgs e)
- {
- selezionaImballo();
- }
- ///
- /// seleziona imballo corretto
- ///
- private void selezionaImballo()
- {
- string codImb = "";
- // cerco se c'è un imballo x particolare corrente...
- if (currParticolare != "")
- {
- codImb = lastCodImb;
- }
- else
- {
- codImb = memLayer.ML.cdv("CodImballoFiniti");
+ string[] elencoUDC;
+ elencoUDC = fullUdc.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
+ partUdcIn = checkPartUDC(elencoUDC);
}
+ }
+ catch
+ { }
+ if (partUdcIn != "")
+ {
+ // controllo da distinta base coerenza particolare IN/OUT
+ bool partDistintaOk = false;
try
{
- // preseleziono
- ddlImballi.SelectedValue = codImb;
+ if (MagClass.magazzino.taPartIO.GetData(currParticolare, partUdcIn, true)[0].Trovati > 0) partDistintaOk = true;
}
catch
{ }
+ if (partDistintaOk)
+ {
+ string newUdcChild = "";
+ int qta = memLayer.ML.cdvi("QtaImballoFiniti");
+ string noteTrim = txtNote.Text.Trim();
+ // 2014.05.08 tolto e spostato in classe postazione gestione NOME LINEA x note, da verificare...
+#if false
+ string nomeLinea = ddlLinea.SelectedItem.Text;
+#endif
+ noteTrim = string.Format("{0}{1}{2}", Postazione.currNomeLinea, Environment.NewLine, noteTrim);
+ 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;
+ try
+ {
+ string codImballo = "";
+ try
+ {
+ codImballo = ddlImballi.SelectedValue;
+ }
+ catch
+ {
+ codImballo = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ // se NON HA selezionato prendo default...
+ if (codImballo == "" || codImballo == "-")
+ {
+ codImballo = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ // creo nuovo UDC FINITO OUT multiple
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, codImballo, "U", MagClass.magazzino.CodSoggCurrUser, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneFiniti"), "IdxPosizioneFiniti", eventoUDC, noteTrim, "", adesso.Year, Request.UserHostName);
+
+ if (OpAuth.isAuth)
+ {
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(newUdcChild, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, codSogg);
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
+ }
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "creaUDC", string.Format("Creato nuovo UDC Finito LM OUT, qta: {0} {1}", qta, noteTrim));
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC Finito LM OUT: {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.cartFiniti, 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 Finito LM OUT");
+ }
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("Finiti LM OUT, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
+ }
+ else
+ {
+ httpLog(string.Format("Finiti LM OUT, Errore controllo coerenza particolari da distinta base!"), tipoLog.ERROR);
+ Postazione.messaggiText += "Errore particolari UDC da controllo distinta base";
+ Postazione.CssClass = "stileComandoND";
+ }
+ }
+ else
+ {
+ httpLog(string.Format("Finiti LM OUT, Errore controllo coerenza elenco particolari IN!"), tipoLog.ERROR);
+ Postazione.messaggiText += "Errore particolari UDC da consumare non coerenti";
+ Postazione.CssClass = "stileComandoND";
+ }
}
+ else
+ {
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
}
+ ///
+ /// effettua il consumo di tutti gli UDC inviati come array di stringhe
+ ///
+ ///
+ 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...
+ }
+ }
+ }
+ }
+ }
+ ///
+ ///associa nuovo UDC ad elenco UDC
+ ///
+ /// UDC da associare come child
+ /// vettore di UDC da associare come parent
+ 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, true);
+ }
+ }
+ }
+ }
+ ///
+ /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
+ ///
+ /// vettore di UDC da verificare
+ private string checkPartUDC(string[] UDC_P)
+ {
+ string answ = "";
+ if (UDC_P.Length > 0)
+ {
+ // imposto il primo particolare...
+ answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
+ // ciclo
+ foreach (string udc_p in UDC_P)
+ {
+ if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
+ }
+ }
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ testoRicerca = "";
+ salvaCerca();
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// passo alla modalità IN
+ ///
+ ///
+ ///
+ protected void btnIn_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("LavorMeccIN.aspx");
+ }
+
+ ///
+ /// effettua refresh (su db) del blocco postazione
+ ///
+ ///
+ 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);
+ }
+ }
+ ///
+ /// CODICE cella associata alla linea corrente
+ ///
+ protected string codCella
+ {
+ get
+ {
+ string answ = "";
+ if (memLayer.ML.isInSessionObject("codCellaLM"))
+ {
+ answ = memLayer.ML.StringSessionObj("codCellaLM");
+ }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("codCellaLM", value);
+ }
+ }
+ ///
+ /// codice della linea corrente
+ ///
+ 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);
+ }
+ }
+ ///
+ /// cambiato valore in ricerca
+ ///
+ ///
+ ///
+ protected void txtCerca_TextChanged(object sender, EventArgs e)
+ {
+ // se è nuovo il testo resetto
+ if (testoRicerca != SteamWare.memLayer.ML.StringSessionObj("valoreCercatoLMO"))
+ {
+ udcSelC = "";
+ udcSelP = "";
+ }
+ salvaCerca();
+ }
+ ///
+ /// effettuato reset
+ ///
+ ///
+ ///
+ protected void lnkReset_Click(object sender, EventArgs e)
+ {
+ testoRicerca = "";
+ salvaCerca();
+ }
+ ///
+ /// pressione del button di ricerca
+ ///
+ ///
+ ///
+ protected void btnCerca_Click(object sender, EventArgs e)
+ {
+ salvaCerca();
+ }
+
+ ///
+ /// testo ricerca trimmato da spazi
+ ///
+ protected string testoRicerca
+ {
+ get
+ {
+ return txtCerca.Text.Trim();
+ }
+ set
+ {
+ txtCerca.Text = value;
+ }
+ }
+ ///
+ /// salvo ricerca particolare
+ ///
+ protected void salvaCerca()
+ {
+ if (testoRicerca == "")
+ {
+ SteamWare.memLayer.ML.emptySessionVal("valoreCercatoLMO");
+ udcSelC = "";
+ udcSelP = "";
+ }
+ else
+ {
+ SteamWare.memLayer.ML.setSessionVal("valoreCercatoLMO", 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();
+ }
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+ ///
+ /// traduce gli header delle colonne
+ ///
+ ///
+ ///
+ 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)
+ {
+
+ }
+ ///
+ /// selezione UDC da elenco
+ ///
+ ///
+ ///
+ 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;
+ updFiltroPart(newPart);
+ checkStampa();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+
+ ///
+ /// preseleziono (se possibile) imballo...
+ ///
+ ///
+ ///
+ protected void ddlImballi_DataBound(object sender, EventArgs e)
+ {
+ selezionaImballo();
+ }
+ ///
+ /// seleziona imballo corretto
+ ///
+ private void selezionaImballo()
+ {
+ string codImb = "";
+ // cerco se c'è un imballo x particolare corrente...
+ if (currParticolare != "")
+ {
+ codImb = lastCodImb;
+ }
+ else
+ {
+ codImb = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ try
+ {
+ // preseleziono
+ ddlImballi.SelectedValue = codImb;
+ }
+ catch
+ { }
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_sanpos_controlloLiquidi.ascx.cs b/GMW/WebUserControls/mod_sanpos_controlloLiquidi.ascx.cs
index febd0903..86d37909 100644
--- a/GMW/WebUserControls/mod_sanpos_controlloLiquidi.ascx.cs
+++ b/GMW/WebUserControls/mod_sanpos_controlloLiquidi.ascx.cs
@@ -6,671 +6,671 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_sanpos_controlloLiquidi : System.Web.UI.UserControl
+ public partial class mod_sanpos_controlloLiquidi : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a controllo liquidi
+ ///
+ protected string flusso = "LI";
+ ///
+ /// stato associato (hard coded) a controllo liquidi
+ ///
+ protected string statoUDC = "FinLiq";
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a controllo liquidi
- ///
- protected string flusso = "LI";
- ///
- /// stato associato (hard coded) a controllo liquidi
- ///
- protected string statoUDC = "FinLiq";
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ Postazione.messaggiText = "";
+ Postazione.warningText = "";
+ traduciObj();
+ }
+ doChecks();
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// ristampo cartellino
+ ///
+ public void ristampa()
+ {
+ // registro ri-stampa UDC
+ DateTime adesso = DateTime.Now;
+ // calcolo particolare...
+ DS_magazzino.ElencoCartelliniRow rigaUDC = null;
+ string particolare = "";
+ // cerco il tipo cartellino dato l'attuale stato e l'imballo del cartellino
+ tipoCartellino cart = tipoCartellino.cartMP;
+ try
+ {
+ rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
+ particolare = rigaUDC.Particolare;
+ switch (rigaUDC.CodImballo)
{
- if (!Page.IsPostBack)
- {
- Postazione.messaggiText = "";
- Postazione.warningText = "";
- traduciObj();
- }
- doChecks();
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
- }
+ case "IF10":
+ cart = tipoCartellino.cartLiquidiF10;
+ break;
+ case "IF18":
+ cart = tipoCartellino.cartLiquidiF18;
+ break;
+ default:
+ break;
}
- ///
- /// ristampo cartellino
- ///
- public void ristampa()
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Controllo Liquidi {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ // stampo
+ MagClass.magazzino.stampaUdc(udcReq, Postazione.printer, cart, Request.UserHostName);
+ // registro azione
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC F10");
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidi");
+ txtAnno.Text = DateTime.Now.Year.ToString();
+ // buttons
+ btnStampa.Text = traduci("btnStampa");
+ btnAdd.ToolTip = traduci("btnAdd");
+ btnSvuota.ToolTip = traduci("btnSvuota");
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- // registro ri-stampa UDC
- DateTime adesso = DateTime.Now;
- // calcolo particolare...
- DS_magazzino.ElencoCartelliniRow rigaUDC = null;
- string particolare = "";
- // cerco il tipo cartellino dato l'attuale stato e l'imballo del cartellino
- tipoCartellino cart = tipoCartellino.cartMP;
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// cod imballo dell'ultimo UDC del particolare generato
+ ///
+ public string lastCodImb
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].CodImballo;
+ }
+ catch
+ {
+ answ = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ // controllo se sia un particolare Tipo P
+ else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ // controllo se sia un codice IMBALLO
+ else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
+ {
+ // è imballo!
+ answ = tipoCodiceBarcode.Imballo;
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
+ {
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Imballo:
+ // cerco di selezionare!
try
{
- rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
- particolare = rigaUDC.Particolare;
- switch (rigaUDC.CodImballo)
- {
- case "IF10":
- cart = tipoCartellino.cartLiquidiF10;
- break;
- case "IF18":
- cart = tipoCartellino.cartLiquidiF18;
- break;
- default:
- break;
- }
+ ddlImballi.SelectedValue = barcodeIn;
}
catch
{
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Controllo Liquidi {0}", udcReq), tipoLog.EXCEPTION);
+ Postazione.warningText = traduci("ERR-IMB-001");
+ Postazione.CssClass = "stileComandoKo";
}
- // stampo
- MagClass.magazzino.stampaUdc(udcReq, Postazione.printer, cart, Request.UserHostName);
- // registro azione
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC F10");
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
+ break;
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // imposto particolare...
+ lblPart.Text = currParticolare;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
{
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidi");
- txtAnno.Text = DateTime.Now.Year.ToString();
- // buttons
- btnStampa.Text = traduci("btnStampa");
- btnAdd.ToolTip = traduci("btnAdd");
- btnSvuota.ToolTip = traduci("btnSvuota");
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// cod imballo dell'ultimo UDC del particolare generato
- ///
- public string lastCodImb
- {
- get
- {
- string answ = "";
- try
- {
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].CodImballo;
- }
- catch
- {
- answ = memLayer.ML.cdv("CodImballoFiniti");
- }
- return answ;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- // controllo se sia un particolare Tipo P
- else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- // controllo se sia un codice IMBALLO
- else if (utils.obj.taSelImballi.getByImballo(barcodeIn).Rows.Count > 0)
- {
- // è imballo!
- answ = tipoCodiceBarcode.Imballo;
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi x UDC
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Imballo:
- // cerco di selezionare!
- try
- {
- ddlImballi.SelectedValue = barcodeIn;
- }
- catch
- {
- Postazione.warningText = traduci("ERR-IMB-001");
- Postazione.CssClass = "stileComandoKo";
- }
- break;
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // imposto particolare...
- lblPart.Text = currParticolare;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += " - impostato particolare!";
- Postazione.CssClass = "stileComandoOk";
- }
- // default: qta a zero
- decimal qtaPart = 0;
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- try
- {
- qtaPart = MagClass.magazzino.taCartellini.getLastByParticolare(memLayer.ML.StringSessionObj("CodCS"), currParticolare)[0].Qta;
- }
- catch
- { }
- if (qtaPart > 0)
- {
- txtQta.Text = Convert.ToInt32(qtaPart).ToString();
- }
- else // rimette default
- {
- txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidi");
- }
- // fix imballo
- ddlImballi.DataBind();
- break;
- case tipoCodiceBarcode.UDC:
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // recupero il particolare dai dati del cartellino preesistente
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
- // controllo esista il particolare
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += " - codice particolare da UDC non valido / non trovato in RILPRO.";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += " - impostato particolare!";
- Postazione.CssClass = "stileComandoOk";
- }
- }
-
- break;
- default:
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
+ currParticolare = "";
+ Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
+ Postazione.CssClass = "stileComandoKo";
}
else
{
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- }
- //grView.DataBind();
- txtBarcode.Focus();
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - almeno 1 trattamento
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- if (currParticolare != "" && qta > 0)
- {
- if (elencoTrattamenti.Count > 0)
- {
- updateListBoxTrattamenti();
- stampaOk = true;
- }
- }
- btnStampa.Enabled = stampaOk;
- }
-
- ///
- /// elenco dictionary dei trattamenti da associare ad UDC
- ///
- public Dictionary elencoTrattamenti
- {
- get
- {
- try
- {
- return (Dictionary)memLayer.ML.objSessionObj("elencoTrattamenti");
- }
- catch
- {
- return new Dictionary();
- }
- }
- set
- {
- memLayer.ML.setSessionVal("elencoTrattamenti", value, false);
- }
- }
- ///
- /// aggiungo un oggetto trattamento alla lista..
- ///
- ///
- ///
- protected void btnAdd_Click(object sender, EventArgs e)
- {
- if (txtTratt.Text.Trim() != "")
- {
- string valore = txtTratt.Text.Trim();
- Dictionary elenco = elencoTrattamenti;
- // controllo il valore non ci sia già...
- if (!elenco.ContainsKey(valore))
- {
- elenco.Add(valore, "n° " + valore);
- elencoTrattamenti = elenco;
- }
- txtTratt.Text = "";
- updateListBoxTrattamenti();
- }
- doChecks();
- }
- ///
- /// aggiorna la listbox
- ///
- private void updateListBoxTrattamenti()
- {
- lbTrattamenti.DataSource = elencoTrattamenti;
- lbTrattamenti.DataTextField = "Value";
- lbTrattamenti.DataValueField = "Key";
- lbTrattamenti.DataBind();
- }
- ///
- /// svuota elenco trattamenti
- ///
- ///
- ///
- protected void btnSvuota_Click(object sender, EventArgs e)
- {
- resetTrattamenti();
- doChecks();
- }
- ///
- /// resetta i trattamenti caricati
- ///
- private void resetTrattamenti()
- {
- Dictionary elenco = new Dictionary();
- elencoTrattamenti = elenco;
- txtTratt.Text = "";
- updateListBoxTrattamenti();
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- string newUdcChild = "";
- string newUdcParent = "";
- bool UdcExists = false;
- int anno = Convert.ToInt32(txtAnno.Text.Substring(txtAnno.Text.Trim().Length - 2, 2));
- int qta = memLayer.ML.cdvi("QtaImballoLiquidi");
- 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 != "")
- {
- // calcolo codImballo
- string codImballo = "";
- try
- {
- codImballo = ddlImballi.SelectedValue;
- }
- catch
- {
- codImballo = memLayer.ML.cdv("CodImballoLiquidi");
- }
- // se NON HA selezionato prendo default...
- if (codImballo == "" || codImballo == "-")
- {
- codImballo = memLayer.ML.cdv("CodImballoLiquidi");
- }
- // genero cartellino liquidi
- DateTime adesso = DateTime.Now;
- try
- {
- // creo nuovo UDC del trattamento liquidi
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, codImballo, "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneLiquidi"), "IdxPosizioneLiquidi", memLayer.ML.cdv("nuovoUdcLiquidiF10"), 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 Liquidi F10 - qta:{0} {1}", qta, noteTrim));
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC Liquidi San Possidonio: {0}", exc), tipoLog.EXCEPTION);
- }
- // se ho cart liquidi genero (se non ci sono) cart trattamenti
- if (newUdcChild != "")
- {
- // creo UDC dei trattamenti termici
- foreach (KeyValuePair kvp in elencoTrattamenti)
- {
- // calcolo il nuovo codice UDC del trattamento
- newUdcParent = MagClass.magazzino.getComposizioneUDC(memLayer.ML.cdv("CodCS"), "TR", anno.ToString(), Convert.ToInt32(kvp.Key)); // !!! "TR" HARD CODED x indicare flusso trattamenti
- // verifico se ci sia già UDC
- UdcExists = MagClass.magazzino.checkUDC(newUdcParent);
- if (!UdcExists)
- {
- try
- {
- // creo UDC
- MagClass.magazzino.creaUdc("TR", "", memLayer.ML.confReadString("particTratt"), "", "", "", "", "", 0, "", "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, DateTime.Now, 0, "Trattamenti", memLayer.ML.cdvi("IdxPosizioneTrattamenti"), "IdxPosizioneTrattamenti", memLayer.ML.cdv("nuovoUdcTrattamenti"), flusso, newUdcParent, anno, Request.UserHostName);
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione cartellino trattamenti San Possidonio: {0}", exc), tipoLog.EXCEPTION);
- }
- }
- // associo tratt termici e liquidi
- MagClass.magazzino.associaUdcParent(newUdcChild, newUdcParent);
- if (!UdcExists)
- {
- // consumo UDC tratt termici
- MagClass.magazzino.scaricaUdcMpWip(newUdcParent, Request.UserHostName);
- }
- // reset valori
- newUdcParent = "";
- UdcExists = false;
- }
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartLiquidiF10, Request.UserHostName);
- // incremento timing...
- adesso = DateTime.Now;
- adesso = adesso.AddSeconds(1);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Liquidi F10");
- }
- }
- else
- {
- httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- }
- ///
- /// preseleziono (se possibile) imballo...
- ///
- ///
- ///
- protected void ddlImballi_DataBound(object sender, EventArgs e)
- {
- selezionaImballo();
- }
- ///
- /// seleziona imballo corretto
- ///
- private void selezionaImballo()
- {
- string codImb = "";
- // cerco se c'è un imballo x particolare corrente...
- if (currParticolare != "")
- {
- codImb = lastCodImb;
- }
- else
- {
- codImb = memLayer.ML.cdv("CodImballoFiniti");
+ Postazione.messaggiText += " - impostato particolare!";
+ Postazione.CssClass = "stileComandoOk";
}
+ // default: qta a zero
+ decimal qtaPart = 0;
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
try
{
- // preseleziono
- ddlImballi.SelectedValue = codImb;
+ qtaPart = MagClass.magazzino.taCartellini.getLastByParticolare(memLayer.ML.StringSessionObj("CodCS"), currParticolare)[0].Qta;
}
catch
{ }
- }
+ if (qtaPart > 0)
+ {
+ txtQta.Text = Convert.ToInt32(qtaPart).ToString();
+ }
+ else // rimette default
+ {
+ txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidi");
+ }
+ // fix imballo
+ ddlImballi.DataBind();
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // recupero il particolare dai dati del cartellino preesistente
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ // controllo esista il particolare
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
+ {
+ currParticolare = "";
+ Postazione.messaggiText += " - codice particolare da UDC non valido / non trovato in RILPRO.";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ Postazione.messaggiText += " - impostato particolare!";
+ Postazione.CssClass = "stileComandoOk";
+ }
+ }
+ break;
+ default:
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
+ }
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ //grView.DataBind();
+ txtBarcode.Focus();
}
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - almeno 1 trattamento
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ if (currParticolare != "" && qta > 0)
+ {
+ if (elencoTrattamenti.Count > 0)
+ {
+ updateListBoxTrattamenti();
+ stampaOk = true;
+ }
+ }
+ btnStampa.Enabled = stampaOk;
+ }
+
+ ///
+ /// elenco dictionary dei trattamenti da associare ad UDC
+ ///
+ public Dictionary elencoTrattamenti
+ {
+ get
+ {
+ try
+ {
+ return (Dictionary)memLayer.ML.objSessionObj("elencoTrattamenti");
+ }
+ catch
+ {
+ return new Dictionary();
+ }
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("elencoTrattamenti", value, false);
+ }
+ }
+ ///
+ /// aggiungo un oggetto trattamento alla lista..
+ ///
+ ///
+ ///
+ protected void btnAdd_Click(object sender, EventArgs e)
+ {
+ if (txtTratt.Text.Trim() != "")
+ {
+ string valore = txtTratt.Text.Trim();
+ Dictionary elenco = elencoTrattamenti;
+ // controllo il valore non ci sia già...
+ if (!elenco.ContainsKey(valore))
+ {
+ elenco.Add(valore, "n° " + valore);
+ elencoTrattamenti = elenco;
+ }
+ txtTratt.Text = "";
+ updateListBoxTrattamenti();
+ }
+ doChecks();
+ }
+ ///
+ /// aggiorna la listbox
+ ///
+ private void updateListBoxTrattamenti()
+ {
+ lbTrattamenti.DataSource = elencoTrattamenti;
+ lbTrattamenti.DataTextField = "Value";
+ lbTrattamenti.DataValueField = "Key";
+ lbTrattamenti.DataBind();
+ }
+ ///
+ /// svuota elenco trattamenti
+ ///
+ ///
+ ///
+ protected void btnSvuota_Click(object sender, EventArgs e)
+ {
+ resetTrattamenti();
+ doChecks();
+ }
+ ///
+ /// resetta i trattamenti caricati
+ ///
+ private void resetTrattamenti()
+ {
+ Dictionary elenco = new Dictionary();
+ elencoTrattamenti = elenco;
+ txtTratt.Text = "";
+ updateListBoxTrattamenti();
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ string newUdcChild = "";
+ string newUdcParent = "";
+ bool UdcExists = false;
+ int anno = Convert.ToInt32(txtAnno.Text.Substring(txtAnno.Text.Trim().Length - 2, 2));
+ int qta = memLayer.ML.cdvi("QtaImballoLiquidi");
+ 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 != "")
+ {
+ // calcolo codImballo
+ string codImballo = "";
+ try
+ {
+ codImballo = ddlImballi.SelectedValue;
+ }
+ catch
+ {
+ codImballo = memLayer.ML.cdv("CodImballoLiquidi");
+ }
+ // se NON HA selezionato prendo default...
+ if (codImballo == "" || codImballo == "-")
+ {
+ codImballo = memLayer.ML.cdv("CodImballoLiquidi");
+ }
+ // genero cartellino liquidi
+ DateTime adesso = DateTime.Now;
+ try
+ {
+ // creo nuovo UDC del trattamento liquidi
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, codImballo, "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneLiquidi"), "IdxPosizioneLiquidi", memLayer.ML.cdv("nuovoUdcLiquidiF10"), 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 Liquidi F10 - qta:{0} {1}", qta, noteTrim));
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC Liquidi San Possidonio: {0}", exc), tipoLog.EXCEPTION);
+ }
+ // se ho cart liquidi genero (se non ci sono) cart trattamenti
+ if (newUdcChild != "")
+ {
+ // creo UDC dei trattamenti termici
+ foreach (KeyValuePair kvp in elencoTrattamenti)
+ {
+ // calcolo il nuovo codice UDC del trattamento
+ newUdcParent = MagClass.magazzino.getComposizioneUDC(memLayer.ML.cdv("CodCS"), "TR", anno.ToString(), Convert.ToInt32(kvp.Key)); // !!! "TR" HARD CODED x indicare flusso trattamenti
+ // verifico se ci sia già UDC
+ UdcExists = MagClass.magazzino.checkUDC(newUdcParent);
+ if (!UdcExists)
+ {
+ try
+ {
+ // creo UDC
+ MagClass.magazzino.creaUdc("TR", "", memLayer.ML.confReadString("particTratt"), "", "", "", "", "", 0, "", "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, DateTime.Now, 0, "Trattamenti", memLayer.ML.cdvi("IdxPosizioneTrattamenti"), "IdxPosizioneTrattamenti", memLayer.ML.cdv("nuovoUdcTrattamenti"), flusso, newUdcParent, anno, Request.UserHostName);
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione cartellino trattamenti San Possidonio: {0}", exc), tipoLog.EXCEPTION);
+ }
+ }
+ // associo tratt termici e liquidi
+ MagClass.magazzino.associaUdcParent(newUdcChild, newUdcParent);
+ if (!UdcExists)
+ {
+ // consumo UDC tratt termici
+ MagClass.magazzino.scaricaUdcMpWip(newUdcParent, Request.UserHostName);
+ }
+ // reset valori
+ newUdcParent = "";
+ UdcExists = false;
+ }
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartLiquidiF10, Request.UserHostName);
+ // incremento timing...
+ adesso = DateTime.Now;
+ adesso = adesso.AddSeconds(1);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Liquidi F10");
+ }
+ }
+ else
+ {
+ httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ }
+ ///
+ /// preseleziono (se possibile) imballo...
+ ///
+ ///
+ ///
+ protected void ddlImballi_DataBound(object sender, EventArgs e)
+ {
+ selezionaImballo();
+ }
+ ///
+ /// seleziona imballo corretto
+ ///
+ private void selezionaImballo()
+ {
+ string codImb = "";
+ // cerco se c'è un imballo x particolare corrente...
+ if (currParticolare != "")
+ {
+ codImb = lastCodImb;
+ }
+ else
+ {
+ codImb = memLayer.ML.cdv("CodImballoFiniti");
+ }
+ try
+ {
+ // preseleziono
+ ddlImballi.SelectedValue = codImb;
+ }
+ catch
+ { }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_sanpos_creazioneF18.ascx.cs b/GMW/WebUserControls/mod_sanpos_creazioneF18.ascx.cs
index 94d82330..3cf2e24b 100644
--- a/GMW/WebUserControls/mod_sanpos_creazioneF18.ascx.cs
+++ b/GMW/WebUserControls/mod_sanpos_creazioneF18.ascx.cs
@@ -6,171 +6,171 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_sanpos_creazioneF18 : System.Web.UI.UserControl
+ public partial class mod_sanpos_creazioneF18 : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a F18
+ ///
+ protected string flusso = "Li";
+ ///
+ /// stato associato (hard coded) a F18
+ ///
+ protected string statoUDC = "FinLiq";
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a F18
- ///
- protected string flusso = "Li";
- ///
- /// stato associato (hard coded) a F18
- ///
- protected string statoUDC = "FinLiq";
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ traduciObj();
+ }
+ doChecks();
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ // registro ri-stampa UDC
+ DateTime adesso = DateTime.Now;
+ // calcolo particolare...
+ DS_magazzino.ElencoCartelliniRow rigaUDC = null;
+ string particolare = "";
+ // cerco il tipo cartellino dato l'attuale stato e l'imballo del cartellino
+ tipoCartellino cart = tipoCartellino.cartMP;
+ try
+ {
+ rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
+ particolare = rigaUDC.Particolare;
+ switch (rigaUDC.CodImballo)
{
- if (!Page.IsPostBack)
- {
- traduciObj();
- }
- doChecks();
- if (currParticolare != "")
- {
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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 = "";
- }
+ case "IF10":
+ cart = tipoCartellino.cartLiquidiF10;
+ break;
+ case "IF18":
+ cart = tipoCartellino.cartLiquidiF18;
+ break;
+ default:
+ break;
}
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- // registro ri-stampa UDC
- DateTime adesso = DateTime.Now;
- // calcolo particolare...
- DS_magazzino.ElencoCartelliniRow rigaUDC = null;
- string particolare = "";
- // cerco il tipo cartellino dato l'attuale stato e l'imballo del cartellino
- tipoCartellino cart = tipoCartellino.cartMP;
- try
- {
- rigaUDC = MagClass.magazzino.taCartellini.getByUdc(udcReq)[0];
- particolare = rigaUDC.Particolare;
- switch (rigaUDC.CodImballo)
- {
- case "IF10":
- cart = tipoCartellino.cartLiquidiF10;
- break;
- case "IF18":
- cart = tipoCartellino.cartLiquidiF18;
- break;
- default:
- break;
- }
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Controllo Liquidi {0}", udcReq), tipoLog.EXCEPTION);
- }
- // stampo
- MagClass.magazzino.stampaUdc(udcReq, Postazione.printer, cart, Request.UserHostName);
- // registro azione
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC F18");
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
- {
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- // labels
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Controllo Liquidi {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ // stampo
+ MagClass.magazzino.stampaUdc(udcReq, Postazione.printer, cart, Request.UserHostName);
+ // registro azione
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC F18");
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ // labels
#if false
lblPostazione.Text = string.Format("{2}: {0} ({1})", postazione_name, postazione_IP, traduci("postazione"));
lblPrinter.Text = string.Format("{1}: {0}", postazione_printer, traduci("stampante"));
lblCurrentPage.Text = traduci(PagCorrente);
#endif
- lblUDC.Text = traduci("lblUDC");
- lblQta.Text = traduci("lblQuantita");
- lblNote.Text = traduci("lblNote");
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidiDaSpedire");
- // buttons
- btnStampa.Text = traduci("btnStampa");
- btnEmptyNote.Text = traduci("btnEmptyNote");
+ lblUDC.Text = traduci("lblUDC");
+ lblQta.Text = traduci("lblQuantita");
+ lblNote.Text = traduci("lblNote");
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidiDaSpedire");
+ // buttons
+ btnStampa.Text = traduci("btnStampa");
+ btnEmptyNote.Text = traduci("btnEmptyNote");
#if false
// fix storico
fixStorico();
#endif
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
#if false
///
/// calcola postazione corrente (ip, name, printer)
@@ -242,168 +242,168 @@ namespace GMW.WebUserControls
}
}
#endif
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- protected string currParticolare
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("currParticolare_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("currParticolare_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
{
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
+ answ = tipoCodiceBarcode.Comando;
}
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- public int pezziUdc
+ // controllo se sia un particolare Tipo P
+ else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è un particolare...
{
- get
- {
- int answ = 0;
- try
- {
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC)[0].Qta;
- }
- catch
- { }
- return answ;
- }
+ answ = tipoCodiceBarcode.Particolare;
}
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
+ else
{
- get
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
{
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- // controllo se sia un particolare Tipo P
- else if (TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare && TermClass.Ter.isParticolare(barcodeIn)) // è 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;
+ answ = tipoCodiceBarcode.UDC;
}
+ }
+ catch
+ {
+ }
}
- ///
- /// valore barcode
- ///
- public string barcodeIn
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi x UDC
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
{
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
+ qta = Convert.ToInt32(txtQta.Text.Trim());
}
- ///
- /// qta pezzi x UDC
- ///
- public int qta
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
{
- get
+ case tipoCodiceBarcode.Particolare:
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo esista il particolare scansionato
+ if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
{
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
+ currParticolare = "";
+ Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
+ Postazione.CssClass = "stileComandoKo";
}
- set
+ else
{
- txtQta.Text = value.ToString();
+ Postazione.messaggiText += " - impostato particolare!";
+ Postazione.CssClass = "stileComandoOk";
}
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
+ // default: qta a zero
+ decimal qtaPart = 0;
+ // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
+ try
{
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo esista il particolare scansionato
- if (DataProxy.obj.taAnagParticolari.getByParticolare(currParticolare).Rows.Count == 0)
- {
- currParticolare = "";
- Postazione.messaggiText += " - codice particolare non valido / non trovato in RILPRO.";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- Postazione.messaggiText += " - impostato particolare!";
- Postazione.CssClass = "stileComandoOk";
- }
- // default: qta a zero
- decimal qtaPart = 0;
- // leggo la qta dell'ultimo UDC del particolare, SE C'E', e la imposto...
- try
- {
- qtaPart = MagClass.magazzino.taCartellini.getLastByParticolare(memLayer.ML.StringSessionObj("CodCS"), currParticolare)[0].Qta;
- }
- catch
- { }
- if (qtaPart > 0)
- {
- txtQta.Text = Convert.ToInt32(qtaPart).ToString();
- }
- else // rimette default
- {
- txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidiDaSpedire");
- }
- break;
- case tipoCodiceBarcode.UDC:
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // VECCHIA VERSIONE: caricava particolare da UDC
+ qtaPart = MagClass.magazzino.taCartellini.getLastByParticolare(memLayer.ML.StringSessionObj("CodCS"), currParticolare)[0].Qta;
+ }
+ catch
+ { }
+ if (qtaPart > 0)
+ {
+ txtQta.Text = Convert.ToInt32(qtaPart).ToString();
+ }
+ else // rimette default
+ {
+ txtQta.Text = memLayer.ML.cdv("QtaImballoLiquidiDaSpedire");
+ }
+ break;
+ case tipoCodiceBarcode.UDC:
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // VECCHIA VERSIONE: caricava particolare da UDC
#if false
// recupero il particolare dai dati del cartellino preesistente
currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
@@ -420,285 +420,285 @@ namespace GMW.WebUserControls
pnlAll.CssClass = "stileComandoOk";
}
#endif
- checkUdc4elenco(barcodeIn);
- }
+ checkUdc4elenco(barcodeIn);
+ }
- break;
- default:
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
- else
- {
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- }
- //grView.DataBind();
- txtBarcode.Focus();
+ break;
+ default:
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - almeno 1 trattamento
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
+ barcodeIn = "";
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ }
+ //grView.DataBind();
+ txtBarcode.Focus();
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - almeno 1 trattamento
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ if (currParticolare != "" && qta > 0)
+ {
+ if (elencoUDC.Count > 0)
{
- bool stampaOk = false;
- if (currParticolare != "" && qta > 0)
- {
- if (elencoUDC.Count > 0)
- {
- updateListBoxUDC();
- stampaOk = true;
- }
- }
- btnStampa.Enabled = stampaOk;
+ updateListBoxUDC();
+ stampaOk = true;
}
- ///
- /// elenco dictionary dei trattamenti da associare ad UDC
- ///
- public Dictionary elencoUDC
+ }
+ btnStampa.Enabled = stampaOk;
+ }
+ ///
+ /// elenco dictionary dei trattamenti da associare ad UDC
+ ///
+ public Dictionary elencoUDC
+ {
+ get
+ {
+ try
{
- get
- {
- try
- {
- return (Dictionary)memLayer.ML.objSessionObj("elencoUDC");
- }
- catch
- {
- return new Dictionary();
- }
- }
- set
- {
- memLayer.ML.setSessionVal("elencoUDC", value, false);
- }
+ return (Dictionary)memLayer.ML.objSessionObj("elencoUDC");
}
- ///
- /// aggiungo un oggetto trattamento alla lista..
- ///
- ///
- ///
- protected void btnAdd_Click(object sender, EventArgs e)
+ catch
{
- if (txtUDC.Text.Trim() != "")
- {
- string valore = txtUDC.Text.Trim().ToUpper();
- // controllo esista UDC..
- checkUdc4elenco(valore);
- }
+ return new Dictionary();
+ }
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("elencoUDC", value, false);
+ }
+ }
+ ///
+ /// aggiungo un oggetto trattamento alla lista..
+ ///
+ ///
+ ///
+ protected void btnAdd_Click(object sender, EventArgs e)
+ {
+ if (txtUDC.Text.Trim() != "")
+ {
+ string valore = txtUDC.Text.Trim().ToUpper();
+ // controllo esista UDC..
+ checkUdc4elenco(valore);
+ }
#if false
fixStorico();
#endif
- doChecks();
- }
- ///
- /// controlla validità UDC x inserire in elenco...
- ///
- ///
- private void checkUdc4elenco(string valore)
+ doChecks();
+ }
+ ///
+ /// controlla validità UDC x inserire in elenco...
+ ///
+ ///
+ private void checkUdc4elenco(string valore)
+ {
+ if (MagClass.magazzino.checkUDC(valore))
+ {
+ // controllo sia un cartellino F10...
+ DS_Applicazione.ElencoCartelliniRow rigaCart;
+ string tipoImballo = "";
+ try
{
- if (MagClass.magazzino.checkUDC(valore))
- {
- // controllo sia un cartellino F10...
- DS_Applicazione.ElencoCartelliniRow rigaCart;
- string tipoImballo = "";
- try
- {
- rigaCart = DataProxy.obj.taCartellini.stp_getByUdc(valore)[0];
- tipoImballo = rigaCart.CodImballo;
- }
- catch
- { }
- // controllo il tipo imballo dell'UDC per decidere se sia F10...
- if (tipoImballo == memLayer.ML.cdv("CodImballoLiquidi"))
- {
- Dictionary elenco = elencoUDC;
- // controllo il valore non ci sia già...
- if (!elenco.ContainsKey(valore))
- {
- elenco.Add(valore, valore);
- elencoUDC = elenco;
- }
- txtUDC.Text = "";
- lblWarnUdc.Visible = false;
- updateListBoxUDC();
- }
- else
- {
- // elimino UDC con imballo non valido!
- txtUDC.Text = "";
- lblWarnUdc.Text = traduci("UdcImballoErrato");
- lblWarnUdc.Visible = true;
- }
- }
- else
- {
- // elimino UDC non valido!
- txtUDC.Text = "";
- lblWarnUdc.Text = traduci("UdcNonTrovato");
- lblWarnUdc.Visible = true;
- }
+ rigaCart = DataProxy.obj.taCartellini.stp_getByUdc(valore)[0];
+ tipoImballo = rigaCart.CodImballo;
}
- ///
- /// aggiorna la listbox
- ///
- private void updateListBoxUDC()
+ catch
+ { }
+ // controllo il tipo imballo dell'UDC per decidere se sia F10...
+ if (tipoImballo == memLayer.ML.cdv("CodImballoLiquidi"))
{
- lbUdc.DataSource = elencoUDC;
- lbUdc.DataTextField = "Value";
- lbUdc.DataValueField = "Key";
- lbUdc.DataBind();
- }
- ///
- /// svuota elenco trattamenti
- ///
- ///
- ///
- protected void btnSvuota_Click(object sender, EventArgs e)
- {
- Dictionary elenco = new Dictionary();
+ Dictionary elenco = elencoUDC;
+ // controllo il valore non ci sia già...
+ if (!elenco.ContainsKey(valore))
+ {
+ elenco.Add(valore, valore);
elencoUDC = elenco;
- txtUDC.Text = "";
- lblWarnUdc.Visible = false;
- updateListBoxUDC();
- doChecks();
+ }
+ txtUDC.Text = "";
+ lblWarnUdc.Visible = false;
+ updateListBoxUDC();
}
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
+ else
{
+ // elimino UDC con imballo non valido!
+ txtUDC.Text = "";
+ lblWarnUdc.Text = traduci("UdcImballoErrato");
+ lblWarnUdc.Visible = true;
+ }
+ }
+ else
+ {
+ // elimino UDC non valido!
+ txtUDC.Text = "";
+ lblWarnUdc.Text = traduci("UdcNonTrovato");
+ lblWarnUdc.Visible = true;
+ }
+ }
+ ///
+ /// aggiorna la listbox
+ ///
+ private void updateListBoxUDC()
+ {
+ lbUdc.DataSource = elencoUDC;
+ lbUdc.DataTextField = "Value";
+ lbUdc.DataValueField = "Key";
+ lbUdc.DataBind();
+ }
+ ///
+ /// svuota elenco trattamenti
+ ///
+ ///
+ ///
+ protected void btnSvuota_Click(object sender, EventArgs e)
+ {
+ Dictionary elenco = new Dictionary();
+ elencoUDC = elenco;
+ txtUDC.Text = "";
+ lblWarnUdc.Visible = false;
+ updateListBoxUDC();
+ doChecks();
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
#if false
// calcolo postazione
calcolaPostazione();
#endif
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ string newUdcChild = "";
+ int qta = memLayer.ML.cdvi("QtaImballoLiquidiDaSpedire");
+ 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 liquidi
+ DateTime adesso = DateTime.Now;
+ try
+ {
+ // creo nuovo UDC del trattamento liquidi
+ newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoLiquidiDaSpedire"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneLiquidi"), "IdxPosizioneLiquidi", memLayer.ML.cdv("nuovoUdcLiquidiF18"), 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 Liquidi F18 - qta:{0} {1}", qta, noteTrim));
+ }
+ catch (Exception exc)
+ {
+ httpLog(string.Format("Errore creazione UDC Liquidi F18 San Possidonio: {0}", exc), tipoLog.EXCEPTION);
+ }
+ // stampo!
+ if (newUdcChild != "")
+ {
+ // controllo se ci sono UDC F10 da associare... e x ognuno associo!
+ foreach (KeyValuePair kvp in elencoUDC)
{
- string newUdcChild = "";
- int qta = memLayer.ML.cdvi("QtaImballoLiquidiDaSpedire");
- 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 liquidi
- DateTime adesso = DateTime.Now;
- try
- {
- // creo nuovo UDC del trattamento liquidi
- newUdcChild = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoLiquidiDaSpedire"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneLiquidi"), "IdxPosizioneLiquidi", memLayer.ML.cdv("nuovoUdcLiquidiF18"), 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 Liquidi F18 - qta:{0} {1}", qta, noteTrim));
- }
- catch (Exception exc)
- {
- httpLog(string.Format("Errore creazione UDC Liquidi F18 San Possidonio: {0}", exc), tipoLog.EXCEPTION);
- }
- // stampo!
- if (newUdcChild != "")
- {
- // controllo se ci sono UDC F10 da associare... e x ognuno associo!
- foreach (KeyValuePair kvp in elencoUDC)
- {
- // associo i 2 cartellini
- MagClass.magazzino.associaUdcParent(newUdcChild, kvp.Key);
- }
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartLiquidiF18, Request.UserHostName);
- // incremento timing...
- adesso = DateTime.Now;
- adesso = adesso.AddSeconds(1);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Liquidi F18");
- }
- }
- else
- {
- httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
+ // associo i 2 cartellini
+ MagClass.magazzino.associaUdcParent(newUdcChild, kvp.Key);
+ }
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartLiquidiF18, Request.UserHostName);
+ // incremento timing...
+ adesso = DateTime.Now;
+ adesso = adesso.AddSeconds(1);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, codSogg, Postazione.name, Postazione.IP, newUdcChild, particolare, "stampaUDC", "Stampato UDC Liquidi F18");
+ }
+ }
+ else
+ {
+ httpLog(string.Format("Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
#if false
mod_storicoAzioniOperatore1.doUpdate();
#endif
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- 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;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- 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;
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ 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;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ 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;
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ }
#if false
///
/// toggle controllo storico
@@ -740,5 +740,5 @@ namespace GMW.WebUserControls
fixStorico();
}
#endif
- }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_sterrTaglio.ascx.cs b/GMW/WebUserControls/mod_sterrTaglio.ascx.cs
index 73e0decf..7dbc3bf0 100644
--- a/GMW/WebUserControls/mod_sterrTaglio.ascx.cs
+++ b/GMW/WebUserControls/mod_sterrTaglio.ascx.cs
@@ -6,608 +6,608 @@ using System.Web.UI.WebControls;
namespace GMW.WebUserControls
{
- public partial class mod_sterrTaglio : System.Web.UI.UserControl
+ public partial class mod_sterrTaglio : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a sterrati
+ ///
+ protected string flusso = "ST";
+ ///
+ /// stato associato (hard coded) a sterrati
+ ///
+ protected string statoUDC = "Sterr";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_STTA";
+ ///
+ /// tipo di evento associato alla modifica qta dell'UDC
+ ///
+ protected string eventoUDC_qta = "UDC_QTY";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a sterrati
- ///
- protected string flusso = "ST";
- ///
- /// stato associato (hard coded) a sterrati
- ///
- protected string statoUDC = "Sterr";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_STTA";
- ///
- /// tipo di evento associato alla modifica qta dell'UDC
- ///
- protected string eventoUDC_qta = "UDC_QTY";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ qta = 0;
+ // imposto destAL
+ destAL = AlByCella;
+ traduciObj();
+ idxCella = Postazione.currIdxCella;
+ checkNumKeyIn();
+ }
+ setVisibility();
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaST"))
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaST");
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaST", value);
+ }
+ }
+ ///
+ /// Codice AL associato alla cella corrente...
+ ///
+ protected string AlByCella
+ {
+ get
+ {
+ string answ = "";
+ try
{
- if (!Page.IsPostBack)
- {
- qta = 0;
- // imposto destAL
- destAL = AlByCella;
- traduciObj();
- idxCella = Postazione.currIdxCella;
- checkNumKeyIn();
- }
- setVisibility();
- doChecks();
+ // tolto 2015.06.25
+ //// se avesse perso codice cella rimando a pagina default...
+ //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
+ answ = string.Format("ALS00{0}", Postazione.currCodCella);
+ // controllo se esista AL sennò lo creo...
+ if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
+ {
+ MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
+ }
}
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
- {
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
- }
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
- {
- get
- {
- int answ = 0;
- if (memLayer.ML.isInSessionObject("IdxCellaLineaST"))
- {
- answ = memLayer.ML.IntSessionObj("IdxCellaLineaST");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("IdxCellaLineaST", value);
- }
- }
- ///
- /// Codice AL associato alla cella corrente...
- ///
- protected string AlByCella
- {
- get
- {
- string answ = "";
- try
- {
- // tolto 2015.06.25
- //// se avesse perso codice cella rimando a pagina default...
- //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
- answ = string.Format("ALS00{0}", Postazione.currCodCella);
- // controllo se esista AL sennò lo creo...
- if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
- {
- MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
- }
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// Codice AL target
- ///
- protected string destAL
- {
- get
- {
- return lblAL.Text.Trim();
- }
- set
- {
- lblAL.Text = value;
- }
- }
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
- {
- bool fatto = false;
- // 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;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura {0}", udcReq), tipoLog.EXCEPTION);
- }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// Codice AL target
+ ///
+ protected string destAL
+ {
+ get
+ {
+ return lblAL.Text.Trim();
+ }
+ set
+ {
+ lblAL.Text = value;
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura {0}", udcReq), tipoLog.EXCEPTION);
+ }
#if false
if (false) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura");
#endif
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// udc da stampare
- ///
- protected string udcReq
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica UDC correntemente selezionato
+ ///
+ protected string currUDC
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- if (currParticolare != "")
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
+ {
+ matricola = Convert.ToInt32(barcodeIn);
+ }
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
+ {
+ answ = tipoCodiceBarcode.Comando;
+ }
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
+ {
+ answ = tipoCodiceBarcode.Particolare;
+ }
+ else if (barcodeIn.StartsWith(preCodSogg))
+ {
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else if (matricola >= 0)
+ {
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
{
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
- // aggiungo descrizione del particolare
- string descr = "";
- string disegno = "";
- try
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ Postazione.warningText = "";
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.UDC:
+ // effettuo controlli che destAL siano disponibili...
+ if (destAL != "ALS00")
+ {
+ // procedo solo se UDC esistente
+ if (MagClass.magazzino.checkUDC(barcodeIn))
+ {
+ // controllo se NON ci siano NC "pending"
+ if (MagClass.magazzino.checkUDC_NC(barcodeIn) != checkUdcNc.HasNc)
{
- 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 = "";
- }
- }
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica UDC correntemente selezionato
- ///
- protected string currUDC
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ /********************************************************************
+ * procedo per UDC in ingresso:
+ * - deve essere di tipo IN
+ * - se NON c'è UDC in AL dest a parti particolare LO CREO
+ * - se c'era già UDC per lo stesso particolare --> consumo (il vecchio)
+ * - associo UDC letto ad UDC in AL dest a pari particolare
+ *
+ ********************************************************************/
+
+ // controllo IdxPosizione dell'UDC e confronto con posizione in webconfig x fusi (pre sterratura/taglio)
+ int IdxPosizione = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].IdxPosizione;
+ if (IdxPosizione == memLayer.ML.cdvi("IdxPosizioneFusi"))
+ {
+
+ // calcolo nuovo particolare
+ string newPart = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
+ string udcDest = "";
+ // imposto particolare!
+ currParticolare = newPart;
+
+
+ int idxCellaCurr = 0;
+ try
{
- answ = tipoCodiceBarcode.Operatore;
+ idxCellaCurr = MagClass.magazzino.taPosUdcCorr.getByUDC(barcodeIn)[0].IdxCella;
}
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ catch
+ { }
+ string codBloccoCurr = "";
+ int idxBlocco = 0;
+ try
{
- answ = tipoCodiceBarcode.Operatore;
+ idxBlocco = MagClass.magazzino.taCelle.getByIdxCella(idxCellaCurr)[0].IdxBlocco;
+ codBloccoCurr = MagClass.magazzino.taBlocchi.getByIdx(idxBlocco)[0].CodBlocco;
}
+ catch
+ { }
+
+ // 2015.01.12 controllo UDC non già su altre postazioni...
+ if (codBloccoCurr == Postazione.currCodBlocco && idxCellaCurr != Postazione.currIdxCella)
+ {
+ Postazione.messaggiText += " - Attenzione, UDC già caricato su ALTRA LINEA!";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ else
+ {
+ // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
+ udcDest = checkCreaUDC();
+
+ // verifico che NON SIA GIA' associato...
+ bool udcGiaAssociato = false;
+ try
+ {
+ udcGiaAssociato = MagClass.magazzino.checkAssociazioneUdcParent(udcDest, barcodeIn);
+ }
+ catch
+ { }
+ if (!udcGiaAssociato)
+ {
+ // associo UDC con quello di destinazione SE NECESSARIO
+ MagClass.magazzino.associaUdcParent(udcDest, barcodeIn, true);
+ }
+ // controllo se UDC non sia già stato spostato in posizione... dsMagazzino, posizUdcCorrente, getByUdc
+ if (idxCellaCurr == Postazione.currIdxCella)
+ {
+ Postazione.messaggiText += " - Attenzione, UDC già caricato!";
+ Postazione.CssClass = "stileComandoKo";
+ // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
+ checkCreaUDC();
+ }
+ else
+ {
+ // verifico per eventuale consumo vecchio UDC... cerco nella posizione
+ DS_magazzino.v_UdcDetailDataTable tabUdcDet = null;
+ try
+ {
+ // cerco nella posizione
+ tabUdcDet = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(idxCella);
+ }
+ catch
+ { }
+ // carico UDC letto in cella...
+ DateTime adesso = DateTime.Now;
+ string noteTrim = Postazione.currNomeLinea;
+ // cerco se NON ci sia l'UDC letto...
+ if (tabUdcDet.Select(string.Format("UDC = '{0}'", barcodeIn)).Length == 0)
+ {
+ string oldUdc = "";
+ try
+ {
+ oldUdc = ((DS_magazzino.v_UdcDetailRow)tabUdcDet.Select(string.Format("Particolare = '{0}'", currParticolare))[0]).UDC;
+ }
+ catch
+ { }
+ // se trovo un altro UDC dello stesso particolare...
+ if (oldUdc != "")
+ {
+ // consumo UDC
+ consumaUdc(oldUdc);
+ }
+
+ // se ho cod cella sposto UDC in nuova posizione!
+ MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), barcodeIn, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
+ // registro spostamento UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, barcodeIn, currParticolare, "spostaUDC", string.Format("Caricato UDC Fusi su linea {2}, qta: {0} {1} ", qta, noteTrim, Postazione.currCodLinea));
+
+ }
+ Postazione.CssClass = "stileComandoOk";
+ }
+ }
+ }
+ else
+ {
+ // udc NON corretto, mostro errore...
+ Postazione.messaggiText += " - Attenzione, UDC NON VALIDO (IdxPosizione)!";
+ Postazione.CssClass = "stileComandoKo";
+ }
+ // controllo SE PER CASO ci fosse NC e ci sia stata deroga, cambio MSG...
+ if (MagClass.magazzino.checkUDC_NC(barcodeIn) == checkUdcNc.ChkDis_HasNc)
+ {
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.messaggiText += string.Format("
{0}", traduci("ERR-NC-001"));
+ // recupero l'NC associata...
+ Postazione.warningText += string.Format("
{0}", MagClass.magazzino.getDescrNc2Udc(barcodeIn));
+ }
}
else
{
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.messaggiText += string.Format("
{0}", traduci("ERR-NC-001"));
+ // recupero l'NC associata...
+ Postazione.warningText += string.Format("
{0}", MagClass.magazzino.getDescrNc2Udc(barcodeIn));
}
- return answ;
+ }
+
+ // update
+ doUpdate();
}
+ else
+ {
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.messaggiText += string.Format("
{0}", traduci("ERR-ALS00"));
+ }
+
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- Postazione.warningText = "";
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.UDC:
- // effettuo controlli che destAL siano disponibili...
- if (destAL != "ALS00")
- {
- // procedo solo se UDC esistente
- if (MagClass.magazzino.checkUDC(barcodeIn))
- {
- // controllo se NON ci siano NC "pending"
- if (MagClass.magazzino.checkUDC_NC(barcodeIn) != checkUdcNc.HasNc)
- {
- /********************************************************************
- * procedo per UDC in ingresso:
- * - deve essere di tipo IN
- * - se NON c'è UDC in AL dest a parti particolare LO CREO
- * - se c'era già UDC per lo stesso particolare --> consumo (il vecchio)
- * - associo UDC letto ad UDC in AL dest a pari particolare
- *
- ********************************************************************/
-
- // controllo IdxPosizione dell'UDC e confronto con posizione in webconfig x fusi (pre sterratura/taglio)
- int IdxPosizione = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].IdxPosizione;
- if (IdxPosizione == memLayer.ML.cdvi("IdxPosizioneFusi"))
- {
-
- // calcolo nuovo particolare
- string newPart = DataProxy.obj.taCartellini.stp_getByUdc(barcodeIn)[0].Particolare;
- string udcDest = "";
- // imposto particolare!
- currParticolare = newPart;
-
-
- int idxCellaCurr = 0;
- try
- {
- idxCellaCurr = MagClass.magazzino.taPosUdcCorr.getByUDC(barcodeIn)[0].IdxCella;
- }
- catch
- { }
- string codBloccoCurr = "";
- int idxBlocco = 0;
- try
- {
- idxBlocco = MagClass.magazzino.taCelle.getByIdxCella(idxCellaCurr)[0].IdxBlocco;
- codBloccoCurr = MagClass.magazzino.taBlocchi.getByIdx(idxBlocco)[0].CodBlocco;
- }
- catch
- { }
-
- // 2015.01.12 controllo UDC non già su altre postazioni...
- if (codBloccoCurr == Postazione.currCodBlocco && idxCellaCurr != Postazione.currIdxCella)
- {
- Postazione.messaggiText += " - Attenzione, UDC già caricato su ALTRA LINEA!";
- Postazione.CssClass = "stileComandoKo";
- }
- else
- {
- // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
- udcDest = checkCreaUDC();
-
- // verifico che NON SIA GIA' associato...
- bool udcGiaAssociato = false;
- try
- {
- udcGiaAssociato = MagClass.magazzino.checkAssociazioneUdcParent(udcDest, barcodeIn);
- }
- catch
- { }
- if (!udcGiaAssociato)
- {
- // associo UDC con quello di destinazione SE NECESSARIO
- MagClass.magazzino.associaUdcParent(udcDest, barcodeIn, true);
- }
- // controllo se UDC non sia già stato spostato in posizione... dsMagazzino, posizUdcCorrente, getByUdc
- if (idxCellaCurr == Postazione.currIdxCella)
- {
- Postazione.messaggiText += " - Attenzione, UDC già caricato!";
- Postazione.CssClass = "stileComandoKo";
- // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
- checkCreaUDC();
- }
- else
- {
- // verifico per eventuale consumo vecchio UDC... cerco nella posizione
- DS_magazzino.v_UdcDetailDataTable tabUdcDet = null;
- try
- {
- // cerco nella posizione
- tabUdcDet = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(idxCella);
- }
- catch
- { }
- // carico UDC letto in cella...
- DateTime adesso = DateTime.Now;
- string noteTrim = Postazione.currNomeLinea;
- // cerco se NON ci sia l'UDC letto...
- if (tabUdcDet.Select(string.Format("UDC = '{0}'", barcodeIn)).Length == 0)
- {
- string oldUdc = "";
- try
- {
- oldUdc = ((DS_magazzino.v_UdcDetailRow)tabUdcDet.Select(string.Format("Particolare = '{0}'", currParticolare))[0]).UDC;
- }
- catch
- { }
- // se trovo un altro UDC dello stesso particolare...
- if (oldUdc != "")
- {
- // consumo UDC
- consumaUdc(oldUdc);
- }
-
- // se ho cod cella sposto UDC in nuova posizione!
- MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), barcodeIn, Postazione.currIdxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
- // registro spostamento UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, barcodeIn, currParticolare, "spostaUDC", string.Format("Caricato UDC Fusi su linea {2}, qta: {0} {1} ", qta, noteTrim, Postazione.currCodLinea));
-
- }
- Postazione.CssClass = "stileComandoOk";
- }
- }
- }
- else
- {
- // udc NON corretto, mostro errore...
- Postazione.messaggiText += " - Attenzione, UDC NON VALIDO (IdxPosizione)!";
- Postazione.CssClass = "stileComandoKo";
- }
- // controllo SE PER CASO ci fosse NC e ci sia stata deroga, cambio MSG...
- if (MagClass.magazzino.checkUDC_NC(barcodeIn) == checkUdcNc.ChkDis_HasNc)
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.messaggiText += string.Format("
{0}", traduci("ERR-NC-001"));
- // recupero l'NC associata...
- Postazione.warningText += string.Format("
{0}", MagClass.magazzino.getDescrNc2Udc(barcodeIn));
- }
- }
- else
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.messaggiText += string.Format("
{0}", traduci("ERR-NC-001"));
- // recupero l'NC associata...
- Postazione.warningText += string.Format("
{0}", MagClass.magazzino.getDescrNc2Udc(barcodeIn));
- }
- }
-
- // update
- doUpdate();
- }
- else
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.messaggiText += string.Format("
{0}", traduci("ERR-ALS00"));
- }
-
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
+ barcodeIn = "";
+ }
#if false
else
{
@@ -615,575 +615,575 @@ namespace GMW.WebUserControls
Postazione.CssClass = "stileAttesa";
}
#endif
- txtBarcode.Focus();
- }
- ///
- /// effettua consumo UDC
- ///
- ///
- private void consumaUdc(string oldUdc)
- {
- // se è consumabile (IdxPosizione > 0)...
- if (MagClass.magazzino.udcMpIsConsumabile(oldUdc))
- {
- // consumo UDC
- MagClass.magazzino.scaricaUdcMpWip(oldUdc, Request.UserHostName);
- }
- }
+ txtBarcode.Focus();
+ }
+ ///
+ /// effettua consumo UDC
+ ///
+ ///
+ private void consumaUdc(string oldUdc)
+ {
+ // se è consumabile (IdxPosizione > 0)...
+ if (MagClass.magazzino.udcMpIsConsumabile(oldUdc))
+ {
+ // consumo UDC
+ MagClass.magazzino.scaricaUdcMpWip(oldUdc, Request.UserHostName);
+ }
+ }
- ///
- /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
- ///
- ///
- ///
- private string checkCreaUDC()
+ ///
+ /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
+ ///
+ ///
+ ///
+ private string checkCreaUDC()
+ {
+ string udcDest = "";
+ DateTime adesso = DateTime.Now;
+ // verifico se ho già quel particolare tra quelli dell'AL...
+ try
+ {
+ udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
+ }
+ catch
+ {
+ udcDest = "";
+ }
+ if (udcDest == "")
+ {
+ try
{
- string udcDest = "";
- DateTime adesso = DateTime.Now;
- // verifico se ho già quel particolare tra quelli dell'AL...
+ // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
+ udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
+ // associo UDC a AL...
+ MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in creazione UDC temp ST x travaso: {0}{1}", Environment.NewLine, exc));
+ }
+ }
+ if (udcDest != "")
+ {
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("partAdded");
+ }
+ else
+ {
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.warningText = traduci("ErroreUdcDest");
+ }
+ grViewDest.DataBind();
+ return udcDest;
+ }
+
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ destAL = AlByCella;
+ setVisibility();
+ checkStampa();
+ grView.DataBind();
+ grViewDest.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - udc da consumo totale/parziale
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ //controllo siano inseriti valori qta
+ if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
+ {
+ // controllo ci siano particolare
+ if (currParticolare != "")
+ {
+ stampaOk = true;
+ txtNote.Focus();
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ string[] stringSeparators = new string[] { "#" };
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ DateTime adesso = DateTime.Now;
+ string noteTrim = txtNote.Text.Trim();
+ string lineaCesta = string.Format("{0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
+ noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
+
+ // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
+ if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
+ {
+
+ // aggiorno note e posizione da temp a definitivo x UDC...
+ MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
+
+ if (OpAuth.isAuth)
+ {
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
+ }
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Sterr Taglio, qta: {0} {1}", qta, ""));
+ // tolgo UDC da AL corrente...
+ MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
+
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
+ // incremento timing...
+ adesso = adesso.AddSeconds(2);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Sterrato");
+ // svuoto campo cesta...
+ numCesta = "";
+
+ // 2016.06.15 modifica per creare subito un NUOVO UDC connesso a quello in origine... QTA 0 !!!
+ string udcParent = "";
+ // recupero parent... IL PIU RECENTE!!!
try
{
- udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
- }
- catch
- {
- udcDest = "";
- }
- if (udcDest == "")
- {
- try
- {
- // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
- udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
- // associo UDC a AL...
- MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in creazione UDC temp ST x travaso: {0}{1}", Environment.NewLine, exc));
- }
- }
- if (udcDest != "")
- {
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("partAdded");
- }
- else
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.warningText = traduci("ErroreUdcDest");
- }
- grViewDest.DataBind();
- return udcDest;
- }
-
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- destAL = AlByCella;
- setVisibility();
- checkStampa();
- grView.DataBind();
- grViewDest.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - udc da consumo totale/parziale
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- //controllo siano inseriti valori qta
- if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
- {
- // controllo ci siano particolare
- if (currParticolare != "")
- {
- stampaOk = true;
- txtNote.Focus();
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- string[] stringSeparators = new string[] { "#" };
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- DateTime adesso = DateTime.Now;
- string noteTrim = txtNote.Text.Trim();
- string lineaCesta = string.Format("{0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
- noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
-
- // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
- if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
- {
-
- // aggiorno note e posizione da temp a definitivo x UDC...
- MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Sterr Taglio, qta: {0} {1}", qta, ""));
- // tolgo UDC da AL corrente...
- MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
-
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
- // incremento timing...
- adesso = adesso.AddSeconds(2);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Sterrato");
- // svuoto campo cesta...
- numCesta = "";
-
- // 2016.06.15 modifica per creare subito un NUOVO UDC connesso a quello in origine... QTA 0 !!!
- string udcParent = "";
- // recupero parent... IL PIU RECENTE!!!
- try
- {
- udcParent = MagClass.magazzino.getUdcParentDesc(currUDC);
- }
- catch
- { }
- // controllo che sia DAVVERO caricato UDC parent...
- string oldUdc = "";
- // verifico per eventuale consumo vecchio UDC... cerco nella posizione
- DS_magazzino.v_UdcDetailDataTable tabUdcDet = null;
- try
- {
- // cerco nella posizione
- tabUdcDet = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(idxCella);
- }
- catch
- { }
- try
- {
- oldUdc = ((DS_magazzino.v_UdcDetailRow)tabUdcDet.Select(string.Format("UDC = '{0}'", udcParent))[0]).UDC;
- }
- catch
- { }
- // PROCEDO SOLO SE HO UN UDC IN INGRESSO!!!
- if (udcParent != "" && oldUdc != "")
- {
- // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
- string udcDest = "";
- udcDest = checkCreaUDC();
- // associo UDC con quello di destinazione
- MagClass.magazzino.associaUdcParent(udcDest, udcParent, true);
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato ed associato nuovo UDC Sterr Taglio con codice {2}, qta: {0}, UDC Parent: {1}", qta, udcParent, udcDest));
- }
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("STERRATI, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- }
- ///
- /// effettua il consumo di tutti gli UDC inviati come array di stringhe
- ///
- ///
- 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...
- }
- }
- }
- }
- }
- ///
- ///associa nuovo UDC ad elenco UDC
- ///
- /// UDC da associare come child
- /// vettore di UDC da associare come parent
- 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);
- }
- }
- }
- }
- ///
- /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
- ///
- /// vettore di UDC da verificare
- private string checkPartUDC(string[] UDC_P)
- {
- string answ = "";
- if (UDC_P.Length > 0)
- {
- // imposto il primo particolare...
- answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
- // ciclo
- foreach (string udc_p in UDC_P)
- {
- if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
- }
- }
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- grViewDest.SelectedIndex = -1;
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// passo alla modalità IN
- ///
- ///
- ///
- protected void btnIn_Click(object sender, EventArgs e)
- {
- Response.Redirect("SterrTaglioIN.aspx");
- }
-
- ///
- /// effettua refresh (su db) del blocco postazione
- ///
- ///
- 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);
- }
- }
-
- protected void grView_PageIndexChanged(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- protected void grView_Sorted(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
- ///
- /// traduce gli header delle colonne
- ///
- ///
- ///
- 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 = "";
- }
- }
- ///
- /// evento selezione grView destinazione: ricarico dati!
- ///
- ///
- ///
- protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
- {
- // ricarico dati dell'UDC come particolare e quantità...
- currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
- if (MagClass.magazzino.checkUDC(currUDC))
- {
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
- qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
- }
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- doChecks();
- doUpdate();
- // fisso focus su note!
- txtNote.Focus();
- }
- ///
- /// sistema modalità input
- ///
- private void setVisibility()
- {
- bool showBtn = false;
- // ora controllo btn quantità
- if (grViewDest.SelectedIndex >= 0)
- {
- showBtn = true;
- }
- divQta.Visible = showBtn;
- }
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- grViewDest.SelectedIndex = -1;
- qta = 0;
- currUDC = "";
- currParticolare = "";
- setVisibility();
- doUpdate();
- }
- ///
- /// update Qty x UDC selezionato...
- ///
- ///
- ///
- protected void lbtUpdQty_Click(object sender, EventArgs e)
- {
- aggiornaQta();
- }
-
- private void aggiornaQta()
- {
- MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
- currUDC = "";
- currParticolare = "";
- grViewDest.SelectedIndex = -1;
- setVisibility();
- doUpdate();
- }
- ///
- /// Numero cesta inserito
- ///
- public string numCesta
- {
- get
- {
- return txtCesta.Text.Trim();
- }
- set
- {
- txtCesta.Text = value;
- }
- }
- ///
- /// evento cambio num cesta/grappolo
- ///
- ///
- ///
- protected void txtCesta_TextChanged(object sender, EventArgs e)
- {
- txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
- doUpdate();
- }
- ///
- /// fornisce in output la corretta classe css x icona
- ///
- ///
- ///
- public string cssGlyphByQty(object _qta)
- {
- string answ = "glyphicon glyphicon-pencil";
- int qtaUDC = 0;
- try
- {
- qtaUDC = Convert.ToInt32(_qta);
- }
- catch { }
- if (qtaUDC > 0)
- {
- answ = "glyphicon glyphicon-print";
- }
- return answ;
- }
- ///
- /// qui la selezione è x scaricare...
- ///
- ///
- ///
- protected void grView_SelectedIndexChanged(object sender, EventArgs e)
- {
- consumaUdc(grView.SelectedValue.ToString());
- doUpdate();
- }
- ///
- /// determina se sia possibile cancellare un record, se qta > 0
- ///
- ///
- ///
- public bool canDelete(object _qta)
- {
- bool answ = false;
- try
- {
- answ = Convert.ToInt32(_qta) == 0;
+ udcParent = MagClass.magazzino.getUdcParentDesc(currUDC);
}
catch
{ }
- return answ;
+ // controllo che sia DAVVERO caricato UDC parent...
+ string oldUdc = "";
+ // verifico per eventuale consumo vecchio UDC... cerco nella posizione
+ DS_magazzino.v_UdcDetailDataTable tabUdcDet = null;
+ try
+ {
+ // cerco nella posizione
+ tabUdcDet = MagClass.magazzino.taDettUDC.getUdcDetailByIdxCella(idxCella);
+ }
+ catch
+ { }
+ try
+ {
+ oldUdc = ((DS_magazzino.v_UdcDetailRow)tabUdcDet.Select(string.Format("UDC = '{0}'", udcParent))[0]).UDC;
+ }
+ catch
+ { }
+ // PROCEDO SOLO SE HO UN UDC IN INGRESSO!!!
+ if (udcParent != "" && oldUdc != "")
+ {
+ // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
+ string udcDest = "";
+ udcDest = checkCreaUDC();
+ // associo UDC con quello di destinazione
+ MagClass.magazzino.associaUdcParent(udcDest, udcParent, true);
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato ed associato nuovo UDC Sterr Taglio con codice {2}, qta: {0}, UDC Parent: {1}", qta, udcParent, udcDest));
+ }
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("STERRATI, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
}
- ///
- /// evento cambio qta
- ///
- ///
- ///
- protected void txtQta_TextChanged(object sender, EventArgs e)
+ else
{
- aggiornaQta();
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
}
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
}
+ ///
+ /// effettua il consumo di tutti gli UDC inviati come array di stringhe
+ ///
+ ///
+ 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...
+ }
+ }
+ }
+ }
+ }
+ ///
+ ///associa nuovo UDC ad elenco UDC
+ ///
+ /// UDC da associare come child
+ /// vettore di UDC da associare come parent
+ 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);
+ }
+ }
+ }
+ }
+ ///
+ /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
+ ///
+ /// vettore di UDC da verificare
+ private string checkPartUDC(string[] UDC_P)
+ {
+ string answ = "";
+ if (UDC_P.Length > 0)
+ {
+ // imposto il primo particolare...
+ answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
+ // ciclo
+ foreach (string udc_p in UDC_P)
+ {
+ if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
+ }
+ }
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ grViewDest.SelectedIndex = -1;
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// passo alla modalità IN
+ ///
+ ///
+ ///
+ protected void btnIn_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("SterrTaglioIN.aspx");
+ }
+
+ ///
+ /// effettua refresh (su db) del blocco postazione
+ ///
+ ///
+ 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);
+ }
+ }
+
+ protected void grView_PageIndexChanged(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ protected void grView_Sorted(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+ ///
+ /// traduce gli header delle colonne
+ ///
+ ///
+ ///
+ 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 = "";
+ }
+ }
+ ///
+ /// evento selezione grView destinazione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // ricarico dati dell'UDC come particolare e quantità...
+ currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
+ if (MagClass.magazzino.checkUDC(currUDC))
+ {
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
+ qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
+ }
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ doChecks();
+ doUpdate();
+ // fisso focus su note!
+ txtNote.Focus();
+ }
+ ///
+ /// sistema modalità input
+ ///
+ private void setVisibility()
+ {
+ bool showBtn = false;
+ // ora controllo btn quantità
+ if (grViewDest.SelectedIndex >= 0)
+ {
+ showBtn = true;
+ }
+ divQta.Visible = showBtn;
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ grViewDest.SelectedIndex = -1;
+ qta = 0;
+ currUDC = "";
+ currParticolare = "";
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// update Qty x UDC selezionato...
+ ///
+ ///
+ ///
+ protected void lbtUpdQty_Click(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+
+ private void aggiornaQta()
+ {
+ MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
+ currUDC = "";
+ currParticolare = "";
+ grViewDest.SelectedIndex = -1;
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// Numero cesta inserito
+ ///
+ public string numCesta
+ {
+ get
+ {
+ return txtCesta.Text.Trim();
+ }
+ set
+ {
+ txtCesta.Text = value;
+ }
+ }
+ ///
+ /// evento cambio num cesta/grappolo
+ ///
+ ///
+ ///
+ protected void txtCesta_TextChanged(object sender, EventArgs e)
+ {
+ txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
+ doUpdate();
+ }
+ ///
+ /// fornisce in output la corretta classe css x icona
+ ///
+ ///
+ ///
+ public string cssGlyphByQty(object _qta)
+ {
+ string answ = "glyphicon glyphicon-pencil";
+ int qtaUDC = 0;
+ try
+ {
+ qtaUDC = Convert.ToInt32(_qta);
+ }
+ catch { }
+ if (qtaUDC > 0)
+ {
+ answ = "glyphicon glyphicon-print";
+ }
+ return answ;
+ }
+ ///
+ /// qui la selezione è x scaricare...
+ ///
+ ///
+ ///
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ consumaUdc(grView.SelectedValue.ToString());
+ doUpdate();
+ }
+ ///
+ /// determina se sia possibile cancellare un record, se qta > 0
+ ///
+ ///
+ ///
+ public bool canDelete(object _qta)
+ {
+ bool answ = false;
+ try
+ {
+ answ = Convert.ToInt32(_qta) == 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// evento cambio qta
+ ///
+ ///
+ ///
+ protected void txtQta_TextChanged(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW/WebUserControls/mod_sterrTaglioFC.ascx.cs b/GMW/WebUserControls/mod_sterrTaglioFC.ascx.cs
index 4d730373..29023a48 100644
--- a/GMW/WebUserControls/mod_sterrTaglioFC.ascx.cs
+++ b/GMW/WebUserControls/mod_sterrTaglioFC.ascx.cs
@@ -5,467 +5,467 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
- public partial class mod_sterrTaglioFC : System.Web.UI.UserControl
+ public partial class mod_sterrTaglioFC : System.Web.UI.UserControl
+ {
+ ///
+ /// flusso associato (hard coded) a sterrati
+ ///
+ protected string flusso = "ST";
+ ///
+ /// stato associato (hard coded) a sterrati
+ ///
+ protected string statoUDC = "Sterr";
+ ///
+ /// tipo di evento associato alla creazione dell'UDC
+ ///
+ protected string eventoUDC = "UDC_STTA";
+ ///
+ /// tipo di evento associato alla modifica qta dell'UDC
+ ///
+ protected string eventoUDC_qta = "UDC_QTY";
+ ///
+ /// dati x verifica CodSoggetto / matricola
+ ///
+ protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ public event EventHandler eh_reqUpdate;
+ ///
+ /// stringa UID univoca
+ ///
+ public string uid
{
- ///
- /// flusso associato (hard coded) a sterrati
- ///
- protected string flusso = "ST";
- ///
- /// stato associato (hard coded) a sterrati
- ///
- protected string statoUDC = "Sterr";
- ///
- /// tipo di evento associato alla creazione dell'UDC
- ///
- protected string eventoUDC = "UDC_STTA";
- ///
- /// tipo di evento associato alla modifica qta dell'UDC
- ///
- protected string eventoUDC_qta = "UDC_QTY";
- ///
- /// dati x verifica CodSoggetto / matricola
- ///
- protected string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- public event EventHandler eh_reqUpdate;
- ///
- /// stringa UID univoca
- ///
- public string uid
+ get
+ {
+ return this.UniqueID.Replace("$", "_").Replace("-", "_");
+ }
+ }
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ qta = 0;
+ // imposto destAL
+ destAL = AlByCella;
+ traduciObj();
+ idxCella = Postazione.currIdxCella;
+ checkNumKeyIn();
+ }
+ setVisibility();
+ doChecks();
+ }
+ ///
+ /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
+ ///
+ private void checkNumKeyIn()
+ {
+ if (memLayer.ML.isInSessionObject("numKeyIn"))
+ {
+ barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
+ // svuoto valore in sessione...
+ memLayer.ML.emptySessionVal("numKeyIn");
+ // controllo barcode...
+ checkBarcode();
+ }
+ }
+ ///
+ /// IDX cella associata alla linea corrente
+ ///
+ protected int idxCella
+ {
+ get
+ {
+ int answ = 0;
+ if (memLayer.ML.isInSessionObject("IdxCellaLineaST_FC"))
{
- get
- {
- return this.UniqueID.Replace("$", "_").Replace("-", "_");
- }
+ answ = memLayer.ML.IntSessionObj("IdxCellaLineaST_FC");
}
- ///
- /// caricamento pagina
- ///
- ///
- ///
- protected void Page_Load(object sender, EventArgs e)
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxCellaLineaST_FC", value);
+ }
+ }
+ ///
+ /// Codice AL associato alla cella corrente...
+ ///
+ protected string AlByCella
+ {
+ get
+ {
+ string answ = "";
+ try
{
- if (!Page.IsPostBack)
- {
- qta = 0;
- // imposto destAL
- destAL = AlByCella;
- traduciObj();
- idxCella = Postazione.currIdxCella;
- checkNumKeyIn();
- }
- setVisibility();
- doChecks();
+ // tolto 2015.06.25
+ //// se avesse perso codice cella rimando a pagina default...
+ //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
+ answ = string.Format("ALS00{0}", Postazione.currCodCella);
+ // controllo se esista AL sennò lo creo...
+ if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
+ {
+ MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
+ }
}
- ///
- /// verifico se ci sia in sessione un input da NumKeyb e nel caso lometto in barcodeIn e processo...
- ///
- private void checkNumKeyIn()
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// Codice AL target
+ ///
+ protected string destAL
+ {
+ get
+ {
+ return lblAL.Text.Trim();
+ }
+ set
+ {
+ lblAL.Text = value;
+ }
+ }
+ ///
+ /// richiesta (ri)stampa UDC
+ ///
+ ///
+ ///
+ public void ristampa()
+ {
+ bool fatto = false;
+ // 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;
+ fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
+ }
+ catch
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura FC {0}", udcReq), tipoLog.EXCEPTION);
+ }
+ if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura Fuoriciclo");
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// udc da stampare
+ ///
+ protected string udcReq
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj("udcSelSAO");
+ }
+ }
+ ///
+ /// controlla particolare selezionato
+ ///
+ private void checkParticolare()
+ {
+ if (currParticolare != "")
+ {
+ lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", currParticolare);
+ // aggiungo descrizione del particolare
+ string descr = "";
+ string disegno = "";
+ try
{
- if (memLayer.ML.isInSessionObject("numKeyIn"))
- {
- barcodeIn = memLayer.ML.StringSessionObj("numKeyIn");
- // svuoto valore in sessione...
- memLayer.ML.emptySessionVal("numKeyIn");
- // controllo barcode...
- checkBarcode();
- }
+ DS_magazzino.AnagParticolariRow riga = MagClass.magazzino.taAnagPart.likeSearch(currParticolare, memLayer.ML.StringSessionObj("CodCS"))[0];
+ descr = riga.DescParticolare;
+ disegno = string.Format("( {0} )", riga.DisegnoGrezzo);
}
- ///
- /// IDX cella associata alla linea corrente
- ///
- protected int idxCella
+ catch
+ { }
+ lblDescrAttivo.Text = descr;
+ lblDisegno.Text = disegno;
+ }
+ else
+ {
+ lblParticolareAttivo.Text = "...";
+ lblDescrAttivo.Text = "";
+ lblDisegno.Text = "";
+ }
+ }
+ ///
+ /// effettua controlli visibilità
+ ///
+ private void doChecks()
+ {
+ checkBarcode();
+ checkStampa();
+ checkParticolare();
+ }
+ ///
+ /// sistemo labels oggetti
+ ///
+ private void traduciObj()
+ {
+ //txtBox
+ txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
+ // buttons
+ btnEmptyNote.Text = traduci("btnEmptyNote");
+ }
+ ///
+ /// restituisce il nome della pagina corrente
+ ///
+ 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;
+ }
+ }
+ ///
+ /// wrapper traduzione
+ ///
+ ///
+ ///
+ public string traduci(object lemma)
+ {
+ return user_std.UtSn.Traduci(lemma.ToString());
+ }
+ ///
+ /// indica il codice articolo correntemente selezionato
+ ///
+ 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"));
+ }
+ }
+ ///
+ /// indica UDC correntemente selezionato
+ ///
+ protected string currUDC
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
+ }
+ }
+ ///
+ /// indica se i caratteri vadano forzati a maiuscoli
+ ///
+ public bool forceUppercase
+ {
+ get
+ {
+ return memLayer.ML.confReadBool("forceUppercase");
+ }
+ }
+ ///
+ /// num pezzi dell'ultimo UDC del particolare generato
+ ///
+ public int pezziUdc
+ {
+ get
+ {
+ int answ = 0;
+ try
{
- get
- {
- int answ = 0;
- if (memLayer.ML.isInSessionObject("IdxCellaLineaST_FC"))
- {
- answ = memLayer.ML.IntSessionObj("IdxCellaLineaST_FC");
- }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("IdxCellaLineaST_FC", value);
- }
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(memLayer.ML.StringSessionObj("CodCS"), currParticolare, statoUDC, false)[0].Qta;
}
- ///
- /// Codice AL associato alla cella corrente...
- ///
- protected string AlByCella
+ catch
+ { }
+ return answ;
+ }
+ }
+ ///
+ /// decodifica il tipo barcode acquisito
+ ///
+ public tipoCodiceBarcode tipoBCode
+ {
+ get
+ {
+ tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
+ int trovati = 0;
+ int matricola = -1;
+ // provo a convertire in intero barcode x verifica eventuale matricola...
+ try
{
- get
- {
- string answ = "";
- try
- {
- // tolto 2015.06.25
- //// se avesse perso codice cella rimando a pagina default...
- //if (Postazione.currCodCella == "") Response.Redirect("Default.aspx");
- answ = string.Format("ALS00{0}", Postazione.currCodCella);
- // controllo se esista AL sennò lo creo...
- if (MagClass.magazzino.taEA.getByAL(answ).Rows.Count == 0)
- {
- MagClass.magazzino.taEA.Insert(answ, true, DateTime.Now, MagClass.magazzino.CodSoggCurrUser, "", "");
- }
- }
- catch
- { }
- return answ;
- }
+ matricola = Convert.ToInt32(barcodeIn);
}
- ///
- /// Codice AL target
- ///
- protected string destAL
+ catch
+ { }
+ // controllo non si tratti di un comando...
+ string preCmd = memLayer.ML.AppConf["prefComandi"];
+ if (barcodeIn.StartsWith(preCmd))
{
- get
- {
- return lblAL.Text.Trim();
- }
- set
- {
- lblAL.Text = value;
- }
+ answ = tipoCodiceBarcode.Comando;
}
- ///
- /// richiesta (ri)stampa UDC
- ///
- ///
- ///
- public void ristampa()
+ else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
{
- bool fatto = false;
- // 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;
- fatto = MagClass.magazzino.ristampaUdc(udcReq, Postazione.printer, Request.UserHostName);
- }
- catch
- {
- logger.lg.scriviLog(string.Format("Errore recupero particolare UDC Sterratura FC {0}", udcReq), tipoLog.EXCEPTION);
- }
- if (fatto) MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, udcReq, particolare, "stampaUDC", "Ri-Stampato UDC Sterratura Fuoriciclo");
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
+ answ = tipoCodiceBarcode.Particolare;
}
- ///
- /// udc da stampare
- ///
- protected string udcReq
+ else if (barcodeIn.StartsWith(preCodSogg))
{
- get
- {
- return memLayer.ML.StringSessionObj("udcSelSAO");
- }
+ // cerco cod soggetto...
+ if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
}
- ///
- /// controlla particolare selezionato
- ///
- private void checkParticolare()
+ else if (matricola >= 0)
{
- if (currParticolare != "")
+ if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
+ {
+ answ = tipoCodiceBarcode.Operatore;
+ }
+ }
+ else
+ {
+ try
+ {
+ // cerco tra gitterbox (UDC)...
+ trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
+ if (trovati > 0)
{
- lblParticolareAttivo.Text = string.Format("Particolare selezionato {0}", 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;
+ answ = tipoCodiceBarcode.UDC;
+ }
+ }
+ catch
+ {
+ }
+ }
+ return answ;
+ }
+ }
+ ///
+ /// valore barcode
+ ///
+ public string barcodeIn
+ {
+ get
+ {
+ return txtBarcode.Text.Trim();
+ }
+ set
+ {
+ txtBarcode.Text = value;
+ }
+ }
+ ///
+ /// qta pezzi TOTALE
+ ///
+ public int qta
+ {
+ get
+ {
+ int qta = 0;
+ try
+ {
+ qta = Convert.ToInt32(txtQta.Text.Trim());
+ }
+ catch
+ { }
+ return qta;
+ }
+ set
+ {
+ txtQta.Text = value.ToString();
+ }
+ }
+ ///
+ /// controlla se ci sia un barcode
+ ///
+ private void checkBarcode()
+ {
+ if (barcodeIn != "")
+ {
+ Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
+ switch (tipoBCode)
+ {
+ case tipoCodiceBarcode.Particolare:
+ // 2015.01.29: particolare accettato SOLO SE contiene "*GRZ"
+ if (barcodeIn.IndexOf("GRZ") >= 0)
+ {
+ // imposto il particolare corrente
+ currParticolare = barcodeIn;
+ // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
+ string udcDest = checkCreaUDC();
}
else
{
- lblParticolareAttivo.Text = "...";
- lblDescrAttivo.Text = "";
- lblDisegno.Text = "";
+ Postazione.messaggiText += " - errore particolare non è grezzo!";
+ Postazione.CssClass = "stileComandoND";
}
+ break;
+ case tipoCodiceBarcode.UDC:
+ break;
+ case tipoCodiceBarcode.Operatore:
+ // calcolo matricola utente
+ int MatrUtente = -1;
+ string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
+ if (barcodeIn.StartsWith(preCodSogg))
+ {
+ MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
+ }
+ else
+ {
+ MatrUtente = Convert.ToInt32(barcodeIn);
+ }
+ if (MatrUtente >= 0)
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.startOpAuth(MatrUtente);
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRec");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ else
+ {
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ }
+ break;
+ default:
+ // cerco se sia "0" = reset utente...
+ if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
+ {
+ // salvo in sessione operatore con AUTH
+ OpAuth.stopAuth();
+ // mostro che ho autorizzato...
+ Postazione.messaggiText += traduci("userAuthRem");
+ Postazione.CssClass = "stileComandoOk";
+ Response.Redirect(user_std.pagCorrente);
+ }
+ Postazione.messaggiText += " - codice non riconosciuto!";
+ Postazione.CssClass = "stileComandoND";
+ break;
}
- ///
- /// effettua controlli visibilità
- ///
- private void doChecks()
- {
- checkBarcode();
- checkStampa();
- checkParticolare();
- }
- ///
- /// sistemo labels oggetti
- ///
- private void traduciObj()
- {
- //txtBox
- txtQta.Text = memLayer.ML.cdv("QtaImballoSterr");
- // buttons
- btnEmptyNote.Text = traduci("btnEmptyNote");
- }
- ///
- /// restituisce il nome della pagina corrente
- ///
- 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;
- }
- }
- ///
- /// wrapper traduzione
- ///
- ///
- ///
- public string traduci(object lemma)
- {
- return user_std.UtSn.Traduci(lemma.ToString());
- }
- ///
- /// indica il codice articolo correntemente selezionato
- ///
- 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"));
- }
- }
- ///
- /// indica UDC correntemente selezionato
- ///
- protected string currUDC
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("UDC_{0}", uid));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("UDC_{0}", uid), value, memLayer.ML.confReadBool("keepParticolareSel"));
- }
- }
- ///
- /// indica se i caratteri vadano forzati a maiuscoli
- ///
- public bool forceUppercase
- {
- get
- {
- return memLayer.ML.confReadBool("forceUppercase");
- }
- }
- ///
- /// num pezzi dell'ultimo UDC del particolare generato
- ///
- 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;
- }
- }
- ///
- /// decodifica il tipo barcode acquisito
- ///
- public tipoCodiceBarcode tipoBCode
- {
- get
- {
- tipoCodiceBarcode answ = tipoCodiceBarcode.ND;
- int trovati = 0;
- int matricola = -1;
- // provo a convertire in intero barcode x verifica eventuale matricola...
- try
- {
- matricola = Convert.ToInt32(barcodeIn);
- }
- catch
- { }
- // controllo non si tratti di un comando...
- string preCmd = memLayer.ML.AppConf["prefComandi"];
- if (barcodeIn.StartsWith(preCmd))
- {
- answ = tipoCodiceBarcode.Comando;
- }
- else if ((TermClass.Ter.riconosciBarcode(barcodeIn) == tipoCodiceBarcode.Particolare)) // è un particolare...
- {
- answ = tipoCodiceBarcode.Particolare;
- }
- else if (barcodeIn.StartsWith(preCodSogg))
- {
- // cerco cod soggetto...
- if (DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else if (matricola >= 0)
- {
- if (DataProxy.obj.taTrascSogg.getByKey("", matricola).Rows.Count == 1)
- {
- answ = tipoCodiceBarcode.Operatore;
- }
- }
- else
- {
- try
- {
- // cerco tra gitterbox (UDC)...
- trovati = MagClass.magazzino.taCartellini.getByUdc(barcodeIn).Rows.Count;
- if (trovati > 0)
- {
- answ = tipoCodiceBarcode.UDC;
- }
- }
- catch
- {
- }
- }
- return answ;
- }
- }
- ///
- /// valore barcode
- ///
- public string barcodeIn
- {
- get
- {
- return txtBarcode.Text.Trim();
- }
- set
- {
- txtBarcode.Text = value;
- }
- }
- ///
- /// qta pezzi TOTALE
- ///
- public int qta
- {
- get
- {
- int qta = 0;
- try
- {
- qta = Convert.ToInt32(txtQta.Text.Trim());
- }
- catch
- { }
- return qta;
- }
- set
- {
- txtQta.Text = value.ToString();
- }
- }
- ///
- /// controlla se ci sia un barcode
- ///
- private void checkBarcode()
- {
- if (barcodeIn != "")
- {
- Postazione.messaggiText = string.Format("Barcode digitato: {0}", barcodeIn);
- switch (tipoBCode)
- {
- case tipoCodiceBarcode.Particolare:
- // 2015.01.29: particolare accettato SOLO SE contiene "*GRZ"
- if (barcodeIn.IndexOf("GRZ") >= 0)
- {
- // imposto il particolare corrente
- currParticolare = barcodeIn;
- // controllo SE esista già UDC in AL dest... altrimenti CREO!!!
- string udcDest = checkCreaUDC();
- }
- else
- {
- Postazione.messaggiText += " - errore particolare non è grezzo!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- case tipoCodiceBarcode.UDC:
- break;
- case tipoCodiceBarcode.Operatore:
- // calcolo matricola utente
- int MatrUtente = -1;
- string preCodSogg = memLayer.ML.AppConf["prefCodSogg"];
- if (barcodeIn.StartsWith(preCodSogg))
- {
- MatrUtente = DataProxy.obj.taTrascSogg.getByKey(barcodeIn, 0)[0].CodMatricola;
- }
- else
- {
- MatrUtente = Convert.ToInt32(barcodeIn);
- }
- if (MatrUtente >= 0)
- {
- // salvo in sessione operatore con AUTH
- OpAuth.startOpAuth(MatrUtente);
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRec");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- else
- {
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- }
- break;
- default:
- // cerco se sia "0" = reset utente...
- if (barcodeIn == memLayer.ML.CRS("resetCodSogg"))
- {
- // salvo in sessione operatore con AUTH
- OpAuth.stopAuth();
- // mostro che ho autorizzato...
- Postazione.messaggiText += traduci("userAuthRem");
- Postazione.CssClass = "stileComandoOk";
- Response.Redirect(user_std.pagCorrente);
- }
- Postazione.messaggiText += " - codice non riconosciuto!";
- Postazione.CssClass = "stileComandoND";
- break;
- }
- barcodeIn = "";
- }
+ barcodeIn = "";
+ }
#if false
else
{
@@ -473,493 +473,493 @@ namespace GMW.WebUserControls
Postazione.CssClass = "stileAttesa";
}
#endif
- txtBarcode.Focus();
- }
-
- ///
- /// effettua consumo UDC
- ///
- ///
- private void consumaUdc(string oldUdc)
- {
- // se è consumabile (IdxPosizione > 0)...
- if (MagClass.magazzino.udcMpIsConsumabile(oldUdc))
- {
- // consumo UDC
- MagClass.magazzino.scaricaUdcMpWip(oldUdc, Request.UserHostName);
- }
- }
-
- ///
- /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
- ///
- ///
- ///
- private string checkCreaUDC()
- {
- string udcDest = "";
- DateTime adesso = DateTime.Now;
- // verifico se ho già quel particolare tra quelli dell'AL...
- try
- {
- udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
- }
- catch
- {
- udcDest = "";
- }
- if (udcDest == "")
- {
- try
- {
- // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
- udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
- // associo UDC a AL...
- MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in creazione UDC temp ST x travaso: {0}{1}", Environment.NewLine, exc));
- }
- }
- if (udcDest != "")
- {
- Postazione.CssClass = "stileAttesa";
- Postazione.warningText = "";
- Postazione.messaggiText = traduci("partAdded");
- }
- else
- {
- Postazione.CssClass = "stileComandoKo";
- Postazione.warningText = traduci("ErroreUdcDest");
- }
- grViewDest.DataBind();
- return udcDest;
- }
-
- ///
- /// aggiorna tabella + focus a barcode
- ///
- public void doUpdate()
- {
- idxCella = Postazione.currIdxCella;
- destAL = AlByCella;
- setVisibility();
- checkStampa();
- grViewDest.DataBind();
- txtBarcode.Focus();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// controllo l'abilitazione alla stampa UDC:
- /// - particolare ok
- /// - qta > 0
- /// - udc da consumo totale/parziale
- /// altrimenti disabilito btn stampa
- ///
- private void checkStampa()
- {
- bool stampaOk = false;
- //controllo siano inseriti valori qta
- if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
- {
- // controllo ci siano particolare
- if (currParticolare != "")
- {
- stampaOk = true;
- txtNote.Focus();
- }
- }
- divNote.Visible = stampaOk;
- }
- ///
- /// genera i barcode di
- /// - trattamenti
- /// - nuovo x pezzi liquidi
- /// e lancia la relativa stampa
- ///
- ///
- ///
- protected void btnStampa_Click(object sender, EventArgs e)
- {
- bool needsRedirect = false;
- string[] stringSeparators = new string[] { "#" };
- // verifico postazione x procedere...
- if (Postazione.printer != "n.d.")
- {
- // verifico auth utente OPPURE se NON sia richiesta...
- if (OpAuth.isAuth || !OpAuth.opAuthReq)
- {
- DateTime adesso = DateTime.Now;
-
- string noteTrim = txtNote.Text.Trim();
- string lineaCesta = string.Format("FUORICICLO | {0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
- noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
- //string noteTrim = txtNote.Text.Trim();
- //noteTrim = string.Format("FUORICICLO{0}{1}", Environment.NewLine, noteTrim);
-
- // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
- if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
- {
- // aggiorno note e posizione da temp a definitiv x UDC...
- MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
-
- if (OpAuth.isAuth)
- {
- // salvo attributo dell'OpAuth...
- MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // consumo una auth...
- OpAuth.currAuth.remAuth--;
- if (OpAuth.currAuth.remAuth == 0)
- {
- OpAuth.stopAuth();
- needsRedirect = true;
- }
- }
-
- // registro creazione nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Sterr Taglio FC, qta: {0} {1}", qta, ""));
- // metto attributo FC
- MagClass.magazzino.taAtt2UDC.Insert(currUDC, "FC", "", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
- // tolgo UDC da AL corrente...
- MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
-
- // ora stampo il nuovo cartellino!!!
- MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
- // incremento timing...
- adesso = adesso.AddSeconds(2);
- // registro stampa nuovo UDC
- MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Sterrato FUORICICLO");
- // svuoto campo cesta...
- numCesta = "";
- // resetto
- doResetData();
- }
- else
- {
- httpLog(string.Format("STERRATI FC, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
- Response.Redirect("~/login.aspx");
- }
- }
- else
- {
- Postazione.messaggiText = traduci("noOpAuth");
- Postazione.CssClass = "stileComandoKo";
- httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
- }
- }
- else
- {
- Response.Redirect("~/menu.aspx");
- }
- doUpdate();
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- if (needsRedirect)
- {
- Response.Redirect(user_std.pagCorrente);
- }
- }
- ///
- /// effettua il consumo di tutti gli UDC inviati come array di stringhe
- ///
- ///
- 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...
- }
- }
- }
- }
- }
- ///
- ///associa nuovo UDC ad elenco UDC
- ///
- /// UDC da associare come child
- /// vettore di UDC da associare come parent
- 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);
- }
- }
- }
- }
- ///
- /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
- ///
- /// vettore di UDC da verificare
- private string checkPartUDC(string[] UDC_P)
- {
- string answ = "";
- if (UDC_P.Length > 0)
- {
- // imposto il primo particolare...
- answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
- // ciclo
- foreach (string udc_p in UDC_P)
- {
- if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
- }
- }
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string _testoPre)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + _testoPre);
- return answ;
- }
- ///
- /// wrapper per log con salvataggio dell'IP del chiamante
- ///
- ///
- ///
- public bool httpLog(string testoLog, tipoLog tipo)
- {
- bool answ = false;
- logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
- return answ;
- }
- ///
- /// effettua reset dati
- ///
- public void doResetData()
- {
- // resetto i dati QtaTot e particolare...
- qta = 0;
- currParticolare = "";
- txtQta.Text = "";
- grViewDest.SelectedIndex = -1;
- doChecks();
- }
- ///
- /// svuoto le note
- ///
- ///
- ///
- protected void btnEmptyNote_Click(object sender, EventArgs e)
- {
- txtNote.Text = "";
- Postazione.messaggiText = traduci("AttesaBCode");
- Postazione.CssClass = "stileAttesa";
- // raise dell'evento
- if (eh_reqUpdate != null)
- {
- eh_reqUpdate(this, new EventArgs());
- }
- }
- ///
- /// passo alla modalità IN
- ///
- ///
- ///
- protected void btnIn_Click(object sender, EventArgs e)
- {
- Response.Redirect("SterrTaglioIN.aspx");
- }
-
- ///
- /// effettua refresh (su db) del blocco postazione
- ///
- ///
- 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);
- }
- }
-
- ///
- /// aggiorno ods al binding..
- ///
- ///
- ///
- protected void ods_DataBinding(object sender, EventArgs e)
- {
- // fix dell'ODS
- checkFixOds();
- }
- ///
- /// verifica se attivo filtro company e imposta ods di conseguenza...
- ///
- private void checkFixOds()
- {
- }
- ///
- /// evento selezione grView destinazione: ricarico dati!
- ///
- ///
- ///
- protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
- {
- // ricarico dati dell'UDC come particolare e quantità...
- currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
- if (MagClass.magazzino.checkUDC(currUDC))
- {
- currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
- qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
- }
- Postazione.messaggiText = traduci("partSelected");
- Postazione.warningText = "";
- Postazione.CssClass = "stileComandoOk";
- doChecks();
- doUpdate();
- // fisso focus su note!
- txtNote.Focus();
- }
- ///
- /// sistema modalità input
- ///
- private void setVisibility()
- {
- bool showBtn = false;
- // ora controllo btn quantità
- if (grViewDest.SelectedIndex >= 0)
- {
- showBtn = true;
- }
- divQta.Visible = showBtn;
- }
- ///
- /// reset della selezione
- ///
- ///
- ///
- protected void btnReset_Click(object sender, EventArgs e)
- {
- grViewDest.SelectedIndex = -1;
- qta = 0;
- currUDC = "";
- currParticolare = "";
- setVisibility();
- doUpdate();
- }
- ///
- /// update Qty x UDC selezionato...
- ///
- ///
- ///
- protected void lbtUpdQty_Click(object sender, EventArgs e)
- {
- aggiornaQta();
- }
-
- private void aggiornaQta()
- {
- MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
- currUDC = "";
- currParticolare = "";
- grViewDest.SelectedIndex = -1;
- setVisibility();
- doUpdate();
- }
- ///
- /// Numero cesta inserito
- ///
- public string numCesta
- {
- get
- {
- return txtCesta.Text.Trim();
- }
- set
- {
- txtCesta.Text = value;
- }
- }
- ///
- /// evento cambio num cesta/grappolo
- ///
- ///
- ///
- protected void txtCesta_TextChanged(object sender, EventArgs e)
- {
- txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
- doUpdate();
- }
- ///
- /// fornisce in output la corretta classe css x icona
- ///
- ///
- ///
- public string cssGlyphByQty(object _qta)
- {
- string answ = "glyphicon glyphicon-pencil";
- int qtaUDC = 0;
- try
- {
- qtaUDC = Convert.ToInt32(_qta);
- }
- catch { }
- if (qtaUDC > 0)
- {
- answ = "glyphicon glyphicon-print";
- }
- return answ;
- }
- ///
- /// determina se sia possibile cancellare un record, se qta > 0
- ///
- ///
- ///
- public bool canDelete(object _qta)
- {
- bool answ = false;
- try
- {
- answ = Convert.ToInt32(_qta) == 0;
- }
- catch
- { }
- return answ;
- }
-
- ///
- /// evento cambio qta
- ///
- ///
- ///
- protected void txtQta_TextChanged(object sender, EventArgs e)
- {
- aggiornaQta();
- }
+ txtBarcode.Focus();
}
+
+ ///
+ /// effettua consumo UDC
+ ///
+ ///
+ private void consumaUdc(string oldUdc)
+ {
+ // se è consumabile (IdxPosizione > 0)...
+ if (MagClass.magazzino.udcMpIsConsumabile(oldUdc))
+ {
+ // consumo UDC
+ MagClass.magazzino.scaricaUdcMpWip(oldUdc, Request.UserHostName);
+ }
+ }
+
+ ///
+ /// crea eventualmente UDC per particolare in AL di destinazione e restituisce codice UDC
+ ///
+ ///
+ ///
+ private string checkCreaUDC()
+ {
+ string udcDest = "";
+ DateTime adesso = DateTime.Now;
+ // verifico se ho già quel particolare tra quelli dell'AL...
+ try
+ {
+ udcDest = MagClass.magazzino.taCartellini.getByParticolareAL(currParticolare, destAL)[0].UDC;
+ }
+ catch
+ {
+ udcDest = "";
+ }
+ if (udcDest == "")
+ {
+ try
+ {
+ // creo nuovo UDC ST... direttamente in posizione definitiva e con un evento differente...
+ udcDest = MagClass.magazzino.creaUdc(flusso, "", currParticolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoSterr"), "U", MagClass.magazzino.CodSoggCurrUser, 0, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneSterratiTemp"), "IdxPosizioneSterratiTemp", eventoUDC, "", "", adesso.Year, Request.UserHostName);
+ // associo UDC a AL...
+ MagClass.magazzino.taAL2UDC.Insert(destAL, udcDest, adesso, MagClass.magazzino.CodSoggCurrUser);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in creazione UDC temp ST x travaso: {0}{1}", Environment.NewLine, exc));
+ }
+ }
+ if (udcDest != "")
+ {
+ Postazione.CssClass = "stileAttesa";
+ Postazione.warningText = "";
+ Postazione.messaggiText = traduci("partAdded");
+ }
+ else
+ {
+ Postazione.CssClass = "stileComandoKo";
+ Postazione.warningText = traduci("ErroreUdcDest");
+ }
+ grViewDest.DataBind();
+ return udcDest;
+ }
+
+ ///
+ /// aggiorna tabella + focus a barcode
+ ///
+ public void doUpdate()
+ {
+ idxCella = Postazione.currIdxCella;
+ destAL = AlByCella;
+ setVisibility();
+ checkStampa();
+ grViewDest.DataBind();
+ txtBarcode.Focus();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// controllo l'abilitazione alla stampa UDC:
+ /// - particolare ok
+ /// - qta > 0
+ /// - udc da consumo totale/parziale
+ /// altrimenti disabilito btn stampa
+ ///
+ private void checkStampa()
+ {
+ bool stampaOk = false;
+ //controllo siano inseriti valori qta
+ if (numCesta != "" && numCesta != "0000" && qta > 0 && grViewDest.SelectedIndex >= 0)
+ {
+ // controllo ci siano particolare
+ if (currParticolare != "")
+ {
+ stampaOk = true;
+ txtNote.Focus();
+ }
+ }
+ divNote.Visible = stampaOk;
+ }
+ ///
+ /// genera i barcode di
+ /// - trattamenti
+ /// - nuovo x pezzi liquidi
+ /// e lancia la relativa stampa
+ ///
+ ///
+ ///
+ protected void btnStampa_Click(object sender, EventArgs e)
+ {
+ bool needsRedirect = false;
+ string[] stringSeparators = new string[] { "#" };
+ // verifico postazione x procedere...
+ if (Postazione.printer != "n.d.")
+ {
+ // verifico auth utente OPPURE se NON sia richiesta...
+ if (OpAuth.isAuth || !OpAuth.opAuthReq)
+ {
+ DateTime adesso = DateTime.Now;
+
+ string noteTrim = txtNote.Text.Trim();
+ string lineaCesta = string.Format("FUORICICLO | {0} | cesta: {1}", Postazione.currNomeLinea, numCesta);
+ noteTrim = string.Format("{0}{1}{2}", lineaCesta, Environment.NewLine, noteTrim);
+ //string noteTrim = txtNote.Text.Trim();
+ //noteTrim = string.Format("FUORICICLO{0}{1}", Environment.NewLine, noteTrim);
+
+ // effettuo controlli che cod_soggetto, cod particolare e destAL siano disponibili...
+ if (MagClass.magazzino.CodSoggCurrUser != "" && currParticolare != "" && destAL != "ALS00")
+ {
+ // aggiorno note e posizione da temp a definitiv x UDC...
+ MagClass.magazzino.updateNotePosizioneDataUDC(currUDC, noteTrim, memLayer.ML.cdvi("IdxPosizioneSterrati"), DateTime.Now);
+
+ if (OpAuth.isAuth)
+ {
+ // salvo attributo dell'OpAuth...
+ MagClass.magazzino.taAtt2UDC.Insert(currUDC, memLayer.ML.CRS("attrOpAuth"), OpAuth.currAuth.CodSoggetto, DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // consumo una auth...
+ OpAuth.currAuth.remAuth--;
+ if (OpAuth.currAuth.remAuth == 0)
+ {
+ OpAuth.stopAuth();
+ needsRedirect = true;
+ }
+ }
+
+ // registro creazione nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "creaUDC", string.Format("Creato nuovo UDC Sterr Taglio FC, qta: {0} {1}", qta, ""));
+ // metto attributo FC
+ MagClass.magazzino.taAtt2UDC.Insert(currUDC, "FC", "", DateTime.Now, MagClass.magazzino.CodSoggCurrUser);
+ // tolgo UDC da AL corrente...
+ MagClass.magazzino.taAL2UDC.deleteQuery(destAL, currUDC);
+
+ // ora stampo il nuovo cartellino!!!
+ MagClass.magazzino.stampaUdc(currUDC, Postazione.printer, tipoCartellino.cartSterr, Request.UserHostName);
+ // incremento timing...
+ adesso = adesso.AddSeconds(2);
+ // registro stampa nuovo UDC
+ MagClass.magazzino.taSAO.insertQuery(adesso, MagClass.magazzino.CodSoggCurrUser, Postazione.name, Postazione.IP, currUDC, currParticolare, "stampaUDC", "Stampato UDC Sterrato FUORICICLO");
+ // svuoto campo cesta...
+ numCesta = "";
+ // resetto
+ doResetData();
+ }
+ else
+ {
+ httpLog(string.Format("STERRATI FC, Errore persi utente/particolare, ricarico!"), tipoLog.ERROR);
+ Response.Redirect("~/login.aspx");
+ }
+ }
+ else
+ {
+ Postazione.messaggiText = traduci("noOpAuth");
+ Postazione.CssClass = "stileComandoKo";
+ httpLog(string.Format("Errore manca OpAuth x UDC anime"), tipoLog.ERROR);
+ }
+ }
+ else
+ {
+ Response.Redirect("~/menu.aspx");
+ }
+ doUpdate();
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ if (needsRedirect)
+ {
+ Response.Redirect(user_std.pagCorrente);
+ }
+ }
+ ///
+ /// effettua il consumo di tutti gli UDC inviati come array di stringhe
+ ///
+ ///
+ 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...
+ }
+ }
+ }
+ }
+ }
+ ///
+ ///associa nuovo UDC ad elenco UDC
+ ///
+ /// UDC da associare come child
+ /// vettore di UDC da associare come parent
+ 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);
+ }
+ }
+ }
+ }
+ ///
+ /// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
+ ///
+ /// vettore di UDC da verificare
+ private string checkPartUDC(string[] UDC_P)
+ {
+ string answ = "";
+ if (UDC_P.Length > 0)
+ {
+ // imposto il primo particolare...
+ answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
+ // ciclo
+ foreach (string udc_p in UDC_P)
+ {
+ if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
+ }
+ }
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string _testoPre)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + _testoPre);
+ return answ;
+ }
+ ///
+ /// wrapper per log con salvataggio dell'IP del chiamante
+ ///
+ ///
+ ///
+ public bool httpLog(string testoLog, tipoLog tipo)
+ {
+ bool answ = false;
+ logger.lg.scriviLog(Postazione.IP + testoLog, tipo);
+ return answ;
+ }
+ ///
+ /// effettua reset dati
+ ///
+ public void doResetData()
+ {
+ // resetto i dati QtaTot e particolare...
+ qta = 0;
+ currParticolare = "";
+ txtQta.Text = "";
+ grViewDest.SelectedIndex = -1;
+ doChecks();
+ }
+ ///
+ /// svuoto le note
+ ///
+ ///
+ ///
+ protected void btnEmptyNote_Click(object sender, EventArgs e)
+ {
+ txtNote.Text = "";
+ Postazione.messaggiText = traduci("AttesaBCode");
+ Postazione.CssClass = "stileAttesa";
+ // raise dell'evento
+ if (eh_reqUpdate != null)
+ {
+ eh_reqUpdate(this, new EventArgs());
+ }
+ }
+ ///
+ /// passo alla modalità IN
+ ///
+ ///
+ ///
+ protected void btnIn_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("SterrTaglioIN.aspx");
+ }
+
+ ///
+ /// effettua refresh (su db) del blocco postazione
+ ///
+ ///
+ 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);
+ }
+ }
+
+ ///
+ /// aggiorno ods al binding..
+ ///
+ ///
+ ///
+ protected void ods_DataBinding(object sender, EventArgs e)
+ {
+ // fix dell'ODS
+ checkFixOds();
+ }
+ ///
+ /// verifica se attivo filtro company e imposta ods di conseguenza...
+ ///
+ private void checkFixOds()
+ {
+ }
+ ///
+ /// evento selezione grView destinazione: ricarico dati!
+ ///
+ ///
+ ///
+ protected void grViewDest_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // ricarico dati dell'UDC come particolare e quantità...
+ currUDC = grViewDest.SelectedDataKey["UDC"].ToString();
+ if (MagClass.magazzino.checkUDC(currUDC))
+ {
+ currParticolare = DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Particolare;
+ qta = Convert.ToInt32(DataProxy.obj.taCartellini.stp_getByUdc(currUDC)[0].Qta);
+ }
+ Postazione.messaggiText = traduci("partSelected");
+ Postazione.warningText = "";
+ Postazione.CssClass = "stileComandoOk";
+ doChecks();
+ doUpdate();
+ // fisso focus su note!
+ txtNote.Focus();
+ }
+ ///
+ /// sistema modalità input
+ ///
+ private void setVisibility()
+ {
+ bool showBtn = false;
+ // ora controllo btn quantità
+ if (grViewDest.SelectedIndex >= 0)
+ {
+ showBtn = true;
+ }
+ divQta.Visible = showBtn;
+ }
+ ///
+ /// reset della selezione
+ ///
+ ///
+ ///
+ protected void btnReset_Click(object sender, EventArgs e)
+ {
+ grViewDest.SelectedIndex = -1;
+ qta = 0;
+ currUDC = "";
+ currParticolare = "";
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// update Qty x UDC selezionato...
+ ///
+ ///
+ ///
+ protected void lbtUpdQty_Click(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+
+ private void aggiornaQta()
+ {
+ MagClass.magazzino.taCartellini.updateQty(currUDC, MagClass.magazzino.CodSoggCurrUser, "U", eventoUDC_qta, qta);
+ currUDC = "";
+ currParticolare = "";
+ grViewDest.SelectedIndex = -1;
+ setVisibility();
+ doUpdate();
+ }
+ ///
+ /// Numero cesta inserito
+ ///
+ public string numCesta
+ {
+ get
+ {
+ return txtCesta.Text.Trim();
+ }
+ set
+ {
+ txtCesta.Text = value;
+ }
+ }
+ ///
+ /// evento cambio num cesta/grappolo
+ ///
+ ///
+ ///
+ protected void txtCesta_TextChanged(object sender, EventArgs e)
+ {
+ txtCesta.Text = txtCesta.Text.ToUpper().Trim().PadLeft(4, '0').Substring(0, 4);
+ doUpdate();
+ }
+ ///
+ /// fornisce in output la corretta classe css x icona
+ ///
+ ///
+ ///
+ public string cssGlyphByQty(object _qta)
+ {
+ string answ = "glyphicon glyphicon-pencil";
+ int qtaUDC = 0;
+ try
+ {
+ qtaUDC = Convert.ToInt32(_qta);
+ }
+ catch { }
+ if (qtaUDC > 0)
+ {
+ answ = "glyphicon glyphicon-print";
+ }
+ return answ;
+ }
+ ///
+ /// determina se sia possibile cancellare un record, se qta > 0
+ ///
+ ///
+ ///
+ public bool canDelete(object _qta)
+ {
+ bool answ = false;
+ try
+ {
+ answ = Convert.ToInt32(_qta) == 0;
+ }
+ catch
+ { }
+ return answ;
+ }
+
+ ///
+ /// evento cambio qta
+ ///
+ ///
+ ///
+ protected void txtQta_TextChanged(object sender, EventArgs e)
+ {
+ aggiornaQta();
+ }
+ }
}
\ No newline at end of file
diff --git a/GMW_data/DS_magazzino.xsd b/GMW_data/DS_magazzino.xsd
index a85ac92a..cdc5418a 100644
--- a/GMW_data/DS_magazzino.xsd
+++ b/GMW_data/DS_magazzino.xsd
@@ -377,6 +377,7 @@ SELECT UDC, CodCS, CodCliente, RagSociale, Particolare, DescParticolare, Disegno
+
@@ -5713,7 +5714,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -5770,7 +5771,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -5802,7 +5803,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -5824,7 +5825,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -5858,7 +5859,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -5933,14 +5934,14 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
-
+
@@ -5976,7 +5977,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -6033,7 +6034,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -6061,7 +6062,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -6108,7 +6109,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -6137,7 +6138,7 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
+
@@ -6315,21 +6316,21 @@ SELECT Trattamento, AL, DataTrattEnd, Durezza, Punzone, DataDur, CodSoggettoDur,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GMW_data/DS_magazzino1.Designer.cs b/GMW_data/DS_magazzino1.Designer.cs
index 077e07a7..27c25a1b 100644
--- a/GMW_data/DS_magazzino1.Designer.cs
+++ b/GMW_data/DS_magazzino1.Designer.cs
@@ -24253,6 +24253,7 @@ SELECT UDC, CodCS, CodCliente, RagSociale, Particolare, DescParticolare, Disegno
this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodCS", global::System.Data.SqlDbType.NVarChar, 2, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Particolare", global::System.Data.SqlDbType.NVarChar, 15, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodStato", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@flgForzaUltimo", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[13] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[13].Connection = this.Connection;
this._commandCollection[13].CommandText = "dbo.stp_UDC_getLast_ByParticolareStatoConImballo";
@@ -24699,7 +24700,7 @@ SELECT UDC, CodCS, CodCliente, RagSociale, Particolare, DescParticolare, Disegno
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
- public virtual DS_magazzino.ElencoCartelliniDataTable getLastByParticolareStato(string CodCS, string Particolare, string CodStato) {
+ public virtual DS_magazzino.ElencoCartelliniDataTable getLastByParticolareStato(string CodCS, string Particolare, string CodStato, global::System.Nullable flgForzaUltimo) {
this.Adapter.SelectCommand = this.CommandCollection[12];
if ((CodCS == null)) {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
@@ -24719,6 +24720,12 @@ SELECT UDC, CodCS, CodCliente, RagSociale, Particolare, DescParticolare, Disegno
else {
this.Adapter.SelectCommand.Parameters[3].Value = ((string)(CodStato));
}
+ if ((flgForzaUltimo.HasValue == true)) {
+ this.Adapter.SelectCommand.Parameters[4].Value = ((bool)(flgForzaUltimo.Value));
+ }
+ else {
+ this.Adapter.SelectCommand.Parameters[4].Value = global::System.DBNull.Value;
+ }
DS_magazzino.ElencoCartelliniDataTable dataTable = new DS_magazzino.ElencoCartelliniDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
diff --git a/GMW_data/UserControlBCodeMan.cs b/GMW_data/UserControlBCodeMan.cs
index 2593ed82..d2d5a0c5 100644
--- a/GMW_data/UserControlBCodeMan.cs
+++ b/GMW_data/UserControlBCodeMan.cs
@@ -552,7 +552,7 @@ namespace GMW_data
string answ = "";
try
{
- answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(CodCs, currParticolare, statoUDC)[0].CodImballo;
+ answ = MagClass.magazzino.taCartellini.getLastByParticolareStato(CodCs, currParticolare, statoUDC, false)[0].CodImballo;
}
catch
{
@@ -571,7 +571,7 @@ namespace GMW_data
int answ = 0;
try
{
- answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(CodCs, currParticolare, statoUDC)[0].Qta;
+ answ = (int)MagClass.magazzino.taCartellini.getLastByParticolareStato(CodCs, currParticolare, statoUDC, false)[0].Qta;
}
catch
{