Continuo fix regexp

This commit is contained in:
Samuele E. Locatelli
2019-08-19 15:08:04 +02:00
parent f250dab4ef
commit f6ca87f0d1
7 changed files with 204 additions and 92 deletions
+34
View File
@@ -5,6 +5,39 @@ namespace AppData
{
public class mUtils
{
#region definizione Regexp
/// <summary>
/// RegExp x Cod ARTICOLO
/// </summary>
public static string reCodArt = memLayer.ML.cdv("regExp_CodArt");
/// <summary>
/// RegExp x Cod OPERATORE
/// </summary>
public static string reCodOper = memLayer.ML.cdv("regExp_CodOper");
/// <summary>
/// RegExp x Cod COMMESSA
/// </summary>
public static string reNumTask = memLayer.ML.cdv("regExp_NumTask");
/// <summary>
/// RegExp x QTA
/// </summary>
public static string reQta = memLayer.ML.cdv("regExp_QtaRic");
/// <summary>
/// RegExp x RESET / CANCEL
/// </summary>
public static string reReset = memLayer.ML.cdv("regExp_KO");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
public static string reAddNew = memLayer.ML.cdv("regExp_AddNew");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
public static string reDelete = memLayer.ML.cdv("regExp_DEL");
#endregion
/// <summary>
/// Codice Operatore
/// </summary>
@@ -81,5 +114,6 @@ namespace AppData
memLayer.ML.setCookieVal("CTrack_postIsMulti", value.ToString());
}
}
}
}
+1 -5
View File
@@ -8,10 +8,6 @@ namespace AppData
/// </summary>
public class stateMachine
{
/// <summary>
/// RegExp x Cod COMMESSA
/// </summary>
protected string reNumTask = memLayer.ML.cdv("regExp_NumTask");
protected DS_AppTableAdapters.AnagEventiTableAdapter taEv;
protected DS_AppTableAdapters.TraEv2StatiTableAdapter taEv2St;
@@ -49,7 +45,7 @@ namespace AppData
/// <returns></returns>
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."))
+6 -30
View File
@@ -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");
}
/// <summary>
/// RegExp x Cod ARTICOLO
/// </summary>
protected string reCodArt = memLayer.ML.cdv("regExp_CodArt");
/// <summary>
/// RegExp x Cod COMMESSA
/// </summary>
protected string reNumTask = memLayer.ML.cdv("regExp_NumTask");
/// <summary>
/// RegExp x QTA
/// </summary>
protected string reQta = memLayer.ML.cdv("regExp_QtaRic");
/// <summary>
/// RegExp x RESET / CANCEL
/// </summary>
protected string reReset = memLayer.ML.cdv("regExp_KO");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
protected string reAddNew = memLayer.ML.cdv("regExp_AddNew");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
protected string reDelete = memLayer.ML.cdv("regExp_DEL");
/// <summary>
/// Input da processare...
/// </summary>
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)
+6 -33
View File
@@ -12,30 +12,6 @@ namespace C_TRACK.WebUserControls
{
public partial class mod_opr2post : System.Web.UI.UserControl
{
/// <summary>
/// RegExp x Cod ARTICOLO
/// </summary>
protected string reCodArt = memLayer.ML.cdv("regExp_CodArt");
/// <summary>
/// RegExp x Cod COMMESSA
/// </summary>
protected string reNumTask = memLayer.ML.cdv("regExp_NumTask");
/// <summary>
/// RegExp x QTA
/// </summary>
protected string reQta = memLayer.ML.cdv("regExp_QtaRic");
/// <summary>
/// RegExp x RESET / CANCEL
/// </summary>
protected string reReset = memLayer.ML.cdv("regExp_KO");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
protected string reAddNew = memLayer.ML.cdv("regExp_AddNew");
/// <summary>
/// RegExp x CONFERMA
/// </summary>
protected string reDelete = memLayer.ML.cdv("regExp_DEL");
/// <summary>
/// evento aggiunta record
@@ -128,16 +104,13 @@ namespace C_TRACK.WebUserControls
/// <param name="value"></param>
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)
+23 -1
View File
@@ -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;
}
}
}
+130 -1
View File
@@ -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());
}
}
/// <summary>
/// Input da processare (tipo codOperatore...)...
/// </summary>
public string newInput
{
set
{
processInput(value);
}
}
/// <summary>
/// Cod OPERATORE corrente
/// </summary>
public string NumTask
{
get
{
return memLayer.ML.StringSessionObj("currNumTaskMulti");
}
set
{
memLayer.ML.setSessionVal("currNumTaskMulti", value);
}
}
/// <summary>
/// Effettua riconoscimento input e determina valori commessa / articolo / qta
/// </summary>
/// <param name="value"></param>
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();
}
}
}
+4 -22
View File
@@ -11,14 +11,6 @@ namespace C_TRACK
{
public partial class barcode : System.Web.UI.Page
{
/// <summary>
/// RegExp x Cod OPERATORE
/// </summary>
protected string reCodOper = memLayer.ML.cdv("regExp_CodOper");
/// <summary>
/// RegExp x Cod COMMESSA
/// </summary>
protected string reNumTask = memLayer.ML.cdv("regExp_NumTask");
/// <summary>
/// idxRec della fase attiva
/// </summary>
@@ -472,18 +464,8 @@ namespace C_TRACK
/// <param name="e"></param>
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);
}
/// <summary>
/// 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")