diff --git a/Jenkinsfile b/Jenkinsfile index e622ccc..1898524 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=397']) { + withEnv(['NEXT_BUILD_NUMBER=398']) { // 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' diff --git a/MTC_Adapter/SCMA/AdapterGeneric.cs b/MTC_Adapter/SCMA/AdapterGeneric.cs index 8243a2f..e3c11a5 100644 --- a/MTC_Adapter/SCMA/AdapterGeneric.cs +++ b/MTC_Adapter/SCMA/AdapterGeneric.cs @@ -11,8 +11,6 @@ namespace SCMA using AdapterCom; using MTC; using OPC_UA_REDIS; - using System.Xml; - using System.Xml.Serialization; #region macro oggetti da istanziare a blocchi da configurazione XML @@ -1370,9 +1368,9 @@ namespace SCMA importFile(utils.nameRepRoleFile); // ora leggo il file GENERATO di replacement... NON dando per scontato ci sia... - if (File.Exists(utils.nameRepRoleFileGen)) + if (File.Exists(utils.nameRepRoleFileSOUR)) { - importFile(utils.nameRepRoleFileGen); + importFile(utils.nameRepRoleFileSOUR); } } @@ -1717,7 +1715,12 @@ namespace SCMA } int totRighe = 0; - string fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("StatusListFilePath")); + // secondo protocollo scelgo quale file... + string fileName = utils.StatusListFile; + if (currGateway.protocollo == gwProtocol.SOURS) + { + fileName = utils.StatusListFileSOUR; + } string linea; totRighe = File.ReadLines(fileName).Count(); // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... diff --git a/MTC_Adapter/SCMA/DATA/CONF/DataModel.xml b/MTC_Adapter/SCMA/DATA/CONF/DataModel.xml index d0226a7..7122e3b 100644 --- a/MTC_Adapter/SCMA/DATA/CONF/DataModel.xml +++ b/MTC_Adapter/SCMA/DATA/CONF/DataModel.xml @@ -135,7 +135,7 @@ - + diff --git a/MTC_Adapter/SCMA/DataModel.cs b/MTC_Adapter/SCMA/DataModel.cs index 678d92e..2a41ba8 100644 --- a/MTC_Adapter/SCMA/DataModel.cs +++ b/MTC_Adapter/SCMA/DataModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using System.Xml; namespace SCMA @@ -34,6 +30,9 @@ namespace SCMA public class Variable : ouData { public string Units { get; set; } + public string CmsDataType { get; set; } = ""; + public string CmsDataIndex { get; set; } = ""; + public string CmsDataOpt { get; set; } = ""; } public class Condition : ouData { @@ -200,7 +199,10 @@ namespace SCMA BrowseName = string.Format(baseNS + ":" + currElement.Attributes["SymbolicName"].Value), DataType = currElement.Attributes["DataType"].Value, ValueRank = currElement.Attributes["ValueRank"].Value, - Units = currElement.Attributes["Units"].Value + Units = currElement.Attributes["Units"].Value, + CmsDataIndex = currElement.Attributes["CmsDataIndex"] == null ? "" : currElement.Attributes["CmsDataIndex"].Value, + CmsDataOpt = currElement.Attributes["CmsDataOpt"] == null ? "" : currElement.Attributes["CmsDataOpt"].Value, + CmsDataType = currElement.Attributes["CmsDataType"] == null ? "" : currElement.Attributes["CmsDataType"].Value }; Variables.Add(newItem); // controllo se ha dei child... nel caso aggiungo i child... diff --git a/MTC_Adapter/SCMA/MainForm.cs b/MTC_Adapter/SCMA/MainForm.cs index ede56c7..204883c 100644 --- a/MTC_Adapter/SCMA/MainForm.cs +++ b/MTC_Adapter/SCMA/MainForm.cs @@ -1284,7 +1284,7 @@ namespace SCMA // preparo file temp x generazione regole StreamWriter fileOut; // apro in scrittura il file x mettere le regole... - fileOut = new StreamWriter(utils.nameRepRoleFileGen); + fileOut = new StreamWriter(utils.nameRepRoleFileSOUR); fileOut.WriteLine("#------------------------------------------------------------"); fileOut.WriteLine("# AUTO GENERATED Replacement Conf File"); fileOut.WriteLine("#------------------------------------------------------------"); @@ -1603,6 +1603,29 @@ namespace SCMA fileOut.WriteLine("#------------------------------------------------------------"); // chiudo file regole! fileOut.Close(); + + // compilo il file StatusList.SOUR.map + fileOut = new StreamWriter(utils.StatusListFileSOUR); + int numStatus = 0; + fileOut.WriteLine("#------------------------------------------------------------"); + fileOut.WriteLine("# AUTO GENERATED StatusList File"); + fileOut.WriteLine("#------------------------------------------------------------"); + fileOut.WriteLine(""); + + // ricerca gruppi AUX + List selStatus = currDataModel.Variables.FindAll(x => x.CmsDataType.Equals("StatusList")); + foreach (var item in selStatus) + { + // compilo il file di conf... + fileOut.WriteLine($"{item.CmsDataIndex}|{item.BrowseName}|{item.CmsDataOpt}"); + } + + fileOut.WriteLine(""); + fileOut.WriteLine("#------------------------------------------------------------"); + fileOut.WriteLine($"# EOF: {numStatus} status added"); + fileOut.WriteLine("#------------------------------------------------------------"); + // chiudo file regole! + fileOut.Close(); } else { diff --git a/MTC_Adapter/SCMA/utils.cs b/MTC_Adapter/SCMA/utils.cs index f7022d3..07671a4 100644 --- a/MTC_Adapter/SCMA/utils.cs +++ b/MTC_Adapter/SCMA/utils.cs @@ -57,13 +57,34 @@ namespace SCMA } } /// - /// File x regole di replacement GENERATED + /// File x regole di replacement generato ad hoc x SOUR / OPC-UA /// - public static string nameRepRoleFileGen + public static string nameRepRoleFileSOUR { get { - return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList").Replace(".map", ".gen.map")); + return nameRepRoleFile.Replace(".map", ".SOUR.map"); + } + } + /// + /// File StatusList + /// + public static string StatusListFile + { + get + { + return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("StatusListFilePath")); + } + } + /// + /// File StatusList generato ad hoc x SOUR / OPC-UA + /// + /// + public static string StatusListFileSOUR + { + get + { + return StatusListFile.Replace(".map", ".SOUR.map"); } }