Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_step into develop
This commit is contained in:
Binary file not shown.
@@ -1,86 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="areasConfig">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
|
||||
<xs:element name="production">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="tooling">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="report">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="alarms">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="maintenance">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="utilities">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="scada">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
<areasConfig>
|
||||
<production>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>false</allowExternalBrowser>
|
||||
<ncNeeded>true</ncNeeded>
|
||||
</production>
|
||||
<tooling>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>false</allowExternalBrowser>
|
||||
<ncNeeded>true</ncNeeded>
|
||||
</tooling>
|
||||
<report>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>true</allowExternalBrowser>
|
||||
<ncNeeded>true</ncNeeded>
|
||||
</report>
|
||||
<alarms>
|
||||
<enabled>false</enabled>
|
||||
<allowExternalBrowser>true</allowExternalBrowser>
|
||||
<ncNeeded>false</ncNeeded>
|
||||
</alarms>
|
||||
<maintenance>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>false</allowExternalBrowser>
|
||||
<ncNeeded>true</ncNeeded>
|
||||
</maintenance>
|
||||
<utilities>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>false</allowExternalBrowser>
|
||||
<ncNeeded>false</ncNeeded>
|
||||
</utilities>
|
||||
<scada>
|
||||
<enabled>true</enabled>
|
||||
<allowExternalBrowser>true</allowExternalBrowser>
|
||||
<ncNeeded>true</ncNeeded>
|
||||
</scada>
|
||||
</areasConfig>
|
||||
@@ -1,82 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:element name="areasConfig">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="areasConfig">
|
||||
<xs:element name="production">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
|
||||
<xs:element name="production">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="tooling">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="tooling">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="report">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="report">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="alarms">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="alarms">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="maintenance">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="maintenance">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="utilities">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="utilities">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="scada">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean"/>
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean"/>
|
||||
<xs:element name="ncNeeded" type="xs:boolean"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="scada">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="enabled" type="xs:boolean" />
|
||||
<xs:element name="allowExternalBrowser" type="xs:boolean" />
|
||||
<xs:element name="ncNeeded" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ncSoftKeys>
|
||||
<auto>
|
||||
<active>true</active>
|
||||
<visualizedName>Auto</visualizedName>
|
||||
</auto>
|
||||
<edit>
|
||||
<active>true</active>
|
||||
<visualizedName>Edit</visualizedName>
|
||||
</edit>
|
||||
<mdi>
|
||||
<active>true</active>
|
||||
<visualizedName>Mdi</visualizedName>
|
||||
</mdi>
|
||||
<dnc>
|
||||
<active>true</active>
|
||||
<visualizedName>Dnc</visualizedName>
|
||||
</dnc>
|
||||
<ref>
|
||||
<active>true</active>
|
||||
<visualizedName>Ref</visualizedName>
|
||||
</ref>
|
||||
<jog>
|
||||
<active>true</active>
|
||||
<visualizedName>Jog</visualizedName>
|
||||
</jog>
|
||||
<jogInc>
|
||||
<active>true</active>
|
||||
<visualizedName>Jog Inc</visualizedName>
|
||||
</jogInc>
|
||||
<restart>
|
||||
<active>true</active>
|
||||
<visualizedName>Restart</visualizedName>
|
||||
</restart>
|
||||
<teach>
|
||||
<active>true</active>
|
||||
<visualizedName>Teach</visualizedName>
|
||||
</teach>
|
||||
<retract>
|
||||
<active>true</active>
|
||||
<visualizedName>Restract</visualizedName>
|
||||
</retract>
|
||||
<wcsMcs>
|
||||
<active>true</active>
|
||||
<visualizedName>Wcs Mcs</visualizedName>
|
||||
</wcsMcs>
|
||||
<handle>
|
||||
<active>true</active>
|
||||
<visualizedName>Handle</visualizedName>
|
||||
</handle>
|
||||
<reset>
|
||||
<active>true</active>
|
||||
<visualizedName>Reset</visualizedName>
|
||||
</reset>
|
||||
<!-- Sub Menu -->
|
||||
<blk>
|
||||
<active>true</active>
|
||||
<visualizedName>Blk/Blk</visualizedName>
|
||||
</blk>
|
||||
<blkDel>
|
||||
<active>true</active>
|
||||
<visualizedName>Blk Del</visualizedName>
|
||||
</blkDel>
|
||||
<opStop>
|
||||
<active>true</active>
|
||||
<visualizedName>OpStop</visualizedName>
|
||||
</opStop>
|
||||
<dryRun>
|
||||
<active>true</active>
|
||||
<visualizedName>DryRun</visualizedName>
|
||||
</dryRun>
|
||||
<prgTest>
|
||||
<active>true</active>
|
||||
<visualizedName>PrgTest</visualizedName>
|
||||
</prgTest>
|
||||
<manualHandleInterrupt>
|
||||
<active>true</active>
|
||||
<visualizedName>Manual Handle Interrupt</visualizedName>
|
||||
</manualHandleInterrupt>
|
||||
<teachIn>
|
||||
<active>true</active>
|
||||
<visualizedName>Teach In</visualizedName>
|
||||
</teachIn>
|
||||
<incPlane>
|
||||
<active>true</active>
|
||||
<visualizedName>Inc Plane</visualizedName>
|
||||
</incPlane>
|
||||
<plus>
|
||||
<active>true</active>
|
||||
<visualizedName>+</visualizedName>
|
||||
</plus>
|
||||
<minus>
|
||||
<active>true</active>
|
||||
<visualizedName>-</visualizedName>
|
||||
</minus>
|
||||
<rapid>
|
||||
<active>true</active>
|
||||
<visualizedName>Rapid</visualizedName>
|
||||
</rapid>
|
||||
<xOne>
|
||||
<active>true</active>
|
||||
<visualizedName>x1</visualizedName>
|
||||
</xOne>
|
||||
<xTen>
|
||||
<active>true</active>
|
||||
<visualizedName>x10</visualizedName>
|
||||
</xTen>
|
||||
<xHundred>
|
||||
<active>true</active>
|
||||
<visualizedName>x10</visualizedName>
|
||||
</xHundred>
|
||||
<xThousand>
|
||||
<active>true</active>
|
||||
<visualizedName>x10</visualizedName>
|
||||
</xThousand>
|
||||
</ncSoftKeys>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<xs:element name="ncSoftKeys" type="menuKeysType"></xs:element>
|
||||
|
||||
|
||||
<!-- ncSoftKeyType type -->
|
||||
<xs:complexType name="ncSoftKeyType">
|
||||
<xs:all>
|
||||
<xs:element name="active" minOccurs="1" maxOccurs="1" type="xs:boolean"></xs:element>
|
||||
<xs:element name="visualizedName" type="xs:string"></xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="menuKeysType">
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
<xs:element name="auto" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="edit" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="mdi" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="dnc" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="ref" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="jog" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="jogInc" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="restart" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="teach" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="retract" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="wcsMcs" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="handle" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="reset" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<!-- Subkeys -->
|
||||
<xs:element name="blk" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="blkDel" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="opStop" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="dryRun" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="prgTest" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="manualHandleInterrupt" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="teachIn" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="incPlane" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="plus" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="minus" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="rapid" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="xOne" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="xTen" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="xHundred" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="xThousand" type="ncSoftKeyType" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -19,7 +19,8 @@ namespace Step.Config
|
||||
public static List<FunctionAccessModel> FunctionsAccessConfig;
|
||||
public static List<DTORuntimeFunctionalityModel> AllFunctionalityDisabled;
|
||||
|
||||
public static List<SoftKeyConfigModel> SoftKeysConfig;
|
||||
public static List<UserSoftKeyConfigModel> SoftKeysConfig;
|
||||
public static List<NcSoftKeysModel> NcSoftKeysConfig;
|
||||
public static List<AlarmsConfigModel> InitialAlarmsConfig;
|
||||
public static List<HeadsConfigModel> HeadsConfig;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Step.Model.ConfigModels;
|
||||
using Step.Utils;
|
||||
using static Step.Utils.SupportFunctions;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
@@ -8,6 +7,7 @@ using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
using static Step.Config.ServerConfig;
|
||||
using static Step.Model.Constants;
|
||||
using static Step.Utils.SupportFunctions;
|
||||
|
||||
namespace Step.Config
|
||||
{
|
||||
@@ -20,7 +20,8 @@ namespace Step.Config
|
||||
ReadServerConfig();
|
||||
ReadAreaConfig();
|
||||
ReadMaintenancesConfig();
|
||||
ReadSoftKeysConfig();
|
||||
ReadNcSoftKeys();
|
||||
ReadUserSoftKeysConfig();
|
||||
ReadAlarmsConfig();
|
||||
ReadHeadsConfig();
|
||||
}
|
||||
@@ -138,7 +139,7 @@ namespace Step.Config
|
||||
}
|
||||
}
|
||||
|
||||
#region Read config from file
|
||||
#region Read config from file from configuration
|
||||
|
||||
public static void ReadServerConfig()
|
||||
{
|
||||
@@ -203,22 +204,39 @@ namespace Step.Config
|
||||
Deadline = DateTime.Parse(x.Element("deadline").Value),
|
||||
Type = x.Element("type").Value,
|
||||
CouterId = Convert.ToInt32(x.Element("counterId").Value)
|
||||
}
|
||||
)
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static void ReadSoftKeysConfig()
|
||||
|
||||
private static void ReadNcSoftKeys()
|
||||
{
|
||||
// Get Softkeys
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(SOFTKEYS_CONFIG_SCHEMA_PATH, SOFTKEYS_CONFIG_PATH);
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(NC_SOFTKEYS_CONFIG_SCHEMA_PATH, NC_SOFTKEYS_CONFIG_PATH);
|
||||
// Read Nc softkey configuration from XML
|
||||
NcSoftKeysConfig = xmlConfigFile
|
||||
.Root
|
||||
.Elements()
|
||||
.Where(x => Convert.ToBoolean(x.Element("active").Value) == true) // Filter for active softkey
|
||||
.Select(x => new NcSoftKeysModel()
|
||||
{
|
||||
Id = GetPlcIdFromNcSoftKey(x.Name.ToString()),
|
||||
Name = x.Name.ToString(),
|
||||
VisualizedName = x.Element("visualizedName").Value,
|
||||
IsActive = Convert.ToBoolean(x.Element("active").Value)
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static void ReadUserSoftKeysConfig()
|
||||
{
|
||||
// Get softkey file content
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(USER_SOFTKEYS_CONFIG_SCHEMA_PATH, USER_SOFTKEYS_CONFIG_PATH);
|
||||
int id = 1;
|
||||
// Read softkey configuration from XML with LINQ
|
||||
SoftKeysConfig = xmlConfigFile
|
||||
.Root
|
||||
.Elements()
|
||||
.Where(x => Convert.ToBoolean(x.Element("active").Value) == true) // Only active softkey
|
||||
.Select(x => new SoftKeyConfigModel()
|
||||
.Where(x => Convert.ToBoolean(x.Element("active").Value) == true) // Filter for active softkey
|
||||
.Select(x => new UserSoftKeyConfigModel()
|
||||
{
|
||||
Id = id++, // autoincrement Id
|
||||
PlcId = Convert.ToInt32(x.Element("plcId")?.Value), // If exists
|
||||
@@ -276,8 +294,6 @@ namespace Step.Config
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endregion Read config from file
|
||||
|
||||
|
||||
#endregion Read config from file from configuration
|
||||
}
|
||||
}
|
||||
@@ -47,11 +47,11 @@
|
||||
<Compile Include="ServerConfigController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Config\softKeyConfig.xml">
|
||||
<EmbeddedResource Include="Config\userSoftKeyConfig.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Config\softKeyConfigValidator.xsd">
|
||||
<EmbeddedResource Include="Config\userSoftKeyConfigValidator.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
@@ -77,6 +77,10 @@
|
||||
<EmbeddedResource Include="Config\headsConfig.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Config\ncSoftKeyConfig.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Content Include="Config\serverConfigValidator.xsd">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -85,6 +89,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Config\ncSoftKeyConfigValidator.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Step.Model\Step.Model.csproj">
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Step.Model.ConfigModels
|
||||
{
|
||||
public class NcSoftKeysModel
|
||||
{
|
||||
public int Id;
|
||||
public bool IsActive;
|
||||
public string Name;
|
||||
public string VisualizedName;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ using static Step.Model.Constants;
|
||||
|
||||
namespace Step.Model.ConfigModels
|
||||
{
|
||||
public class SoftKeyConfigModel
|
||||
public class UserSoftKeyConfigModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Dictionary<string, string> LocalizedNames { get; set; }
|
||||
@@ -89,8 +89,8 @@ namespace Step.Model
|
||||
public const string MAINTENANCES_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "maintenancesConfigValidator.xsd";
|
||||
public const string MAINTENANCES_CONFIG_PATH = CONFIG_DIRECTORY + "maintenancesConfig.xml";
|
||||
|
||||
public const string SOFTKEYS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "softKeyConfigValidator.xsd";
|
||||
public const string SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "softKeyConfig.xml";
|
||||
public const string USER_SOFTKEYS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "userSoftKeyConfigValidator.xsd";
|
||||
public const string USER_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "userSoftKeyConfig.xml";
|
||||
|
||||
public const string ALARMS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "alarmsConfigValidator.xsd";
|
||||
public const string ALARMS_CONFIG_PATH = CONFIG_DIRECTORY + "alarmsConfig.xml";
|
||||
@@ -98,6 +98,9 @@ namespace Step.Model
|
||||
public const string HEADS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "headsConfigValidator.xsd";
|
||||
public const string HEADS_CONFIG_PATH = CONFIG_DIRECTORY + "headsConfig.xml";
|
||||
|
||||
public const string NC_SOFTKEYS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfigValidator.xsd";
|
||||
public const string NC_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfig.xml";
|
||||
|
||||
public static string WEBSITE_DIRECTORY = Path.Combine(BASE_PATH, "..", "wwwroot");
|
||||
public static string LANGUAGE_PACK_DIRECTORY = BASE_PATH + "\\languages\\";
|
||||
public static string LANGUAGE_SCHEMA_PATH = BASE_PATH + "\\LanguageValidator.xsd";
|
||||
@@ -117,7 +120,8 @@ namespace Step.Model
|
||||
public const string SEND_PROCESSES_DATA = "SEND_PROCESSES_STATUS";
|
||||
public const string SEND_FUNCTIONALITY_DATA = "SEND_FUNCTION_DATA";
|
||||
public const string SEND_EXPIRED_MAINTENANCES_DATA = "SEND_EXPIRED_MAINTENANCES_DATA";
|
||||
public const string SEND_SOFTKEYS_DATA = "SEND_SOFT_KEYS_DATA";
|
||||
public const string SEND_USER_SOFTKEYS_DATA = "SEND_USER_SOFTKEYS_DATA";
|
||||
public const string SEND_NC_SOFTKEYS_DATA = "SEND_NC_SOFTKEYS_DATA";
|
||||
public const string SEND_HEADS_DATA = "SEND_HEADS_DATA";
|
||||
|
||||
public const string BROADCAST_DATA = "BROADCAST_DATA";
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Step.Model.DTOModels
|
||||
{
|
||||
public class DTONcSoftKeyModel
|
||||
{
|
||||
public int Id;
|
||||
public bool Active;
|
||||
public bool Value;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTONcSoftKeyModel;
|
||||
|
||||
if (Id != item.Id)
|
||||
return false;
|
||||
if (Active != item.Active)
|
||||
return false;
|
||||
if (Value != item.Value)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -7,7 +7,7 @@ using static Step.Model.Constants;
|
||||
|
||||
namespace Step.Model.DTOModels
|
||||
{
|
||||
public class DTOSoftKeyConfigModel
|
||||
public class DTOUserSoftKeyConfigModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Category { get; set; }
|
||||
@@ -16,7 +16,7 @@ namespace Step.Model.DTOModels
|
||||
public Dictionary<int, string> SubKeys { get; set; }
|
||||
}
|
||||
|
||||
public class DTOSoftKeyModel
|
||||
public class DTOUserSoftKeyModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Category { get; set; }
|
||||
@@ -25,7 +25,7 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOSoftKeyModel;
|
||||
var item = obj as DTOUserSoftKeyModel;
|
||||
|
||||
if (Id != item.Id)
|
||||
return false;
|
||||
@@ -63,10 +63,11 @@
|
||||
<Compile Include="ConfigModels\AlarmsConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\HeadsConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\MaintenanceConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\NcSoftKeysModel.cs" />
|
||||
<Compile Include="ConfigModels\ServerConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\AreasConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\NcConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\SoftKeyConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\UserSoftKeyConfigModel.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="DatabaseModels\FunctionAccessModel.cs" />
|
||||
<Compile Include="ConfigModels\MessageModel.cs" />
|
||||
@@ -90,11 +91,12 @@
|
||||
<LastGenOutput>DTOLanguageModel.cs.d.ts</LastGenOutput>
|
||||
</Compile>
|
||||
<Compile Include="DTOModels\DTONcGenericDataModel.cs" />
|
||||
<Compile Include="DTOModels\DTONcSoftKeyModel.cs" />
|
||||
<Compile Include="DTOModels\DTOPowerOnDataModel.cs" />
|
||||
<Compile Include="DTOModels\DTOProcessDataModel.cs" />
|
||||
<Compile Include="DTOModels\DTORoleModel.cs" />
|
||||
<Compile Include="DTOModels\DTORuntimeFunctionAccessModel.cs" />
|
||||
<Compile Include="DTOModels\DTOSoftKeyModel.cs" />
|
||||
<Compile Include="DTOModels\DTOUserSoftKeyModel.cs" />
|
||||
<Compile Include="DTOModels\DTOStartupConfigurationModel.cs" />
|
||||
<Compile Include="DTOModels\DTOUserModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
+45
-11
@@ -441,13 +441,13 @@ namespace Step.NC
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
public CmsError GetSoftKeys(out List<DTOSoftKeyModel> softKeys)
|
||||
public CmsError GetUserSoftKeys(out List<DTOUserSoftKeyModel> softKeys)
|
||||
{
|
||||
softKeys = new List<DTOSoftKeyModel>();
|
||||
softKeys = new List<DTOUserSoftKeyModel>();
|
||||
List<SoftKeysModel> plcSoftKeys = new List<SoftKeysModel>();
|
||||
|
||||
// Get softkeys data from PLC
|
||||
CmsError cmsError = numericalControl.PLC_RSoftKeys(ref plcSoftKeys);
|
||||
CmsError cmsError = numericalControl.PLC_RUserSoftKeys(ref plcSoftKeys);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -459,10 +459,10 @@ namespace Step.NC
|
||||
// Foreach subkey create a softkey
|
||||
foreach (var subkey in softKey.SubKeys)
|
||||
{
|
||||
// Find plc value
|
||||
// Find the plc matching data
|
||||
var plcSoftKey = plcSoftKeys.Find(x => x.Id == subkey.PlcId);
|
||||
// Set data
|
||||
softKeys.Add(new DTOSoftKeyModel()
|
||||
// Create and add new user softkey model
|
||||
softKeys.Add(new DTOUserSoftKeyModel()
|
||||
{
|
||||
Id = subkey.Id,
|
||||
Active = plcSoftKey.Active,
|
||||
@@ -473,9 +473,9 @@ namespace Step.NC
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find plc value
|
||||
// Find the plc matching data
|
||||
var plcSoftKey = plcSoftKeys.Find(x => x.Id == softKey.PlcId);
|
||||
softKeys.Add(new DTOSoftKeyModel()
|
||||
softKeys.Add(new DTOUserSoftKeyModel()
|
||||
{
|
||||
Id = softKey.Id,
|
||||
Active = plcSoftKey.Active,
|
||||
@@ -487,6 +487,32 @@ namespace Step.NC
|
||||
|
||||
return cmsError;
|
||||
}
|
||||
public CmsError GetNcSoftKeys(out List<DTONcSoftKeyModel> ncSoftKeys)
|
||||
{
|
||||
ncSoftKeys = new List<DTONcSoftKeyModel>();
|
||||
List<SoftKeysModel> plcSoftKeys = new List<SoftKeysModel>();
|
||||
|
||||
// Get Nc softkeys data from PLC
|
||||
CmsError cmsError = numericalControl.PLC_RNcSoftKeys(ref plcSoftKeys);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
foreach (var softKey in NcSoftKeysConfig)
|
||||
{
|
||||
// Find the plc matching data
|
||||
var plcSoftKey = plcSoftKeys.Find(x => x.Id == softKey.Id);
|
||||
|
||||
// Create and add Nc softkey model
|
||||
ncSoftKeys.Add(new DTONcSoftKeyModel()
|
||||
{
|
||||
Id = softKey.Id,
|
||||
Active = plcSoftKey.Active,
|
||||
Value = plcSoftKey.Value
|
||||
});
|
||||
}
|
||||
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
public CmsError GetHeadsData(out List<DTOHeadModel> heads)
|
||||
{
|
||||
@@ -566,10 +592,18 @@ namespace Step.NC
|
||||
|
||||
#region Write data
|
||||
|
||||
public CmsError PutSoftKeyValue(uint id)
|
||||
public CmsError PutNcSoftKeyClick(uint id)
|
||||
{
|
||||
// Write softkey pression to plc
|
||||
CmsError cmsError = numericalControl.PLC_WSoftKey(id);
|
||||
// Write Nc softkey press to plc
|
||||
CmsError cmsError = numericalControl.PLC_WNcSoftKey(id);
|
||||
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
public CmsError PutUserSoftKeyClick(uint id)
|
||||
{
|
||||
// Write user softkey press to plc
|
||||
CmsError cmsError = numericalControl.PLC_WNcSoftKey(id);
|
||||
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ public static class ThreadsFunctions
|
||||
private static long ReadProcPPTimer = 0, ReadProcPPTimes = 0;
|
||||
private static long ReadFunctionTimer = 0, ReadFunctionTimes = 0;
|
||||
private static long ReadMaintenanceTimer = 0, ReadMaintenanceTimes = 0;
|
||||
private static long ReadSoftKeysTimer = 0, ReadSoftKeysTimes = 0;
|
||||
private static long ReadUserSoftKeysTimer = 0, ReadUserSoftKeysTimes = 0;
|
||||
private static long ReadNcSoftKeysTimer = 0, ReadNcSoftKeysTimes = 0;
|
||||
|
||||
private static Thread ConnThread;
|
||||
|
||||
@@ -53,7 +54,7 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
sw.Stop();
|
||||
|
||||
//Send to the UI the time
|
||||
//Update thread timer
|
||||
ReadAlarmsTimer += sw.ElapsedMilliseconds;
|
||||
ReadAlarmsTimes++;
|
||||
|
||||
@@ -96,7 +97,7 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
sw.Stop();
|
||||
|
||||
//Send time to the UI
|
||||
// Update thread timer
|
||||
ReadPowerOnTimer += sw.ElapsedMilliseconds;
|
||||
ReadPowerOnTimes++;
|
||||
|
||||
@@ -141,7 +142,8 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
|
||||
// Update thread timer
|
||||
ReadProcPPTimer += sw.ElapsedMilliseconds;
|
||||
ReadProcPPTimes++;
|
||||
|
||||
@@ -185,7 +187,8 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
|
||||
// Update thread timer
|
||||
ReadFunctionTimer += sw.ElapsedMilliseconds;
|
||||
ReadFunctionTimes++;
|
||||
|
||||
@@ -229,7 +232,8 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
|
||||
// Update thread timer
|
||||
ReadMaintenanceTimer += sw.ElapsedMilliseconds;
|
||||
ReadMaintenanceTimes++;
|
||||
|
||||
@@ -243,7 +247,7 @@ public static class ThreadsFunctions
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadSoftKeysData()
|
||||
public static void ReadUserSoftKeysData()
|
||||
{
|
||||
NcHandler ncHandler = new NcHandler();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -261,21 +265,67 @@ public static class ThreadsFunctions
|
||||
|
||||
if (ncHandler.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get Data from config and PLC
|
||||
libraryError = ncHandler.GetSoftKeys(out List<DTOSoftKeyModel> softKeys);
|
||||
// Get softkey data from config and PLC
|
||||
libraryError = ncHandler.GetUserSoftKeys(out List<DTOUserSoftKeyModel> softKeys);
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
else
|
||||
// Send through signalR
|
||||
MessageServices.Current.Publish(SEND_SOFTKEYS_DATA, null, softKeys);
|
||||
MessageServices.Current.Publish(SEND_USER_SOFTKEYS_DATA, null, softKeys);
|
||||
}
|
||||
else
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
ReadSoftKeysTimer += sw.ElapsedMilliseconds;
|
||||
ReadSoftKeysTimes++;
|
||||
|
||||
// Update thread timer
|
||||
ReadUserSoftKeysTimer += sw.ElapsedMilliseconds;
|
||||
ReadUserSoftKeysTimes++;
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
ncHandler.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadNcSoftKeysData()
|
||||
{
|
||||
NcHandler ncHandler = new NcHandler();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
|
||||
try
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
if (ncHandler.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get softkey data from config and PLC
|
||||
libraryError = ncHandler.GetNcSoftKeys(out List<DTONcSoftKeyModel> ncSoftKeys);
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
else
|
||||
// Send through signalR
|
||||
MessageServices.Current.Publish(SEND_NC_SOFTKEYS_DATA, null, ncSoftKeys);
|
||||
}
|
||||
else
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
// Update thread timer
|
||||
ReadUserSoftKeysTimer += sw.ElapsedMilliseconds;
|
||||
ReadUserSoftKeysTimes++;
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(200);
|
||||
@@ -317,9 +367,10 @@ public static class ThreadsFunctions
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
ReadSoftKeysTimer += sw.ElapsedMilliseconds;
|
||||
ReadSoftKeysTimes++;
|
||||
|
||||
//Update thread timer
|
||||
ReadNcSoftKeysTimer += sw.ElapsedMilliseconds;
|
||||
ReadNcSoftKeysTimes++;
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(500);
|
||||
@@ -472,11 +523,17 @@ public static class ThreadsFunctions
|
||||
ReadMaintenanceTimer = 0;
|
||||
ReadMaintenanceTimes = 0;
|
||||
}
|
||||
if (ThreadsHandler.RunningThreadStatus.ContainsKey("ReadSoftKeysData") && ReadSoftKeysTimes != 0)
|
||||
if (ThreadsHandler.RunningThreadStatus.ContainsKey("ReadUserSoftKeysData") && ReadUserSoftKeysTimes != 0)
|
||||
{
|
||||
ThreadsHandler.RunningThreadStatus["ReadSoftKeysData"] = (ReadSoftKeysTimer / ReadSoftKeysTimes) + " mS";
|
||||
ReadSoftKeysTimer = 0;
|
||||
ReadSoftKeysTimes = 0;
|
||||
ThreadsHandler.RunningThreadStatus["ReadUserSoftKeysData"] = (ReadUserSoftKeysTimer / ReadUserSoftKeysTimes) + " mS";
|
||||
ReadUserSoftKeysTimer = 0;
|
||||
ReadUserSoftKeysTimes = 0;
|
||||
}
|
||||
if (ThreadsHandler.RunningThreadStatus.ContainsKey("ReadNcSoftKeysData") && ReadNcSoftKeysTimes != 0)
|
||||
{
|
||||
ThreadsHandler.RunningThreadStatus["ReadNcSoftKeysData"] = (ReadNcSoftKeysTimer / ReadNcSoftKeysTimes) + " mS";
|
||||
ReadNcSoftKeysTimer = 0;
|
||||
ReadNcSoftKeysTimes = 0;
|
||||
}
|
||||
|
||||
MessageServices.Current.Publish(SEND_THREADS_STATUS, null, ThreadsHandler.RunningThreadStatus);
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace Step.Core
|
||||
ThreadsFunctions.ReadProcessesPPStatus,
|
||||
ThreadsFunctions.ReadEnabledFunctionality,
|
||||
ThreadsFunctions.ReadExpiredMaintenances,
|
||||
ThreadsFunctions.ReadSoftKeysData,
|
||||
ThreadsFunctions.ReadNcSoftKeysData,
|
||||
ThreadsFunctions.ReadUserSoftKeysData,
|
||||
ThreadsFunctions.ReadHeadsData
|
||||
};
|
||||
|
||||
|
||||
@@ -24,5 +24,41 @@ namespace Step.Utils
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetPlcIdFromNcSoftKey(string softKey)
|
||||
{
|
||||
switch (softKey)
|
||||
{
|
||||
case "auto": return 0;
|
||||
case "edit": return 1;
|
||||
case "mdi": return 2;
|
||||
case "dnc": return 3;
|
||||
case "ref": return 4;
|
||||
case "jog": return 5;
|
||||
case "jogInc": return 6;
|
||||
case "restart": return 7;
|
||||
case "teach": return 8;
|
||||
case "retract": return 9;
|
||||
case "wcsMcs": return 10;
|
||||
case "handle": return 11;
|
||||
case "reset": return 12;
|
||||
case "blk": return 13;
|
||||
case "blkDel": return 14;
|
||||
case "opStop": return 15;
|
||||
case "dryRun": return 16;
|
||||
case "prgTest": return 17;
|
||||
case "manualHandleInterrupt": return 18;
|
||||
case "teachIn": return 19;
|
||||
case "incPlane": return 20;
|
||||
case "plus": return 21;
|
||||
case "minus": return 22;
|
||||
case "rapid": return 23;
|
||||
case "xOne": return 24;
|
||||
case "xTen": return 25;
|
||||
case "xHundred": return 26;
|
||||
case "xThousand": return 27;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,19 @@ namespace Step.Controllers.SignalR
|
||||
MessageServices.Current.Publish(SHOW_MSG_UI, null, "Recovery Alarm. ID: " + id);
|
||||
}
|
||||
|
||||
public void UserSoftKeyClicked(int id)
|
||||
public void NcSoftKeyClick(int id)
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
ncHandler.Connect();
|
||||
// Write click into plc memory
|
||||
CmsError libraryError = ncHandler.PutNcSoftKeyClick((uint)id);
|
||||
if (libraryError.IsError())
|
||||
throw new HubException(libraryError.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void UserSoftKeyClick(int id)
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
@@ -108,7 +120,7 @@ namespace Step.Controllers.SignalR
|
||||
if (subkey.Id == id)
|
||||
{
|
||||
// Write click button
|
||||
ncHandler.PutSoftKeyValue((uint)softKey.PlcId);
|
||||
ncHandler.PutUserSoftKeyClick((uint)softKey.PlcId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +130,7 @@ namespace Step.Controllers.SignalR
|
||||
if (softKey.Id == id)
|
||||
{
|
||||
// Write click button
|
||||
ncHandler.PutSoftKeyValue((uint)softKey.PlcId);
|
||||
ncHandler.PutUserSoftKeyClick((uint)softKey.PlcId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -131,8 +143,6 @@ namespace Step.Controllers.SignalR
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
if (libraryError.IsError())
|
||||
throw new HubException(libraryError.message);
|
||||
|
||||
libraryError = ncHandler.PutSelectProcess(procNumber);
|
||||
if (libraryError.IsError())
|
||||
|
||||
@@ -43,17 +43,24 @@ namespace Step.Controllers.WebApi
|
||||
return Ok(clientConfiguration);
|
||||
}
|
||||
|
||||
|
||||
[Route("nc_softKeys"), HttpGet]
|
||||
public IHttpActionResult GetNcSoftKeysConfig()
|
||||
{
|
||||
return Ok(NcSoftKeysConfig);
|
||||
}
|
||||
|
||||
[Route("softKeys"), HttpGet]
|
||||
public IHttpActionResult GetSoftKeysConfig()
|
||||
{
|
||||
Dictionary<int, List<DTOSoftKeyConfigModel>> output = new Dictionary<int, List<DTOSoftKeyConfigModel>>();
|
||||
Dictionary<int, List<DTOUserSoftKeyConfigModel>> output = new Dictionary<int, List<DTOUserSoftKeyConfigModel>>();
|
||||
foreach (var softKey in SoftKeysConfig)
|
||||
{
|
||||
// Check if category exists
|
||||
if (!output.ContainsKey(softKey.Category))
|
||||
{
|
||||
// Add category if not exits
|
||||
output.Add(softKey.Category, new List< DTOSoftKeyConfigModel>());
|
||||
output.Add(softKey.Category, new List< DTOUserSoftKeyConfigModel>());
|
||||
}
|
||||
|
||||
// Create subkeys dictionary for group
|
||||
@@ -67,7 +74,7 @@ namespace Step.Controllers.WebApi
|
||||
}
|
||||
}
|
||||
// Add to the category the new softkey
|
||||
output[softKey.Category].Add(new DTOSoftKeyConfigModel()
|
||||
output[softKey.Category].Add(new DTOUserSoftKeyConfigModel()
|
||||
{
|
||||
Id = softKey.Id,
|
||||
Category = softKey.Category,
|
||||
@@ -93,5 +100,6 @@ namespace Step.Controllers.WebApi
|
||||
|
||||
return Ok(heads);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -47,9 +47,13 @@ namespace Step.Listeners
|
||||
{
|
||||
SignalRListener.SendExpMaintenancesData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_SOFTKEYS_DATA, async (a, b) =>
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_NC_SOFTKEYS_DATA, async (a, b) =>
|
||||
{
|
||||
SignalRListener.SendSoftKeysData(a);
|
||||
SignalRListener.SendNcSoftKeysData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_USER_SOFTKEYS_DATA, async (a, b) =>
|
||||
{
|
||||
SignalRListener.SendUserSoftKeysData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_HEADS_DATA, async (a, b) =>
|
||||
{
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace Step.Listeners.SignalR
|
||||
private static List<DTOExpiredMaintenanceModel> LastExpiredMaintenances = new List<DTOExpiredMaintenanceModel>();
|
||||
private static DTOPowerOnDataModel LastPowerOnData = new DTOPowerOnDataModel();
|
||||
private static DTOProcessDataModel LastProcessesData = new DTOProcessDataModel();
|
||||
private static List<DTOSoftKeyModel> LastSoftKeysData = new List<DTOSoftKeyModel>();
|
||||
private static List<DTOUserSoftKeyModel> LastUserSoftKeysData = new List<DTOUserSoftKeyModel>();
|
||||
private static List<DTONcSoftKeyModel> LastNcSoftKeysData = new List<DTONcSoftKeyModel>();
|
||||
private static List<DTOHeadModel> LastHeadsData = new List<DTOHeadModel>();
|
||||
|
||||
private static bool LastIsNcConnected = false;
|
||||
@@ -88,7 +89,7 @@ namespace Step.Listeners.SignalR
|
||||
// Send data to clients
|
||||
context.Clients.Group("ncData").processesData(processesStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendFunctionalityData(object functionalityData)
|
||||
{
|
||||
@@ -118,17 +119,31 @@ namespace Step.Listeners.SignalR
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendSoftKeysData(object softKeys)
|
||||
public static void SendNcSoftKeysData(object softKeys)
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
List<DTOSoftKeyModel> newData = softKeys as List<DTOSoftKeyModel>;
|
||||
List<DTONcSoftKeyModel> newData = softKeys as List<DTONcSoftKeyModel>;
|
||||
|
||||
// Check if collections are equals
|
||||
if (newData.Count != LastSoftKeysData.Count || !LastSoftKeysData.All(newData.Contains))
|
||||
if (newData.Count != LastNcSoftKeysData.Count || !LastNcSoftKeysData.All(newData.Contains))
|
||||
{
|
||||
LastSoftKeysData = newData;
|
||||
LastNcSoftKeysData = newData;
|
||||
// Send data to clients
|
||||
context.Clients.Group("ncData").softKeys(softKeys);
|
||||
context.Clients.Group("ncData").ncSoftKeys(softKeys);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendUserSoftKeysData(object softKeys)
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
List<DTOUserSoftKeyModel> newData = softKeys as List<DTOUserSoftKeyModel>;
|
||||
|
||||
// Check if collections are equals
|
||||
if (newData.Count != LastUserSoftKeysData.Count || !LastUserSoftKeysData.All(newData.Contains))
|
||||
{
|
||||
LastUserSoftKeysData = newData;
|
||||
// Send data to clients
|
||||
context.Clients.Group("ncData").userSoftKeys(softKeys);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +162,7 @@ namespace Step.Listeners.SignalR
|
||||
}
|
||||
|
||||
private volatile static object _broadcastlock = new Object();
|
||||
|
||||
public static void BroadcastData()
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
@@ -170,20 +186,21 @@ namespace Step.Listeners.SignalR
|
||||
// Send Maintenances
|
||||
group.expiredMaintenances(LastExpiredMaintenances);
|
||||
|
||||
// Send nc status
|
||||
// Send nc status
|
||||
context.Clients.Group("ncData").ncNetworkStatus(
|
||||
new
|
||||
{
|
||||
connected = LastIsNcConnected
|
||||
});
|
||||
// Send softkeys
|
||||
context.Clients.Group("ncData").softKeys(LastSoftKeysData);
|
||||
context.Clients.Group("ncData").ncSoftKeys(LastNcSoftKeysData);
|
||||
|
||||
context.Clients.Group("ncData").userSoftKeys(LastUserSoftKeysData);
|
||||
// Send heads data
|
||||
context.Clients.Group("ncData").heads(LastHeadsData);
|
||||
|
||||
Debug.WriteLine(string.Format("{0} {1} Broadcast..completed", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), DateTime.Now.Millisecond));
|
||||
Monitor.Exit(_broadcastlock);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user