>Fix decodifica e file RepRoles GENERATO per VacPump e VacAct
This commit is contained in:
Vendored
+1
-1
@@ -15,7 +15,7 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=391']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=392']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SCMA'
|
||||
|
||||
@@ -1364,8 +1364,26 @@ namespace SCMA
|
||||
{
|
||||
lg.Info("Inizio caricamento dizionario remapping nomi variabili");
|
||||
}
|
||||
try
|
||||
{
|
||||
// processo file pre REPLACE parziale (con like) - file DI BASE ESPLICITO
|
||||
importFile(utils.nameRepRoleFile);
|
||||
|
||||
// ora leggo il file GENERATO di replacement... NON dando per scontato ci sia...
|
||||
if (File.Exists(utils.nameRepRoleFileGen))
|
||||
{
|
||||
importFile(utils.nameRepRoleFileGen);
|
||||
}
|
||||
}
|
||||
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
private void importFile(string fileName)
|
||||
{
|
||||
// init variabili
|
||||
string linea;
|
||||
string fileName = "";
|
||||
int rumRiga = 0;
|
||||
string valSost = "";
|
||||
string valTrad;
|
||||
@@ -1376,77 +1394,69 @@ namespace SCMA
|
||||
substSearch tipoCerca;
|
||||
StreamReader file;
|
||||
replDict replacement;
|
||||
try
|
||||
// carica da file...
|
||||
file = new StreamReader(fileName);
|
||||
// leggo 1 linea alla volta
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// processo file pre REPLACE parziale (con like)
|
||||
fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList"));
|
||||
// carica da file...
|
||||
file = new StreamReader(fileName);
|
||||
// leggo 1 linea alla volta...
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
linea = linea.Trim();
|
||||
// se HA CONTENUTO
|
||||
if (linea != "")
|
||||
{
|
||||
linea = linea.Trim();
|
||||
// se HA CONTENUTO
|
||||
if (linea != "")
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
dictSubst = linea.Split(utils.CRC("testCharSep"));
|
||||
// recupero valori inseriti
|
||||
sMode = dictSubst[0].Trim();
|
||||
sSearch = dictSubst[1].Trim();
|
||||
valSost = dictSubst[2].Trim();
|
||||
valTrad = dictSubst[3].Trim();
|
||||
switch (sMode)
|
||||
{
|
||||
dictSubst = linea.Split(utils.CRC("testCharSep"));
|
||||
// recupero valori inseriti
|
||||
sMode = dictSubst[0].Trim();
|
||||
sSearch = dictSubst[1].Trim();
|
||||
valSost = dictSubst[2].Trim();
|
||||
valTrad = dictSubst[3].Trim();
|
||||
switch (sMode)
|
||||
{
|
||||
case "X":
|
||||
modoSearch = subsMode.X;
|
||||
break;
|
||||
default:
|
||||
case "A":
|
||||
modoSearch = subsMode.A;
|
||||
break;
|
||||
}
|
||||
switch (sSearch)
|
||||
{
|
||||
case "B":
|
||||
tipoCerca = substSearch.B;
|
||||
break;
|
||||
case "C":
|
||||
tipoCerca = substSearch.C;
|
||||
break;
|
||||
case "E":
|
||||
tipoCerca = substSearch.E;
|
||||
break;
|
||||
default:
|
||||
case "I":
|
||||
tipoCerca = substSearch.I;
|
||||
break;
|
||||
}
|
||||
replacement = new replDict { modo = modoSearch, search = tipoCerca, tradz = valTrad };
|
||||
// 3 oggetti: tipo ricerca | valOriginale | valTradotto
|
||||
if (currGateway.nameRepRoles != null && currGateway.nameRepRoles.ContainsKey(valSost))
|
||||
{
|
||||
currGateway.nameRepRoles.Remove(valSost);
|
||||
}
|
||||
currGateway.nameRepRoles.Add(valSost, replacement);
|
||||
rumRiga++;
|
||||
case "X":
|
||||
modoSearch = subsMode.X;
|
||||
break;
|
||||
default:
|
||||
case "A":
|
||||
modoSearch = subsMode.A;
|
||||
break;
|
||||
}
|
||||
switch (sSearch)
|
||||
{
|
||||
case "B":
|
||||
tipoCerca = substSearch.B;
|
||||
break;
|
||||
case "C":
|
||||
tipoCerca = substSearch.C;
|
||||
break;
|
||||
case "E":
|
||||
tipoCerca = substSearch.E;
|
||||
break;
|
||||
default:
|
||||
case "I":
|
||||
tipoCerca = substSearch.I;
|
||||
break;
|
||||
}
|
||||
replacement = new replDict { modo = modoSearch, search = tipoCerca, tradz = valTrad };
|
||||
// 3 oggetti: tipo ricerca | valOriginale | valTradotto
|
||||
if (currGateway.nameRepRoles != null && currGateway.nameRepRoles.ContainsKey(valSost))
|
||||
{
|
||||
currGateway.nameRepRoles.Remove(valSost);
|
||||
}
|
||||
currGateway.nameRepRoles.Add(valSost, replacement);
|
||||
rumRiga++;
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
|
||||
// registro chiusura
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info(string.Format("Fine caricamento dizionario traduzioni nomi: {0} regole caricate", rumRiga));
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
|
||||
catch
|
||||
{ }
|
||||
// registro chiusura
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info(string.Format("Fine caricamento file {0} con dizionario traduzioni nomi: {1} regole caricate", fileName, rumRiga));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1530,7 +1540,7 @@ namespace SCMA
|
||||
file = new StreamReader(fileName);
|
||||
// leggo file...
|
||||
string rawDataModel = file.ReadToEnd();
|
||||
|
||||
|
||||
// pre-processo datamodel...
|
||||
currGateway.DataModel = utils.xmlSanitize(rawDataModel);
|
||||
// chiudo file
|
||||
|
||||
@@ -1280,9 +1280,42 @@ namespace SCMA
|
||||
adpConf.NomeAdapt = plcName;
|
||||
adpConf.TipoAdapt = tipoScelto;
|
||||
adpConf.Version = 2;
|
||||
// cerco i dati di VacuumPump...
|
||||
|
||||
// preparo file temp x generazione regole
|
||||
StreamWriter fileOut;
|
||||
// apro in scrittura il file x mettere le regole...
|
||||
fileOut = new StreamWriter(utils.nameRepRoleFileGen);
|
||||
fileOut.WriteLine("#------------------------------------------------------------");
|
||||
fileOut.WriteLine("# AUTO GENERATED Replacement Conf File");
|
||||
fileOut.WriteLine("#------------------------------------------------------------");
|
||||
fileOut.WriteLine("");
|
||||
|
||||
/*********************************************************
|
||||
* verificare come mappare la NameRepRolesList.map in memoria da NOMI COMPONENTI... NON ANDREBBE ricaricata dopo ma composto già qui...
|
||||
* es:
|
||||
* A|I|VacPump_01_Status|AuxiliaryGroups:04:Status
|
||||
* A|I|ST_VacPump_01_Status|AuxiliaryGroups:04:Status
|
||||
* A|I|VacPump_01_WrkTime|AuxiliaryGroups:04:ActiveTime
|
||||
* A|I|VacPump_02_Status|AuxiliaryGroups:05:Status
|
||||
* A|I|ST_VacPump_02_Status|AuxiliaryGroups:05:Status
|
||||
* A|I|VacPump_02_WrkTime|AuxiliaryGroups:05:ActiveTime
|
||||
*
|
||||
* al posto di chiamare loadNameRepRoles in AdapterGeneric che salva in currGateway --> comporre un valore stringa da ACCODARE / SOSTITUIRE a quello ?!?
|
||||
*
|
||||
***********************************************/
|
||||
|
||||
// cerco i dati dei vari elementi opzionali
|
||||
|
||||
// VacuumPump...
|
||||
int numVP = 0;
|
||||
List<element> listaVP = new List<element>();
|
||||
// VacuumAct
|
||||
int numVA = 0;
|
||||
List<element> listaVA = new List<element>();
|
||||
|
||||
/// numero righe roles generate
|
||||
int numRules = 0;
|
||||
string replString = "";
|
||||
List<DataModel.Property> listaAux = currDataModel.Properties.FindAll(x => x.BrowseName.Contains("Machine:AuxiliaryGroups"));
|
||||
foreach (var item in listaAux)
|
||||
{
|
||||
@@ -1294,14 +1327,46 @@ namespace SCMA
|
||||
ident = $"VacPump_{numVP.ToString("00")}"
|
||||
};
|
||||
listaVP.Add(newVP);
|
||||
// aggiungo su file...
|
||||
replString = item.BrowseName.Replace("Machine:", "").Replace(":Type", "");
|
||||
fileOut.WriteLine($"A|I|{newVP.ident}_Status|{replString}:Status");
|
||||
fileOut.WriteLine($"A|I|ST_{newVP.ident}_Status|{replString}:Status");
|
||||
fileOut.WriteLine($"A|I|{newVP.ident}_WrkTime|{replString}:ActiveTime");
|
||||
numRules += 3;
|
||||
}
|
||||
if (item.Value == "VACUUM_ACT")
|
||||
{
|
||||
numVA++;
|
||||
element newVA = new element()
|
||||
{
|
||||
ident = $"VacAct_{numVA.ToString("00")}"
|
||||
};
|
||||
listaVA.Add(newVA);
|
||||
// aggiungo su file...
|
||||
replString = item.BrowseName.Replace("Machine:", "").Replace(":Type", "");
|
||||
fileOut.WriteLine($"A|I|{newVA.ident}_Count|{replString}:Repetitions");
|
||||
numRules ++;
|
||||
}
|
||||
}
|
||||
// aggiungo elementi trovati...
|
||||
if (numVP > 0)
|
||||
{
|
||||
element[] elencoVP = listaVP.ToArray();
|
||||
adpConf.Cooler = elencoVP;
|
||||
}
|
||||
if (numVA > 0)
|
||||
{
|
||||
element[] elencoVA = listaVA.ToArray();
|
||||
adpConf.VacuumAct = elencoVA;
|
||||
}
|
||||
|
||||
|
||||
fileOut.WriteLine("");
|
||||
fileOut.WriteLine("#------------------------------------------------------------");
|
||||
fileOut.WriteLine($"# EOF: {numRules} rules added");
|
||||
fileOut.WriteLine("#------------------------------------------------------------");
|
||||
// chiudo file regole!
|
||||
fileOut.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -46,7 +46,26 @@ namespace SCMA
|
||||
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataPath"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File x regole di replacement USER DEFINED
|
||||
/// </summary>
|
||||
public static string nameRepRoleFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// File x regole di replacement GENERATED
|
||||
/// </summary>
|
||||
public static string nameRepRoleFileGen
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList").Replace(".map", ".gen.map"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di sanitizzazione XML
|
||||
|
||||
Reference in New Issue
Block a user