fix modo ricerca con ESCLUSIONE VARIABILI (INIZIATO)

This commit is contained in:
Samuele E. Locatelli
2018-09-18 15:47:33 +02:00
parent b463322158
commit bcbceff9e0
5 changed files with 86 additions and 56 deletions
Vendored
+1 -1
View File
@@ -15,7 +15,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=307']) {
withEnv(['NEXT_BUILD_NUMBER=308']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'SCMA'
+21 -8
View File
@@ -1,18 +1,27 @@
namespace MTC
{
/// <summary>
/// Tipologia di ricerca ammessa
/// </summary>
public enum subsMode
{
/// ADD: includo
A,
/// X: ESCLUDO
X
}
/// <summary>
/// Tipologia di sostituzioni ammesse
/// </summary>
public enum substType
public enum substSearch
{
// BEGIN: inizia per
// CERCO BEGIN: inizia per
B,
// END: finisce per
// CERCO END: finisce per
E,
// CONTAINS: contiene
// CERCO CONTAINS: contiene
C,
// IDENTICAL: identica
// CERCO IDENTICAL: identica
I
}
@@ -26,9 +35,13 @@
/// </summary>
public string tradz;
/// <summary>
/// Tipologia di sostituzione ammessa
/// Tipologia di azione
/// </summary>
public substType sost;
public subsMode modo;
/// <summary>
/// Modalità di ricerca
/// </summary>
public substSearch search;
}
/// <summary>
/// Classe item node (tipo/obj)
+4 -4
View File
@@ -313,22 +313,22 @@ namespace OPC_UA_REDIS
trovato = false;
txt2find = item.Key;
// B --> cerco inizio
if (item.Value.sost == substType.B)
if (item.Value.search == substSearch.B)
{
trovato = answ.StartsWith(txt2find);
}
// E --> cerco fine
else if (item.Value.sost == substType.E)
else if (item.Value.search == substSearch.E)
{
trovato = answ.EndsWith(txt2find);
}
// I --> cerco IDENTICO
else if (item.Value.sost == substType.I)
else if (item.Value.search == substSearch.I)
{
trovato = (answ == txt2find);
}
// C --> cerco OVUNQUE contenuto
else if (item.Value.sost == substType.C)
else if (item.Value.search == substSearch.C)
{
trovato = answ.IndexOf(txt2find) >= 0;
}
+24 -9
View File
@@ -1315,8 +1315,11 @@ namespace SCMA
string fileName = "";
int rumRiga = 0;
string valSost = "";
string sMode = "";
string sSearch = "";
string[] dictSubst;
substType tipoSost;
subsMode modoSearch;
substSearch tipoCerca;
StreamReader file;
replDict replacement;
// processo file pre REPLACE parziale (con like)
@@ -1333,25 +1336,37 @@ namespace SCMA
if (linea.Substring(0, 1) != "#")
{
dictSubst = linea.Split(utils.CRC("testCharSep"));
// recupero valori inseriti
valSost = dictSubst[1].Trim();
switch (dictSubst[0].Trim())
// recupero valori inseriti
sMode = dictSubst[0].Trim();
sSearch = dictSubst[1].Trim();
valSost = dictSubst[2].Trim();
switch (sMode)
{
case "X":
modoSearch = subsMode.X;
break;
default:
case "A":
modoSearch = subsMode.A;
break;
}
switch (sSearch)
{
case "B":
tipoSost = substType.B;
tipoCerca = substSearch.B;
break;
case "C":
tipoSost = substType.C;
tipoCerca = substSearch.C;
break;
case "E":
tipoSost = substType.E;
tipoCerca = substSearch.E;
break;
default:
case "I":
tipoSost = substType.I;
tipoCerca = substSearch.I;
break;
}
replacement = new replDict { sost = tipoSost, tradz = dictSubst[2].Trim() };
replacement = new replDict { modo = modoSearch, search = tipoCerca, tradz = dictSubst[2].Trim() };
// 3 oggetti: tipo ricerca | valOriginale | valTradotto
if (currGateway.nameRepRoles != null && currGateway.nameRepRoles.ContainsKey(valSost))
{
+36 -34
View File
@@ -2,62 +2,64 @@
# CONFIGURAZIONE SOSTITUZIONE CHIAVI per OPC-UA-REDIS
#------------------------------------------------------------
# - commenti con "#"
# - elenco tipo MODO_RICERCA | NOME_ORIGINALE | NomeReplaced
# - se MODO_RICERCA = B --> cerco INIZIO (regexp: ^VAR)
# - se MODO_RICERCA = E --> cerco FINE (regexp: VAR$)
# - se MODO_RICERCA = C --> cerco NELLA STRINGA (regexp: %VAR%)
# - se MODO_RICERCA = I --> cerco INTERA STRINGA (regexp: VAR)
# - elenco tipo MODO | RICERCA | NOME_ORIGINALE | NomeReplaced
# - se MODO = A --> INCLUDO
# - se MODO = X --> ESCLUDO
# - se RICERCA = B --> cerco INIZIO (regexp: ^VAR)
# - se RICERCA = E --> cerco FINE (regexp: VAR$)
# - se RICERCA = C --> cerco NELLA STRINGA (regexp: %VAR%)
# - se RICERCA = I --> cerco INTERA STRINGA (regexp: VAR)
#------------------------------------------------------------
# B: Ricerca dall'INIZIO stringa (BEGIN, regexp: ^VAR)
#------------------------------------------------------------
B|AV_|
B|ST_|
B|UNK_|Unk
B|Axis_01|Axes:AxisX
B|Axis_02|Axes:AxisY
B|Axis_03|Axes:AxisZ
B|Axis_04|Axes:AxisB
B|Axis_05|Axes:AxisC
B|Axis_06|Axes:AxisV
A|B|AV_|
A|B|ST_|
A|B|UNK_|Unk
A|B|Axis_01|Axes:AxisX
A|B|Axis_02|Axes:AxisY
A|B|Axis_03|Axes:AxisZ
A|B|Axis_04|Axes:AxisB
A|B|Axis_05|Axes:AxisC
A|B|Axis_06|Axes:AxisV
#------------------------------------------------------------
# E: Ricerca dalla FINE stringa (END, regexp: VAR$)
#------------------------------------------------------------
E|RUN_MODE|RunMode
E|EXE_MODE|ExeMode
E|COD_M|CodM
E|COD_S|CodS
E|COD_T|CodT
E|Cod_M|CodM
E|Cod_S|CodS
E|Cod_T|CodT
E|CodG_Act|CodGAct
E|PZ_TOT|PzTot
E|CurrProg_RowNum|CurrProgRowNum
A|E|RUN_MODE|RunMode
A|E|EXE_MODE|ExeMode
A|E|COD_M|CodM
A|E|COD_S|CodS
A|E|COD_T|CodT
A|E|Cod_M|CodM
A|E|Cod_S|CodS
A|E|Cod_T|CodT
A|E|CodG_Act|CodGAct
A|E|PZ_TOT|PzTot
A|E|CurrProg_RowNum|CurrProgRowNum
#------------------------------------------------------------
# C: Ricerca NELLA stringa (CONTAINS, regexp: %VAR%)
#------------------------------------------------------------
C|SpindleOver_|SpindleOver
A|C|SpindleOver_|SpindleOver
#------------------------------------------------------------
# I: Ricerca stringa COMPLETA (IDENTICAL, regexp: VAR)
#------------------------------------------------------------
I|E_STOP|EStop
I|ACC_TIME|AccTime
I|ACC_TIME_WORK|AccTimeWork
I|PROC_SEL|ProcSel
I|CodG_ACT|CodGAct
I|USER_ACTION|UserAction
A|I|E_STOP|EStop
A|I|ACC_TIME|AccTime
A|I|ACC_TIME_WORK|AccTimeWork
A|I|PROC_SEL|ProcSel
A|I|CodG_ACT|CodGAct
A|I|USER_ACTION|UserAction
#------------------------------------------------------------
# Ricerca SOSTITUZIONI ESPLICITE per variabili (counter generici)
#------------------------------------------------------------
#I|Path_01_FeedRate|Axes:feedRate
#I|Counter_026|Head10:spindleRevs
#A|I|Path_01_FeedRate|Axes:feedRate
#A|I|Counter_026|Head10:spindleRevs