Started config setup for new objects

This commit is contained in:
Samuele Locatelli
2020-06-04 15:21:15 +02:00
parent e5daf52bb4
commit 8bd8144294
8 changed files with 167 additions and 6 deletions
+2
View File
@@ -33,6 +33,8 @@ namespace Thermo.Active.Config
public static List<AlarmsConfigModel> InitialAlarmsConfig;
public static List<HeadsConfigModel> HeadsConfig;
public static List<RecipeConfigModel> RecipeConfig;
public static List<ModBlockConfigModel> ModBlockConfig;
public static List<RiskConfigModel> RiskConfig;
public static CmsConnectConfigModel CmsConnectConfig;
public static AreasConfigModel ProductionConfig;
+53 -3
View File
@@ -34,6 +34,8 @@ namespace Thermo.Active.Config
ReadAlarmsConfig();
ReadHeadsConfig();
ReadRecipeConfig();
ReadModBlockConfig();
ReadRiskConfig();
// ReadCMSConnectConfig();
ReadMacros();
ReadScadaFile();
@@ -572,19 +574,21 @@ namespace Thermo.Active.Config
})
.ToList();
}
/// <summary>
/// Recipe Config setup from file
/// </summary>
private static void ReadRecipeConfig()
{
XDocument xmlConfigFile = GetXmlHandlerWithValidator(RECIPE_CONFIG_SCHEMA_PATH, RECIPE_CONFIG_PATH);
// Read head config from XML file
// Read Recipe config from XML file
RecipeConfig = xmlConfigFile
.Root
.Elements()
.Select(x => new RecipeConfigModel()
{
Id = Convert.ToInt16(x.Element("id").Value),
Category = GetTActCategory(x.Element("category").Value),
Category = GetTActParamType(x.Element("category").Value),
SubCategory_1 = x.Element("subCategory_1").Value,
SubCategory_2 = x.Element("subCategory_2").Value,
Name = x.Element("name").Value,
@@ -593,6 +597,52 @@ namespace Thermo.Active.Config
})
.ToList();
}
/// <summary>
/// Module config setup from file
/// </summary>
private static void ReadModBlockConfig()
{
XDocument xmlConfigFile = GetXmlHandlerWithValidator(MODBLOCK_CONFIG_SCHEMA_PATH, MODBLOCK_CONFIG_PATH);
// Read head config from XML file
ModBlockConfig = xmlConfigFile
.Root
.Elements()
.Select(x => new ModBlockConfigModel()
{
Id = Convert.ToInt16(x.Element("id").Value),
Label = x.Element("label").Value,
Type = GetTActMB_Type(x.Element("type").Value),
Section = GetTActMB_Section(x.Element("section").Value),
IdParam = Convert.ToInt16(x.Element("idParam").Value),
ShowDelay = Convert.ToBoolean(x.Element("showDelay").Value),
Priority = Convert.ToInt16(x.Element("priority").Value)
})
.ToList();
}
/// <summary>
/// Warmers config setup from file
/// </summary>
private static void ReadRiskConfig()
{
XDocument xmlConfigFile = GetXmlHandlerWithValidator(RISK_CONFIG_SCHEMA_PATH, RISK_CONFIG_PATH);
//// Read head config from XML file
//RiskConfig = xmlConfigFile
// .Root
// .Elements()
// .Select(x => new RiskConfigModel()
// {
// Id = Convert.ToInt16(x.Element("id").Value),
// Category = GetTActCategory(x.Element("category").Value),
// SubCategory_1 = x.Element("subCategory_1").Value,
// SubCategory_2 = x.Element("subCategory_2").Value,
// Name = x.Element("name").Value,
// Description = x.Element("description").Value,
// Format = x.Element("format").Value
// })
// .ToList();
}
private static void ReadCMSConnectConfig()
{
@@ -69,9 +69,15 @@
<Content Include="Config\customMainProgram.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Config\moduleBlockConfig.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\recipeConfig.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\risk2007Config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\userSoftKeyConfig.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
@@ -159,5 +165,15 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\moduleBlockConfigValidator.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\risk2007ConfigValidator.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.ConfigModels
{
public class ModBlockConfigModel
{
public int Id;
public string Label { get; set; }
public TACT_MBLOCK_TYPE Type { get; set; }
public TACT_MBLOCK_SECTION Section { get; set; }
public int IdParam{ get; set; }
public bool ShowDelay { get; set; }
public int Priority { get; set; }
}
}
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using static Thermo.Active.Model.Constants;
namespace Thermo.Active.Model.ConfigModels
{
public class RiskConfigModel
{
public int Id;
public TACT_PARAM_TYPE Category { get; set; }
public string SubCategory_1 { get; set; }
public string SubCategory_2 { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Format { get; set; }
}
}
+25
View File
@@ -90,6 +90,25 @@ namespace Thermo.Active.Model
Options
}
public enum TACT_MBLOCK_TYPE
{
ND = 0,
Heating,
Drawing,
Movement,
Vacuum,
Cooling,
Extraction
}
public enum TACT_MBLOCK_SECTION
{
ND = 0,
Heating,
Forming,
Extraction
}
public enum MAINTENANCE_UNIT_OF_MEASURE
{
mm = 0,
@@ -216,6 +235,12 @@ namespace Thermo.Active.Model
public const string RECIPE_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "recipeConfigValidator.xsd";
public const string RECIPE_CONFIG_PATH = CONFIG_DIRECTORY + "recipeConfig.xml";
public const string MODBLOCK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "moduleBlockConfigValidator.xsd";
public const string MODBLOCK_CONFIG_PATH = CONFIG_DIRECTORY + "moduleBlockConfig.xml";
public const string RISK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "risk2007ConfigValidator.xsd";
public const string RISK_CONFIG_PATH = CONFIG_DIRECTORY + "risk2007Config.xml";
public const string NC_SOFTKEYS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "ncSoftKeyConfigValidator.xsd";
public const string NC_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfig.xml";
@@ -63,6 +63,8 @@
<Compile Include="ConfigModels\AlarmsConfigModel.cs" />
<Compile Include="ConfigModels\CmsConnectConfigModel.cs" />
<Compile Include="ConfigModels\ExtSoftwareModel.cs" />
<Compile Include="ConfigModels\ModBlockConfigModel.cs" />
<Compile Include="ConfigModels\RiskConfigModel.cs" />
<Compile Include="ConfigModels\RecipeConfigModel.cs" />
<Compile Include="ConfigModels\HeadsConfigModel.cs" />
<Compile Include="ConfigModels\MaintenanceConfigModel.cs" />
+37 -3
View File
@@ -39,13 +39,47 @@ namespace Thermo.Active.Utils
default: return HEAD_TYPE.WJ;
}
}
public static TACT_PARAM_TYPE GetTActCategory(string strCategory)
/// <summary>
/// Conversion string --> TACT_PARAM_TYPE
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
public static TACT_PARAM_TYPE GetTActParamType(string strValue)
{
TACT_PARAM_TYPE answ = TACT_PARAM_TYPE.ND;
try
{
answ = (TACT_PARAM_TYPE)Enum.Parse(typeof(TACT_PARAM_TYPE), strCategory);
answ = (TACT_PARAM_TYPE)Enum.Parse(typeof(TACT_PARAM_TYPE), strValue);
}
catch { }
return answ;
}
/// <summary>
/// Conversion string --> TACT_MBLOCK_TYPE
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
public static TACT_MBLOCK_TYPE GetTActMB_Type(string strValue)
{
TACT_MBLOCK_TYPE answ = TACT_MBLOCK_TYPE.ND;
try
{
answ = (TACT_MBLOCK_TYPE)Enum.Parse(typeof(TACT_MBLOCK_TYPE), strValue);
}
catch { }
return answ;
}
/// <summary>
/// Conversion string --> TACT_MBLOCK_SECTION
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
public static TACT_MBLOCK_SECTION GetTActMB_Section(string strValue)
{
TACT_MBLOCK_SECTION answ = TACT_MBLOCK_SECTION.ND;
try
{
answ = (TACT_MBLOCK_SECTION)Enum.Parse(typeof(TACT_MBLOCK_SECTION), strValue);
}
catch { }
return answ;