update config controller x gestione unità di misura
This commit is contained in:
@@ -11,7 +11,8 @@ namespace Thermo.Active.Config
|
||||
public static ServerConfigModel ServerStartupConfig;
|
||||
public static NcConfigModel NcConfig;
|
||||
public static List<ExtSoftwareModel> ExtSoftwaresConfig;
|
||||
public static Dictionary<string, string> additionalParametersConfig;
|
||||
public static Dictionary<string, string> AdditionalParametersConfig;
|
||||
public static Dictionary<int, string> UnitMeasuresConfig;
|
||||
public static SoftwareProdConfigModel SoftwareProdConfig;
|
||||
public static MachineModel MachineConfig;
|
||||
public static List<MaintenanceConfigModel> MaintenancesConfig;
|
||||
|
||||
@@ -372,11 +372,18 @@ namespace Thermo.Active.Config
|
||||
}).ToList();
|
||||
|
||||
// carico additionals parameters
|
||||
additionalParametersConfig = xmlConfigFile
|
||||
AdditionalParametersConfig = xmlConfigFile
|
||||
.Descendants("additionalParameters")
|
||||
.Elements("entry")
|
||||
.Select(x => new KeyValuePair<string,string>(x.Element("key").Value,x.Element("value").Value))
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
// carico unità di misura...
|
||||
UnitMeasuresConfig = xmlConfigFile
|
||||
.Descendants("unitOfMeasures")
|
||||
.Elements("unitOfMeasure")
|
||||
.Select(x => new KeyValuePair<int, string>(Convert.ToInt32(x.Attribute("id").Value), x.Attribute("value").Value))
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
}
|
||||
|
||||
private static void ReadAreaConfig()
|
||||
|
||||
@@ -1836,7 +1836,7 @@ namespace Thermo.Active.NC
|
||||
Id = item.Id,
|
||||
Range = currRange,
|
||||
Status = currStatus,
|
||||
UnitMeasure = $"{paramPLC.UnitMeasure}",
|
||||
UnitMeasure = getUM(paramPLC.UnitMeasure),
|
||||
ValueAct = paramPLC.ValueAct / item.ScaleFactor,
|
||||
SetpointHMI = paramPLC.SetpointHMI / item.ScaleFactor,
|
||||
SetpointPLC = paramPLC.SetpointPLC / item.ScaleFactor,
|
||||
@@ -1884,6 +1884,19 @@ namespace Thermo.Active.NC
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
protected string getUM(int um)
|
||||
{
|
||||
// default: no translation...
|
||||
string answ = $"{um}";
|
||||
// cerco in dictionary...
|
||||
if (UnitMeasuresConfig.ContainsKey(um))
|
||||
{
|
||||
answ = UnitMeasuresConfig[um];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recipe Parameters write to PLC (only SetpointHMI)
|
||||
/// </summary>
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
ProdEnabled = SoftwareProdConfig.Enabled,
|
||||
ProdPath = SoftwareProdConfig.Path,
|
||||
ExtSoftwares = ExtSoftwaresConfig,
|
||||
AdditionalParameters = additionalParametersConfig,
|
||||
AdditionalParameters = AdditionalParametersConfig,
|
||||
Autorun = ServerStartupConfig.AutoOpenCmsClient,
|
||||
EditorPath = ServerStartupConfig.TextEditorPath,
|
||||
MgiOption = NcConfig.MgiOption,
|
||||
|
||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.15.83")]
|
||||
[assembly: AssemblyVersion("0.15.85")]
|
||||
Reference in New Issue
Block a user