Merge branch 'feature/alarms' into develop

This commit is contained in:
Samuele Locatelli
2020-06-29 19:42:25 +02:00
18 changed files with 189 additions and 18 deletions
@@ -1091,6 +1091,23 @@
<format>enum</format>
<scaleFactor>1</scaleFactor>
<numDec>0</numDec>
<enumList>
<enumVal>
<label>drawing_type_RE_01</label>
<value>1</value>
<anim>imbutitura-a-tempo.json</anim>
</enumVal>
<enumVal>
<label>drawing_type_RE_02</label>
<value>2</value>
<anim>imbutitura-mantenuta.json</anim>
</enumVal>
<enumVal>
<label>drawing_type_RE_03</label>
<value>3</value>
<anim>imbutitura-negativa.json</anim>
</enumVal>
</enumList>
</parameter>
<parameter>
<id>99</id>
@@ -2191,6 +2208,23 @@
<format>integer</format>
<scaleFactor>1</scaleFactor>
<numDec>0</numDec>
<enumList>
<enumVal>
<label>extraction_main_type_RE_01</label>
<value>1</value>
<anim>estrazione-normale.json</anim>
</enumVal>
<enumVal>
<label>extraction_main_type_RE_02</label>
<value>2</value>
<anim>estrazione-senza-cornice.json</anim>
</enumVal>
<enumVal>
<label>extraction_main_type_RE_03</label>
<value>3</value>
<anim>estrazione-assistita.json</anim>
</enumVal>
</enumList>
</parameter>
<parameter>
<id>199</id>
@@ -24,6 +24,7 @@
<xs:all>
<xs:element name="label" type="xs:string" />
<xs:element name="value" type="xs:string" />
<xs:element name="anim" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
@@ -54,14 +55,4 @@
</xs:restriction>
</xs:simpleType>
<!-- Enum Type -->
<!--<xs:complexType name="enumVal">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="label" use="required" type="xs:string" />
<xs:attribute name="value" use="required" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>-->
</xs:schema>
@@ -597,11 +597,14 @@ namespace Thermo.Active.Config
NumDec = Convert.ToInt16(x.Element("numDec").Value),
//EnumVal = new Dictionary<string, string>()
EnumVal = x.Element("enumList") != null ? x.Element("enumList").Elements().ToDictionary(
y => y.Element("label").Value, y => y.Element("value").Value
) : new Dictionary<string, string>()
y => y.Element("value").Value,
y => new EnumDetail(y.Element("label").Value, y.Element("anim") != null ? y.Element("anim").Value : "")
) : new Dictionary<string, EnumDetail>()
})
.ToList();
}
/// <summary>
/// Module config setup from file
/// </summary>
@@ -14,6 +14,37 @@ namespace Thermo.Active.Model.ConfigModels
public string Format { get; set; }
public int ScaleFactor { get; set; }
public int NumDec { get; set; }
public Dictionary<string, string> EnumVal { get; set; }
public Dictionary<string, EnumDetail> EnumVal { get; set; }
public string Anim { get; set; }
}
public class EnumDetail
{
public string text { get; set; } = "";
public string anim { get; set; } = "";
public EnumDetail(string text, string anim)
{
this.text = text;
this.anim = anim;
}
public override bool Equals(object obj)
{
if (!(obj is EnumDetail item))
return false;
if (text != item.text)
return false;
if (anim != item.anim)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Thermo.Active.Model.ConfigModels;
namespace Thermo.Active.Model.DTOModels.ThRecipe
{
@@ -14,6 +15,6 @@ namespace Thermo.Active.Model.DTOModels.ThRecipe
public string Label;
public int ScaleFactor;
public int NumDec;
public Dictionary<string, string> EnumVal { get; set; }
public Dictionary<string, EnumDetail> EnumVal { get; set; }
}
}
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Thermo.Active.Model.ConfigModels;
namespace Thermo.Active.Model.DTOModels.ThRecipe
{
@@ -14,7 +15,7 @@ namespace Thermo.Active.Model.DTOModels.ThRecipe
public double ValueAct { get; set; }
public int ScaleFactor { get; set; }
public int NumDec { get; set; }
public Dictionary<string, string> EnumVal { get; set; }
public Dictionary<string, EnumDetail> EnumVal { get; set; }
public override bool Equals(object obj)
{
+1 -1
View File
@@ -1374,7 +1374,7 @@ namespace Thermo.Active.NC
ValueAct = 0,
ScaleFactor = 1,
NumDec = 0,
EnumVal = new Dictionary<string, string>()
EnumVal = new Dictionary<string, Model.ConfigModels.EnumDetail>()
};
}
currentRecipe.Add(item.Label, currParam);
@@ -55,9 +55,13 @@ namespace Thermo.Active.Controllers.WebApi
Dictionary<string, string> alarmsNames = GetPlcAlarmsTranslations(language);
Dictionary<string, string> headsNames = GetLocalizedHeadsNames(language);
// scada
Dictionary<string, string> scadaTranslations = GetScadaTranslations(language);
// THermo (modules and recipe enums) translations
Dictionary<string, string> thermoTranslations = GetThermoTranslations(language);
// Concat maintenances dictionary with translations dictionary
translations = translations.Concat(maintenanceNames).ToDictionary(x => x.Key, x => x.Value);
// Softkeys
@@ -68,6 +72,8 @@ namespace Thermo.Active.Controllers.WebApi
translations = translations.Concat(headsNames).ToDictionary(x => x.Key, x => x.Value);
// Scada
translations = translations.Concat(scadaTranslations).ToDictionary(x => x.Key, x => x.Value);
// Scada
translations = translations.Concat(thermoTranslations).ToDictionary(x => x.Key, x => x.Value);
if (translations == null)
return InternalServerError();
@@ -159,6 +165,37 @@ namespace Thermo.Active.Controllers.WebApi
return returnValue;
}
public static Dictionary<string, string> GetThermoTranslations(string language)
{
Dictionary<string, string> returnValue = new Dictionary<string, string>();
// Read data from CN
ncAdapter.numericalControl.NC_GetTranslatedThermoLabels(language, ref returnValue);
//// Id start from 1
//for (int i = 1; i <= 1024; i++)
//{
// // Get configurated alarms
// var tmpAlarmConfig = InitialAlarmsConfig.Where(x => x.PlcId == i).FirstOrDefault();
// // Default string
// string message = string.Format(NOT_CONFIGURATED_ALARM_MESSAGE, i);
// // If is configurated
// if (tmpAlarmConfig != null)
// {
// // Find translated string
// message = messages.Where(x => x.Key == tmpAlarmConfig.AlarmId).FirstOrDefault().Value;
// if (message == null)
// message = string.Format(NOT_FOUND_ALARM_MESSAGE, i);
// }
// // Add to dictionary
// returnValue.Add(
// ALARM_PREFIX + i,
// message
// );
//}
return returnValue;
}
private static Dictionary<string, string> GetScadaTranslations(string language)
{
Dictionary<string, string> translatedNames = new Dictionary<string, string>();
+3
View File
@@ -0,0 +1,3 @@
general_sizes_sheet_material_RE_01,Materiale UNO
general_sizes_sheet_material_RE_02,Materiale DUE
general_sizes_sheet_material_RE_03,Materiale TRE
+40
View File
@@ -0,0 +1,40 @@
mb_DiscesaCZ,MB_DiscesaCZ ITA
mb_MembDiscesaZ,MB_MembDiscesaZ ITA
mb_MembZ,MB_MembZ ITA
mb_Mod_MembSalitaZ,MB_Mod_MembSalitaZ ITA
mb_Mod_AppoggioDiscesaW,MB_Mod_AppoggioDiscesaW ITA
mb_Mod_RiscaldoInf,MB_Mod_RiscaldoInf ITA
mb_Mod_RiscaldoSup,MB_Mod_RiscaldoSup ITA
mb_Mod_PirometroRisc,MB_Mod_PirometroRisc ITA
mb_Mod_DecompSustain,MB_Mod_DecompSustain ITA
mb_Mod_Acrilico,MB_Mod_Acrilico ITA
mb_Mod_RiscaldiIndietro,MB_Mod_RiscaldiIndietro ITA
mb_Mod_ExtraR,MB_Mod_ExtraR ITA
mb_Mod_Imbutitura,MB_Mod_Imbutitura ITA
mb_Mod_SalitaW,MB_Mod_SalitaW ITA
mb_Mod_AttesaStampo,MB_Mod_AttesaStampo ITA
mb_Mod_Raffreddamento,MB_Mod_Raffreddamento ITA
mb_Mod_PirometroRaffr,MB_Mod_PirometroRaffr ITA
mb_Mod_Vuoto,MB_Mod_Vuoto ITA
mb_Mod_VuotoDiretto,MB_Mod_VuotoDiretto ITA
mb_Mod_VuotoAux,MB_Mod_VuotoAux ITA
mb_Mod_Nebulizz,MB_Mod_Nebulizz ITA
mb_Mod_AttesaPartenzaZ,MB_Mod_AttesaPartenzaZ ITA
mb_Mod_DiscesaZ,MB_Mod_DiscesaZ ITA
mb_Mod_Z,MB_Mod_Z ITA
mb_Mod_SalitaZ,MB_Mod_SalitaZ ITA
mb_Mod_AriaZ,MB_Mod_AriaZ ITA
mb_Mod_VuotoZ,MB_Mod_VuotoZ ITA
mb_Mod_ScaricoVuotoZ,MB_Mod_ScaricoVuotoZ ITA
mb_Mod_ScaricoVuoto,MB_Mod_ScaricoVuoto ITA
mb_Mod_EstrazioneZ,MB_Mod_EstrazioneZ ITA
mb_Mod_DiscesaAssistZ,MB_Mod_DiscesaAssistZ ITA
mb_Mod_Estrazione,MB_Mod_Estrazione ITA
mb_Mod_DiscesaW,MB_Mod_DiscesaW ITA
mb_Mod_RiscaldiIndietro2,MB_Mod_RiscaldiIndietro2 ITA
mb_Mod_SalitaCZ,MB_Mod_SalitaCZ ITA
mb_Mod_Riscaldi2,MB_Mod_Riscaldi2 ITA
mb_Mod_Estrazione_Aux_W,MB_Mod_Estrazione_Aux_W ITA
mb_Mod_Attesa_Pirometro,MB_Mod_Attesa_Pirometro ITA
mb_Mod_Prevuoto,MB_Mod_Prevuoto ITA
mb_Mod_SalitaAssistZ,MB_Mod_SalitaAssistZ ITA
+1 -1
View File
@@ -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.9.14")]
[assembly: AssemblyVersion("0.9.15")]
+24
View File
@@ -261,6 +261,12 @@
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="CMS_Icon.ico" />
<Content Include="Dict\Enums_it.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Dict\Labels_it.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SetupActive.iss" />
<Content Include="wwwroot\.idea\encodings.xml" />
<Content Include="wwwroot\.idea\misc.xml" />
@@ -11759,6 +11765,24 @@
<None Include="wwwroot\.bowerrc" />
<None Include="wwwroot\.editorconfig" />
<None Include="wwwroot\.idea\wwwroot.iml" />
<None Include="wwwroot\assets\animations\estrazione-assistita.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\animations\estrazione-normale.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\animations\estrazione-senza-cornice.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\animations\imbutitura-a-tempo.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\animations\imbutitura-mantenuta.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\animations\imbutitura-negativa.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\assets\fonts\WorkSans-Black.ttf" />
<None Include="wwwroot\assets\fonts\WorkSans-Bold.ttf" />
<None Include="wwwroot\assets\fonts\WorkSans-ExtraBold.ttf" />
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long