diff --git a/AppData/mUtils.cs b/AppData/mUtils.cs index 1ff9353..826286f 100644 --- a/AppData/mUtils.cs +++ b/AppData/mUtils.cs @@ -5,6 +5,39 @@ namespace AppData { public class mUtils { + + #region definizione Regexp + /// + /// RegExp x Cod ARTICOLO + /// + public static string reCodArt = memLayer.ML.cdv("regExp_CodArt"); + /// + /// RegExp x Cod OPERATORE + /// + public static string reCodOper = memLayer.ML.cdv("regExp_CodOper"); + /// + /// RegExp x Cod COMMESSA + /// + public static string reNumTask = memLayer.ML.cdv("regExp_NumTask"); + /// + /// RegExp x QTA + /// + public static string reQta = memLayer.ML.cdv("regExp_QtaRic"); + /// + /// RegExp x RESET / CANCEL + /// + public static string reReset = memLayer.ML.cdv("regExp_KO"); + /// + /// RegExp x CONFERMA + /// + public static string reAddNew = memLayer.ML.cdv("regExp_AddNew"); + /// + /// RegExp x CONFERMA + /// + public static string reDelete = memLayer.ML.cdv("regExp_DEL"); + + #endregion + /// /// Codice Operatore /// @@ -81,5 +114,6 @@ namespace AppData memLayer.ML.setCookieVal("CTrack_postIsMulti", value.ToString()); } } + } } diff --git a/AppData/stateMachine.cs b/AppData/stateMachine.cs index 8d655ba..f7433c3 100644 --- a/AppData/stateMachine.cs +++ b/AppData/stateMachine.cs @@ -8,10 +8,6 @@ namespace AppData /// public class stateMachine { - /// - /// RegExp x Cod COMMESSA - /// - protected string reNumTask = memLayer.ML.cdv("regExp_NumTask"); protected DS_AppTableAdapters.AnagEventiTableAdapter taEv; protected DS_AppTableAdapters.TraEv2StatiTableAdapter taEv2St; @@ -49,7 +45,7 @@ namespace AppData /// public tipoAzione azioneComando(inputComando comando) { - var testNumTask = Regex.Match(comando.valore, reNumTask); + var testNumTask = Regex.Match(comando.valore, mUtils.reNumTask); tipoAzione _azione = tipoAzione.noAct; // se è un SET OPR o POST è un azione IMPLICITA... if (comando.valore.Contains("OPR.") || comando.valore.Contains("POST.")) diff --git a/C-TRACK/WebUserControls/mod_addTask.ascx.cs b/C-TRACK/WebUserControls/mod_addTask.ascx.cs index fcbf8a9..7531c5b 100644 --- a/C-TRACK/WebUserControls/mod_addTask.ascx.cs +++ b/C-TRACK/WebUserControls/mod_addTask.ascx.cs @@ -33,30 +33,6 @@ namespace C_TRACK.WebUserControls divQta.Attributes.Add("class", Quantita > 0 ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary"); } /// - /// RegExp x Cod ARTICOLO - /// - protected string reCodArt = memLayer.ML.cdv("regExp_CodArt"); - /// - /// RegExp x Cod COMMESSA - /// - protected string reNumTask = memLayer.ML.cdv("regExp_NumTask"); - /// - /// RegExp x QTA - /// - protected string reQta = memLayer.ML.cdv("regExp_QtaRic"); - /// - /// RegExp x RESET / CANCEL - /// - protected string reReset = memLayer.ML.cdv("regExp_KO"); - /// - /// RegExp x CONFERMA - /// - protected string reAddNew = memLayer.ML.cdv("regExp_AddNew"); - /// - /// RegExp x CONFERMA - /// - protected string reDelete = memLayer.ML.cdv("regExp_DEL"); - /// /// Input da processare... /// public string newInput @@ -73,12 +49,12 @@ namespace C_TRACK.WebUserControls private void processInput(string value) { // verifico se sia un articolo... - Match testReset = Regex.Match(value, reReset); - Match testDelete = Regex.Match(value, reDelete); - Match testAddNew = Regex.Match(value, reAddNew); - Match testCodArt = Regex.Match(value, reCodArt); - Match testNumTask = Regex.Match(value, reNumTask); - Match testQta = Regex.Match(value, reQta); + Match testReset = Regex.Match(value, mUtils.reReset); + Match testDelete = Regex.Match(value, mUtils.reDelete); + Match testAddNew = Regex.Match(value, mUtils.reAddNew); + Match testCodArt = Regex.Match(value, mUtils.reCodArt); + Match testNumTask = Regex.Match(value, mUtils.reNumTask); + Match testQta = Regex.Match(value, mUtils.reQta); if (testReset.Success) diff --git a/C-TRACK/WebUserControls/mod_opr2post.ascx.cs b/C-TRACK/WebUserControls/mod_opr2post.ascx.cs index 1575b0f..aeaa83d 100644 --- a/C-TRACK/WebUserControls/mod_opr2post.ascx.cs +++ b/C-TRACK/WebUserControls/mod_opr2post.ascx.cs @@ -12,30 +12,6 @@ namespace C_TRACK.WebUserControls { public partial class mod_opr2post : System.Web.UI.UserControl { - /// - /// RegExp x Cod ARTICOLO - /// - protected string reCodArt = memLayer.ML.cdv("regExp_CodArt"); - /// - /// RegExp x Cod COMMESSA - /// - protected string reNumTask = memLayer.ML.cdv("regExp_NumTask"); - /// - /// RegExp x QTA - /// - protected string reQta = memLayer.ML.cdv("regExp_QtaRic"); - /// - /// RegExp x RESET / CANCEL - /// - protected string reReset = memLayer.ML.cdv("regExp_KO"); - /// - /// RegExp x CONFERMA - /// - protected string reAddNew = memLayer.ML.cdv("regExp_AddNew"); - /// - /// RegExp x CONFERMA - /// - protected string reDelete = memLayer.ML.cdv("regExp_DEL"); /// /// evento aggiunta record @@ -128,16 +104,13 @@ namespace C_TRACK.WebUserControls /// private void processInput(string value) { - // verifico se sia un articolo... - Match testReset = Regex.Match(value, reReset); - Match testDelete = Regex.Match(value, reDelete); - Match testAddNew = Regex.Match(value, reAddNew); - Match testCodArt = Regex.Match(value, reCodArt); - Match testNumTask = Regex.Match(value, reNumTask); - Match testQta = Regex.Match(value, reQta); + // verifico se sia un operatore... + Match testOper = Regex.Match(value, mUtils.reCodOper); - - // qui devo verificare SE SIA un oepratore... + if(testOper.Success) + { + codOper = value; + } #if false if (testReset.Success) diff --git a/C-TRACK/WebUserControls/mod_postMulti.ascx.cs b/C-TRACK/WebUserControls/mod_postMulti.ascx.cs index 3ee30fd..153bcac 100644 --- a/C-TRACK/WebUserControls/mod_postMulti.ascx.cs +++ b/C-TRACK/WebUserControls/mod_postMulti.ascx.cs @@ -1,6 +1,8 @@ -using System; +using AppData; +using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; @@ -45,5 +47,25 @@ namespace C_TRACK.WebUserControls eh_reqUpdate(this, new EventArgs()); } } + + public bool processInput(string valore) + { + bool answ = false; + // controllo se sto leggendo un operatore o una commessa + Match testNumTask = Regex.Match(valore, mUtils.reNumTask); + Match testOper = Regex.Match(valore, mUtils.reCodOper); + // a seconda dei cari decido se far processare ai controlli oepratore o commessa in post multi... + if (testOper.Success) + { + mod_opr2post.newInput = valore; + answ = true; + } + else if (testNumTask.Success) + { + //mod_opr2post.newInput = valore; + answ = true; + } + return answ; + } } } \ No newline at end of file diff --git a/C-TRACK/WebUserControls/mod_task2post.ascx.cs b/C-TRACK/WebUserControls/mod_task2post.ascx.cs index fe771a6..76204f8 100644 --- a/C-TRACK/WebUserControls/mod_task2post.ascx.cs +++ b/C-TRACK/WebUserControls/mod_task2post.ascx.cs @@ -3,6 +3,7 @@ using SteamWare; using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; @@ -17,7 +18,20 @@ namespace C_TRACK.WebUserControls public event EventHandler eh_reqUpdate; protected void Page_Load(object sender, EventArgs e) { - + checkValori(); + } + private void checkValori() + { +#if false + // verifica quali valori siano disponibili e di conseguenza visualizza COLORE... + divArticolo.Attributes.Remove("class"); + divCommessa.Attributes.Remove("class"); + divQta.Attributes.Remove("class"); + divArticolo.Attributes.Add("class", CodArticolo != "" ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary"); + divCommessa.Attributes.Add("class", NumTask != "" ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary"); + divQta.Attributes.Add("class", Quantita > 0 ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary"); +#endif + //lblOut.Text = codOper != "" ? codOper : ""; } public void doUpdate() { @@ -81,5 +95,120 @@ namespace C_TRACK.WebUserControls eh_reqUpdate(this, new EventArgs()); } } + + /// + /// Input da processare (tipo codOperatore...)... + /// + public string newInput + { + set + { + processInput(value); + } + } + + /// + /// Cod OPERATORE corrente + /// + public string NumTask + { + get + { + return memLayer.ML.StringSessionObj("currNumTaskMulti"); + } + set + { + memLayer.ML.setSessionVal("currNumTaskMulti", value); + } + } + /// + /// Effettua riconoscimento input e determina valori commessa / articolo / qta + /// + /// + private void processInput(string value) + { + // verifico se sia un operatore... + Match testNumTask = Regex.Match(value, mUtils.reNumTask); + + if (testNumTask.Success) + { + NumTask = value; + } + +#if false + if (testReset.Success) + { + CodArticolo = ""; + NumTask = ""; + Quantita = 0; + } + else if (testDelete.Success) + { + // creo... + dataLayer.man.taTL.deleteQuery(NumTask); + // resetto! + CodArticolo = ""; + NumTask = ""; + Quantita = 0; + // invoco update... + if (eh_created != null) + { + eh_created(this, new EventArgs()); + } + } + else if (testAddNew.Success) + { + // se qta > 0 ed ho articolo e commessa... + if (Quantita > 0 && CodArticolo != "" && NumTask != "") + { + // creo... + dataLayer.man.taTL.insertQuery(NumTask, CodArticolo, Quantita); + // resetto! + CodArticolo = ""; + NumTask = ""; + Quantita = 0; + // invoco update... + if (eh_created != null) + { + eh_created(this, new EventArgs()); + } + } + } + else if (testCodArt.Success) + { + CodArticolo = value; + } + else if (testNumTask.Success) + { + NumTask = value; + } + else if (testQta.Success) + { + int qta = 0; + int.TryParse(value, out qta); + Quantita = qta; + } + + // non match con RegExp --> ricerca ESPLICITA, se abilitato ricerca estesa + if (memLayer.ML.CRB("OptEnableMapoIn") && !(testCodArt.Success || testNumTask.Success)) + { + var tabArt = dataLayer.man.taAnArt.getByKey(value); + if (tabArt.Rows.Count > 0) + { + CodArticolo = value; + } + else + { + var tabTask = dataLayer.man.taTL.getByKey(value); + if (tabTask.Rows.Count > 0) + { + NumTask = value; + } + } + } +#endif + + checkValori(); + } } } \ No newline at end of file diff --git a/C-TRACK/barcode.aspx.cs b/C-TRACK/barcode.aspx.cs index 0e9462a..b254949 100644 --- a/C-TRACK/barcode.aspx.cs +++ b/C-TRACK/barcode.aspx.cs @@ -11,14 +11,6 @@ namespace C_TRACK { public partial class barcode : System.Web.UI.Page { - /// - /// RegExp x Cod OPERATORE - /// - protected string reCodOper = memLayer.ML.cdv("regExp_CodOper"); - /// - /// RegExp x Cod COMMESSA - /// - protected string reNumTask = memLayer.ML.cdv("regExp_NumTask"); /// /// idxRec della fase attiva /// @@ -472,18 +464,8 @@ namespace C_TRACK /// void Mod_barcode_eh_dataRead(object sender, EventArgs e) { - // controllo se sto leggendo un operatore o una commessa - Match testNumTask = Regex.Match(mod_barcode1.comandoRegistrato.valore, reNumTask); - Match testOper = Regex.Match(mod_barcode1.comandoRegistrato.valore, reCodOper); - // a seconda dei cari decido se far processare ai controlli oepratore o commessa in post multi... - if (testOper.Success) - { - - } - else if (testNumTask.Success) - { - - } + // passo il processing al modulo postMulti... + mod_postMulti.processInput(mod_barcode1.rawInput); } /// /// il barcode ha registrato un evento... @@ -545,8 +527,8 @@ namespace C_TRACK { // in primis: sono in esecuzione, x cui il comando è valido... string msg2show = ""; - Match testNumTask = Regex.Match(mod_barcode1.comandoRegistrato.valore, reNumTask); - Match testOper = Regex.Match(mod_barcode1.comandoRegistrato.valore, reCodOper); + Match testNumTask = Regex.Match(mod_barcode1.comandoRegistrato.valore, mUtils.reNumTask); + Match testOper = Regex.Match(mod_barcode1.comandoRegistrato.valore, mUtils.reCodOper); // verifico se cmd setup utente... if (mod_barcode1.comandoRegistrato.prevCmdIn == "RESOP")