Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_step into develop

This commit is contained in:
Paolo Possanzini
2018-02-09 15:07:39 +01:00
20 changed files with 216 additions and 177 deletions
-1
View File
@@ -95,7 +95,6 @@ namespace CMS_Client.View
if (this.WindowState == FormWindowState.Minimized)
{
NcFrm.Hide();
NcWindow.HideNcWindow();
NcWindow.ShowTaskBar();
}
else
+11
View File
@@ -24,5 +24,16 @@ namespace CMS_Client.View
this.BackColor = this.TransparencyKey;
}
protected override CreateParams CreateParams
{
get
{
var Params = base.CreateParams;
Params.ExStyle |= 0x80;
return Params;
}
}
}
}
+22 -46
View File
@@ -379,7 +379,7 @@ namespace CMS_Client.View
//Attach the new hook
procDelegate = new WinEventDelegate(WinEventProc);
hhook = SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, IntPtr.Zero, procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);
hhook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, procDelegate, 0, 0, WINEVENT_OUTOFCONTEXT);
//Start the new Thread of Image Captutre - in Standby (NICOLA CARMINATI 25/01/2018)
//if (CaptureThread != null)
@@ -437,56 +437,31 @@ namespace CMS_Client.View
GetWindowThreadProcessId(hwnd, out ActualPID);
ActualHND = hwnd;
//Filter if comes multiple event at the same time
if (ActualHND != LastHookedHND || dwmsEventTime != LastdwmsEventTime)
//If the PID is the STEP-HMI Process
if (ActualPID == MainProcessPID)
{
//If the PID is the STEP-HMI Process
if (ActualPID == MainProcessPID)
{
//Hide the TaskBar
HideTaskBar();
//Resize the Popup opened on Nc Window
//if (ActualPID != LastHookedPID)
//{
// //get the Handle of the Popup
// PopupHandle = GetLastActivePopup(ncprocess.MainWindowHandle);
// if (PopupHandle != ncprocess.MainWindowHandle)
// ResizeOutofBoundWindow(ncprocess.MainWindowHandle, PopupHandle);
//}
}
else if (ActualPID == NcProcessPID)
{
//Hide the TaskBar
HideTaskBar();
if (IsIconic(MainViewHandle))
ShowWindow(MainViewHandle, SW_SHOWDEFAULT);
if (state == NcState.HIDE)
SetForegroundWindow(MainViewHandle);
//Disable main manu if is present
//IntPtr Menu = GetSystemMenu(ActualHND, false);
//if (Menu != IntPtr.Zero)
//{
// DeleteMenu(Menu, SC_MINIMIZE, MF_BYCOMMAND);
// DeleteMenu(Menu, SC_MAXIMIZE, MF_BYCOMMAND);
//}
}
//If the PID is OTHER Process
else
{
//Show the TaskBar
ShowTaskBar();
}
//Hide the TaskBar
HideTaskBar();
}
//If the PID is the NC-HMI Process
else if (ActualPID == NcProcessPID)
{
//Hide the TaskBar
HideTaskBar();
if(LastHookedPID != MainProcessPID && LastHookedPID != NcProcessPID)
SetForegroundWindow(MainViewHandle);
}
//If the PID is OTHER Process
else
{
//Show the TaskBar
ShowTaskBar();
}
//Save the Last Hooked PID
LastHookedHND = ActualHND;
LastHookedPID = ActualPID;
//Save the Last TimeStamp
LastdwmsEventTime = dwmsEventTime;
@@ -816,6 +791,7 @@ namespace CMS_Client.View
private const int ICON_SMALL = 0;
private const int ICON_BIG = 1;
private const uint EVENT_OBJECT_FOCUS = 0x8005;
private const uint EVENT_SYSTEM_FOREGROUND = 0x0003;
private const uint WINEVENT_OUTOFCONTEXT = 0;
private const UInt32 SWP_NOSIZE = 0x0001;
private const UInt32 SWP_NOMOVE = 0x0002;
@@ -1,17 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<ncConfig>
<ncVendor>DEMO</ncVendor> <!-- NO_NC/DEMO/FANUC/SIEMENS/OSAI -->
<showNcHMI>true</showNcHMI>
<ncIpAddress>127.0.0.1</ncIpAddress>
<ncPort>8080</ncPort>
<machineModel>Ares 37 OF</machineModel>
</ncConfig>
<serverConfig>
<serverPort>9000</serverPort>
<language>en</language>
<enableDirectoryBrowsing>true</enableDirectoryBrowsing>
</serverConfig>
<areasConfig>
<production>
<enabled>true</enabled>
@@ -3,31 +3,10 @@
<xs:element name="root">
<xs:complexType>
<xs:all>
<xs:element name="ncConfig">
<xs:complexType>
<xs:all>
<xs:element name="ncVendor" type="NcType" minOccurs='1' maxOccurs='1'/>
<xs:element name="showNcHMI" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
<xs:element name="ncIpAddress" minOccurs='1' maxOccurs='1'/>
<xs:element name="ncPort" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="machineModel" type="xs:string" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="serverConfig">
<xs:complexType>
<xs:all>
<xs:element name="serverPort" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="language" type="xs:language" minOccurs='1' maxOccurs='1' default="en"/>
<xs:element name="enableDirectoryBrowsing" type="xs:boolean" default="false"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="areasConfig">
<xs:complexType>
<xs:all>
<xs:element name="production">
<xs:complexType>
<xs:all>
@@ -97,19 +76,11 @@
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:simpleType name="NcType" final="restriction" >
<xs:restriction base="xs:string">
<xs:enumeration value="DEMO" />
<xs:enumeration value="OSAI" />
<xs:enumeration value="FANUC" />
<xs:enumeration value="SIEMENS" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<ncConfig>
<ncVendor>DEMO</ncVendor> <!-- NO_NC/DEMO/FANUC/SIEMENS/OSAI -->
<showNcHMI>true</showNcHMI>
<ncIpAddress>127.0.0.1</ncIpAddress>
<ncPort>8080</ncPort>
<machineModel>Ares 37 OF</machineModel>
</ncConfig>
<serverConfig>
<serverPort>9000</serverPort>
<language>en</language>
<enableDirectoryBrowsing>true</enableDirectoryBrowsing>
</serverConfig>
</root>
@@ -0,0 +1,39 @@
<?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="ncConfig">
<xs:complexType>
<xs:all>
<xs:element name="ncVendor" type="NcType" minOccurs='1' maxOccurs='1'/>
<xs:element name="showNcHMI" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
<xs:element name="ncIpAddress" minOccurs='1' maxOccurs='1'/>
<xs:element name="ncPort" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="machineModel" type="xs:string" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="serverConfig">
<xs:complexType>
<xs:all>
<xs:element name="serverPort" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="language" type="xs:language" minOccurs='1' maxOccurs='1' default="en"/>
<xs:element name="enableDirectoryBrowsing" type="xs:boolean" default="false"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:simpleType name="NcType" final="restriction" >
<xs:restriction base="xs:string">
<xs:enumeration value="DEMO" />
<xs:enumeration value="OSAI" />
<xs:enumeration value="FANUC" />
<xs:enumeration value="SIEMENS" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
+20 -10
View File
@@ -15,17 +15,10 @@ namespace Step.Config
{
public static void ReadStartupConfig()
{
// Read validation file
XmlSchemaSet readerSettings = new XmlSchemaSet();
try
{
// Add Schema
readerSettings.Add(null, BASE_PATH + "\\" + STARTUP_CONFIG_SCHEMA_PATH);
// Open file reader
XDocument xmlConfigFile = XDocument.Load(BASE_PATH + "\\" + STARTUP_CONFIG_PATH);
// Validate file
xmlConfigFile.Validate(readerSettings, ValidationHandler);
// Get server file handler
XDocument xmlConfigFile = GetXmlHandlerWithValidator(SERVER_CONFIG_SCHEMA_PATH, SERVER_CONFIG_PATH);
// Read nc Config with LINQ
NcConfig = xmlConfigFile
@@ -40,7 +33,7 @@ namespace Step.Config
}).FirstOrDefault();
// Read server config with LINQ and save into static config
ServerConfig.ServerStartupConfig = xmlConfigFile
ServerStartupConfig = xmlConfigFile
.Descendants(SERVER_CONFIG_KEY)
.Select(x => new ServerConfigModel()
{ // Set server config model data
@@ -49,6 +42,9 @@ namespace Step.Config
EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value)
}).FirstOrDefault();
// Get Areas file handler
xmlConfigFile = GetXmlHandlerWithValidator(AREAS_CONFIG_SCHEMA_PATH, AREAS_CONFIG_PATH);
// Read areas config with LINQ
xmlConfigFile
.Descendants(AREAS_CONFIG_KEY) // Get areas config node
@@ -63,6 +59,20 @@ namespace Step.Config
}
}
private static XDocument GetXmlHandlerWithValidator(string configSchemaFilePath, string configFilePath)
{
// Create new instance
XmlSchemaSet readerSettings = new XmlSchemaSet();
// Add Schema
readerSettings.Add(null, BASE_PATH + "\\" + configSchemaFilePath );
// Open file reader
XDocument xmlConfigFile = XDocument.Load(BASE_PATH + "\\" + configFilePath);
// Validate file
xmlConfigFile.Validate(readerSettings, ValidationHandler);
return xmlConfigFile;
}
private static void SetAreaValueByName(XElement element)
{
+11 -2
View File
@@ -47,7 +47,10 @@
<Compile Include="ServerConfigController.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="serverConfigValidator.xsd">
<Content Include="Config\areasConfig.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\serverConfigValidator.xsd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
@@ -63,10 +66,16 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="serverConfig.xml">
<EmbeddedResource Include="Config\serverConfig.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Config\areasConfigValidator.xsd">
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,8 +1,8 @@
using System;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using System;
using System.Collections.Generic;
using System.Linq;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using static CMS_CORE_Library.DataStructures;
namespace Step.Database.Controllers
@@ -47,12 +47,12 @@ namespace Step.Database.Controllers
.ToList();
}
public List<DTORuntimeFunctionAccessModel> GetFunctionsMappedWithPlc(List<FunctionalityModel> functionalityList)
public List<DTORuntimeFunctionalityModel> GetFunctionsMappedWithPlc(List<FunctionalityModel> functionalityList)
{
return dbCtx
.FunctionsAccess
.ToList() // Find all function access
.Select(f => new DTORuntimeFunctionAccessModel()
.Select(f => new DTORuntimeFunctionalityModel()
{
Id = f.FunctionAccessId,
Name = f.Name,
@@ -71,4 +71,4 @@ namespace Step.Database.Controllers
return functionalityList[id - 1].IsActive;
}
}
}
}
@@ -39,14 +39,16 @@ namespace Step.Database.Controllers
public MachineModel Create(string uniqueId)
{
// Create database machine model
MachineModel machine = new MachineModel()
{
MachineId = 1,
Model = NcConfig.NcName,
UniqueId = uniqueId
};
// Add to database
dbCtx.Machines.Add(machine);
// Commit changes
dbCtx.SaveChanges();
return machine;
@@ -54,12 +56,14 @@ namespace Step.Database.Controllers
public void UpdateMachineName(int id, string name)
{
// Find machine by id
MachineModel machine = FindById(id);
if(machine != null)
if (machine != null)
{
// Update machine name
machine.Model = name;
dbCtx.SaveChanges();
}
}
}
}
}
@@ -1,10 +1,7 @@
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Database.Controllers
{
@@ -37,20 +34,26 @@ namespace Step.Database.Controllers
{
return dbCtx
.MachinesUsers
.Include("Role")
.Include("Role") // Join with Role, Machine, User
.Include("Machine")
.Include("User")
.Where(x => x.MachineUserId == id)
.FirstOrDefault();
}
public MachineUserModel Create(int machineId, int userId, int roleId)
{
MachineUserModel machine = new MachineUserModel() { MachineId = machineId, UserId = userId, RoleId = roleId };
// Create database model
MachineUserModel machine = new MachineUserModel() {
MachineId = machineId,
UserId = userId,
RoleId = roleId
};
// Add into database
dbCtx.MachinesUsers.Add(
machine
);
// Commit changes
dbCtx.SaveChanges();
return machine;
@@ -61,7 +64,7 @@ namespace Step.Database.Controllers
RoleModel role = dbCtx
.MachinesUsers
.Include("Role")
.Where(x => x.MachineId == machineId && x.UserId == userId)
.Where(x => x.MachineId == machineId && x.UserId == userId) // Find by machine id and user id, joining with role
.FirstOrDefault().Role;
return new DTORoleModel()
@@ -71,4 +74,4 @@ namespace Step.Database.Controllers
};
}
}
}
}
@@ -1,9 +1,6 @@
using Step.Model.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Step.Database.Controllers
{
@@ -38,7 +35,7 @@ namespace Step.Database.Controllers
.RemoveRange( // Delete rows
dbCtx
.Sessions
.Where(x => x.MachineUserId == machineUserId) // Find all the session with matching machineUserId
.Where(x => x.MachineUserId == machineUserId) // Find all the session with matching machineUserId
);
// Commit changes
dbCtx.SaveChanges();
@@ -70,4 +67,4 @@ namespace Step.Database.Controllers
dbCtx.SaveChanges();
}
}
}
}
+11 -8
View File
@@ -1,10 +1,9 @@
using System;
using System.Data.Entity.Migrations;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using System;
using System.Globalization;
using System.Linq;
using System.Web.Helpers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
using static Step.Config.ServerConfig;
namespace Step.Database.Controllers
@@ -48,6 +47,7 @@ namespace Step.Database.Controllers
Language = language
};
}
public static UserModel CreateUserModel(string username, string password, string firstName, string lastName, CultureInfo language)
{
return CreateUserModel(0, username, password, firstName, lastName, language);
@@ -59,12 +59,13 @@ namespace Step.Database.Controllers
UserModel userDatabaseModel = dbCtx.Users.Where(u => u.UserId == userId).FirstOrDefault();
DTORoleModel roleModel = null;
// Find user role through machineUser table
using (MachinesUsersController machinesUsersControler = new MachinesUsersController())
{
roleModel = machinesUsersControler.GetUserRole(MachineConfig.MachineId, userId);
}
return new DTOUserModel()
return new DTOUserModel() // Return DTOUserModel
{
Id = userDatabaseModel.UserId,
Username = userDatabaseModel.Username,
@@ -106,9 +107,11 @@ namespace Step.Database.Controllers
public void CreateCmsDefaultUserIfNotExists(int machineId)
{
// Find if there is a cms standard user
UserModel user = FindByUsername("cms");
if (user == null)
{
// If not exist add new user
user = dbCtx.Users.Add(
CreateUserModel("cms", "cms", "cms", "cms", new CultureInfo("en"))
);
@@ -116,7 +119,7 @@ namespace Step.Database.Controllers
// Commit changes
dbCtx.SaveChanges();
}
// Add user to local machine users if not exists
using (MachinesUsersController machinesUsersController = new MachinesUsersController())
{
MachineUserModel machineUser = machinesUsersController.FindByUserId(machineId, user.UserId);
@@ -130,11 +133,11 @@ namespace Step.Database.Controllers
{
UserModel user = FindById(userId);
if(user != null)
if (user != null)
{
user.Language = newLanguage;
dbCtx.SaveChanges();
}
}
}
}
}
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Step.Model.DTOModels
{
public class DTORuntimeFunctionAccessModel
public class DTORuntimeFunctionalityModel
{
public int Id { get; set; }
+23 -20
View File
@@ -1,20 +1,18 @@
using System;
using System.Collections.Generic;
using static Step.Utils.Constants;
using static Step.Config.ServerConfig;
using CMS_CORE;
using CMS_CORE;
using CMS_CORE.Demo;
using CMS_CORE.Fanuc;
using CMS_CORE.Siemens;
using CMS_CORE.Osai;
using CMS_CORE.Siemens;
using Step.Database.Controllers;
using Step.Model.DTOModels;
using System;
using System.Collections.Generic;
using System.Globalization;
using static Step.Utils.ExceptionManager;
using System.Reflection;
using static CMS_CORE.Nc;
using static CMS_CORE_Library.DataStructures;
using System.Reflection;
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using static Step.Config.ServerConfig;
using static Step.Utils.Constants;
namespace Step.NC
{
@@ -42,7 +40,6 @@ namespace Step.NC
return null;
}
public Nc SetNumericalControl()
{
// Return new Numerical control instance choosed from the configuration
@@ -50,10 +47,13 @@ namespace Step.NC
{
case NC_VENDOR.DEMO:
return new Nc_Demo(NcConfig.NcIpAddress, NcConfig.NcPort);
case NC_VENDOR.FANUC:
return new Nc_Fanuc(NcConfig.NcIpAddress, NcConfig.NcPort, 2000);
case NC_VENDOR.SIEMENS:
return new Nc_Siemens(2000);
case NC_VENDOR.OSAI:
return new Nc_Osai(NcConfig.NcIpAddress, NcConfig.NcPort, 2000);
}
@@ -124,7 +124,7 @@ namespace Step.NC
genericData.PlcVersion = "1.0.0";
// Get PLC version
genericData.UnitOfMeasurement = "mm";
// Get Server version
// Get Server version
genericData.ServerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
//Get Library Version
genericData.CoreLibraryVersion = "2.0.0";
@@ -160,7 +160,7 @@ namespace Step.NC
if (cmsError.errorCode != 0)
return cmsError;
// For each process
// For each process
for (ushort i = 1; i <= maxProcNumber; i++)
{
// Get process active alarms
@@ -203,14 +203,13 @@ namespace Step.NC
{
axes = new List<DTOAxesModel>();
// Get NC max process number
ushort maxProcNumber = 0;
CmsError cmsError = numericalControl.NC_RProcessesNum(ref maxProcNumber);
if (cmsError.errorCode != 0)
return cmsError;
// For each process
// For each process
for (ushort i = 1; i <= maxProcNumber; i++)
{
cmsError = GetAxesPositionsByProcess(i, out DTOAxesModel axis);
@@ -251,21 +250,24 @@ namespace Step.NC
public CmsError GetPowerOnData(out DTOPowerOnDataModel resultPowerOnData)
{
resultPowerOnData = new DTOPowerOnDataModel();
// Init object
PreAndPostPowerOnModel prePostPowerOn = new PreAndPostPowerOnModel
{
PostPowerOn = new PostPowerOnModel(),
PrePowerOn = new PrePowerOnModel()
};
// Read pre and post power on data
CmsError cmsError = numericalControl.PLC_RPowerOnData(ref prePostPowerOn);
if (cmsError.IsError())
return cmsError;
// Set return object
resultPowerOnData.PrePowerOn = prePostPowerOn.PrePowerOn;
resultPowerOnData.PostPowerOn = prePostPowerOn.PostPowerOn;
// Read axes procedure data from
// Read axes procedure data from
cmsError = numericalControl.PLC_RAxesResetData(ref resultPowerOnData.AxisReset);
return cmsError;
@@ -314,10 +316,10 @@ namespace Step.NC
return cmsError;
}
public CmsError GetFunctionsMappedWithNC(out List<DTORuntimeFunctionAccessModel> functionsAccessList)
public CmsError GetFunctionsMappedWithNC(out List<DTORuntimeFunctionalityModel> functionsAccessList)
{
functionsAccessList = new List<DTORuntimeFunctionAccessModel>();
// Read plc functionality
functionsAccessList = new List<DTORuntimeFunctionalityModel>();
// Read plc functionality
List<FunctionalityModel> functionalityList = null;
CmsError cmsError = numericalControl.PLC_RFunctionAccess(ref functionalityList);
@@ -338,9 +340,10 @@ namespace Step.NC
{
return new CmsError(0, "");
}
public CmsError RefreshAlarm(string id)
{
return new CmsError(0, "");
}
}
}
}
+23 -17
View File
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Step.Core;
using Step.Model.DTOModels;
using TeamDev.SDK.MVVM;
using Step.NC;
using Step.Core;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using TeamDev.SDK.MVVM;
using static CMS_CORE_Library.DataStructures;
using static Step.Utils.Constants;
using static Step.Utils.ExceptionManager;
using System.Diagnostics;
using static CMS_CORE_Library.DataStructures;
public static class ThreadsFunctions
{
@@ -23,6 +22,7 @@ public static class ThreadsFunctions
private static Thread ConnThread;
#region Nc Threads
public static void ReadAlarms()
{
NcHandler ncHandler = new NcHandler();
@@ -34,7 +34,6 @@ public static class ThreadsFunctions
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
while (true)
{
sw.Restart();
@@ -109,7 +108,6 @@ public static class ThreadsFunctions
}
}
public static void ReadAxes()
{
NcHandler ncHandler = new NcHandler();
@@ -239,8 +237,7 @@ public static class ThreadsFunctions
}
}
public static void ReadRuntimeFunctionAccess()
public static void ReadEnabledFunctionality()
{
NcHandler ncHandler = new NcHandler();
Stopwatch sw = new Stopwatch();
@@ -259,7 +256,7 @@ public static class ThreadsFunctions
if (ncHandler.numericalControl.NC_IsConnected())
{
// Get Data from NC
libraryError = ncHandler.GetFunctionsMappedWithNC(out List<DTORuntimeFunctionAccessModel> functionsAccessList);
libraryError = ncHandler.GetFunctionsMappedWithNC(out List<DTORuntimeFunctionalityModel> functionsAccessList);
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
else
@@ -284,7 +281,7 @@ public static class ThreadsFunctions
}
}
#endregion
#endregion Nc Threads
#region SupportFunctions
@@ -344,26 +341,36 @@ public static class ThreadsFunctions
case CMS_ERROR_CODES.NC_PROD_ERROR:
Manage(ERROR_LEVEL.WARNING, cmsError.message);
break;
case CMS_ERROR_CODES.NOT_CONNECTED:
TryNcConnection(); // If not connected try reconnection
break;
case CMS_ERROR_CODES.PROC_NOT_FOUND:
break;
case CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED:
break;
case CMS_ERROR_CODES.BIT_NOT_IN_RANGE:
break;
case CMS_ERROR_CODES.BYTE_NOT_IN_RANGE:
break;
case CMS_ERROR_CODES.INTERNAL_ERROR:
break;
case CMS_ERROR_CODES.INCORRECT_PARAMETERS:
break;
case CMS_ERROR_CODES.NC_LANGUAGE_ERROR:
break;
case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND:
Manage(ERROR_LEVEL.FATAL, cmsError.message);
break;
case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING:
Manage(ERROR_LEVEL.WARNING, cmsError.message);
TryNcConnection(); // If not connected try reconnection
@@ -371,7 +378,6 @@ public static class ThreadsFunctions
}
}
internal static void StatThread()
{
while (true)
@@ -423,7 +429,6 @@ public static class ThreadsFunctions
}
}
private static void StatReset()
{
ReadAlarmsTimer = 0;
@@ -433,5 +438,6 @@ public static class ThreadsFunctions
ReadAxesTimer = 0;
ReadAxesTimes = 0;
}
#endregion
}
#endregion SupportFunctions
}
+1 -1
View File
@@ -27,7 +27,7 @@ namespace Step.Core
ThreadsFunctions.ReadPowerOnData,
ThreadsFunctions.StatThread,
ThreadsFunctions.ReadProcessesPPStatus,
ThreadsFunctions.ReadRuntimeFunctionAccess
ThreadsFunctions.ReadEnabledFunctionality
};
private volatile static List<Thread> RunningThreadsList = new List<Thread>();
internal volatile static Dictionary<String, String> RunningThreadStatus = new Dictionary<String, String>();
+7 -2
View File
@@ -56,8 +56,13 @@ namespace Step.Utils
// Filenames
public static readonly string BASE_PATH = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public const string STARTUP_CONFIG_SCHEMA_PATH = "serverConfigValidator.xsd";
public const string STARTUP_CONFIG_PATH = "serverConfig.xml";
public const string CONFIG_DIRECTORY = "Config\\";
public const string SERVER_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "serverConfigValidator.xsd";
public const string SERVER_CONFIG_PATH = CONFIG_DIRECTORY + "serverConfig.xml";
public const string AREAS_CONFIG_SCHEMA_PATH = CONFIG_DIRECTORY + "areasConfigValidator.xsd";
public const string AREAS_CONFIG_PATH = CONFIG_DIRECTORY + "areasConfig.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";
+3 -3
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Step.Listeners.Database;
using Step.Listeners.Database;
using Step.Listeners.SignalR;
using Step.Model.DTOModels;
using System.Collections.Generic;
using TeamDev.SDK.MVVM;
using static Step.Utils.Constants;
@@ -64,4 +64,4 @@ namespace Step.Listeners
MessageServices.Current.UnSubscribe(infos.ToArray());
}
}
}
}