Fix sofkey config and name

Added refresh alarm
This commit is contained in:
Lucio Maranta
2018-03-15 17:27:43 +01:00
parent d94bcff103
commit bfc8bc8451
7 changed files with 89 additions and 78 deletions
Binary file not shown.
+57 -57
View File
@@ -10,7 +10,7 @@
<lang langKey="it">Ita</lang>
</localizedNames>
</softKey_toggle>
<softkey_group>
<softKey_group>
<active>true</active>
<category>1</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -18,12 +18,12 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>false</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -31,12 +31,12 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -44,11 +44,11 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -56,12 +56,12 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -69,13 +69,13 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
<plcKey plcId="3"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
<subKey plcId="3"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -83,14 +83,14 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
<plcKey plcId="3"> 1 </plcKey>
<plcKey plcId="4"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
<subKey plcId="3"> 1 </subKey>
<subKey plcId="4"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -98,15 +98,15 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
<plcKey plcId="3"> 1 </plcKey>
<plcKey plcId="4"> 1 </plcKey>
<plcKey plcId="5"> 1 </plcKey>
</plcKeys>
</softkey_group>
<softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
<subKey plcId="3"> 1 </subKey>
<subKey plcId="4"> 1 </subKey>
<subKey plcId="5"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_group>
<active>true</active>
<category>2</category>
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
@@ -114,15 +114,15 @@
<lang langKey="en">Test</lang>
<lang langKey="it">Ita</lang>
</localizedNames>
<plcKeys>
<plcKey plcId="1"> 1 </plcKey>
<plcKey plcId="2"> 1 </plcKey>
<plcKey plcId="3"> 1 </plcKey>
<plcKey plcId="4"> 1 </plcKey>
<plcKey plcId="5"> 1 </plcKey>
<plcKey plcId="6"> 1 </plcKey>
</plcKeys>
</softkey_group>
<subKeys>
<subKey plcId="1"> 1 </subKey>
<subKey plcId="2"> 1 </subKey>
<subKey plcId="3"> 1 </subKey>
<subKey plcId="4"> 1 </subKey>
<subKey plcId="5"> 1 </subKey>
<subKey plcId="6"> 1 </subKey>
</subKeys>
</softKey_group>
<softKey_toggle>
<active>true</active>
<category>1</category>
@@ -3,9 +3,9 @@
<xs:element name="root">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="softkey_group" type="groupType" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="softKey_group" type="groupType" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="softKey_toggle" type="softKeyType" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="softkey_procedure" type="procedureType" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="softKey_procedure" type="procedureType" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:choice>
</xs:complexType>
@@ -39,10 +39,10 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="plcKeys">
<xs:element name="subKeys">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="6">
<xs:element name="plcKey">
<xs:element name="subKey">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
+3 -3
View File
@@ -20,7 +20,7 @@ namespace Step.Config
ReadServerConfig();
ReadAreaConfig();
ReadMaintenancesConfig();
ReadSoftkeysConfig();
ReadSoftKeysConfig();
ReadAlarmsConfig();
ReadHeadsConfig();
}
@@ -208,7 +208,7 @@ namespace Step.Config
.ToList();
}
private static void ReadSoftkeysConfig()
private static void ReadSoftKeysConfig()
{
// Get Softkeys
XDocument xmlConfigFile = GetXmlHandlerWithValidator(SOFTKEYS_CONFIG_SCHEMA_PATH, SOFTKEYS_CONFIG_PATH);
@@ -228,7 +228,7 @@ namespace Step.Config
y => y.Attribute("langKey").Value, y => y.Value
),
SubKeys = x.Element("plcKeys")?.Elements().Select(y => new SubKeysModel() // Populate subkeys if exist
SubKeys = x.Element("subKeys")?.Elements().Select(y => new SubKeysModel() // Populate subkeys if exist
{
Id = id++,
PlcId = Convert.ToInt32(y.Attribute("plcId").Value),
+2 -2
View File
@@ -8,8 +8,8 @@ namespace Step.Utils
{
switch (type)
{
case "softkey_procedure": return SOFTKEY_TYPE.PROCEDURE;
case "softkey_group": return SOFTKEY_TYPE.GROUP;
case "softKey_procedure": return SOFTKEY_TYPE.PROCEDURE;
case "softKey_group": return SOFTKEY_TYPE.GROUP;
default: return SOFTKEY_TYPE.TOGGLE;
}
}
+12 -1
View File
@@ -71,8 +71,19 @@ namespace Step.Controllers.SignalR
MessageServices.Current.Publish(SHOW_MSG_UI, null, "Refresh All Alarms.");
}
public void RefreshAlarm(string id)
public void RefreshAlarm(uint id)
{
using (NcHandler ncHandler = new NcHandler())
{
CmsError libraryError = ncHandler.Connect();
if (libraryError.IsError())
throw new HubException(libraryError.message);
libraryError = ncHandler.numericalControl.PLC_WRefreshMessage(id);
if (libraryError.IsError())
throw new HubException(libraryError.message);
}
MessageServices.Current.Publish(SHOW_MSG_UI, null, "Refresh Single Alarm. ID: " + id);
}
@@ -47,32 +47,32 @@ namespace Step.Controllers.WebApi
public IHttpActionResult GetSoftKeysConfig()
{
Dictionary<int, List<DTOSoftKeyConfigModel>> output = new Dictionary<int, List<DTOSoftKeyConfigModel>>();
foreach (var softkey in SoftKeysConfig)
foreach (var softKey in SoftKeysConfig)
{
// Check if category exists
if (!output.ContainsKey(softkey.Category))
if (!output.ContainsKey(softKey.Category))
{
// Add category if not exits
output.Add(softkey.Category, new List< DTOSoftKeyConfigModel>());
output.Add(softKey.Category, new List< DTOSoftKeyConfigModel>());
}
// Create subkeys dictionary for group
Dictionary<int, string> tmpSubKey = new Dictionary<int, string>();
if (softkey.Type == SOFTKEY_TYPE.GROUP && softkey.SubKeys != null)
if (softKey.Type == SOFTKEY_TYPE.GROUP && softKey.SubKeys != null)
{
tmpSubKey = new Dictionary<int, string>();
foreach (var subkey in softkey.SubKeys)
foreach (var subKey in softKey.SubKeys)
{
tmpSubKey.Add(subkey.Id, subkey.Text);
tmpSubKey.Add(subKey.Id, subKey.Text);
}
}
// Add to the category the new softkey
output[softkey.Category].Add(new DTOSoftKeyConfigModel()
output[softKey.Category].Add(new DTOSoftKeyConfigModel()
{
Id = softkey.Id,
Category = softkey.Category,
OperatorConfirmationNeeded = softkey.OperatorConfirmationNeeded,
Type = softkey.Type,
Id = softKey.Id,
Category = softKey.Category,
OperatorConfirmationNeeded = softKey.OperatorConfirmationNeeded,
Type = softKey.Type,
SubKeys = tmpSubKey
});