From 89ef149dd8fd73ebd8427ac0fa426f4204c86aea Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Wed, 2 May 2018 15:53:05 +0000 Subject: [PATCH] Added edges functions: Read Add Remove --- CMS_CORE_Library/CMS_CORE_Library.csproj | 3 +- CMS_CORE_Library/DataStructures.cs | 17 +- .../Demo/DemoEdgesConfiguration.cs | 444 +++++++++ CMS_CORE_Library/Demo/ILibraryService.cs | 5 + CMS_CORE_Library/Demo/Models/ToolDataModel.cs | 3 +- CMS_CORE_Library/Demo/Nc_Demo.cs | 175 +++- CMS_CORE_Library/Fanuc/Nc_Fanuc.cs | 5 + CMS_CORE_Library/Nc.cs | 4 +- CMS_CORE_Library/Osai/Nc_Osai.cs | 5 + CMS_CORE_Library/Siemens/Nc_Siemens.cs | 45 +- .../Siemens/SiemensEdgesConfigurations.cs | 441 +++++++++ .../Nc_Demo_Application/Constants.cs | 1 + .../Database/DatabaseController.cs | 207 +++- .../Database/Models/ToolsDataModel.cs | 16 +- .../Server/Service/ILibraryService.cs | 9 + .../Server/Service/LibraryService.cs | 68 +- .../Views/DemoApplicationForm.Designer.cs | 896 ++++++++++++------ .../Views/DemoApplicationForm.cs | 22 +- .../Views/DemoApplicationForm.resx | 108 +++ 19 files changed, 2107 insertions(+), 367 deletions(-) create mode 100644 CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs create mode 100644 CMS_CORE_Library/Siemens/SiemensEdgesConfigurations.cs diff --git a/CMS_CORE_Library/CMS_CORE_Library.csproj b/CMS_CORE_Library/CMS_CORE_Library.csproj index d0d2e9d..1acb674 100644 --- a/CMS_CORE_Library/CMS_CORE_Library.csproj +++ b/CMS_CORE_Library/CMS_CORE_Library.csproj @@ -130,6 +130,7 @@ Reference.svcmap + @@ -148,7 +149,7 @@ - + diff --git a/CMS_CORE_Library/DataStructures.cs b/CMS_CORE_Library/DataStructures.cs index 9c4ce2b..d0b7d14 100644 --- a/CMS_CORE_Library/DataStructures.cs +++ b/CMS_CORE_Library/DataStructures.cs @@ -480,7 +480,16 @@ namespace CMS_CORE_Library public bool ChangeTool; public bool IsInUse; public bool PreAlarm; - public List> EdgesData; + public List EdgesData; + } + + public class EdgesModel + { + public int Id; + public double ResidualLife; + public double NominalLife; + public double PreAlmLife; + public Dictionary EdgeAdditionalParams; } public class ShankModel @@ -518,6 +527,12 @@ namespace CMS_CORE_Library public int Type; } + public class EdgeConfigModel + { + public string Name; + public string Path; + } + #endregion ToolsConfig } } \ No newline at end of file diff --git a/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs b/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs new file mode 100644 index 0000000..b6dd1c6 --- /dev/null +++ b/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs @@ -0,0 +1,444 @@ +using System.Collections.Generic; +using static CMS_CORE_Library.DataStructures; + +namespace CMS_CORE_Library.Demo +{ + internal class DemoEdgesConfiguration + { + + public Dictionary> EdgesConfig = new Dictionary>() + { + { + 100, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 110, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 111, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "CornerRadius", Path = "7"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 120, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 121, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 130, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "GeomDeltaLenght1", Path = "12"}, + new EdgeConfigModel{Name = "GeomDeltaLenght2", Path = "13"}, + new EdgeConfigModel{Name = "GeomDeltaLenght3", Path = "14"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"}, + new EdgeConfigModel{Name = "V", Path = "27"}, + new EdgeConfigModel{Name = "Vector1", Path = "28"}, + new EdgeConfigModel{Name = "Vector2", Path = "29"}, + new EdgeConfigModel{Name = "Vector3", Path = "30"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 131, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "CornerRadius", Path = "7"}, + new EdgeConfigModel{Name = "GeomDeltaLenght1", Path = "12"}, + new EdgeConfigModel{Name = "GeomDeltaLenght2", Path = "13"}, + new EdgeConfigModel{Name = "GeomDeltaLenght3", Path = "14"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"}, + new EdgeConfigModel{Name = "V", Path = "27"}, + new EdgeConfigModel{Name = "Vector1", Path = "28"}, + new EdgeConfigModel{Name = "Vector2", Path = "29"}, + new EdgeConfigModel{Name = "Vector3", Path = "30"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 140, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "OutsideRadius", Path = "7"}, + new EdgeConfigModel{Name = "ToolAngle", Path = "11"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 145, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 150, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "Width", Path = "9" }, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15" }, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 151, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "Width", Path = "9" }, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15" }, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 155, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "TaperAngle", Path = "11" }, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 156, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "CornerRadius", Path = "7"}, + new EdgeConfigModel{Name = "TaperAngle", Path = "11" }, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 157, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "TaperAngle", Path = "11" }, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + { + 160, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "Teeth", Path = "34" } + } + }, + //////// 200 + { + 200, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{ Name = "TipAngle", Path = "24"} + } + }, + { + 205, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"} + } + }, + { + 210, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"} + } + }, + { + 220, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{ Name = "TipAngle", Path = "24"} + } + }, + { + 230, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{ Name = "TipAngle", Path = "24"} + } + }, + { + 231, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"} + } + }, + { + 240, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "Pitch", Path = "9"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"} + } + }, + { + 241, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"} + } + }, + { + 242, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{ Name = "TipAngle", Path = "24"} + } + }, + { + 250, new List() + { + new EdgeConfigModel{ Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{ Name = "Lenght", Path = "3"}, + new EdgeConfigModel{ Name = "Radius", Path = "6"}, + new EdgeConfigModel{ Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{ Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{ Name = "TipAngle", Path = "24"} + } + }, + ///////// 700 + { + 700, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Diameter", Path = "6"}, + new EdgeConfigModel{Name = "GeomSlotWidth", Path = "7"}, + new EdgeConfigModel{Name = "GeomPrjection", Path = "8"}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "9"}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "13"}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "14"}, + new EdgeConfigModel{Name = "WearDiameter", Path = "15"}, + new EdgeConfigModel{Name = "WearSlotWdth", Path = "16"}, + new EdgeConfigModel{Name = "WearGeomPrjection", Path = "17"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"} + } + }, + { + 710, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"} + } + }, + { + 711, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"} + } + }, + { + 712, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "CorrAngle", Path = "10"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"} + } + }, + { + 713, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "BoomLenght", Path = "7"}, + new EdgeConfigModel{Name = "CorrAngle", Path = "10"}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "12"}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "13["}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"} + } + }, + { + 714, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "BallRadius", Path = "7"}, + new EdgeConfigModel{Name = "CorrAngle", Path = "10"}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "12"}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "13"}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "14"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"} + } + }, + { + 725, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "3"}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "4"}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "5"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "CorrAngle", Path = "10"}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "12"}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "13"}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "14"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "21"}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "22"}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "23"} + } + }, + { + 730, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"} + } + }, + { + 900, new List() + { + new EdgeConfigModel{Name = "CuttingEdge", Path = "2"}, + new EdgeConfigModel{Name = "Lenght", Path = "3"}, + new EdgeConfigModel{Name = "Radius", Path = "6"}, + new EdgeConfigModel{Name = "WearLenght", Path = "12"}, + new EdgeConfigModel{Name = "WearRadius", Path = "15"} + } + }, + }; + } +} diff --git a/CMS_CORE_Library/Demo/ILibraryService.cs b/CMS_CORE_Library/Demo/ILibraryService.cs index 5ee8f69..b9177dd 100644 --- a/CMS_CORE_Library/Demo/ILibraryService.cs +++ b/CMS_CORE_Library/Demo/ILibraryService.cs @@ -188,6 +188,11 @@ namespace Nc_Demo_Application.Server.Service [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/tool/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void DeleteTool(string id); + [WebInvoke(Method = "POST", UriTemplate = "tool_table/edge/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void AddEdge(string toolId, ref EdgesModel edge); + + [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/edge/{toolId}/{edgeId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void DeleteEdge(string toolId, string edgeId); [WebGet(UriTemplate = "tool_table/shanks", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetShanks(out List shanksData); diff --git a/CMS_CORE_Library/Demo/Models/ToolDataModel.cs b/CMS_CORE_Library/Demo/Models/ToolDataModel.cs index e3667e1..2fc52d6 100644 --- a/CMS_CORE_Library/Demo/Models/ToolDataModel.cs +++ b/CMS_CORE_Library/Demo/Models/ToolDataModel.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using static CMS_CORE_Library.DataStructures; namespace CMS_CORE.Demo.Models { @@ -23,7 +24,7 @@ namespace CMS_CORE.Demo.Models public bool IsInUse; public bool PreAlarm; public int ShanksId; - public List> EdgesData; + public List EdgesData; } public class ShankDataModel diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index d2083df..4cea5df 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -1,5 +1,6 @@ using CMS_CORE.Demo.Models; using CMS_CORE.Utils; +using CMS_CORE_Library.Demo; using CMS_CORE_Library.Demo.Models; using Nc_Demo_Application.Server.Service; using System; @@ -11,9 +12,9 @@ using System.Linq; using System.ServiceModel; using System.ServiceModel.Description; using System.Threading; +using static CMS_CORE.Demo.MEMORY_ADDRESS; using static CMS_CORE.Nc; using static CMS_CORE_Library.DataStructures; -using static CMS_CORE.Demo.MEMORY_ADDRESS; using static CMS_CORE_Library.ToolConfigurations; namespace CMS_CORE.Demo @@ -24,7 +25,6 @@ namespace CMS_CORE.Demo private ChannelFactory cf; private ILibraryService serverService; - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Contructor & global methods @@ -597,7 +597,7 @@ namespace CMS_CORE.Demo return NO_ERROR; } - + public override CmsError PLC_RNcSoftKeys(ref List ncSoftKeys) { CmsError cmsError = PLC_RSoftKeys(NC_SOFTKEYS_VALUE, NC_SOFTKEYS_CLICKABLE, ref ncSoftKeys); @@ -734,10 +734,10 @@ namespace CMS_CORE.Demo List readValues = new List(); // Find the size of a single head int headsByte = (HEADS_DATA.Size / HEADS_NUMBER); - double headsInts = Math.Ceiling((double)(headsByte / 4 ) + 1); + double headsInts = Math.Ceiling((double)(headsByte / 4) + 1); // Read data for N heads - CmsError cmsError = MEM_RWIntegerList(R, 0, HEADS_DATA.MemType, 0,HEADS_DATA.Address, (int)headsInts * number, ref readInts); + CmsError cmsError = MEM_RWIntegerList(R, 0, HEADS_DATA.MemType, 0, HEADS_DATA.Address, (int)headsInts * number, ref readInts); if (cmsError.IsError()) return cmsError; readValues = readInts.SelectMany(BitConverter.GetBytes).ToList(); @@ -944,7 +944,6 @@ namespace CMS_CORE.Demo // Populate response structure processData.Type = bits[3] ? "AUX" : "WORK"; - // Choose process status if (bits[4]) processData.Status = "HOLD"; @@ -956,8 +955,6 @@ namespace CMS_CORE.Demo processData.Status = "READY"; } - - // Get Reps from 2nd byte processData.Reps = bytes[1]; @@ -1121,7 +1118,7 @@ namespace CMS_CORE.Demo try { serverService.GetAxesPosition(procNumber.ToString(), out List demoAxes); - // Parse response and retrieve distance to go + // Parse response and retrieve distance to go foreach (NcAxisModel demoAxis in demoAxes) { Axes.Add(demoAxis.name, demoAxis.distanceToGo); @@ -1704,15 +1701,16 @@ namespace CMS_CORE.Demo } #endregion File Management + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Tools Management - + public override CmsError TOOLS_RConfiguration(ref ToolTableConfiguration config) { - config.ToolsConfiguration = SiemensToolsConfig; - config.FamiliesConfiguration = SiemensFamiliesConfig; - config.ShanksConfiguration = SiemensShanksConfig; + config.ToolsConfiguration = SiemensToolsConfig; + config.FamiliesConfiguration = SiemensFamiliesConfig; + config.ShanksConfiguration = SiemensShanksConfig; config.MagazinePosConfiguration = SiemensMagazinePosConfig; config.Magazines = new List() @@ -1720,7 +1718,6 @@ namespace CMS_CORE.Demo new MagazineModel{Id = 1, Type = MAGAZINE_TYPE.MAGAZINE}, new MagazineModel{Id = 2, Type = MAGAZINE_TYPE.MAGAZINE}, new MagazineModel{Id = 3, Type = MAGAZINE_TYPE.SPINDLE}, - }; return NO_ERROR; @@ -1737,31 +1734,68 @@ namespace CMS_CORE.Demo { toolTable = new List(); // Get tool table data - serverService.GetTools(out List toolsData); + serverService.GetTools(out List DemoToolsData); - foreach(ToolsDataModel tool in toolsData) + DemoEdgesConfiguration toolsConfig = new DemoEdgesConfiguration(); + + foreach (ToolsDataModel demoTool in DemoToolsData) { - toolTable.Add(new SiemensToolModel() + var toolData = new SiemensToolModel() { - Id = tool.Id, - FamilyName = tool.FamilyName, - ChildId = tool.ChildId, - MagazinePositionType = tool.MagazinePositionType, - ToolType = tool.ToolType, - LeftSize = tool.LeftSize, - RightSize = tool.RightSize, - Rotation = (ROTATION)tool.Rotation, - Cooling1 = tool.Cooling1, - Cooling2 = tool.Cooling2, - IsActive = tool.IsActive, - FixedPlace = tool.FixedPlace, - IsInhibited = tool.IsInhibited, - IsMeasured = tool.IsMeasured, - ChangeTool = tool.ChangeTool, - IsInUse = tool.IsInUse, - PreAlarm = tool.PreAlarm, - EdgesData = tool.EdgesData - }); + Id = demoTool.Id, + FamilyName = demoTool.FamilyName, + ChildId = demoTool.ChildId, + MagazinePositionType = demoTool.MagazinePositionType, + ToolType = demoTool.ToolType, + LeftSize = demoTool.LeftSize, + RightSize = demoTool.RightSize, + Rotation = (ROTATION)demoTool.Rotation, + Cooling1 = demoTool.Cooling1, + Cooling2 = demoTool.Cooling2, + IsActive = demoTool.IsActive, + FixedPlace = demoTool.FixedPlace, + IsInhibited = demoTool.IsInhibited, + IsMeasured = demoTool.IsMeasured, + ChangeTool = demoTool.ChangeTool, + IsInUse = demoTool.IsInUse, + PreAlarm = demoTool.PreAlarm, + EdgesData = new List() + }; + + // Get tool type additional parameters + var toolTypeConfig = toolsConfig.EdgesConfig[demoTool.ToolType]; + + //--- Read Edges + + // For each demo edge + foreach (var demoEdge in demoTool.EdgesData) + { + // Create new edge model with filtered data + var tmpEdge = new EdgesModel() + { + Id = demoEdge.Id, + ResidualLife = demoEdge.ResidualLife, + NominalLife = demoEdge.NominalLife, + PreAlmLife = demoEdge.PreAlmLife, + EdgeAdditionalParams = new Dictionary() + }; + + // Populate dinamycal Params Get only tool type additional parameters + foreach (var item in toolTypeConfig) + { + tmpEdge.EdgeAdditionalParams.Add( + // Item name + item.Name, + // "param" + N; N is configured in the path + demoEdge.EdgeAdditionalParams["param" + item.Path] + ); + } + // Add new edge to selected tool edges list + toolData.EdgesData.Add(tmpEdge); + } + + // Add new tool to tool table + toolTable.Add(toolData); } return NO_ERROR; @@ -1781,8 +1815,8 @@ namespace CMS_CORE.Demo try { - serverService.AddTool(ref tool); - + serverService.AddTool(ref tool); + return NO_ERROR; } catch (Exception ex) @@ -1829,6 +1863,66 @@ namespace CMS_CORE.Demo } } + #endregion Tools Management + + #region Edges + + //public override CmsError TOOLS_WAddEdge(int toolId, EdgesModel edge) + //{ + // // Check if the NC Demo is Connected + // CmsError cmsError = CheckConnection(); + // if (cmsError.IsError()) + // return cmsError; + + // try + // { + // DemoEdgesConfiguration toolsConfig = new DemoEdgesConfiguration(); + + // var toolTypeConfig = toolsConfig.EdgesConfig[demoTool.ToolType]; + // // Populate dinamycal Params Get only tool type additional parameters + // foreach (var item in toolTypeConfig) + // { + // tmpEdge.EdgeAdditionalParams.Add( + // // Item name + // item.Name, + // // "param" + N; N is configured in the path + // demoEdge.EdgeAdditionalParams["param" + item.Path] + // ); + // } + + // serverService.AddEdge(toolId.ToString(), ref edge); + + // return NO_ERROR; + // } + // catch (Exception ex) + // { + // return ManageException(ex); + // } + //} + + public override CmsError TOOLS_WDeleteEdge(int toolId, int edgeId) + { + // Check if the NC Demo is Connected + CmsError cmsError = CheckConnection(); + if (cmsError.IsError()) + return cmsError; + + try + { + serverService.DeleteEdge(toolId.ToString(), edgeId.ToString()); + + return NO_ERROR; + } + catch (Exception ex) + { + return ManageException(ex); + } + } + + #endregion + + #region ToolTable + public override CmsError TOOLS_RShanksData(ref List shanks) { // Check if the NC Demo is Connected @@ -1884,7 +1978,6 @@ namespace CMS_CORE.Demo } } - public override CmsError TOOLS_WDeleteShank(int id) { // Check if the NC Demo is Connected @@ -1974,7 +2067,6 @@ namespace CMS_CORE.Demo // Get families data serverService.PutFamily(oldName, demoFamilyData); - return NO_ERROR; } catch (Exception ex) @@ -2002,7 +2094,6 @@ namespace CMS_CORE.Demo } } - public override CmsError TOOLS_RMagazinePositions(ref List positions) { // Check if the NC Demo is Connected @@ -2054,7 +2145,7 @@ namespace CMS_CORE.Demo } } - #endregion Tools Management +#endregion Tools Management /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 0c09e0d..0abc320 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -1735,6 +1735,11 @@ namespace CMS_CORE.Fanuc return NO_ERROR; } + public override CmsError TOOLS_WDeleteEdge(int toolId, int edgeId) + { + return NO_ERROR; + } + #endregion Tools Management /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Nc.cs b/CMS_CORE_Library/Nc.cs index c609c8e..6e26b7c 100644 --- a/CMS_CORE_Library/Nc.cs +++ b/CMS_CORE_Library/Nc.cs @@ -1302,7 +1302,6 @@ namespace CMS_CORE public abstract CmsError TOOLS_RToolTable(ref List toolTable); - public abstract CmsError TOOLS_RShanksData(ref List shanksData); public abstract CmsError TOOLS_RFamilyData(ref List families); @@ -1327,6 +1326,9 @@ namespace CMS_CORE public abstract CmsError TOOLS_WDeleteFamily(string name); + public abstract CmsError TOOLS_WDeleteEdge(int toolId, int edgeId); + + #endregion File Management (To override) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index fe56859..c60c006 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -2105,6 +2105,11 @@ namespace CMS_CORE.Osai return NO_ERROR; } + public override CmsError TOOLS_WDeleteEdge(int toolId, int edgeId) + { + return NO_ERROR; + } + #endregion Tools Management /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index ccd901a..8a70e2d 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -1,5 +1,4 @@ using CMS_CORE.Utils; -using CMS_CORE_Library; using CMS_CORE_Library.Siemens; using Siemens.Sinumerik.Operate.Services; using System; @@ -15,8 +14,8 @@ using System.Xml.Linq; using static CMS_CORE.Nc; using static CMS_CORE.Siemens.MEMORY_ADDRESS; using static CMS_CORE_Library.DataStructures; -using static Siemens.Sinumerik.Operate.Services.ToolMngmntSvc; using static CMS_CORE_Library.ToolConfigurations; +using static Siemens.Sinumerik.Operate.Services.ToolMngmntSvc; namespace CMS_CORE.Siemens { @@ -66,6 +65,7 @@ namespace CMS_CORE.Siemens // STatic variables private AlarmSvc SiemensAlmSvc; + private ToolMngmntSvc SiemensToolSvc = null; private Guid ToolMngmtListGuid = Guid.Empty; @@ -123,7 +123,6 @@ namespace CMS_CORE.Siemens SiemensToolSvc = new ToolMngmntSvc(1); ToolMngmtListGuid = SiemensToolSvc.Subscribe(TOOLS_UpdateToolsData); - } catch (Exception ex) { @@ -176,7 +175,7 @@ namespace CMS_CORE.Siemens Value = x.Element("translation").Value }); - foreach ( var message in messagesList) + foreach (var message in messagesList) { if (!messages.Keys.Contains(message.Key)) { @@ -1757,7 +1756,7 @@ namespace CMS_CORE.Siemens { TOOLS_ChooseActions(toolInfos[i]); } - } + } catch (Exception ex) { Console.WriteLine(ex.Message); @@ -1777,6 +1776,7 @@ namespace CMS_CORE.Siemens ToolTableData.Remove(tool); } break; + case ToolAction.TOOL_CREATED: { // Create a configuration file @@ -1791,10 +1791,12 @@ namespace CMS_CORE.Siemens ToolTableData.Add(newTool); } break; + case ToolAction.TOOL_DATA_CHANGED: { } break; case ToolAction.TOOL_MOVED: { } break; } - } catch (Exception ex) + } + catch (Exception ex) { Console.WriteLine(ex.Message); } @@ -1804,11 +1806,13 @@ namespace CMS_CORE.Siemens private SiemensToolModel TOOLS_CreateToolFromType(int toolId, string[] toolStrings) { + SiemensEdgesConfiguration toolEdgesConfig = new SiemensEdgesConfiguration(); + // Find its status var toolStatus = Convert.ToByte(toolStrings.FirstOrDefault(X => X.Contains("$TC_TP8[" + toolId)).Split('=').LastOrDefault()); // Find basic info (rotation, cooling ...) var toolInfo = Convert.ToInt32(toolStrings.FirstOrDefault(X => X.Contains("$TC_DP25[" + toolId)).Split('=').LastOrDefault()); - + // Get rotation data ROTATION rotation = ROTATION.NONE; if (GetBitValue(toolInfo, 9)) @@ -1834,36 +1838,36 @@ namespace CMS_CORE.Siemens ChangeTool = GetBitValue(toolStatus, 5), IsInUse = GetBitValue(toolStatus, 7), PreAlarm = GetBitValue(toolStatus, 8), - EdgesData = new List>() + EdgesData = new List() }; // LEGGERE MAX = $MN_MM_MAX_CUTTING_EDGE_PERTOOL // For each possible edges - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { // Find the type of the edges var toolType = toolStrings.FirstOrDefault(X => X.Contains("$TC_DP1[" + toolId + "," + i)); // If type doesn't exist than edges doesn't exist - if( toolType != null) + if (toolType != null) { int toolTypeVal = Convert.ToByte(toolType.Split('=').LastOrDefault()); - // Get tool type additional parameters - SiemensAdditionalParams toolsConfig = new SiemensAdditionalParams(); - var toolTypeConfig = toolsConfig.ToolsSettings[toolTypeVal]; - Dictionary tmpDictionary = new Dictionary(); - // For each parameter + // Get tool type additional parameters + var toolTypeConfig = toolEdgesConfig.EdgesConfig[toolTypeVal]; + + EdgesModel edgeData = new EdgesModel(); + // For each dynamic parameter configured foreach (var item in toolTypeConfig) { - tmpDictionary.Add( + edgeData.EdgeAdditionalParams.Add( item.Name, Convert.ToDouble(toolStrings.FirstOrDefault(X => X.Contains(item.Path + toolId + "," + i)).Split('=').LastOrDefault()) ); } - toolValues.EdgesData.Add(tmpDictionary); + toolValues.EdgesData.Add(edgeData); } } - + return toolValues; } @@ -1927,6 +1931,11 @@ namespace CMS_CORE.Siemens return NO_ERROR; } + public override CmsError TOOLS_WDeleteEdge(int toolId, int edgeId) + { + return NO_ERROR; + } + #endregion Tool Management /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Siemens/SiemensEdgesConfigurations.cs b/CMS_CORE_Library/Siemens/SiemensEdgesConfigurations.cs new file mode 100644 index 0000000..201acef --- /dev/null +++ b/CMS_CORE_Library/Siemens/SiemensEdgesConfigurations.cs @@ -0,0 +1,441 @@ +using System.Collections.Generic; +using static CMS_CORE_Library.DataStructures; + +namespace CMS_CORE_Library.Siemens +{ + internal class SiemensEdgesConfiguration + { + public Dictionary> EdgesConfig = new Dictionary>() + { + { + 100, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 110, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 111, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "CornerRadius", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 120, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 121, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 130, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "GeomDeltaLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomDeltaLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomDeltaLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["}, + new EdgeConfigModel{Name = "V", Path = "$TC_DPV["}, + new EdgeConfigModel{Name = "Vector1", Path = "$TC_DPV3["}, + new EdgeConfigModel{Name = "Vector2", Path = "$TC_DPV4["}, + new EdgeConfigModel{Name = "Vector3", Path = "$TC_DPV5["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 131, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "CornerRadius", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "GeomDeltaLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomDeltaLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomDeltaLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["}, + new EdgeConfigModel{Name = "V", Path = "$TC_DPV["}, + new EdgeConfigModel{Name = "Vector1", Path = "$TC_DPV3["}, + new EdgeConfigModel{Name = "Vector2", Path = "$TC_DPV4["}, + new EdgeConfigModel{Name = "Vector3", Path = "$TC_DPV5["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 140, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "OutsideRadius", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "ToolAngle", Path = "$TC_DP11["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 145, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 150, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "Width", Path = "$TC_DP9[" }, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15[" }, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 151, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "Width", Path = "$TC_DP9[" }, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15[" }, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 155, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "TaperAngle", Path = "$TC_DP11[" }, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 156, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "CornerRadius", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "TaperAngle", Path = "$TC_DP11[" }, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 157, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "TaperAngle", Path = "$TC_DP11[" }, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + { + 160, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "Teeth", Path = "$TC_DPNT[" } + } + }, + //////// 200 - 300 + { + 200, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{ Name = "TipAngle", Path = "$TC_DP24["} + } + }, + { + 205, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 210, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 220, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{ Name = "TipAngle", Path = "$TC_DP24["} + } + }, + { + 230, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{ Name = "TipAngle", Path = "$TC_DP24["} + } + }, + { + 231, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 240, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "Pitch", Path = "$TC_DP9["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 241, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 242, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 250, new List() + { + new EdgeConfigModel{ Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{ Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{ Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{ Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{ Name = "WearRadius", Path = "$TC_DP15["} + } + }, + ///////// 700 - 900 + { + 700, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Diameter", Path = "6"}, + new EdgeConfigModel{Name = "GeomSlotWidth", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "GeomPrjection", Path = "$TC_DP8["}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearDiameter", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "WearSlotWdth", Path = "$TC_DP16["}, + new EdgeConfigModel{Name = "WearGeomPrjection", Path = "$TC_DP17["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["} + } + }, + { + 710, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 711, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 712, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "CorrAngle", Path = "$TC_DP10["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 713, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "BoomLenght", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "CorrAngle", Path = "$TC_DP10["}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["} + } + }, + { + 714, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "BallRadius", Path = "$TC_DP7["}, + new EdgeConfigModel{Name = "CorrAngle", Path = "$TC_DP10["}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["} + } + }, + { + 725, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "GeomLenght1", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "GeomLenght2", Path = "$TC_DP4["}, + new EdgeConfigModel{Name = "GeomLenght3", Path = "$TC_DP5["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "CorrAngle", Path = "$TC_DP10["}, + new EdgeConfigModel{Name = "GeomWearLenght1", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "GeomWearLenght2", Path = "$TC_DP13["}, + new EdgeConfigModel{Name = "GeomWearLenght3", Path = "$TC_DP14["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["}, + new EdgeConfigModel{Name = "AdapterLenght1", Path = "$TC_DP21["}, + new EdgeConfigModel{Name = "AdapterLenght2", Path = "$TC_DP22["}, + new EdgeConfigModel{Name = "AdapterLenght3", Path = "$TC_DP23["} + } + }, + { + 730, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["} + } + }, + { + 900, new List() + { + new EdgeConfigModel{Name = "CuttingEdgeConfigModel", Path = "$TC_DP2["}, + new EdgeConfigModel{Name = "Lenght", Path = "$TC_DP3["}, + new EdgeConfigModel{Name = "Radius", Path = "$TC_DP6["}, + new EdgeConfigModel{Name = "WearLenght", Path = "$TC_DP12["}, + new EdgeConfigModel{Name = "WearRadius", Path = "$TC_DP15["} + } + }, + }; + } +} \ No newline at end of file diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Constants.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Constants.cs index bc36c24..4976744 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Constants.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Constants.cs @@ -18,6 +18,7 @@ namespace Nc_Demo_Application public const string READ_FAMILIES_QUERY = "SELECT * FROM family"; public const string READ_SHANKS_QUERY = "SELECT * FROM shank"; public const string READ_MAGAZINES_QUERY = "SELECT * FROM magazine"; + public const string READ_EDGES_QUERY = "SELECT * FROM edge"; // Server configuration public static string SERVER_PORT = ":8080"; diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/DatabaseController.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/DatabaseController.cs index d4c20ca..73111ea 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/DatabaseController.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/DatabaseController.cs @@ -26,6 +26,7 @@ namespace Nc_Demo_Application.Database private DataTable FamiliesDataTable; private DataTable ShanksDataTable; private DataTable MagazinesPositionDataTable; + private DataTable EdgeDataTable; #region Constructor & Private functions @@ -42,6 +43,7 @@ namespace Nc_Demo_Application.Database MagazinesPositionDataTable = new DataTable(); NcProcessDataTable = new DataTable(); BinaryMemory = new DataTable(); + EdgeDataTable = new DataTable(); // Create ncProcess columns NcProcessDataTable.Columns.Add("status", typeof(PROC_STATUS)); @@ -72,6 +74,7 @@ namespace Nc_Demo_Application.Database public void ResetDatabase() { + // Dispose all the Datatable BinaryMemory.Dispose(); NcProcessDataTable.Dispose(); NcAlarmDataTable.Dispose(); @@ -80,7 +83,9 @@ namespace Nc_Demo_Application.Database FamiliesDataTable.Dispose(); ShanksDataTable.Dispose(); MagazinesPositionDataTable.Dispose(); + EdgeDataTable.Dispose(); + // Close sql connection sqlConnection.Close(); } @@ -808,10 +813,12 @@ namespace Nc_Demo_Application.Database // Delete row with matching id DataRow row = ShanksDataTable.AsEnumerable().FirstOrDefault(x => Convert.ToInt32(x["id"]) == id); - - row.Delete(); - // Update database - adapter.Update(ShanksDataTable); + if(row != null) + { + row.Delete(); + // Update database + adapter.Update(ShanksDataTable); + } // Close the connection with database sqlConnection.Close(); @@ -894,7 +901,7 @@ namespace Nc_Demo_Application.Database DataRow row = ToolsDataTable.NewRow(); // Find & set new item Id toolData.Id = Convert.ToInt32(ToolsDataTable.Rows[ToolsDataTable.Rows.Count - 1]["id"]) + 1; - // Get child id + // Get child id toolData.ChildId = GetFamilyChildId(toolData.FamilyName); // Setup autoincrement Id @@ -982,7 +989,7 @@ namespace Nc_Demo_Application.Database Console.WriteLine("Update tool exception: " + ex.Message); } } - + private int GetFamilyChildId(string familyName) { // Find next child id @@ -1012,9 +1019,12 @@ namespace Nc_Demo_Application.Database // Delete row with matching id DataRow row = ToolsDataTable.AsEnumerable().FirstOrDefault(x => Convert.ToInt32(x["id"]) == id); - row.Delete(); - // Update database - adapter.Update(ToolsDataTable); + if(row != null) + { + row.Delete(); + // Update database + adapter.Update(ToolsDataTable); + } // Close the connection with database sqlConnection.Close(); @@ -1027,6 +1037,153 @@ namespace Nc_Demo_Application.Database #endregion Tools + #region Edges + + public DataTable ReadEdges(int toolId) + { + try + { + ReadDataFromDatabase(READ_EDGES_QUERY + " where tool_id =" + toolId, ref EdgeDataTable); + + return EdgeDataTable; + } + catch (Exception ex) + { + Console.WriteLine("Read edges exception: " + ex.Message); + return null; + } + } + + public List GetEdgesData(int toolId) + { + List edgesList = new List(); + // Not having a list of all the edges, you must read again + ReadEdges(toolId); + // Populate Edges Model with db data + foreach (DataRow row in EdgeDataTable.Rows) + { + EdgesDataModel edge = new EdgesDataModel + { + Id = Convert.ToInt32(row["id"]), + NominalLife = Convert.ToInt32(row["nominal_life"]), + ResidualLife = Convert.ToInt32(row["residual_life"]), + PreAlmLife = Convert.ToInt32(row["prealm_life"]) + }; + + edge.EdgeAdditionalParams = new Dictionary(); + for (int i = 2; i <= 30; i++) + { + string key = "param" + i; + edge.EdgeAdditionalParams.Add(key, Convert.ToDouble(row[key])); + } + + edge.EdgeAdditionalParams.Add("param34", Convert.ToDouble(row["param34"])); + + edgesList.Add(edge); + } + + return edgesList; + } + + public EdgesDataModel AddEdge(int toolId, EdgesDataModel newEdge) + { + try + { + // Get data from DB, alreaby filtred by tool id + DataTable edgesTable = ReadEdges(toolId); + + // Open the connection with database + SetConnection(); + sqlConnection.Open(); + + // Create a SQLite command with query, adapter and commandbuilder in order to update. + sqlCommand = new SQLiteCommand(READ_EDGES_QUERY, sqlConnection); + SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand); + SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter); + + // Create new row that must be inserted + DataRow row = edgesTable.NewRow(); + int id = Convert.ToInt32(edgesTable.Rows[edgesTable.Rows.Count - 1]["child_id"]) + 1; + + newEdge.Id = id; + + // Setup autoincrement Id + row["child_id"] = id; + row["tool_id"] = toolId; + row["residual_life"] = newEdge.ResidualLife; + row["nominal_life"] = newEdge.NominalLife; + row["prealm_life"] = newEdge.PreAlmLife; + + // Set additional param value + for (int i = 2; i <= 30; i++) + { + string key = "param" + i; + // Check if value exist, if not 0 + row[key] = newEdge.EdgeAdditionalParams.ContainsKey(key) ? newEdge.EdgeAdditionalParams[key] : 0; + } + // Same operation as above but for param34 + row["param34"] = newEdge.EdgeAdditionalParams.ContainsKey("param34") ? newEdge.EdgeAdditionalParams["param34"] : 0; + + // Add the new row + EdgeDataTable.Rows.Add(row); + + // Update database + adapter.Update(EdgeDataTable); + + // Close the connection with database + sqlConnection.Close(); + + return newEdge; + } + catch (Exception ex) + { + Console.WriteLine("Add edge exception: " + ex.Message); + return null; + } + } + + public void UpdateEdges(DataTable edges) + { + UpdateDatabaseFromGridView(edges, READ_EDGES_QUERY); + } + + public void DeleteEdge(int toolId, int edgeId) + { + try + { + // Get data from DB, alreaby filtred by tool id + DataTable edgesTable = ReadEdges(toolId); + + SetConnection(); + + // Open the connection with database + sqlConnection.Open(); + // Create a SQLite command with query, adapter and commandbuilder in order to delete + sqlCommand = new SQLiteCommand(READ_EDGES_QUERY, sqlConnection); + SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand); + SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter); + + // Delete row with matching edgeId inside tool + DataRow row = edgesTable.AsEnumerable().FirstOrDefault(x => Convert.ToInt32(x["child_id"]) == edgeId); + if(row != null) + { + row.Delete(); + + // Update database + adapter.Update(edgesTable); + } + + // Close the connection with database + sqlConnection.Close(); + } + catch (Exception ex) + { + Console.WriteLine("Delete edge exception: " + ex.Message); + } + } + + #endregion Edges + #region Magazines public DataTable ReadMagazines() @@ -1068,13 +1225,43 @@ namespace Nc_Demo_Application.Database return positions; } + public List GetMagazinePositions(int magazineId) + { + List positions = new List(); + // Find only selected magazine rows + List magazinePositions = MagazinesPositionDataTable + .AsEnumerable() + .Where(x => Convert.ToInt32(x["magazineId"]) == magazineId).ToList(); + + foreach (DataRow row in magazinePositions) + { + // Convert DataTable.row into positions model + PositionsDataModel tmpPositions = new PositionsDataModel + { + Id = Convert.ToInt32(row["positionId"]), + MagazineId = Convert.ToInt32(row["magazineId"]), + Type = Convert.ToInt32(row["type"]), + }; + + // Find mounted tool in the selected position & magazine + tmpPositions.childsTools = ToolsDataTable.AsEnumerable() + .Where(x => Convert.ToInt32(x["magazine"]) == magazineId && Convert.ToInt32(x["shankId"]) == tmpPositions.Id)? + .Select(x => new PositionsChild() { Id = tmpPositions.Id }) + .ToList(); + + positions.Add(tmpPositions); + } + + return positions; + } + public void UpdatePosition(PositionsDataModel position) { // Find position to be updated DataRow row = MagazinesPositionDataTable .AsEnumerable() .FirstOrDefault(x => Convert.ToInt32(x["positionId"]) == position.Id && Convert.ToInt32(x["magazineId"]) == position.MagazineId); - + // Update positions type row["type"] = position.Type; // Save diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/Models/ToolsDataModel.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/Models/ToolsDataModel.cs index 108e9d5..eb42641 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/Models/ToolsDataModel.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Database/Models/ToolsDataModel.cs @@ -23,7 +23,7 @@ namespace Nc_Demo_Application.Database.Models public bool IsInUse; public bool PreAlarm; public int ShanksId; - public List> EdgesData; + public List EdgesData; } public class ShankDataModel @@ -45,5 +45,19 @@ namespace Nc_Demo_Application.Database.Models public int Id; public int MagazineId; public int Type; + public List childsTools; + } + public class PositionsChild + { + public int Id; + } + + public class EdgesDataModel + { + public int Id; + public double ResidualLife; + public double NominalLife; + public double PreAlmLife; + public Dictionary EdgeAdditionalParams; } } \ No newline at end of file diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/ILibraryService.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/ILibraryService.cs index c6e0451..a895545 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/ILibraryService.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/ILibraryService.cs @@ -190,6 +190,12 @@ namespace Nc_Demo_Application.Server.Service [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/tool/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void DeleteTool(string id); + [WebInvoke(Method = "POST", UriTemplate = "tool_table/edge/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void AddEdge(string toolId, ref EdgesDataModel edge); + + [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/edge/{toolId}/{edgeId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void DeleteEdge(string toolId, string edgeId); + [WebGet(UriTemplate = "tool_table/shanks", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetShanks(out List shanksData); @@ -202,6 +208,9 @@ namespace Nc_Demo_Application.Server.Service [WebGet(UriTemplate = "tool_table/positions", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetPositions(out List positionsData); + [WebGet(UriTemplate = "tool_table/magazine/{magazineId}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] + void GetMagazinePositions(string magazineId, out List positionsData); + [WebInvoke(Method = "PUT", UriTemplate = "tool_table/position", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void PutPosition(PositionsDataModel position); #endregion diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/LibraryService.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/LibraryService.cs index db84804..a64acd5 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/LibraryService.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Server/Service/LibraryService.cs @@ -468,7 +468,12 @@ namespace Nc_Demo_Application.Server.Service public void AddFamily(ref FamilyModel family) { - family = DatabaseController.getInstance().AddFamily(family); + family = DatabaseController.getInstance().AddFamily(family); + } + + public void DeleteFamily(string name) + { + DatabaseController.getInstance().DeleteFamily(name); } #endregion Family @@ -478,6 +483,10 @@ namespace Nc_Demo_Application.Server.Service public void GetTools(out List toolsData) { toolsData = DatabaseController.getInstance().ReadTools(); + foreach(ToolsDataModel tool in toolsData) + { + tool.EdgesData = DatabaseController.getInstance().GetEdgesData(tool.Id); + } } public void AddTool(ref ToolsDataModel tool) @@ -490,6 +499,29 @@ namespace Nc_Demo_Application.Server.Service DatabaseController.getInstance().UpdateToolData(tool); } + public void DeleteTool(string id) + { + DatabaseController.getInstance().DeleteTool(Convert.ToInt32(id)); + } + + #endregion Tools + + #region Edges + + public void AddEdge(string toolId, ref EdgesDataModel edge) + { + edge = DatabaseController.getInstance().AddEdge(Convert.ToInt32(toolId), edge); + } + + public void DeleteEdge(string toolId, string edgeId) + { + DatabaseController.getInstance().DeleteEdge(Convert.ToInt32(toolId), Convert.ToInt32(edgeId)); + } + + #endregion Edges + + #region Shanks + public void GetShanks(out List shanksData) { shanksData = DatabaseController.getInstance().GetShanks(); @@ -500,19 +532,8 @@ namespace Nc_Demo_Application.Server.Service shankData = DatabaseController.getInstance().AddShank(); } - public void GetPositions(out List positionsData) + public void PutShank(ShankDataModel shankData) { - positionsData = DatabaseController.getInstance().GetPositions(); - } - - public void PutPosition(PositionsDataModel position) - { - DatabaseController.getInstance().UpdatePosition(position); - } - - public void DeleteTool(string id) - { - DatabaseController.getInstance().DeleteTool(Convert.ToInt32(id)); } public void DeleteShank(string id) @@ -520,10 +541,25 @@ namespace Nc_Demo_Application.Server.Service DatabaseController.getInstance().DeleteShank(Convert.ToInt32(id)); } - public void DeleteFamily(string name) + #endregion Shanks + + #region Positions + + public void GetPositions(out List positionsData) { - DatabaseController.getInstance().DeleteFamily(name); + positionsData = DatabaseController.getInstance().GetPositions(); } - #endregion Tools + + public void GetMagazinePositions(string magazineId, out List positionsData) + { + positionsData = DatabaseController.getInstance().GetMagazinePositions(Convert.ToInt32(magazineId)); + } + + public void PutPosition(PositionsDataModel position) + { + DatabaseController.getInstance().UpdatePosition(position); + } + + #endregion Positions } } \ No newline at end of file diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs index b7945df..8487d78 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs @@ -36,10 +36,9 @@ namespace Nc_Demo_Application System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DemoApplicationForm)); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.serverStatusLabel = new System.Windows.Forms.Label(); this.ncDataPage = new System.Windows.Forms.TabPage(); - this.toolStrip5 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveNcDataButton = new System.Windows.Forms.ToolStripButton(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); @@ -59,8 +58,6 @@ namespace Nc_Demo_Application this.NCNameLabel = new System.Windows.Forms.Label(); this.ncTabControl = new System.Windows.Forms.TabControl(); this.processPage = new System.Windows.Forms.TabPage(); - this.toolStrip1 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveNcProcessData = new System.Windows.Forms.ToolStripButton(); this.ncProcessGridView = new System.Windows.Forms.DataGridView(); this.ncProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ProcessPartProgram = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -68,16 +65,12 @@ namespace Nc_Demo_Application this.ncProcessStatusColumn = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.ncProcessModeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.alarms = new System.Windows.Forms.TabPage(); - this.toolStrip3 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveNcAlarmsButton = new System.Windows.Forms.ToolStripButton(); this.ncAlarmsGridView = new System.Windows.Forms.DataGridView(); this.ncAlarmCodeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncAlarmProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncAlarmTextColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncAlarmIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncAxesPage = new System.Windows.Forms.TabPage(); - this.toolStrip4 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveNcAxesButton = new System.Windows.Forms.ToolStripButton(); this.ncAxisGridView = new System.Windows.Forms.DataGridView(); this.axisIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.axisNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -95,25 +88,14 @@ namespace Nc_Demo_Application this.BinaryMemoryBinaryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BinaryMemoryWordColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BinaryMemoryIntegerColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.toolStrip2 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveBinaryMemoryButton = new System.Windows.Forms.ToolStripButton(); - this.addRowsBinaryMemory = new System.Windows.Forms.ToolStripButton(); - this.deleteRowsBinaryMemory = new System.Windows.Forms.ToolStripButton(); this.partProgramPage = new System.Windows.Forms.TabPage(); this.fileContentTextBox = new System.Windows.Forms.TextBox(); this.fileTreeView = new System.Windows.Forms.TreeView(); - this.toolStrip6 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveFileButton = new System.Windows.Forms.ToolStripButton(); - this.deleteFileButton = new System.Windows.Forms.ToolStripButton(); - this.addFileButton = new System.Windows.Forms.ToolStripButton(); - this.newFileNameTextBox = new System.Windows.Forms.ToolStripTextBox(); this.magazinesTab = new System.Windows.Forms.TabPage(); this.magazinesGridView = new System.Windows.Forms.DataGridView(); this.magazineId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.positionId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.positionType = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.toolStripEx2 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveMagazinesButton = new System.Windows.Forms.ToolStripButton(); this.familiesTab = new System.Windows.Forms.TabPage(); this.label18 = new System.Windows.Forms.Label(); this.shanksDataGridView = new System.Windows.Forms.DataGridView(); @@ -122,9 +104,8 @@ namespace Nc_Demo_Application this.familiesDataGridView = new System.Windows.Forms.DataGridView(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.toolStripEx1 = new Nc_Demo_Application.Views.ToolStripEx(); - this.saveFamiliesButton = new System.Windows.Forms.ToolStripButton(); this.toolsPage = new System.Windows.Forms.TabPage(); + this.edgesDataGridView = new System.Windows.Forms.DataGridView(); this.label19 = new System.Windows.Forms.Label(); this.shankIdTextBox = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); @@ -158,36 +139,94 @@ namespace Nc_Demo_Application this.toolsIdLlb = new System.Windows.Forms.Label(); this.toolNameTxt = new System.Windows.Forms.TextBox(); this.toolsTreeView = new System.Windows.Forms.TreeView(); + this.stopServer = new System.Windows.Forms.Button(); + this.toolStrip5 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveNcDataButton = new System.Windows.Forms.ToolStripButton(); + this.toolStrip1 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveNcProcessData = new System.Windows.Forms.ToolStripButton(); + this.toolStrip3 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveNcAlarmsButton = new System.Windows.Forms.ToolStripButton(); + this.toolStrip4 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveNcAxesButton = new System.Windows.Forms.ToolStripButton(); + this.toolStrip2 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveBinaryMemoryButton = new System.Windows.Forms.ToolStripButton(); + this.addRowsBinaryMemory = new System.Windows.Forms.ToolStripButton(); + this.deleteRowsBinaryMemory = new System.Windows.Forms.ToolStripButton(); + this.toolStrip6 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveFileButton = new System.Windows.Forms.ToolStripButton(); + this.deleteFileButton = new System.Windows.Forms.ToolStripButton(); + this.addFileButton = new System.Windows.Forms.ToolStripButton(); + this.newFileNameTextBox = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripEx2 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveMagazinesButton = new System.Windows.Forms.ToolStripButton(); + this.toolStripEx1 = new Nc_Demo_Application.Views.ToolStripEx(); + this.saveFamiliesButton = new System.Windows.Forms.ToolStripButton(); this.toolStrip7 = new Nc_Demo_Application.Views.ToolStripEx(); this.refreshToolUI = new System.Windows.Forms.ToolStripButton(); this.removeTool = new System.Windows.Forms.ToolStripButton(); this.addTool = new System.Windows.Forms.ToolStripButton(); - this.stopServer = new System.Windows.Forms.Button(); + this.edgesId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.edgeId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.edgeToolId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.edgesResidualLife = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.edgesNominalLife = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.edgesPreAlarmLife = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param12 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param13 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param14 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param15 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param16 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param17 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param18 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param19 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param20 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param21 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param22 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param23 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param24 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param25 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param26 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param27 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param28 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param29 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param30 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.param34 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncDataPage.SuspendLayout(); - this.toolStrip5.SuspendLayout(); this.ncTabControl.SuspendLayout(); this.processPage.SuspendLayout(); - this.toolStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).BeginInit(); this.alarms.SuspendLayout(); - this.toolStrip3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).BeginInit(); this.ncAxesPage.SuspendLayout(); - this.toolStrip4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).BeginInit(); this.byteMemoryPage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).BeginInit(); - this.toolStrip2.SuspendLayout(); this.partProgramPage.SuspendLayout(); - this.toolStrip6.SuspendLayout(); this.magazinesTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.magazinesGridView)).BeginInit(); - this.toolStripEx2.SuspendLayout(); this.familiesTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.shanksDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.familiesDataGridView)).BeginInit(); - this.toolStripEx1.SuspendLayout(); this.toolsPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.edgesDataGridView)).BeginInit(); + this.toolStrip5.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.toolStrip3.SuspendLayout(); + this.toolStrip4.SuspendLayout(); + this.toolStrip2.SuspendLayout(); + this.toolStrip6.SuspendLayout(); + this.toolStripEx2.SuspendLayout(); + this.toolStripEx1.SuspendLayout(); this.toolStrip7.SuspendLayout(); this.SuspendLayout(); // @@ -229,27 +268,6 @@ namespace Nc_Demo_Application this.ncDataPage.TabIndex = 0; this.ncDataPage.Text = "Nc Data"; // - // toolStrip5 - // - this.toolStrip5.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveNcDataButton}); - this.toolStrip5.Location = new System.Drawing.Point(3, 3); - this.toolStrip5.Name = "toolStrip5"; - this.toolStrip5.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - this.toolStrip5.Size = new System.Drawing.Size(972, 25); - this.toolStrip5.TabIndex = 53; - this.toolStrip5.Text = "toolStrip5"; - // - // saveNcDataButton - // - this.saveNcDataButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveNcDataButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveNcDataButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveNcDataButton.Name = "saveNcDataButton"; - this.saveNcDataButton.Size = new System.Drawing.Size(23, 22); - this.saveNcDataButton.Text = "toolStripButton1"; - this.saveNcDataButton.Click += new System.EventHandler(this.SaveCnDataButton_Click); - // // label6 // this.label6.AutoSize = true; @@ -420,28 +438,6 @@ namespace Nc_Demo_Application this.processPage.TabIndex = 1; this.processPage.Text = "Nc Process"; // - // toolStrip1 - // - this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; - this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveNcProcessData}); - this.toolStrip1.Location = new System.Drawing.Point(3, 3); - this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(35, 25); - this.toolStrip1.TabIndex = 9; - this.toolStrip1.Text = "toolStrip1"; - this.toolStrip1.Click += new System.EventHandler(this.SaveNcProcessData_Click); - // - // saveNcProcessData - // - this.saveNcProcessData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveNcProcessData.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveNcProcessData.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveNcProcessData.Name = "saveNcProcessData"; - this.saveNcProcessData.Size = new System.Drawing.Size(23, 22); - this.saveNcProcessData.Text = "Save"; - this.saveNcProcessData.Click += new System.EventHandler(this.SaveNcProcessData_Click); - // // ncProcessGridView // this.ncProcessGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -509,32 +505,6 @@ namespace Nc_Demo_Application this.alarms.Text = "NC Alarms"; this.alarms.UseVisualStyleBackColor = true; // - // toolStrip3 - // - this.toolStrip3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.toolStrip3.Dock = System.Windows.Forms.DockStyle.None; - this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveNcAlarmsButton}); - this.toolStrip3.Location = new System.Drawing.Point(0, 0); - this.toolStrip3.Name = "toolStrip3"; - this.toolStrip3.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.toolStrip3.Size = new System.Drawing.Size(35, 25); - this.toolStrip3.TabIndex = 2; - this.toolStrip3.Text = "toolStrip3"; - this.toolStrip3.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click); - // - // saveNcAlarmsButton - // - this.saveNcAlarmsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveNcAlarmsButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveNcAlarmsButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveNcAlarmsButton.Name = "saveNcAlarmsButton"; - this.saveNcAlarmsButton.Size = new System.Drawing.Size(23, 22); - this.saveNcAlarmsButton.Text = "Save"; - this.saveNcAlarmsButton.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click); - // // ncAlarmsGridView // this.ncAlarmsGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -592,26 +562,6 @@ namespace Nc_Demo_Application this.ncAxesPage.Text = "Axes"; this.ncAxesPage.UseVisualStyleBackColor = true; // - // toolStrip4 - // - this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveNcAxesButton}); - this.toolStrip4.Location = new System.Drawing.Point(0, 0); - this.toolStrip4.Name = "toolStrip4"; - this.toolStrip4.Size = new System.Drawing.Size(978, 25); - this.toolStrip4.TabIndex = 53; - this.toolStrip4.Text = "toolStrip4"; - // - // saveNcAxesButton - // - this.saveNcAxesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveNcAxesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveNcAxesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveNcAxesButton.Name = "saveNcAxesButton"; - this.saveNcAxesButton.Size = new System.Drawing.Size(23, 22); - this.saveNcAxesButton.Text = "Save"; - this.saveNcAxesButton.Click += new System.EventHandler(this.SaveNcAxesButton_Click); - // // ncAxisGridView // this.ncAxisGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; @@ -758,49 +708,6 @@ namespace Nc_Demo_Application this.BinaryMemoryIntegerColumn.HeaderText = "Integer"; this.BinaryMemoryIntegerColumn.Name = "BinaryMemoryIntegerColumn"; // - // toolStrip2 - // - this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveBinaryMemoryButton, - this.addRowsBinaryMemory, - this.deleteRowsBinaryMemory}); - this.toolStrip2.Location = new System.Drawing.Point(0, 0); - this.toolStrip2.Name = "toolStrip2"; - this.toolStrip2.Size = new System.Drawing.Size(978, 25); - this.toolStrip2.TabIndex = 1; - this.toolStrip2.Text = "toolStrip2"; - // - // saveBinaryMemoryButton - // - this.saveBinaryMemoryButton.CheckOnClick = true; - this.saveBinaryMemoryButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveBinaryMemoryButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveBinaryMemoryButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveBinaryMemoryButton.Name = "saveBinaryMemoryButton"; - this.saveBinaryMemoryButton.Size = new System.Drawing.Size(23, 22); - this.saveBinaryMemoryButton.Text = "Save"; - this.saveBinaryMemoryButton.Click += new System.EventHandler(this.SaveBinaryMemory_Click); - // - // addRowsBinaryMemory - // - this.addRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.addRowsBinaryMemory.Image = global::Nc_Demo_Application.Properties.Resources.addButton; - this.addRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta; - this.addRowsBinaryMemory.Name = "addRowsBinaryMemory"; - this.addRowsBinaryMemory.Size = new System.Drawing.Size(23, 22); - this.addRowsBinaryMemory.Text = "Add 4 Rows"; - this.addRowsBinaryMemory.Click += new System.EventHandler(this.addRowsBinaryMemory_Click); - // - // deleteRowsBinaryMemory - // - this.deleteRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.deleteRowsBinaryMemory.Image = global::Nc_Demo_Application.Properties.Resources.removeButton; - this.deleteRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta; - this.deleteRowsBinaryMemory.Name = "deleteRowsBinaryMemory"; - this.deleteRowsBinaryMemory.Size = new System.Drawing.Size(23, 22); - this.deleteRowsBinaryMemory.Text = "Remove 4 rows"; - this.deleteRowsBinaryMemory.Click += new System.EventHandler(this.deleteRowsBinaryMemory_Click); - // // partProgramPage // this.partProgramPage.Controls.Add(this.fileContentTextBox); @@ -838,55 +745,6 @@ namespace Nc_Demo_Application this.fileTreeView.TabIndex = 0; this.fileTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.FileTreeView_AfterSelect); // - // toolStrip6 - // - this.toolStrip6.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveFileButton, - this.deleteFileButton, - this.addFileButton, - this.newFileNameTextBox}); - this.toolStrip6.Location = new System.Drawing.Point(3, 3); - this.toolStrip6.Name = "toolStrip6"; - this.toolStrip6.Size = new System.Drawing.Size(972, 25); - this.toolStrip6.TabIndex = 1; - this.toolStrip6.Text = "toolStrip6"; - // - // saveFileButton - // - this.saveFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveFileButton.Enabled = false; - this.saveFileButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveFileButton.Name = "saveFileButton"; - this.saveFileButton.Size = new System.Drawing.Size(23, 22); - this.saveFileButton.Text = "Save file"; - this.saveFileButton.Click += new System.EventHandler(this.SaveFileButton_Click); - // - // deleteFileButton - // - this.deleteFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.deleteFileButton.Image = global::Nc_Demo_Application.Properties.Resources.removeButton; - this.deleteFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.deleteFileButton.Name = "deleteFileButton"; - this.deleteFileButton.Size = new System.Drawing.Size(23, 22); - this.deleteFileButton.Text = "Delete file"; - this.deleteFileButton.Click += new System.EventHandler(this.DeleteFile_Click); - // - // addFileButton - // - this.addFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.addFileButton.Image = global::Nc_Demo_Application.Properties.Resources.addButton; - this.addFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.addFileButton.Name = "addFileButton"; - this.addFileButton.Size = new System.Drawing.Size(23, 22); - this.addFileButton.Text = "Add file"; - this.addFileButton.Click += new System.EventHandler(this.AddFile_Click); - // - // newFileNameTextBox - // - this.newFileNameTextBox.Name = "newFileNameTextBox"; - this.newFileNameTextBox.Size = new System.Drawing.Size(100, 25); - // // magazinesTab // this.magazinesTab.Controls.Add(this.magazinesGridView); @@ -946,26 +804,6 @@ namespace Nc_Demo_Application this.positionType.HeaderText = "Type"; this.positionType.Name = "positionType"; // - // toolStripEx2 - // - this.toolStripEx2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveMagazinesButton}); - this.toolStripEx2.Location = new System.Drawing.Point(3, 3); - this.toolStripEx2.Name = "toolStripEx2"; - this.toolStripEx2.Size = new System.Drawing.Size(972, 25); - this.toolStripEx2.TabIndex = 1; - this.toolStripEx2.Text = "toolStripEx2"; - // - // saveMagazinesButton - // - this.saveMagazinesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveMagazinesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveMagazinesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveMagazinesButton.Name = "saveMagazinesButton"; - this.saveMagazinesButton.Size = new System.Drawing.Size(23, 22); - this.saveMagazinesButton.Text = "Save"; - this.saveMagazinesButton.Click += new System.EventHandler(this.SaveMagazinesButton_Click); - // // familiesTab // this.familiesTab.Controls.Add(this.label18); @@ -1047,25 +885,6 @@ namespace Nc_Demo_Application this.name.HeaderText = "Name"; this.name.Name = "name"; // - // toolStripEx1 - // - this.toolStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.saveFamiliesButton}); - this.toolStripEx1.Location = new System.Drawing.Point(3, 3); - this.toolStripEx1.Name = "toolStripEx1"; - this.toolStripEx1.Size = new System.Drawing.Size(972, 25); - this.toolStripEx1.TabIndex = 0; - this.toolStripEx1.Text = "toolStripEx1"; - // - // saveFamiliesButton - // - this.saveFamiliesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveFamiliesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; - this.saveFamiliesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveFamiliesButton.Name = "saveFamiliesButton"; - this.saveFamiliesButton.Size = new System.Drawing.Size(23, 22); - this.saveFamiliesButton.Click += new System.EventHandler(this.SaveFamiliesButton_Click); - // // toolsPage // this.toolsPage.Controls.Add(this.label19); @@ -1102,6 +921,7 @@ namespace Nc_Demo_Application this.toolsPage.Controls.Add(this.toolNameTxt); this.toolsPage.Controls.Add(this.toolsTreeView); this.toolsPage.Controls.Add(this.toolStrip7); + this.toolsPage.Controls.Add(this.edgesDataGridView); this.toolsPage.Location = new System.Drawing.Point(4, 22); this.toolsPage.Name = "toolsPage"; this.toolsPage.Padding = new System.Windows.Forms.Padding(3); @@ -1110,6 +930,51 @@ namespace Nc_Demo_Application this.toolsPage.Text = "Tools"; this.toolsPage.UseVisualStyleBackColor = true; // + // edgesDataGridView + // + this.edgesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.edgesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.edgesId, + this.edgeId, + this.edgeToolId, + this.edgesResidualLife, + this.edgesNominalLife, + this.edgesPreAlarmLife, + this.param2, + this.param3, + this.param4, + this.param5, + this.param6, + this.param7, + this.param8, + this.param9, + this.param10, + this.param11, + this.param12, + this.param13, + this.param14, + this.param15, + this.param16, + this.param17, + this.param18, + this.param19, + this.param20, + this.param21, + this.param22, + this.param23, + this.param24, + this.param25, + this.param26, + this.param27, + this.param28, + this.param29, + this.param30, + this.param34}); + this.edgesDataGridView.Location = new System.Drawing.Point(173, 269); + this.edgesDataGridView.Name = "edgesDataGridView"; + this.edgesDataGridView.Size = new System.Drawing.Size(799, 337); + this.edgesDataGridView.TabIndex = 34; + // // label19 // this.label19.AutoSize = true; @@ -1180,6 +1045,7 @@ namespace Nc_Demo_Application // // saveToolButton // + this.saveToolButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.saveToolButton.Location = new System.Drawing.Point(897, 612); this.saveToolButton.Name = "saveToolButton"; this.saveToolButton.Size = new System.Drawing.Size(75, 23); @@ -1406,6 +1272,237 @@ namespace Nc_Demo_Application this.toolsTreeView.TabIndex = 0; this.toolsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ToolsTreeView_AfterSelect); // + // stopServer + // + this.stopServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.stopServer.Location = new System.Drawing.Point(906, 687); + this.stopServer.Name = "stopServer"; + this.stopServer.Size = new System.Drawing.Size(91, 30); + this.stopServer.TabIndex = 8; + this.stopServer.Text = "Stop"; + this.stopServer.UseVisualStyleBackColor = true; + this.stopServer.Click += new System.EventHandler(this.StopServer_Click); + // + // toolStrip5 + // + this.toolStrip5.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveNcDataButton}); + this.toolStrip5.Location = new System.Drawing.Point(3, 3); + this.toolStrip5.Name = "toolStrip5"; + this.toolStrip5.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.toolStrip5.Size = new System.Drawing.Size(972, 25); + this.toolStrip5.TabIndex = 53; + this.toolStrip5.Text = "toolStrip5"; + // + // saveNcDataButton + // + this.saveNcDataButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveNcDataButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveNcDataButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveNcDataButton.Name = "saveNcDataButton"; + this.saveNcDataButton.Size = new System.Drawing.Size(23, 22); + this.saveNcDataButton.Text = "toolStripButton1"; + this.saveNcDataButton.Click += new System.EventHandler(this.SaveCnDataButton_Click); + // + // toolStrip1 + // + this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveNcProcessData}); + this.toolStrip1.Location = new System.Drawing.Point(3, 3); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(35, 25); + this.toolStrip1.TabIndex = 9; + this.toolStrip1.Text = "toolStrip1"; + this.toolStrip1.Click += new System.EventHandler(this.SaveNcProcessData_Click); + // + // saveNcProcessData + // + this.saveNcProcessData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveNcProcessData.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveNcProcessData.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveNcProcessData.Name = "saveNcProcessData"; + this.saveNcProcessData.Size = new System.Drawing.Size(23, 22); + this.saveNcProcessData.Text = "Save"; + this.saveNcProcessData.Click += new System.EventHandler(this.SaveNcProcessData_Click); + // + // toolStrip3 + // + this.toolStrip3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.toolStrip3.Dock = System.Windows.Forms.DockStyle.None; + this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveNcAlarmsButton}); + this.toolStrip3.Location = new System.Drawing.Point(0, 0); + this.toolStrip3.Name = "toolStrip3"; + this.toolStrip3.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.toolStrip3.Size = new System.Drawing.Size(35, 25); + this.toolStrip3.TabIndex = 2; + this.toolStrip3.Text = "toolStrip3"; + this.toolStrip3.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click); + // + // saveNcAlarmsButton + // + this.saveNcAlarmsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveNcAlarmsButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveNcAlarmsButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveNcAlarmsButton.Name = "saveNcAlarmsButton"; + this.saveNcAlarmsButton.Size = new System.Drawing.Size(23, 22); + this.saveNcAlarmsButton.Text = "Save"; + this.saveNcAlarmsButton.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click); + // + // toolStrip4 + // + this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveNcAxesButton}); + this.toolStrip4.Location = new System.Drawing.Point(0, 0); + this.toolStrip4.Name = "toolStrip4"; + this.toolStrip4.Size = new System.Drawing.Size(978, 25); + this.toolStrip4.TabIndex = 53; + this.toolStrip4.Text = "toolStrip4"; + // + // saveNcAxesButton + // + this.saveNcAxesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveNcAxesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveNcAxesButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveNcAxesButton.Name = "saveNcAxesButton"; + this.saveNcAxesButton.Size = new System.Drawing.Size(23, 22); + this.saveNcAxesButton.Text = "Save"; + this.saveNcAxesButton.Click += new System.EventHandler(this.SaveNcAxesButton_Click); + // + // toolStrip2 + // + this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveBinaryMemoryButton, + this.addRowsBinaryMemory, + this.deleteRowsBinaryMemory}); + this.toolStrip2.Location = new System.Drawing.Point(0, 0); + this.toolStrip2.Name = "toolStrip2"; + this.toolStrip2.Size = new System.Drawing.Size(978, 25); + this.toolStrip2.TabIndex = 1; + this.toolStrip2.Text = "toolStrip2"; + // + // saveBinaryMemoryButton + // + this.saveBinaryMemoryButton.CheckOnClick = true; + this.saveBinaryMemoryButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveBinaryMemoryButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveBinaryMemoryButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveBinaryMemoryButton.Name = "saveBinaryMemoryButton"; + this.saveBinaryMemoryButton.Size = new System.Drawing.Size(23, 22); + this.saveBinaryMemoryButton.Text = "Save"; + this.saveBinaryMemoryButton.Click += new System.EventHandler(this.SaveBinaryMemory_Click); + // + // addRowsBinaryMemory + // + this.addRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.addRowsBinaryMemory.Image = global::Nc_Demo_Application.Properties.Resources.addButton; + this.addRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta; + this.addRowsBinaryMemory.Name = "addRowsBinaryMemory"; + this.addRowsBinaryMemory.Size = new System.Drawing.Size(23, 22); + this.addRowsBinaryMemory.Text = "Add 4 Rows"; + this.addRowsBinaryMemory.Click += new System.EventHandler(this.addRowsBinaryMemory_Click); + // + // deleteRowsBinaryMemory + // + this.deleteRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.deleteRowsBinaryMemory.Image = global::Nc_Demo_Application.Properties.Resources.removeButton; + this.deleteRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta; + this.deleteRowsBinaryMemory.Name = "deleteRowsBinaryMemory"; + this.deleteRowsBinaryMemory.Size = new System.Drawing.Size(23, 22); + this.deleteRowsBinaryMemory.Text = "Remove 4 rows"; + this.deleteRowsBinaryMemory.Click += new System.EventHandler(this.deleteRowsBinaryMemory_Click); + // + // toolStrip6 + // + this.toolStrip6.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveFileButton, + this.deleteFileButton, + this.addFileButton, + this.newFileNameTextBox}); + this.toolStrip6.Location = new System.Drawing.Point(3, 3); + this.toolStrip6.Name = "toolStrip6"; + this.toolStrip6.Size = new System.Drawing.Size(972, 25); + this.toolStrip6.TabIndex = 1; + this.toolStrip6.Text = "toolStrip6"; + // + // saveFileButton + // + this.saveFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveFileButton.Enabled = false; + this.saveFileButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveFileButton.Name = "saveFileButton"; + this.saveFileButton.Size = new System.Drawing.Size(23, 22); + this.saveFileButton.Text = "Save file"; + this.saveFileButton.Click += new System.EventHandler(this.SaveFileButton_Click); + // + // deleteFileButton + // + this.deleteFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.deleteFileButton.Image = global::Nc_Demo_Application.Properties.Resources.removeButton; + this.deleteFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.deleteFileButton.Name = "deleteFileButton"; + this.deleteFileButton.Size = new System.Drawing.Size(23, 22); + this.deleteFileButton.Text = "Delete file"; + this.deleteFileButton.Click += new System.EventHandler(this.DeleteFile_Click); + // + // addFileButton + // + this.addFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.addFileButton.Image = global::Nc_Demo_Application.Properties.Resources.addButton; + this.addFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.addFileButton.Name = "addFileButton"; + this.addFileButton.Size = new System.Drawing.Size(23, 22); + this.addFileButton.Text = "Add file"; + this.addFileButton.Click += new System.EventHandler(this.AddFile_Click); + // + // newFileNameTextBox + // + this.newFileNameTextBox.Name = "newFileNameTextBox"; + this.newFileNameTextBox.Size = new System.Drawing.Size(100, 25); + // + // toolStripEx2 + // + this.toolStripEx2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveMagazinesButton}); + this.toolStripEx2.Location = new System.Drawing.Point(3, 3); + this.toolStripEx2.Name = "toolStripEx2"; + this.toolStripEx2.Size = new System.Drawing.Size(972, 25); + this.toolStripEx2.TabIndex = 1; + this.toolStripEx2.Text = "toolStripEx2"; + // + // saveMagazinesButton + // + this.saveMagazinesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveMagazinesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveMagazinesButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveMagazinesButton.Name = "saveMagazinesButton"; + this.saveMagazinesButton.Size = new System.Drawing.Size(23, 22); + this.saveMagazinesButton.Text = "Save"; + this.saveMagazinesButton.Click += new System.EventHandler(this.SaveMagazinesButton_Click); + // + // toolStripEx1 + // + this.toolStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveFamiliesButton}); + this.toolStripEx1.Location = new System.Drawing.Point(3, 3); + this.toolStripEx1.Name = "toolStripEx1"; + this.toolStripEx1.Size = new System.Drawing.Size(972, 25); + this.toolStripEx1.TabIndex = 0; + this.toolStripEx1.Text = "toolStripEx1"; + // + // saveFamiliesButton + // + this.saveFamiliesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveFamiliesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton; + this.saveFamiliesButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveFamiliesButton.Name = "saveFamiliesButton"; + this.saveFamiliesButton.Size = new System.Drawing.Size(23, 22); + this.saveFamiliesButton.Click += new System.EventHandler(this.SaveFamiliesButton_Click); + // // toolStrip7 // this.toolStrip7.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1448,16 +1545,227 @@ namespace Nc_Demo_Application this.addTool.Text = "toolStripButton1"; this.addTool.Click += new System.EventHandler(this.AddTool_Click); // - // stopServer + // edgesId // - this.stopServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.stopServer.Location = new System.Drawing.Point(906, 687); - this.stopServer.Name = "stopServer"; - this.stopServer.Size = new System.Drawing.Size(91, 30); - this.stopServer.TabIndex = 8; - this.stopServer.Text = "Stop"; - this.stopServer.UseVisualStyleBackColor = true; - this.stopServer.Click += new System.EventHandler(this.StopServer_Click); + this.edgesId.DataPropertyName = "child_id"; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.CornflowerBlue; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; + this.edgesId.DefaultCellStyle = dataGridViewCellStyle6; + this.edgesId.HeaderText = "Id"; + this.edgesId.Name = "edgesId"; + // + // edgeId + // + this.edgeId.DataPropertyName = "edge_id"; + this.edgeId.HeaderText = "edgeId"; + this.edgeId.Name = "edgeId"; + this.edgeId.Visible = false; + // + // edgeToolId + // + this.edgeToolId.DataPropertyName = "tool_id"; + this.edgeToolId.HeaderText = "ToolId"; + this.edgeToolId.Name = "edgeToolId"; + // + // edgesResidualLife + // + this.edgesResidualLife.DataPropertyName = "residual_life"; + this.edgesResidualLife.HeaderText = "Residual Life"; + this.edgesResidualLife.Name = "edgesResidualLife"; + // + // edgesNominalLife + // + this.edgesNominalLife.DataPropertyName = "nominal_life"; + this.edgesNominalLife.HeaderText = "Nominal Life"; + this.edgesNominalLife.Name = "edgesNominalLife"; + // + // edgesPreAlarmLife + // + this.edgesPreAlarmLife.DataPropertyName = "prealm_life"; + this.edgesPreAlarmLife.HeaderText = "PreAlm Life"; + this.edgesPreAlarmLife.Name = "edgesPreAlarmLife"; + // + // param2 + // + this.param2.DataPropertyName = "param2"; + this.param2.HeaderText = "2"; + this.param2.Name = "param2"; + // + // param3 + // + this.param3.DataPropertyName = "param3"; + this.param3.HeaderText = "3"; + this.param3.Name = "param3"; + // + // param4 + // + this.param4.DataPropertyName = "param4"; + this.param4.HeaderText = "4"; + this.param4.Name = "param4"; + // + // param5 + // + this.param5.DataPropertyName = "param5"; + this.param5.HeaderText = "5"; + this.param5.Name = "param5"; + // + // param6 + // + this.param6.DataPropertyName = "param6"; + this.param6.HeaderText = "6"; + this.param6.Name = "param6"; + // + // param7 + // + this.param7.DataPropertyName = "param7"; + this.param7.HeaderText = "7"; + this.param7.Name = "param7"; + // + // param8 + // + this.param8.DataPropertyName = "param8"; + this.param8.HeaderText = "8"; + this.param8.Name = "param8"; + // + // param9 + // + this.param9.DataPropertyName = "param9"; + this.param9.HeaderText = "9"; + this.param9.Name = "param9"; + // + // param10 + // + this.param10.DataPropertyName = "param10"; + this.param10.HeaderText = "10"; + this.param10.Name = "param10"; + // + // param11 + // + this.param11.DataPropertyName = "param11"; + this.param11.HeaderText = "11"; + this.param11.Name = "param11"; + // + // param12 + // + this.param12.DataPropertyName = "param12"; + this.param12.HeaderText = "12"; + this.param12.Name = "param12"; + // + // param13 + // + this.param13.DataPropertyName = "param13"; + this.param13.HeaderText = "13"; + this.param13.Name = "param13"; + // + // param14 + // + this.param14.DataPropertyName = "param14"; + this.param14.HeaderText = "14"; + this.param14.Name = "param14"; + // + // param15 + // + this.param15.DataPropertyName = "param15"; + this.param15.HeaderText = "15"; + this.param15.Name = "param15"; + // + // param16 + // + this.param16.DataPropertyName = "param16"; + this.param16.HeaderText = "16"; + this.param16.Name = "param16"; + // + // param17 + // + this.param17.DataPropertyName = "param17"; + this.param17.HeaderText = "17"; + this.param17.Name = "param17"; + // + // param18 + // + this.param18.DataPropertyName = "param18"; + this.param18.HeaderText = "18"; + this.param18.Name = "param18"; + // + // param19 + // + this.param19.DataPropertyName = "param19"; + this.param19.HeaderText = "19"; + this.param19.Name = "param19"; + // + // param20 + // + this.param20.DataPropertyName = "param20"; + this.param20.HeaderText = "20"; + this.param20.Name = "param20"; + // + // param21 + // + this.param21.DataPropertyName = "param21"; + this.param21.HeaderText = "21"; + this.param21.Name = "param21"; + // + // param22 + // + this.param22.DataPropertyName = "param22"; + this.param22.HeaderText = "22"; + this.param22.Name = "param22"; + // + // param23 + // + this.param23.DataPropertyName = "param23"; + this.param23.HeaderText = "23"; + this.param23.Name = "param23"; + // + // param24 + // + this.param24.DataPropertyName = "param24"; + this.param24.HeaderText = "24"; + this.param24.Name = "param24"; + // + // param25 + // + this.param25.DataPropertyName = "param25"; + this.param25.HeaderText = "25"; + this.param25.Name = "param25"; + // + // param26 + // + this.param26.DataPropertyName = "param26"; + this.param26.HeaderText = "26"; + this.param26.Name = "param26"; + // + // param27 + // + this.param27.DataPropertyName = "param27"; + this.param27.HeaderText = "27"; + this.param27.Name = "param27"; + // + // param28 + // + this.param28.DataPropertyName = "param28"; + this.param28.HeaderText = "28"; + this.param28.Name = "param28"; + // + // param29 + // + this.param29.DataPropertyName = "param29"; + this.param29.HeaderText = "29"; + this.param29.Name = "param29"; + // + // param30 + // + this.param30.DataPropertyName = "param30"; + this.param30.HeaderText = "30"; + this.param30.Name = "param30"; + // + // param34 + // + this.param34.DataPropertyName = "param34"; + this.param34.HeaderText = "34"; + this.param34.Name = "param34"; // // DemoApplicationForm // @@ -1476,46 +1784,47 @@ namespace Nc_Demo_Application this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DemoApplicationForm_KeyDown); this.ncDataPage.ResumeLayout(false); this.ncDataPage.PerformLayout(); - this.toolStrip5.ResumeLayout(false); - this.toolStrip5.PerformLayout(); this.ncTabControl.ResumeLayout(false); this.processPage.ResumeLayout(false); this.processPage.PerformLayout(); - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).EndInit(); this.alarms.ResumeLayout(false); this.alarms.PerformLayout(); - this.toolStrip3.ResumeLayout(false); - this.toolStrip3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).EndInit(); this.ncAxesPage.ResumeLayout(false); this.ncAxesPage.PerformLayout(); - this.toolStrip4.ResumeLayout(false); - this.toolStrip4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).EndInit(); this.byteMemoryPage.ResumeLayout(false); this.byteMemoryPage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).EndInit(); - this.toolStrip2.ResumeLayout(false); - this.toolStrip2.PerformLayout(); this.partProgramPage.ResumeLayout(false); this.partProgramPage.PerformLayout(); - this.toolStrip6.ResumeLayout(false); - this.toolStrip6.PerformLayout(); this.magazinesTab.ResumeLayout(false); this.magazinesTab.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.magazinesGridView)).EndInit(); - this.toolStripEx2.ResumeLayout(false); - this.toolStripEx2.PerformLayout(); this.familiesTab.ResumeLayout(false); this.familiesTab.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.shanksDataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.familiesDataGridView)).EndInit(); - this.toolStripEx1.ResumeLayout(false); - this.toolStripEx1.PerformLayout(); this.toolsPage.ResumeLayout(false); this.toolsPage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.edgesDataGridView)).EndInit(); + this.toolStrip5.ResumeLayout(false); + this.toolStrip5.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.toolStrip3.ResumeLayout(false); + this.toolStrip3.PerformLayout(); + this.toolStrip4.ResumeLayout(false); + this.toolStrip4.PerformLayout(); + this.toolStrip2.ResumeLayout(false); + this.toolStrip2.PerformLayout(); + this.toolStrip6.ResumeLayout(false); + this.toolStrip6.PerformLayout(); + this.toolStripEx2.ResumeLayout(false); + this.toolStripEx2.PerformLayout(); + this.toolStripEx1.ResumeLayout(false); + this.toolStripEx1.PerformLayout(); this.toolStrip7.ResumeLayout(false); this.toolStrip7.PerformLayout(); this.ResumeLayout(false); @@ -1652,6 +1961,43 @@ namespace Nc_Demo_Application private System.Windows.Forms.DataGridViewTextBoxColumn positionId; private System.Windows.Forms.DataGridViewTextBoxColumn positionType; private System.Windows.Forms.ToolStripButton refreshToolUI; + private System.Windows.Forms.DataGridView edgesDataGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn edgesId; + private System.Windows.Forms.DataGridViewTextBoxColumn edgeId; + private System.Windows.Forms.DataGridViewTextBoxColumn edgeToolId; + private System.Windows.Forms.DataGridViewTextBoxColumn edgesResidualLife; + private System.Windows.Forms.DataGridViewTextBoxColumn edgesNominalLife; + private System.Windows.Forms.DataGridViewTextBoxColumn edgesPreAlarmLife; + private System.Windows.Forms.DataGridViewTextBoxColumn param2; + private System.Windows.Forms.DataGridViewTextBoxColumn param3; + private System.Windows.Forms.DataGridViewTextBoxColumn param4; + private System.Windows.Forms.DataGridViewTextBoxColumn param5; + private System.Windows.Forms.DataGridViewTextBoxColumn param6; + private System.Windows.Forms.DataGridViewTextBoxColumn param7; + private System.Windows.Forms.DataGridViewTextBoxColumn param8; + private System.Windows.Forms.DataGridViewTextBoxColumn param9; + private System.Windows.Forms.DataGridViewTextBoxColumn param10; + private System.Windows.Forms.DataGridViewTextBoxColumn param11; + private System.Windows.Forms.DataGridViewTextBoxColumn param12; + private System.Windows.Forms.DataGridViewTextBoxColumn param13; + private System.Windows.Forms.DataGridViewTextBoxColumn param14; + private System.Windows.Forms.DataGridViewTextBoxColumn param15; + private System.Windows.Forms.DataGridViewTextBoxColumn param16; + private System.Windows.Forms.DataGridViewTextBoxColumn param17; + private System.Windows.Forms.DataGridViewTextBoxColumn param18; + private System.Windows.Forms.DataGridViewTextBoxColumn param19; + private System.Windows.Forms.DataGridViewTextBoxColumn param20; + private System.Windows.Forms.DataGridViewTextBoxColumn param21; + private System.Windows.Forms.DataGridViewTextBoxColumn param22; + private System.Windows.Forms.DataGridViewTextBoxColumn param23; + private System.Windows.Forms.DataGridViewTextBoxColumn param24; + private System.Windows.Forms.DataGridViewTextBoxColumn param25; + private System.Windows.Forms.DataGridViewTextBoxColumn param26; + private System.Windows.Forms.DataGridViewTextBoxColumn param27; + private System.Windows.Forms.DataGridViewTextBoxColumn param28; + private System.Windows.Forms.DataGridViewTextBoxColumn param29; + private System.Windows.Forms.DataGridViewTextBoxColumn param30; + private System.Windows.Forms.DataGridViewTextBoxColumn param34; } } diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs index d9b859c..bd8ab8e 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs @@ -17,6 +17,7 @@ namespace Nc_Demo_Application { private StartupPanel startupPanel; private bool axisResetRunning = false; + private int SelectedToolId; public DemoApplicationForm() { @@ -482,6 +483,8 @@ namespace Nc_Demo_Application System.Diagnostics.Process.Start("https://docs.google.com/spreadsheets/d/17AHl_qwPTGupYdWCmFYV3ubXmJykQpy1ciSTk8AgNek/edit?usp=sharing"); } + #region Tool + private void SetupToolData(List toolsList) { toolsTreeView.Nodes.Clear(); @@ -580,7 +583,6 @@ namespace Nc_Demo_Application { // Get selected Node var selectedTool = toolsTreeView.SelectedNode; - if (selectedTool.Level == 0) return; // Find selected tools data from database @@ -589,6 +591,8 @@ namespace Nc_Demo_Application if (toolInfo != null) { + SelectedToolId = toolInfo.Id; + // Update form inputs toolsIdLlb.Text = toolInfo.Id.ToString(); FamilyTxt.Text = toolInfo.FamilyName; @@ -611,7 +615,11 @@ namespace Nc_Demo_Application toolTypeSelect.SelectedItem = (TOOLS_TYPE)toolInfo.ToolType; rotationSelect.SelectedItem = (ROTATION)toolInfo.Rotation; magazineComboBox.SelectedItem = (MAGAZINES)toolInfo.MagazineId; + + // Populate edge grid view + PopulateEdgeGridView(toolInfo.Id); } + } private void SaveToolButton_Click(object sender, EventArgs e) @@ -650,6 +658,16 @@ namespace Nc_Demo_Application toolInfo.Rotation = (int)rotationSelect.SelectedItem; DatabaseController.getInstance().UpdateToolData(toolInfo); + + DatabaseController.getInstance().UpdateEdges((DataTable)edgesDataGridView.DataSource); + PopulateEdgeGridView(toolInfo.Id); + } + + private void PopulateEdgeGridView(int toolId) + { + // Populate edge grid view + DataTable edges = DatabaseController.getInstance().ReadEdges(toolId); + edgesDataGridView.DataSource = edges; } private void SaveFamiliesButton_Click(object sender, EventArgs e) @@ -671,6 +689,8 @@ namespace Nc_Demo_Application { FillToolsInput(); } + + #endregion Tool private void DemoApplicationForm_KeyDown(object sender, KeyEventArgs e) { diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.resx b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.resx index bf2f2bf..c3998c0 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.resx +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.resx @@ -173,4 +173,112 @@ jm/GcW7031RP8zpHxQAAAABJRU5ErkJggg== + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + \ No newline at end of file