diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index 3fe034b..478af3e 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -94,17 +94,31 @@ namespace CMS_CORE_Application Cooling1 = false, Cooling2 = true, IsActive = true, - FixedPlace = true, + InFixedPlace = true, IsInhibited = true, IsMeasured = true, - ChangeTool = true, + InChangeTool = true, IsInUse = false, PreAlarm = false, EdgesData = null }; - - byte axisId = 0; + EdgeModel edge = new EdgeModel() + { + Id = 1, + NominalLife = 22, + PreAlmLife = 21, + ResidualLife = 20, + EdgeAdditionalParams = new Dictionary() + { + { "CuttingEdge", 10 }, + { "Lenght", 11 }, + { "WearLenght", 22 }, + { "WearRadius", 33 }, + { "ugo", 11 } + } + }; + N = SetNcByType(); @@ -194,6 +208,8 @@ namespace CMS_CORE_Application }; cmsError = N.TOOLS_WAddFamily(ref family); cmsError = N.TOOLS_RConfiguration(ref toolsConfig); + // cmsError = N.TOOLS_WAddEdge(1, ref edge); + cmsError = N.TOOLS_WUpdateEdge(1, ref edge); // N.PLC_WPowerOnData(6, true); //N.PLC_RFunctionAccess(ref functionality); diff --git a/CMS_CORE_Library/DataStructures.cs b/CMS_CORE_Library/DataStructures.cs index d0b7d14..cb04b8b 100644 --- a/CMS_CORE_Library/DataStructures.cs +++ b/CMS_CORE_Library/DataStructures.cs @@ -444,7 +444,11 @@ namespace CMS_CORE_Library public List ToolsConfiguration; } - + public class EdgesConfiguration + { + public List EdgeConfiguration; + public Dictionary> EdgesAdditionalParamsConfiguration; + } public class MagazineModel { @@ -459,6 +463,7 @@ namespace CMS_CORE_Library public FamiliesConfiguration FamiliesConfiguration; public ShanksConfiguration ShanksConfiguration; public List MagazinePosConfiguration; + public EdgesConfiguration EdgesConfiguration; } public class SiemensToolModel @@ -474,16 +479,16 @@ namespace CMS_CORE_Library public bool Cooling1; public bool Cooling2; public bool IsActive; - public bool FixedPlace; + public bool InFixedPlace; public bool IsInhibited; public bool IsMeasured; - public bool ChangeTool; + public bool InChangeTool; public bool IsInUse; public bool PreAlarm; - public List EdgesData; + public List EdgesData; } - public class EdgesModel + public class EdgeModel { public int Id; public double ResidualLife; diff --git a/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs b/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs index b6dd1c6..8f327a9 100644 --- a/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs +++ b/CMS_CORE_Library/Demo/DemoEdgesConfiguration.cs @@ -5,438 +5,437 @@ 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" } + 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" } + 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" } + 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" } + 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" } + 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 = "weeth", 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" } + 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" } + 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" } + 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" } + 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" } + 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" } + 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 = "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" } + 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 = "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" } + 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 = "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" } + 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" } + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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 = "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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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"} + 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 b9177dd..afd7f91 100644 --- a/CMS_CORE_Library/Demo/ILibraryService.cs +++ b/CMS_CORE_Library/Demo/ILibraryService.cs @@ -189,7 +189,10 @@ namespace Nc_Demo_Application.Server.Service 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); + void AddEdge(string toolId, ref EdgeModel edge); + + [WebInvoke(Method = "PUT", UriTemplate = "tool_table/edge/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void PutEdge(string toolId, ref EdgeModel 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); diff --git a/CMS_CORE_Library/Demo/Models/ToolDataModel.cs b/CMS_CORE_Library/Demo/Models/ToolDataModel.cs index 2fc52d6..425b653 100644 --- a/CMS_CORE_Library/Demo/Models/ToolDataModel.cs +++ b/CMS_CORE_Library/Demo/Models/ToolDataModel.cs @@ -17,14 +17,14 @@ namespace CMS_CORE.Demo.Models public bool Cooling1; public bool Cooling2; public bool IsActive; - public bool FixedPlace; + public bool InFixedPlace; public bool IsInhibited; public bool IsMeasured; - public bool ChangeTool; + public bool InChangeTool; 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 4cea5df..d970a34 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -24,7 +24,7 @@ namespace CMS_CORE.Demo private EndpointAddress serverAddress; private ChannelFactory cf; private ILibraryService serverService; - + private DemoEdgesConfiguration DemoEdgesConfiguration = new DemoEdgesConfiguration(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Contructor & global methods @@ -1712,7 +1712,20 @@ namespace CMS_CORE.Demo config.FamiliesConfiguration = SiemensFamiliesConfig; config.ShanksConfiguration = SiemensShanksConfig; config.MagazinePosConfiguration = SiemensMagazinePosConfig; - + config.EdgesConfiguration = SiemensEdgesConfiguration; + + config.EdgesConfiguration.EdgesAdditionalParamsConfiguration = new Dictionary>(); + // Remove path and set only names + foreach (int key in DemoEdgesConfiguration.EdgesConfig.Keys) + { + List tmpNames = new List(); + foreach (var conf in DemoEdgesConfiguration.EdgesConfig[key]) + { + tmpNames.Add(conf.Name); + } + config.EdgesConfiguration.EdgesAdditionalParamsConfiguration.Add(key, tmpNames); + } + config.Magazines = new List() { new MagazineModel{Id = 1, Type = MAGAZINE_TYPE.MAGAZINE}, @@ -1733,12 +1746,12 @@ namespace CMS_CORE.Demo try { toolTable = new List(); - // Get tool table data - serverService.GetTools(out List DemoToolsData); + // Get tools table data + serverService.GetTools(out List demoToolsData); DemoEdgesConfiguration toolsConfig = new DemoEdgesConfiguration(); - foreach (ToolsDataModel demoTool in DemoToolsData) + foreach (ToolsDataModel demoTool in demoToolsData) { var toolData = new SiemensToolModel() { @@ -1753,25 +1766,25 @@ namespace CMS_CORE.Demo Cooling1 = demoTool.Cooling1, Cooling2 = demoTool.Cooling2, IsActive = demoTool.IsActive, - FixedPlace = demoTool.FixedPlace, + InFixedPlace = demoTool.InFixedPlace, IsInhibited = demoTool.IsInhibited, IsMeasured = demoTool.IsMeasured, - ChangeTool = demoTool.ChangeTool, + InChangeTool = demoTool.InChangeTool, IsInUse = demoTool.IsInUse, PreAlarm = demoTool.PreAlarm, - EdgesData = new List() + EdgesData = new List() }; // Get tool type additional parameters - var toolTypeConfig = toolsConfig.EdgesConfig[demoTool.ToolType]; - + var toolTypeConfigs = 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() + // Create new edge model with static data + var tmpEdge = new EdgeModel() { Id = demoEdge.Id, ResidualLife = demoEdge.ResidualLife, @@ -1780,14 +1793,14 @@ namespace CMS_CORE.Demo EdgeAdditionalParams = new Dictionary() }; - // Populate dinamycal Params Get only tool type additional parameters - foreach (var item in toolTypeConfig) + // Populate edges' additional params getting only configured fields for the selected tool type + foreach (var configItem in toolTypeConfigs) { tmpEdge.EdgeAdditionalParams.Add( // Item name - item.Name, + configItem.Name, // "param" + N; N is configured in the path - demoEdge.EdgeAdditionalParams["param" + item.Path] + demoEdge.EdgeAdditionalParams["param" + configItem.Path] ); } // Add new edge to selected tool edges list @@ -1867,38 +1880,127 @@ namespace CMS_CORE.Demo #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; + public override CmsError TOOLS_WAddEdge(int toolId, ref EdgeModel newEdge) + { + // Check if the NC Demo is Connected + CmsError cmsError = CheckConnection(); + if (cmsError.IsError()) + return cmsError; - // try - // { - // DemoEdgesConfiguration toolsConfig = new DemoEdgesConfiguration(); + try + { + // Get tools data in order to get tool type and its config + serverService.GetTools(out List demoToolsData); - // 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] - // ); - // } + // Find tool by id + var demoTool = demoToolsData + .Where(x => x.Id == toolId).FirstOrDefault(); - // serverService.AddEdge(toolId.ToString(), ref edge); + if (demoTool == null) + return INCORRECT_PARAMETERS_ERROR; + + // Get the configuration of the tool type + var toolTypeConfig = DemoEdgesConfiguration.EdgesConfig[demoTool.ToolType]; - // return NO_ERROR; - // } - // catch (Exception ex) - // { - // return ManageException(ex); - // } - //} + // Create tmp edge to be sended to the Demo + EdgeModel demoEdge = new EdgeModel + { + Id = newEdge.Id, + PreAlmLife = newEdge.PreAlmLife, + NominalLife = newEdge.NominalLife, + ResidualLife = newEdge.ResidualLife, + EdgeAdditionalParams = new Dictionary(), + }; + + // Convert Siemens additional param names into Demo param names + foreach (var additionalParam in newEdge.EdgeAdditionalParams) + { + // Get path of the additional parameter from configuration + string pathNumber = toolTypeConfig + .Where(x => x.Name == additionalParam.Key) + .Select(x => x.Path).FirstOrDefault(); + + if (!string.IsNullOrEmpty(pathNumber)) + { + // Add new Demo param to the temporary list + demoEdge.EdgeAdditionalParams.Add( + "param" + pathNumber, + additionalParam.Value + ); + } + } + + serverService.AddEdge(toolId.ToString(), ref demoEdge); + // Set id to the returned model + newEdge.Id = demoEdge.Id; + + return NO_ERROR; + } + catch (Exception ex) + { + return ManageException(ex); + } + } + + public override CmsError TOOLS_WUpdateEdge(int toolId, ref EdgeModel newEdge) + { + // Check if the NC Demo is Connected + CmsError cmsError = CheckConnection(); + if (cmsError.IsError()) + return cmsError; + + try + { + // Get tools data in order to get tool type and its config + serverService.GetTools(out List demoToolsData); + + // Find tool by id + var demoTool = demoToolsData + .Where(x => x.Id == toolId).FirstOrDefault(); + + if (demoTool == null) + return INCORRECT_PARAMETERS_ERROR; + + // Get the configuration of the tool type + var toolTypeConfig = DemoEdgesConfiguration.EdgesConfig[demoTool.ToolType]; + + // Create tmp edge to be sended to the Demo + EdgeModel demoEdge = new EdgeModel + { + Id = newEdge.Id, + PreAlmLife = newEdge.PreAlmLife, + NominalLife = newEdge.NominalLife, + ResidualLife = newEdge.ResidualLife, + EdgeAdditionalParams = new Dictionary(), + }; + + // Convert Siemens additional param names into Demo param names + foreach (var additionalParam in newEdge.EdgeAdditionalParams) + { + // Get path of the additional parameter from configuration + string pathNumber = toolTypeConfig + .Where(x => x.Name == additionalParam.Key) + .Select(x => x.Path).FirstOrDefault(); + + if (!string.IsNullOrEmpty(pathNumber)) + { + // Add new Demo param to the temporary list + demoEdge.EdgeAdditionalParams.Add( + "param" + pathNumber, + additionalParam.Value + ); + } + } + + serverService.PutEdge(toolId.ToString(), ref demoEdge); + + return NO_ERROR; + } + catch (Exception ex) + { + return ManageException(ex); + } + } public override CmsError TOOLS_WDeleteEdge(int toolId, int edgeId) { @@ -1918,8 +2020,8 @@ namespace CMS_CORE.Demo return ManageException(ex); } } - - #endregion + + #endregion Edges #region ToolTable @@ -2105,7 +2207,7 @@ namespace CMS_CORE.Demo try { // Get position data from demo - serverService.GetPositions(out List demoPositions); + serverService.GetPositions(out positions); //// Populate output model //foreach (DemoPositionsModel position in demoPositions) //{ @@ -2145,7 +2247,7 @@ namespace CMS_CORE.Demo } } -#endregion Tools Management + #endregion ToolTable /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 0abc320..33ca439 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -1740,6 +1740,16 @@ namespace CMS_CORE.Fanuc return NO_ERROR; } + public override CmsError TOOLS_WAddEdge(int toolId, ref EdgeModel edge) + { + return NO_ERROR; + } + + public override CmsError TOOLS_WUpdateEdge(int toolId, ref EdgeModel newEdge) + { + return NO_ERROR; + } + #endregion Tools Management /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Nc.cs b/CMS_CORE_Library/Nc.cs index 6e26b7c..20cbfce 100644 --- a/CMS_CORE_Library/Nc.cs +++ b/CMS_CORE_Library/Nc.cs @@ -1276,7 +1276,7 @@ namespace CMS_CORE /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - #region File Management (To override) + #region Tool Table /** * Read tool table configuration @@ -1328,8 +1328,11 @@ namespace CMS_CORE public abstract CmsError TOOLS_WDeleteEdge(int toolId, int edgeId); + public abstract CmsError TOOLS_WAddEdge(int toolId, ref EdgeModel edge); - #endregion File Management (To override) + public abstract CmsError TOOLS_WUpdateEdge(int toolId, ref EdgeModel newEdge); + + #endregion Tool Table /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index c60c006..991f505 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -2110,6 +2110,16 @@ namespace CMS_CORE.Osai return NO_ERROR; } + public override CmsError TOOLS_WAddEdge(int toolId, ref EdgeModel edge) + { + return NO_ERROR; + } + + public override CmsError TOOLS_WUpdateEdge(int toolId, ref EdgeModel newEdge) + { + 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 8a70e2d..664b068 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -1,4 +1,5 @@ using CMS_CORE.Utils; +using CMS_CORE_Library; using CMS_CORE_Library.Siemens; using Siemens.Sinumerik.Operate.Services; using System; @@ -1832,13 +1833,13 @@ namespace CMS_CORE.Siemens Cooling1 = GetBitValue(toolInfo, 11), Cooling2 = GetBitValue(toolInfo, 12), IsActive = GetBitValue(toolStatus, 1), - FixedPlace = GetBitValue(toolStatus, 2), + InFixedPlace = GetBitValue(toolStatus, 2), IsInhibited = GetBitValue(toolStatus, 3), IsMeasured = GetBitValue(toolStatus, 4), - ChangeTool = GetBitValue(toolStatus, 5), + InChangeTool = 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 @@ -1855,7 +1856,7 @@ namespace CMS_CORE.Siemens // Get tool type additional parameters var toolTypeConfig = toolEdgesConfig.EdgesConfig[toolTypeVal]; - EdgesModel edgeData = new EdgesModel(); + EdgeModel edgeData = new EdgeModel(); // For each dynamic parameter configured foreach (var item in toolTypeConfig) { @@ -1936,14 +1937,23 @@ namespace CMS_CORE.Siemens return NO_ERROR; } - #endregion Tool Management + public override CmsError TOOLS_WAddEdge(int toolId, ref EdgeModel edge) + { + return NO_ERROR; + } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + public override CmsError TOOLS_WUpdateEdge(int toolId, ref EdgeModel newEdge) + { + return NO_ERROR; + } + #endregion Tool Management - #region Subordinate Private Functions + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Manage the Alarms - Called automatically on changes - private void AlarmsChanged(Guid guid, Alarm[] alarms) + #region Subordinate Private Functions + + //Manage the Alarms - Called automatically on changes + private void AlarmsChanged(Guid guid, Alarm[] alarms) { SiemensAlarms = alarms; } diff --git a/CMS_CORE_Library/ToolConfigurations.cs b/CMS_CORE_Library/ToolConfigurations.cs index 43ddc2d..979966e 100644 --- a/CMS_CORE_Library/ToolConfigurations.cs +++ b/CMS_CORE_Library/ToolConfigurations.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using static CMS_CORE_Library.DataStructures; namespace CMS_CORE_Library @@ -10,7 +6,9 @@ namespace CMS_CORE_Library public static class ToolConfigurations { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #region PRIVATE_SELECTS_VALUES + private static Dictionary toolTypeList = new Dictionary() { {100, "Milling tool"}, @@ -49,8 +47,6 @@ namespace CMS_CORE_Library {900, "Auxiliary tools"} }; - - private static Dictionary toolLifeList = new Dictionary() { {0, "toolLifeType"}, @@ -58,20 +54,17 @@ namespace CMS_CORE_Library {2, "wearLife"} }; - - private static Dictionary rotationTypeList = new Dictionary() { {0, "none"}, {1, "clockWhise"}, {2, "counterClockWhise"} }; - #endregion - - + #endregion PRIVATE_SELECTS_VALUES /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #region PUBLIC_CONFIGS_FIELDS public static List SiemensToolsConfig = new List() @@ -83,9 +76,9 @@ namespace CMS_CORE_Library new FieldsConfiguration{Name = "childId", Type = "int", SelectValues = null, Category = "family", ReadOnly = true }, new FieldsConfiguration{Name = "isActive", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, new FieldsConfiguration{Name = "isInhibited", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, - new FieldsConfiguration{Name = "fixedPlace", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, + new FieldsConfiguration{Name = "inFixedPlace", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, new FieldsConfiguration{Name = "isMeasured", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, - new FieldsConfiguration{Name = "changeTool", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, + new FieldsConfiguration{Name = "inChangeTool", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, new FieldsConfiguration{Name = "isInUse", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, new FieldsConfiguration{Name = "preAlarm", Type = "boolean", SelectValues = null, Category = "state", ReadOnly = false}, new FieldsConfiguration{Name = "cooling1", Type = "boolean", SelectValues = null, Category = "cooling", ReadOnly = false}, @@ -101,8 +94,6 @@ namespace CMS_CORE_Library new FieldsConfiguration{Name = "edgePreAlarmVal", Type = "double", SelectValues = null, Category = "edge", ReadOnly = false} }; - - public static FamiliesConfiguration SiemensFamiliesConfig = new FamiliesConfiguration() { FamilyConfiguration = new List() @@ -118,8 +109,6 @@ namespace CMS_CORE_Library } }; - - public static ShanksConfiguration SiemensShanksConfig = new ShanksConfiguration() { ShankConfiguration = new List() @@ -132,11 +121,9 @@ namespace CMS_CORE_Library new FieldsConfiguration{Name = "multiToolId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true }, new FieldsConfiguration{Name = "familyName", Type = "string", SelectValues = null, Category = "general", ReadOnly = true }, new FieldsConfiguration{Name = "toolType", Type = "select", SelectValues = toolTypeList, Category = "general", ReadOnly = true } - } + } }; - - public static List SiemensMagazinePosConfig = new List() { new FieldsConfiguration{Name = "magazineId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true }, @@ -144,8 +131,19 @@ namespace CMS_CORE_Library new FieldsConfiguration{Name = "type", Type = "int", SelectValues = null, Category = "general", ReadOnly = false } }; - #endregion + public static EdgesConfiguration SiemensEdgesConfiguration = new EdgesConfiguration() + { + EdgeConfiguration = new List() + { + new FieldsConfiguration{Name = "id", Type = "int", SelectValues = null, Category = "general", ReadOnly = true }, + new FieldsConfiguration{Name = "residualLife", Type = "double", SelectValues = null, Category = "general", ReadOnly = false }, + new FieldsConfiguration{Name = "nominalLife", Type = "double", SelectValues = null, Category = "general", ReadOnly = false }, + new FieldsConfiguration{Name = "preAlmLife", Type = "double", SelectValues = null, Category = "general", ReadOnly = false } + }, + EdgesAdditionalParamsConfiguration = new Dictionary>() + }; + #endregion PUBLIC_CONFIGS_FIELDS } -} +} \ No newline at end of file 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 73111ea..4982010 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 @@ -105,7 +105,7 @@ namespace Nc_Demo_Application.Database sqlConnection.Close(); } - public void UpdateDatabaseFromGridView(DataTable newDataTable, string readingQuery) + public void UpdateDatabaseFromDataTable(DataTable newDataTable, string readingQuery) { try { @@ -261,7 +261,7 @@ namespace Nc_Demo_Application.Database public void UpdateNcProcess(DataTable ncProcessData) { - UpdateDatabaseFromGridView(ncProcessData, READ_NC_PROCESS_QUERY); + UpdateDatabaseFromDataTable(ncProcessData, READ_NC_PROCESS_QUERY); } #endregion Nc Processes Data @@ -311,7 +311,7 @@ namespace Nc_Demo_Application.Database public void UpdateNcAlarms(DataTable ncAlarms) { - UpdateDatabaseFromGridView(ncAlarms, READ_NC_ALARMS_QUERY); + UpdateDatabaseFromDataTable(ncAlarms, READ_NC_ALARMS_QUERY); } #endregion Nc Alarms Data @@ -363,7 +363,7 @@ namespace Nc_Demo_Application.Database public void UpdateNcAxes(DataTable ncAxes) { - UpdateDatabaseFromGridView(ncAxes, READ_NC_AXES_QUERY); + UpdateDatabaseFromDataTable(ncAxes, READ_NC_AXES_QUERY); } #endregion Nc Axes Data @@ -419,7 +419,7 @@ namespace Nc_Demo_Application.Database public void UpdateBinaryMemory(DataTable binaryMemory) { - UpdateDatabaseFromGridView(binaryMemory, READ_BINARY_MEMORY_QUERY); + UpdateDatabaseFromDataTable(binaryMemory, READ_BINARY_MEMORY_QUERY); } public byte GetByteValue(int index) @@ -614,16 +614,21 @@ namespace Nc_Demo_Application.Database public void UpdateFamilies(DataTable families) { - UpdateDatabaseFromGridView(families, READ_FAMILIES_QUERY); + UpdateDatabaseFromDataTable(families, READ_FAMILIES_QUERY); } - public void UpdateFamily(string oldName, string newName) + public string UpdateFamily(string oldName, string newName) { DataRow row = FamiliesDataTable.AsEnumerable().FirstOrDefault(x => x["name"].ToString() == oldName); + if (row == null) + return null; + row["name"] = newName; UpdateFamilies(FamiliesDataTable); + + return newName; } public FamilyModel AddFamily(FamilyModel family) @@ -725,6 +730,8 @@ namespace Nc_Demo_Application.Database lastId = lastId + 1; else lastId = Convert.ToInt32(row["id"]); + + // Create&Populate shanks childs int i = 1; List childTools = GetToolsData() @@ -742,6 +749,16 @@ namespace Nc_Demo_Application.Database ShankDataModel tmpShank = new ShankDataModel { Id = lastId, + Name = row["name"].ToString(), + + InChangeTool = Convert.ToInt32(row["in_change_tool"]) == 1, + IsEnabled = Convert.ToInt32(row["is_enabled"]) == 1, + IsInhibited = Convert.ToInt32(row["is_inhibited"]) == 1, + InFixedPlace = Convert.ToInt32(row["in_fixed_place"]) == 1, + InUse = Convert.ToInt32(row["in_use"]) == 1, + LeftSize = Convert.ToInt32(row["left_size"]), + RightSize = Convert.ToInt32(row["right_size"]), + MagazinePositionType = Convert.ToInt32(row["magazine_position"]), childsTools = childTools }; @@ -753,10 +770,10 @@ namespace Nc_Demo_Application.Database public void UpdateShanks(DataTable shanks) { - UpdateDatabaseFromGridView(shanks, READ_SHANKS_QUERY); + UpdateDatabaseFromDataTable(shanks, READ_SHANKS_QUERY); } - public ShankDataModel AddShank() + public ShankDataModel AddShank(ShankDataModel newShank) { try { @@ -771,11 +788,23 @@ namespace Nc_Demo_Application.Database // Create new row that must be inserted DataRow row = ShanksDataTable.NewRow(); - int id = Convert.ToInt32(ShanksDataTable.Rows[ShanksDataTable.Rows.Count - 1]["id"]) + 1; + int id = 1; + if(ShanksDataTable.Rows.Count > 0) + id = Convert.ToInt32(ShanksDataTable.Rows[ShanksDataTable.Rows.Count - 1]["id"]) + 1; // Setup autoincrement Id + newShank.Id = id; row["id"] = id; - + row["name"] = newShank.Name; + row["is_enabled"] = newShank.IsEnabled ? 1 : 0; + row["is_inhibited"] = newShank.IsInhibited ? 1 : 0; + row["in_change_tool"] = newShank.InChangeTool ? 1 : 0; + row["in_fixed_place"] = newShank.InFixedPlace ? 1 : 0; + row["in_use"] = newShank.InUse ? 1 : 0; + row["left_size"] = newShank.LeftSize; + row["right_size"] = newShank.RightSize; + row["magazine_position"] = newShank.RightSize; + // Add the new row ShanksDataTable.Rows.Add(row); @@ -785,11 +814,7 @@ namespace Nc_Demo_Application.Database // Close the connection with database sqlConnection.Close(); - return new ShankDataModel() - { - Id = id, - childsTools = new List() - }; + return newShank; } catch (Exception ex) { @@ -870,10 +895,10 @@ namespace Nc_Demo_Application.Database Cooling1 = Convert.ToInt32(row["cooling1"]) == 1, Cooling2 = Convert.ToInt32(row["cooling2"]) == 1, IsActive = Convert.ToInt32(row["isActive"]) == 1, - FixedPlace = Convert.ToInt32(row["fixedPlace"]) == 1, + InFixedPlace = Convert.ToInt32(row["fixedPlace"]) == 1, IsInhibited = Convert.ToInt32(row["isInhibited"]) == 1, IsMeasured = Convert.ToInt32(row["IsMeasured"]) == 1, - ChangeTool = Convert.ToInt32(row["changeTool"]) == 1, + InChangeTool = Convert.ToInt32(row["changeTool"]) == 1, IsInUse = Convert.ToInt32(row["isInUse"]) == 1, PreAlarm = Convert.ToInt32(row["preAlarm"]) == 1 }; @@ -917,10 +942,10 @@ namespace Nc_Demo_Application.Database row["cooling1"] = toolData.Cooling1; row["cooling2"] = toolData.Cooling2; row["isActive"] = toolData.IsActive; - row["fixedPlace"] = toolData.FixedPlace; + row["fixedPlace"] = toolData.InFixedPlace; row["isInhibited"] = toolData.IsInhibited; row["IsMeasured"] = toolData.IsMeasured; - row["changeTool"] = toolData.ChangeTool; + row["changeTool"] = toolData.InChangeTool; row["isInUse"] = toolData.IsInUse; row["preAlarm"] = toolData.PreAlarm; row["shankId"] = toolData.ShanksId; @@ -943,26 +968,24 @@ namespace Nc_Demo_Application.Database } } - public void UpdateToolData(ToolsDataModel toolData) + public ToolsDataModel UpdateToolData(ToolsDataModel toolData) { try { - SetConnection(); - - // Open the connection with database - sqlConnection.Open(); - // Create a SQLite command with query, adapter and commandbuilder in order to update. - sqlCommand = new SQLiteCommand(READ_TOOLS_QUERY, sqlConnection); - SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand); - SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter); - - // Create new row that must be inserted + // Find the row to be update DataRow row = ToolsDataTable.AsEnumerable().FirstOrDefault(x => Convert.ToInt32(x["id"]) == toolData.Id); + if (row == null) + return null; + + if (row["family"].ToString() != toolData.FamilyName) + row["childId"] = GetFamilyChildId(toolData.FamilyName); + else if (toolData.ChildId != 0) + row["childId"] = toolData.ChildId; + row["family"] = toolData.FamilyName; row["magazine"] = toolData.MagazineId; row["magazinePositionType"] = toolData.MagazinePositionType; - row["childId"] = GetFamilyChildId(toolData.FamilyName); row["toolType"] = toolData.ToolType; row["shankId"] = toolData.ShanksId; row["sizeLeft"] = toolData.LeftSize; @@ -971,25 +994,29 @@ namespace Nc_Demo_Application.Database row["cooling1"] = toolData.Cooling1; row["cooling2"] = toolData.Cooling2; row["isActive"] = toolData.IsActive; - row["fixedPlace"] = toolData.FixedPlace; + row["fixedPlace"] = toolData.InFixedPlace; row["isInhibited"] = toolData.IsInhibited; row["IsMeasured"] = toolData.IsMeasured; - row["changeTool"] = toolData.ChangeTool; + row["changeTool"] = toolData.InChangeTool; row["isInUse"] = toolData.IsInUse; row["preAlarm"] = toolData.PreAlarm; - // Update database - adapter.Update(ToolsDataTable); + UpdateTool(ToolsDataTable); - // Close the connection with database - sqlConnection.Close(); + return toolData; } catch (Exception ex) { Console.WriteLine("Update tool exception: " + ex.Message); } + + return null; } + private void UpdateTool(DataTable tools) + { + UpdateDatabaseFromDataTable(tools, READ_TOOLS_QUERY); + } private int GetFamilyChildId(string familyName) { // Find next child id @@ -1062,21 +1089,24 @@ namespace Nc_Demo_Application.Database // Populate Edges Model with db data foreach (DataRow row in EdgeDataTable.Rows) { + // Create edges model EdgesDataModel edge = new EdgesDataModel { - Id = Convert.ToInt32(row["id"]), + Id = Convert.ToInt32(row["child_id"]), NominalLife = Convert.ToInt32(row["nominal_life"]), ResidualLife = Convert.ToInt32(row["residual_life"]), PreAlmLife = Convert.ToInt32(row["prealm_life"]) }; + // Add edge additional params to the new model edge.EdgeAdditionalParams = new Dictionary(); + // For each param 2-30 + 34 for (int i = 2; i <= 30; i++) { string key = "param" + i; edge.EdgeAdditionalParams.Add(key, Convert.ToDouble(row[key])); } - + // 34th edge.EdgeAdditionalParams.Add("param34", Convert.ToDouble(row["param34"])); edgesList.Add(edge); @@ -1092,15 +1122,6 @@ namespace Nc_Demo_Application.Database // 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; @@ -1127,11 +1148,7 @@ namespace Nc_Demo_Application.Database // Add the new row EdgeDataTable.Rows.Add(row); - // Update database - adapter.Update(EdgeDataTable); - - // Close the connection with database - sqlConnection.Close(); + UpdateEdges(edgesTable); return newEdge; } @@ -1142,9 +1159,44 @@ namespace Nc_Demo_Application.Database } } + public EdgesDataModel UpdateEdge(int toolId, EdgesDataModel newEdge) + { + try + { + // Get data from DB, alreaby filtred by tool id + DataTable edgesTable = ReadEdges(toolId); + + // Create new row that must be inserted + DataRow row = edgesTable + .AsEnumerable() + .FirstOrDefault(x => Convert.ToInt32(x["tool_id"]) == toolId && Convert.ToInt32(x["child_id"]) == newEdge.Id); + + if (row == null) + return null; + + row["residual_life"] = newEdge.ResidualLife; + row["nominal_life"] = newEdge.NominalLife; + row["prealm_life"] = newEdge.PreAlmLife; + // Setup additional parameters value + foreach(KeyValuePair param in newEdge.EdgeAdditionalParams) + { + row[param.Key] = param.Value; + } + + UpdateEdges(edgesTable); + + return newEdge; + } + catch (Exception ex) + { + Console.WriteLine("Update edge exception: " + ex.Message); + return null; + } + } + public void UpdateEdges(DataTable edges) { - UpdateDatabaseFromGridView(edges, READ_EDGES_QUERY); + UpdateDatabaseFromDataTable(edges, READ_EDGES_QUERY); } public void DeleteEdge(int toolId, int edgeId) @@ -1203,7 +1255,7 @@ namespace Nc_Demo_Application.Database public void UpdateMagazines(DataTable magazines) { - UpdateDatabaseFromGridView(magazines, READ_MAGAZINES_QUERY); + UpdateDatabaseFromDataTable(magazines, READ_MAGAZINES_QUERY); } public List GetPositions() @@ -1270,7 +1322,7 @@ namespace Nc_Demo_Application.Database public void UpdatePositions(DataTable positions) { - UpdateDatabaseFromGridView(positions, READ_MAGAZINES_QUERY); + UpdateDatabaseFromDataTable(positions, READ_MAGAZINES_QUERY); } #endregion Magazines 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 eb42641..6144d3d 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 @@ -16,10 +16,10 @@ namespace Nc_Demo_Application.Database.Models public bool Cooling1; public bool Cooling2; public bool IsActive; - public bool FixedPlace; + public bool InFixedPlace; public bool IsInhibited; public bool IsMeasured; - public bool ChangeTool; + public bool InChangeTool; public bool IsInUse; public bool PreAlarm; public int ShanksId; @@ -29,6 +29,15 @@ namespace Nc_Demo_Application.Database.Models public class ShankDataModel { public int Id; + public string Name; + public bool IsEnabled; + public bool IsInhibited; + public bool InChangeTool; + public bool InFixedPlace; + public bool InUse; + public int LeftSize; + public int RightSize; + public int MagazinePositionType; public List childsTools; } diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db index b0181c1..dd18558 100644 Binary files a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db and b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db differ 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 a895545..1adb83c 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 @@ -193,6 +193,9 @@ namespace Nc_Demo_Application.Server.Service [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 = "PUT", UriTemplate = "tool_table/edge/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void PutEdge(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); @@ -200,7 +203,7 @@ namespace Nc_Demo_Application.Server.Service void GetShanks(out List shanksData); [WebInvoke(Method = "POST", UriTemplate = "tool_table/shank", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] - void AddShank(out ShankDataModel shankData); + void AddShank(ref ShankDataModel shankData); [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/shank/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void DeleteShank(string id); 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 a64acd5..e50945a 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 @@ -483,7 +483,10 @@ namespace Nc_Demo_Application.Server.Service public void GetTools(out List toolsData) { toolsData = DatabaseController.getInstance().ReadTools(); - foreach(ToolsDataModel tool in toolsData) + if (toolsData == null) + throw new WebFaultException(HttpStatusCode.InternalServerError); + + foreach (ToolsDataModel tool in toolsData) { tool.EdgesData = DatabaseController.getInstance().GetEdgesData(tool.Id); } @@ -492,11 +495,17 @@ namespace Nc_Demo_Application.Server.Service public void AddTool(ref ToolsDataModel tool) { tool = DatabaseController.getInstance().AddToolToDatabase(tool); + + if (tool == null) + throw new WebFaultException(HttpStatusCode.BadRequest); } public void PutTool(ToolsDataModel tool) { - DatabaseController.getInstance().UpdateToolData(tool); + tool = DatabaseController.getInstance().UpdateToolData(tool); + + if (tool == null) + throw new WebFaultException(HttpStatusCode.BadRequest); } public void DeleteTool(string id) @@ -511,6 +520,16 @@ namespace Nc_Demo_Application.Server.Service public void AddEdge(string toolId, ref EdgesDataModel edge) { edge = DatabaseController.getInstance().AddEdge(Convert.ToInt32(toolId), edge); + + if (edge == null) + throw new WebFaultException(HttpStatusCode.BadRequest); + } + + public void PutEdge(string toolId, ref EdgesDataModel edge) + { + edge = DatabaseController.getInstance().UpdateEdge(Convert.ToInt32(toolId), edge); + if (edge == null) + throw new WebFaultException(HttpStatusCode.BadRequest); } public void DeleteEdge(string toolId, string edgeId) @@ -527,13 +546,18 @@ namespace Nc_Demo_Application.Server.Service shanksData = DatabaseController.getInstance().GetShanks(); } - public void AddShank(out ShankDataModel shankData) + public void AddShank(ref ShankDataModel shankData) { - shankData = DatabaseController.getInstance().AddShank(); + shankData = DatabaseController.getInstance().AddShank(shankData); + if (shankData == null) + throw new WebFaultException(HttpStatusCode.BadRequest); } public void PutShank(ShankDataModel shankData) { + + if (shankData == null) + throw new WebFaultException(HttpStatusCode.BadRequest); } public void DeleteShank(string id) 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 8487d78..2bfdf56 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 @@ -35,8 +35,8 @@ namespace Nc_Demo_Application System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); 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(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DemoApplicationForm)); this.serverStatusLabel = new System.Windows.Forms.Label(); this.ncDataPage = new System.Windows.Forms.TabPage(); this.label6 = new System.Windows.Forms.Label(); @@ -99,13 +99,11 @@ namespace Nc_Demo_Application this.familiesTab = new System.Windows.Forms.TabPage(); this.label18 = new System.Windows.Forms.Label(); this.shanksDataGridView = new System.Windows.Forms.DataGridView(); - this.shanksId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label17 = new System.Windows.Forms.Label(); this.familiesDataGridView = new System.Windows.Forms.DataGridView(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.name = new System.Windows.Forms.DataGridViewTextBoxColumn(); 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(); @@ -139,32 +137,7 @@ 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.edgesDataGridView = new System.Windows.Forms.DataGridView(); this.edgesId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.edgeId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.edgeToolId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -201,6 +174,42 @@ namespace Nc_Demo_Application this.param29 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.param30 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.param34 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + 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.shanksId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.shankName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.shankIsEnabled = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.ShankIsInhibited = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.ShankInChangeTool = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.FixedPlace = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.ShankIsInUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.ShankLeftSize = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ShankRightSize = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ShankMagPos = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ncDataPage.SuspendLayout(); this.ncTabControl.SuspendLayout(); this.processPage.SuspendLayout(); @@ -823,7 +832,7 @@ namespace Nc_Demo_Application // this.label18.AutoSize = true; this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); - this.label18.Location = new System.Drawing.Point(627, 34); + this.label18.Location = new System.Drawing.Point(273, 34); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(67, 20); this.label18.TabIndex = 4; @@ -831,21 +840,24 @@ namespace Nc_Demo_Application // // shanksDataGridView // - this.shanksDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.shanksDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells; this.shanksDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.shanksDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.shanksId}); - this.shanksDataGridView.Location = new System.Drawing.Point(624, 61); + this.shanksId, + this.shankName, + this.shankIsEnabled, + this.ShankIsInhibited, + this.ShankInChangeTool, + this.FixedPlace, + this.ShankIsInUse, + this.ShankLeftSize, + this.ShankRightSize, + this.ShankMagPos}); + this.shanksDataGridView.Location = new System.Drawing.Point(271, 61); this.shanksDataGridView.Name = "shanksDataGridView"; - this.shanksDataGridView.Size = new System.Drawing.Size(291, 577); + this.shanksDataGridView.Size = new System.Drawing.Size(701, 577); this.shanksDataGridView.TabIndex = 3; // - // shanksId - // - this.shanksId.DataPropertyName = "id"; - this.shanksId.HeaderText = "Id"; - this.shanksId.Name = "shanksId"; - // // label17 // this.label17.AutoSize = true; @@ -865,7 +877,7 @@ namespace Nc_Demo_Application this.name}); this.familiesDataGridView.Location = new System.Drawing.Point(3, 61); this.familiesDataGridView.Name = "familiesDataGridView"; - this.familiesDataGridView.Size = new System.Drawing.Size(457, 584); + this.familiesDataGridView.Size = new System.Drawing.Size(250, 584); this.familiesDataGridView.TabIndex = 1; // // id @@ -920,8 +932,8 @@ namespace Nc_Demo_Application this.toolsPage.Controls.Add(this.toolsIdLlb); 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.Controls.Add(this.toolStrip7); this.toolsPage.Location = new System.Drawing.Point(4, 22); this.toolsPage.Name = "toolsPage"; this.toolsPage.Padding = new System.Windows.Forms.Padding(3); @@ -930,51 +942,6 @@ 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; @@ -1272,6 +1239,273 @@ namespace Nc_Demo_Application this.toolsTreeView.TabIndex = 0; this.toolsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ToolsTreeView_AfterSelect); // + // 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; + // + // edgesId + // + 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"; + // // stopServer // this.stopServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -1545,227 +1779,91 @@ namespace Nc_Demo_Application this.addTool.Text = "toolStripButton1"; this.addTool.Click += new System.EventHandler(this.AddTool_Click); // - // edgesId - // - 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"; + // shanksId + // + this.shanksId.DataPropertyName = "id"; + this.shanksId.HeaderText = "Id"; + this.shanksId.Name = "shanksId"; + this.shanksId.Width = 41; + // + // shankName + // + this.shankName.DataPropertyName = "name"; + this.shankName.HeaderText = "Name"; + this.shankName.Name = "shankName"; + this.shankName.Width = 60; + // + // shankIsEnabled + // + this.shankIsEnabled.DataPropertyName = "is_enabled"; + this.shankIsEnabled.FalseValue = "0"; + this.shankIsEnabled.HeaderText = "Enabled"; + this.shankIsEnabled.Name = "shankIsEnabled"; + this.shankIsEnabled.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.shankIsEnabled.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.shankIsEnabled.TrueValue = "1"; + this.shankIsEnabled.Width = 71; + // + // ShankIsInhibited + // + this.ShankIsInhibited.DataPropertyName = "is_inhibited"; + this.ShankIsInhibited.FalseValue = "0"; + this.ShankIsInhibited.HeaderText = "Inhibited"; + this.ShankIsInhibited.Name = "ShankIsInhibited"; + this.ShankIsInhibited.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.ShankIsInhibited.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.ShankIsInhibited.TrueValue = "1"; + this.ShankIsInhibited.Width = 72; + // + // ShankInChangeTool + // + this.ShankInChangeTool.DataPropertyName = "in_change_tool"; + this.ShankInChangeTool.FalseValue = "0"; + this.ShankInChangeTool.HeaderText = "ChangeTool"; + this.ShankInChangeTool.Name = "ShankInChangeTool"; + this.ShankInChangeTool.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.ShankInChangeTool.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.ShankInChangeTool.TrueValue = "1"; + this.ShankInChangeTool.Width = 90; + // + // FixedPlace + // + this.FixedPlace.DataPropertyName = "in_fixed_place"; + this.FixedPlace.FalseValue = "0"; + this.FixedPlace.HeaderText = "Fixed Place"; + this.FixedPlace.Name = "FixedPlace"; + this.FixedPlace.TrueValue = "1"; + this.FixedPlace.Width = 68; + // + // ShankIsInUse + // + this.ShankIsInUse.DataPropertyName = "in_use"; + this.ShankIsInUse.FalseValue = "0"; + this.ShankIsInUse.HeaderText = "In Use"; + this.ShankIsInUse.Name = "ShankIsInUse"; + this.ShankIsInUse.TrueValue = "1"; + this.ShankIsInUse.Width = 44; + // + // ShankLeftSize + // + this.ShankLeftSize.DataPropertyName = "left_size"; + this.ShankLeftSize.HeaderText = "Man SX"; + this.ShankLeftSize.Name = "ShankLeftSize"; + this.ShankLeftSize.Width = 70; + // + // ShankRightSize + // + this.ShankRightSize.DataPropertyName = "right_size"; + this.ShankRightSize.HeaderText = "Man DX"; + this.ShankRightSize.Name = "ShankRightSize"; + this.ShankRightSize.Width = 71; + // + // ShankMagPos + // + this.ShankMagPos.DataPropertyName = "magazine_position"; + this.ShankMagPos.HeaderText = "ShankMagPos"; + this.ShankMagPos.Name = "ShankMagPos"; + this.ShankMagPos.Width = 102; // // DemoApplicationForm // @@ -1936,7 +2034,6 @@ namespace Nc_Demo_Application private ToolStripEx toolStripEx1; private System.Windows.Forms.ToolStripButton saveFamiliesButton; private System.Windows.Forms.DataGridView shanksDataGridView; - private System.Windows.Forms.DataGridViewTextBoxColumn shanksId; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; private System.Windows.Forms.TabPage magazinesTab; @@ -1998,6 +2095,16 @@ namespace Nc_Demo_Application private System.Windows.Forms.DataGridViewTextBoxColumn param29; private System.Windows.Forms.DataGridViewTextBoxColumn param30; private System.Windows.Forms.DataGridViewTextBoxColumn param34; + private System.Windows.Forms.DataGridViewTextBoxColumn shanksId; + private System.Windows.Forms.DataGridViewTextBoxColumn shankName; + private System.Windows.Forms.DataGridViewCheckBoxColumn shankIsEnabled; + private System.Windows.Forms.DataGridViewCheckBoxColumn ShankIsInhibited; + private System.Windows.Forms.DataGridViewCheckBoxColumn ShankInChangeTool; + private System.Windows.Forms.DataGridViewCheckBoxColumn FixedPlace; + private System.Windows.Forms.DataGridViewCheckBoxColumn ShankIsInUse; + private System.Windows.Forms.DataGridViewTextBoxColumn ShankLeftSize; + private System.Windows.Forms.DataGridViewTextBoxColumn ShankRightSize; + private System.Windows.Forms.DataGridViewTextBoxColumn ShankMagPos; } } 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 bd8ab8e..39ec03f 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 @@ -535,9 +535,9 @@ namespace Nc_Demo_Application Cooling2 = false, Rotation = 0, IsActive = false, - FixedPlace = false, + InFixedPlace = false, IsMeasured = false, - ChangeTool = false, + InChangeTool = false, PreAlarm = false, IsInUse = false, IsInhibited = false @@ -605,11 +605,11 @@ namespace Nc_Demo_Application shankIdTextBox.Text = toolInfo.ShanksId.ToString(); isActiveCheckBox.Checked = toolInfo.IsActive; - fixedPlaceCheckBox.Checked = toolInfo.FixedPlace; + fixedPlaceCheckBox.Checked = toolInfo.InFixedPlace; inhibitedCheckBox.Checked = toolInfo.IsInhibited; measuredCheckBox.Checked = toolInfo.IsMeasured; preAlarmCheckBox.Checked = toolInfo.PreAlarm; - changeToolCheckBox.Checked = toolInfo.ChangeTool; + changeToolCheckBox.Checked = toolInfo.InChangeTool; useCheckBox.Checked = toolInfo.IsInUse; toolTypeSelect.SelectedItem = (TOOLS_TYPE)toolInfo.ToolType; @@ -647,11 +647,11 @@ namespace Nc_Demo_Application toolInfo.ShanksId = Convert.ToInt32(shankIdTextBox.Text); toolInfo.IsActive = isActiveCheckBox.Checked; - toolInfo.FixedPlace = fixedPlaceCheckBox.Checked; + toolInfo.InFixedPlace = fixedPlaceCheckBox.Checked; toolInfo.IsInhibited = inhibitedCheckBox.Checked; toolInfo.IsMeasured = measuredCheckBox.Checked; toolInfo.PreAlarm = preAlarmCheckBox.Checked; - toolInfo.ChangeTool = changeToolCheckBox.Checked; + toolInfo.InChangeTool = changeToolCheckBox.Checked; toolInfo.IsInUse = useCheckBox.Checked; toolInfo.ToolType = (int)toolTypeSelect.SelectedItem; 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 c3998c0..675522a 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 @@ -150,6 +150,33 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -159,20 +186,6 @@ 752, 17 - - 647, 17 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADaSURBVDhPvdPNCgFRGMbx2eESpFyABRsbCzchSq7C0gUo - C1sbl2CjXATysSFchLKR8lE+/s8wdcaciYSnfjXnvJ33NGfOOL9IAk2scMAJSzSQxgwjWFPBDtc3BFLG - BSp2kEMUERRwRmiDJLydq5p4yhzm4kCDNjSpnW0Zwlw8gC8bqJBxRx9Ep9q/P/4nU4R+ylfJQq+7dkdG - 1NU8KB2cLT2o3nJHRszFMsFzalBtC91YX8zFujQlxB7y6MKrFRGI2SCMdlZja3SqY6RQh27fEXssoJ8p - jm/GcW7031RP8zpHxQAAAABJRU5ErkJggg== - - True @@ -281,4 +294,18 @@ True + + 647, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADaSURBVDhPvdPNCgFRGMbx2eESpFyABRsbCzchSq7C0gUo + C1sbl2CjXATysSFchLKR8lE+/s8wdcaciYSnfjXnvJ33NGfOOL9IAk2scMAJSzSQxgwjWFPBDtc3BFLG + BSp2kEMUERRwRmiDJLydq5p4yhzm4kCDNjSpnW0Zwlw8gC8bqJBxRx9Ep9q/P/4nU4R+ylfJQq+7dkdG + 1NU8KB2cLT2o3nJHRszFMsFzalBtC91YX8zFujQlxB7y6MKrFRGI2SCMdlZja3SqY6RQh27fEXssoJ8p + jm/GcW7031RP8zpHxQAAAABJRU5ErkJggg== + + \ No newline at end of file