From a6fa85bc447023e657b06fc7ea1f1739a5a2d5aa Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 26 Oct 2017 15:53:25 +0200 Subject: [PATCH] update formattazione --- GMW/WebUserControls/mod_anime.ascx.cs | 1244 ++++++++++++------------- 1 file changed, 622 insertions(+), 622 deletions(-) diff --git a/GMW/WebUserControls/mod_anime.ascx.cs b/GMW/WebUserControls/mod_anime.ascx.cs index cb5ea813..a9e99f11 100644 --- a/GMW/WebUserControls/mod_anime.ascx.cs +++ b/GMW/WebUserControls/mod_anime.ascx.cs @@ -5,628 +5,628 @@ using System.Web.UI; namespace GMW.WebUserControls { - public partial class mod_anime : System.Web.UI.UserControl + public partial class mod_anime : System.Web.UI.UserControl + { + /// + /// flusso associato (hard coded) a ANIME + /// + protected string flusso = "AN"; + /// + /// stato associato (hard coded) a ANIME + /// + protected string statoUDC = "Anim"; + /// + /// 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 - /// - protected string flusso = "AN"; - /// - /// stato associato (hard coded) a ANIME - /// - protected string statoUDC = "Anim"; - /// - /// 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(); - 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 = ""; - } - } - /// - /// 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 Anime {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"); - // raise dell'evento - if (eh_reqUpdate != null) - { - eh_reqUpdate(this, new EventArgs()); - } - } - /// - /// 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 = pezziUdc; - // 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 - { - answ = memLayer.ML.cdvi("QtaImballoAnime"); - } - 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"]; - int matricola = -1; - // provo a convertire in intero barcode x verifica eventuale matricola... - try - { - matricola = Convert.ToInt32(barcodeIn); - } - catch - { } - // decodifico! - 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 x UDC - /// - public int qta - { - get - { - int _qta = 0; - try - { - _qta = Convert.ToInt32(txtQta.Text.Trim()); - } - catch - { - _qta = memLayer.ML.cdvi("QtaImballoAnime"); - } - 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-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) - { - qta = pezziUdc; - } - else // rimette default - { - qta = memLayer.ML.cdvi("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; - 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"; - // svuoto particolare e qta... - 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 - /// - anime - /// 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 = 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 - { - // creo nuovo UDC del trattamento liquidi - newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoAnime"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneAnime"), "IdxPosizioneAnime", "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); - // 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 Anime - qta:{0} {1}", qta, noteTrim)); - } - catch (Exception exc) - { - httpLog(string.Format("Errore creazione UDC anime: {0}", exc), tipoLog.EXCEPTION); - } - // se ho cart stampo! - if (newUdcChild != "") - { - // ora stampo il nuovo cartellino!!! - MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartAnime, 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 Anime"); - } - } - 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); - } - } - 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; - 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 = ""; - 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(); + 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 = ""; + } + } + /// + /// 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 Anime {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"); + // raise dell'evento + if (eh_reqUpdate != null) + { + eh_reqUpdate(this, new EventArgs()); + } + } + /// + /// 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 = pezziUdc; + // 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 + { + answ = memLayer.ML.cdvi("QtaImballoAnime"); + } + 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"]; + int matricola = -1; + // provo a convertire in intero barcode x verifica eventuale matricola... + try + { + matricola = Convert.ToInt32(barcodeIn); + } + catch + { } + // decodifico! + 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 x UDC + /// + public int qta + { + get + { + int _qta = 0; + try + { + _qta = Convert.ToInt32(txtQta.Text.Trim()); + } + catch + { + _qta = memLayer.ML.cdvi("QtaImballoAnime"); + } + 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-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) + { + qta = pezziUdc; + } + else // rimette default + { + qta = memLayer.ML.cdvi("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; + 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"; + // svuoto particolare e qta... + 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 + /// - anime + /// 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 = 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 + { + // creo nuovo UDC del trattamento liquidi + newUdcChild = MagClass.magazzino.creaUdc(flusso, "", particolare, "", "", "", "", "", 0, memLayer.ML.cdv("CodImballoAnime"), "U", codSogg, qta, 0, 0, adesso, 0, statoUDC, memLayer.ML.cdvi("IdxPosizioneAnime"), "IdxPosizioneAnime", "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); + // 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 Anime - qta:{0} {1}", qta, noteTrim)); + } + catch (Exception exc) + { + httpLog(string.Format("Errore creazione UDC anime: {0}", exc), tipoLog.EXCEPTION); + } + // se ho cart stampo! + if (newUdcChild != "") + { + // ora stampo il nuovo cartellino!!! + MagClass.magazzino.stampaUdc(newUdcChild, Postazione.printer, tipoCartellino.cartAnime, 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 Anime"); + } + } + 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); + } + } + 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; + 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 = ""; + 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