From c4d668c5fd4cb1e5c7375bf218becb7fb90d5c0f Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Tue, 12 Jun 2018 15:47:03 +0000 Subject: [PATCH] --- CMS_CORE_Application/Form1.cs | 3 +- CMS_CORE_Library/DataStructures.cs | 27 +- CMS_CORE_Library/Demo/Nc_Demo.cs | 22 +- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 262 +++++++++++------- CMS_CORE_Library/ToolConfigurations.cs | 19 +- .../Database/DatabaseController.cs | 6 +- .../Database/Models/ToolsDataModel.cs | 3 +- .../Views/DemoApplicationForm.Designer.cs | 143 +++++----- .../Views/DemoApplicationForm.cs | 4 +- .../Views/DemoApplicationForm.resx | 3 + 10 files changed, 298 insertions(+), 194 deletions(-) diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index 640f623..7abdeb5 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -224,7 +224,8 @@ namespace CMS_CORE_Application // PositionId = 1 //}); // cmsError = N.TOOLS_WUnloadToolInMagazine(1, 53); - cmsError = N.TOOLS_WLoadToolInMagazine(1, new NewToolInMagazineModel() { PositionId = 1, ToolId = 4 }); + // cmsError = N.TOOLS_WLoadToolInMagazine(1, new NewToolInMagazineModel() { PositionId = 1, ToolId = 4 }); + cmsError = N.TOOLS_RToolsData(ref dataTable); //cmsError = N.PLC_WRefreshAllMessages(); //cmsError = N.PLC_RHeadsData(headsTest, 1); diff --git a/CMS_CORE_Library/DataStructures.cs b/CMS_CORE_Library/DataStructures.cs index e9be298..8f726c4 100644 --- a/CMS_CORE_Library/DataStructures.cs +++ b/CMS_CORE_Library/DataStructures.cs @@ -445,13 +445,6 @@ namespace CMS_CORE_Library GENERIC = 5 } - public enum ROTATION - { - NONE = 0, - CLOCKWHISE = 1, - COUNTERCLOCKWHISE = 2 - } - public enum MAGAZINE_TYPE { CHAIN = 1, @@ -461,6 +454,24 @@ namespace CMS_CORE_Library MAGAZINE_LOADING_STATION = 9 } + public enum POSITION_TYPE + { + MAGAZINE_LOCATION = 1, + SPINDLE = 2, + GRIPPER = 3, + LOADER = 4, + TRANSFER_LOCATION = 5, + LOADING_STATION = 6, + LOADING_POINT = 7 + } + + public enum ROTATION + { + NONE = 0, + CLOCKWHISE = 1, + COUNTERCLOCKWHISE = 2 + } + public enum SIEMENS_LIFE_TYPE { NONE = 0, @@ -570,6 +581,7 @@ namespace CMS_CORE_Library { public int PositionId; public int MagazineId; + public POSITION_TYPE PhysicalType; public int Type; public bool Disabled; } @@ -659,6 +671,7 @@ namespace CMS_CORE_Library public MAGAZINE_TYPE Type; public int MaxPositions; public bool LoadingIsActive; + public int LoadPosition; } public class ToolTableConfiguration diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index 304871c..46c1ace 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -1722,19 +1722,21 @@ namespace CMS_CORE.Demo { if (tool.IsMultiTool) { - if (tool.Shank.Id == demoTool.Id) - { - magazineId = tool.MagazineId; - positionId = tool.PositionId; - } + if(tool.Shank != null) + if (tool.Shank.Id == demoTool.Id) + { + magazineId = tool.MagazineId; + positionId = tool.PositionId; + } } else { - if (tool.ChildTools.Id == demoTool.Id) - { - magazineId = tool.MagazineId; - positionId = tool.PositionId; - } + if(tool.ChildTools != null) + if (tool.ChildTools.Id == demoTool.Id) + { + magazineId = tool.MagazineId; + positionId = tool.PositionId; + } } } diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 5d18f6a..a92b641 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -249,13 +249,15 @@ namespace CMS_CORE.Siemens if (magPosItems.Count > 0) // Subscribe MagazinePositionSvc.Subscribe(MagazinePositionEnabled_OnChange, magPosItems.ToArray()); + List magActionsItem = new List() + { + new Item() { Path = "DB71.DBB0", SymbolicName = "71"}, + new Item() { Path = "DB72.DBB0", SymbolicName = "72"} + }; + // Setup magazine actions listener - Item magActionsItem = new Item() - { - Path = "DB71.DBB0" - }; - MagazineActionsSvc.Subscribe(MagazineAction_OnChange, magActionsItem); + MagazineActionsSvc.Subscribe(MagazineAction_OnChange, magActionsItem.ToArray()); DataSvc d = new DataSvc(); Item i = new Item() { Path = "/Tool/MTCatalogue/numMultiTools[u1]" }; @@ -2175,7 +2177,7 @@ namespace CMS_CORE.Siemens foreach (ShankChildModel child in shank.ChildsTools) { // Find tool by id - SiemensToolModel tool = ToolTableData.Where(x => x.Id == child.Id).First(); + SiemensToolModel tool = ToolTableData.Where(x => x.Id == child.Id).FirstOrDefault(); if (tool != null) { child.FamilyName = tool.FamilyName; @@ -2472,8 +2474,8 @@ namespace CMS_CORE.Siemens case SIEMENS_LIFE_TYPE.COUNT: { items.Add(new Item() { Path = string.Format("/Tool/Supervision/data[c{0}, {1}]", tool.Id, edgeLifeOffset + 3), Value = edge.PreAlmLife }); - items.Add(new Item() { Path = string.Format("/Tool/Supervision/data[c{0}, {1}]", tool.Id, edgeLifeOffset + 4), Value = edge.NominalLife }); - items.Add(new Item() { Path = string.Format("/Tool/Supervision/data[c{0}, {1}]", tool.Id, edgeLifeOffset + 6), Value = edge.ResidualLife }); + items.Add(new Item() { Path = string.Format("/Tool/Supervision/data[c{0}, {1}]", tool.Id, edgeLifeOffset + 6), Value = edge.NominalLife }); + items.Add(new Item() { Path = string.Format("/Tool/Supervision/data[c{0}, {1}]", tool.Id, edgeLifeOffset + 4), Value = edge.ResidualLife }); } break; } @@ -2583,17 +2585,28 @@ namespace CMS_CORE.Siemens int toolIndex = ToolTableData.FindIndex(x => x.Id == pos.ToolId); if (toolIndex > 0) { + + int decPosition, incPosition; + decPosition = incPosition = pos.PositionId; + // if it is a circular magazine move position before ( for left case ) or after ( right case ) the location you want to mount the tool + if (magConfig.Type != MAGAZINE_TYPE.BOX_MAGAZINE) + { + decPosition = decPosition < newMagazineTool.PositionId ? decPosition + magConfig.MaxPositions : decPosition; + incPosition = incPosition > newMagazineTool.PositionId ? incPosition - magConfig.MaxPositions : incPosition; + } // Right check - int decPosition = pos.PositionId < newMagazineTool.PositionId ? pos.PositionId + 60 : pos.PositionId; - double leftMounted = decPosition - (ToolTableData[toolIndex].LeftSize / 2.0); // Calculate left space occupied - double rightToBeMount = newMagazineTool.PositionId + ((tool as SiemensToolModel).RightSize / 2.0); // Calculate right space needed + // Calculate left space occupied + double leftMounted = decPosition - (ToolTableData[toolIndex].LeftSize / 2.0); + // Calculate right space needed + double rightToBeMount = newMagazineTool.PositionId + ((tool as SiemensToolModel).RightSize / 2.0); if (leftMounted < rightToBeMount) return MAGAZINE_POSITION_OCCUPIED_ERROR; // Left check - int incPosition = pos.PositionId > newMagazineTool.PositionId ? pos.PositionId - 60 : pos.PositionId; - double rightMounted = incPosition + (ToolTableData[toolIndex].RightSize / 2.0); // Calculate right space occupied - double leftToBeMounted = newMagazineTool.PositionId - ((tool as SiemensToolModel).LeftSize / 2.0); // Calculate left space needed + // Calculate right space occupied + double rightMounted = incPosition + (ToolTableData[toolIndex].RightSize / 2.0); + // Calculate left space needed + double leftToBeMounted = newMagazineTool.PositionId - ((tool as SiemensToolModel).LeftSize / 2.0); if (rightMounted > leftToBeMounted) return MAGAZINE_POSITION_OCCUPIED_ERROR; } @@ -2612,7 +2625,7 @@ namespace CMS_CORE.Siemens piArgs[0] = "/NC"; piArgs[1] = "401"; piArgs[2] = newMagazineTool.ToolId.ToString().PadLeft(5, '0'); //Tool ID (> 00000) - piArgs[3] = magazineId.ToString().PadLeft(5, '0'); ; // Manina carico (valore fisso) + piArgs[3] = magConfig.LoadPosition.ToString().PadLeft(5, '0'); ; // Manina carico (valore fisso) piArgs[4] = "09999"; // Magazzino di carico (valore fisso) piArgs[5] = newMagazineTool.PositionId.ToString().PadLeft(5, '0'); // Manina di destinazione (dove caricare l'utensile) piArgs[6] = magazineId.ToString().PadLeft(5, '0'); // Magazzino di destinazione (dove caricare l'utensile) @@ -2626,6 +2639,7 @@ namespace CMS_CORE.Siemens { return ManageException(ex); } + // Mount temporarily till the Siemens notification arrives MountToolToMagazineList(newMagazineTool.ToolId, magazineId, newMagazineTool.PositionId); @@ -2637,6 +2651,11 @@ namespace CMS_CORE.Siemens if (MagazineAction.Action != MAGAZINE_ACTIONS.NONE) return MAGAZINE_BUSY_ERROR; + // Get mag config + MagazineConfigModel magConfig = MagazineConfig.Where(x => x.Id == magazineId).FirstOrDefault(); + if (magConfig == null || !magConfig.LoadingIsActive) + return INCORRECT_PARAMETERS_ERROR; + //Check if the NC is Connected CmsError cmsError = CheckConnection(); if (cmsError.IsError()) @@ -2651,7 +2670,7 @@ namespace CMS_CORE.Siemens piArgs[2] = "-0001"; // Tool ID (Fixed, no ID) piArgs[3] = positionId.ToString().PadLeft(5, '0'); // Manina carico (valore fisso) piArgs[4] = magazineId.ToString().PadLeft(5, '0'); // Magazzino di carico (valore fisso) - piArgs[5] = magazineId.ToString().PadLeft(5, '0'); //Manina carico (valore fisso) + piArgs[5] = magConfig.LoadPosition.ToString().PadLeft(5, '0'); //Manina carico (valore fisso) piArgs[6] = "09999"; // Magazzino da cui scaricare l'utensile piArgs[7] = "_N_TMMVTL"; @@ -3203,105 +3222,110 @@ namespace CMS_CORE.Siemens } } - private void MagazineAction_OnChange(Guid guid, Item item, DataSvcStatus status) + private void MagazineAction_OnChange(Guid guid, Item[] items, DataSvcStatus[] status) { - DataSvc dataSvc = new DataSvc(); - Item action = new Item("DB71.DBB4"); - dataSvc.Read(action); - - if ((uint)item.Value == 0) + foreach (Item item in items) { - MagazineAction = new MagazineActionModel() + string prefix = "DB" + item.SymbolicName + "."; + DataSvc dataSvc = new DataSvc(); + Item action = new Item(prefix + "DBB4"); + dataSvc.Read(action); + + if ((uint)item.Value == 0) { - Action = MAGAZINE_ACTIONS.NONE, - OriginMagazine = 0, - OriginPosition = 0, - DestinationMagazine = 0, - DestinationPosition = 0, - Tool = null - }; - } - else - { - List magazineValue = new List() + MagazineAction = new MagazineActionModel() + { + Action = MAGAZINE_ACTIONS.NONE, + OriginMagazine = 0, + OriginPosition = 0, + DestinationMagazine = 0, + DestinationPosition = 0, + Tool = null + }; + } + else + { + List magazineValue = new List() { - new Item("DB71.DBW20"), // Intermediate mag Id - new Item("DB71.DBW22"), // intermediate pos Id + new Item(prefix + "DBW20"), // Intermediate mag Id + new Item(prefix + "DBW22"), // intermediate pos Id - new Item("DB71.DBW24"), // Unload mag Id - new Item("DB71.DBW26"), // Unload pos Id + new Item(prefix + "DBW24"), // Unload mag Id + new Item(prefix + "DBW26"), // Unload pos Id - new Item("DB71.DBW28"), // Load mag Id - new Item("DB71.DBW30") // Load pos Id + new Item(prefix + "DBW28"), // Load mag Id + new Item(prefix + "DBW30") // Load pos Id }; - // Read magazine positions - dataSvc.Read(magazineValue.ToArray()); + // Read magazine positions + dataSvc.Read(magazineValue.ToArray()); - uint toolMagId = 0; - uint toolPosId = 0; - uint toolId = 0; + uint toolMagId = 0; + uint toolPosId = 0; + uint toolId = 0; - switch ((MAGAZINE_ACTIONS)Convert.ToInt32(action.Value)) - { - case MAGAZINE_ACTIONS.LOADING: - { - toolPosId = (((uint)magazineValue[1].Value - 1) * 11) + 3; // (position_id - 1) * 11 + 3 - toolMagId = (uint)magazineValue[0].Value; - } - break; + switch ((MAGAZINE_ACTIONS)Convert.ToInt32(action.Value)) + { + case MAGAZINE_ACTIONS.LOADING: + { + toolPosId = (((uint)magazineValue[1].Value - 1) * 11) + 3; // (position_id - 1) * 11 + 3 + toolMagId = (uint)magazineValue[0].Value; + } + break; - case MAGAZINE_ACTIONS.UNLOADING: - { - toolPosId = (((uint)magazineValue[3].Value - 1) * 11) + 3; - toolMagId = (uint)magazineValue[2].Value; - } - break; + case MAGAZINE_ACTIONS.UNLOADING: + { + toolPosId = (((uint)magazineValue[3].Value - 1) * 11) + 3; + toolMagId = (uint)magazineValue[2].Value; + } + break; - case MAGAZINE_ACTIONS.TRANSFER: - { - toolPosId = (((uint)magazineValue[3].Value - 1) * 11) + 3; - toolMagId = (uint)magazineValue[2].Value; - } - break; - } - // If position and magazine exist - if (toolMagId != 0 && toolPosId != 0) - { - // Read tool id - Item toolIdItem = new Item(string.Format("/Tool/Magazine/placeData[c{0} , {1}]", toolMagId, toolPosId)); - dataSvc.Read(toolIdItem); - toolId = (uint)toolIdItem.Value; - } + case MAGAZINE_ACTIONS.TRANSFER: + { + toolPosId = (((uint)magazineValue[3].Value - 1) * 11) + 3; + toolMagId = (uint)magazineValue[2].Value; + } + break; + } - // Find tool data into tools list - MagazineActionToolModel tool = ToolTableData.Where(x => x.Id == toolId)?.Select(x => new MagazineActionToolModel - { - Id = x.Id, - Name = x.FamilyName, - ToolType = x.ToolType, - IsMultitool = false - }).FirstOrDefault(); + // If position and magazine exist + if (toolMagId != 0 && toolPosId != 0) + { + // Read tool id + Item toolIdItem = new Item(string.Format("/Tool/Magazine/placeData[c{0} , {1}]", toolMagId, toolPosId)); + dataSvc.Read(toolIdItem); + toolId = (uint)toolIdItem.Value; + } - if (tool == null) - // If not found in the tools list, find in the multitools - tool = MultitoolsData.Where(x => x.Id == toolId)?.Select(x => new MagazineActionToolModel + // Find tool data into tools list + MagazineActionToolModel tool = ToolTableData.Where(x => x.Id == toolId)?.Select(x => new MagazineActionToolModel { Id = x.Id, - Name = x.Name, - ToolType = 0, - IsMultitool = true + Name = x.FamilyName, + ToolType = x.ToolType, + IsMultitool = false }).FirstOrDefault(); - MagazineAction = new MagazineActionModel() - { - Action = (MAGAZINE_ACTIONS)Convert.ToInt32(action.Value), - OriginMagazine = Convert.ToInt32(magazineValue[4].Value), - OriginPosition = Convert.ToInt32(magazineValue[5].Value), - DestinationMagazine = Convert.ToInt32(magazineValue[2].Value), - DestinationPosition = Convert.ToInt32(magazineValue[3].Value), - Tool = tool - }; + if (tool == null) + // If not found in the tools list, find in the multitools + tool = MultitoolsData.Where(x => x.Id == toolId)?.Select(x => new MagazineActionToolModel + { + Id = x.Id, + Name = x.Name, + ToolType = 0, + IsMultitool = true + }).FirstOrDefault(); + + MagazineAction = new MagazineActionModel() + { + Action = (MAGAZINE_ACTIONS)Convert.ToInt32(action.Value), + OriginMagazine = Convert.ToInt32(magazineValue[4].Value), + OriginPosition = Convert.ToInt32(magazineValue[5].Value), + DestinationMagazine = Convert.ToInt32(magazineValue[2].Value), + DestinationPosition = Convert.ToInt32(magazineValue[3].Value), + Tool = tool + }; + } } } @@ -3506,6 +3530,14 @@ namespace CMS_CORE.Siemens mag.Name = actualString.Split('=').LastOrDefault().Replace("\"", ""); } break; + case "$TC_MAP7": + { + // Add max number of magazine positions + MagazineConfigModel mag = MagazineConfig.Where(x => x.Id == firstId).FirstOrDefault(); + if (mag != null) + mag.MaxPositions = Convert.ToInt32(actualString.Split('=').LastOrDefault()); + } + break; } } else @@ -3643,17 +3675,29 @@ namespace CMS_CORE.Siemens } } break; - - case "$TC_MPP2": + case "$TC_MPP1": { MagazinePositionsData.Add(new PositionModel() { PositionId = secondId, MagazineId = firstId, - Type = Convert.ToInt32(actualString.Split('=').LastOrDefault()) + PhysicalType = (POSITION_TYPE)Convert.ToInt32(actualString.Split('=').LastOrDefault()) }); } break; + case "$TC_MPP2": + { + int index = MagazinePositionsData.FindIndex(x => x.PositionId == secondId && x.MagazineId == firstId); + if (index >= 0) + MagazinePositionsData[index].Type = Convert.ToInt32(actualString.Split('=').LastOrDefault()); + //MagazinePositionsData.Add(new PositionModel() + //{ + // PositionId = secondId, + // MagazineId = firstId, + // Type = Convert.ToInt32(actualString.Split('=').LastOrDefault()) + //}); + } + break; case "$TC_MPP4": { @@ -3688,6 +3732,14 @@ namespace CMS_CORE.Siemens } } break; + case "$TC_MDP1": + { + // Add max number of magazine positions + MagazineConfigModel mag = MagazineConfig.Where(x => x.Id == firstId).FirstOrDefault(); + if (mag != null) + mag.LoadPosition = secondId; + } + break; } } } @@ -3922,8 +3974,18 @@ namespace CMS_CORE.Siemens // Find tool SiemensToolModel tool = ToolTableData.FirstOrDefault(t => t.Id == toolInfo.tNo); if (tool != null) + { + // Delete Families + SiemensToolModel sameFamilyTool = ToolTableData.FirstOrDefault(x => x.FamilyName == tool.FamilyName && x.Id != tool.Id); + if(sameFamilyTool == null) + { + FamiliesData.RemoveAll(x => x.Name == tool.FamilyName); + } + // Remove ToolTableData.Remove(tool); + } + else if (MULTITOOL_OPTION_ACTIVE) { // if tool not exist, find into shanks diff --git a/CMS_CORE_Library/ToolConfigurations.cs b/CMS_CORE_Library/ToolConfigurations.cs index a796e4d..b9257b1 100644 --- a/CMS_CORE_Library/ToolConfigurations.cs +++ b/CMS_CORE_Library/ToolConfigurations.cs @@ -62,6 +62,16 @@ namespace CMS_CORE_Library {2, "counterClockWhise"} }; + private static Dictionary physicalType = new Dictionary() + { + {1, "magazine_location" }, + {2, "spindle" }, + {3, "gripper" }, + {4, "loader" }, + {5, "transfer_location" }, + {6, "loading_station" }, + {7, "loading_point" } + }; #endregion PRIVATE_SELECTS_VALUES /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -133,10 +143,11 @@ namespace CMS_CORE_Library public static List SiemensMagazinePosFieldsConfig = new List() { - new FieldsConfiguration{Name = "magazineId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, - new FieldsConfiguration{Name = "positionId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, - new FieldsConfiguration{Name = "type", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, - new FieldsConfiguration{Name = "disabled", Type = "boolean", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = 0 }, + new FieldsConfiguration{ Name = "magazineId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, + new FieldsConfiguration{ Name = "positionId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, + new FieldsConfiguration{ Name = "type", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, + new FieldsConfiguration{ Name = "physicalType", Type = "select", SelectValues = physicalType, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, + new FieldsConfiguration{ Name = "disabled", Type = "boolean", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = 0 } }; public static EdgesConfiguration SiemensEdgesFieldsConfiguration = new EdgesConfiguration() 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 4062b65..8ef64f8 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 @@ -1412,6 +1412,7 @@ namespace Nc_Demo_Application.Database PositionId = Convert.ToInt32(row["positionId"]), MagazineId = Convert.ToInt32(row["magazineId"]), Type = Convert.ToInt32(row["type"]), + PhysicalType = Convert.ToInt32(row["physicalType"]), Disabled = Convert.ToInt32(row["disabled"]) == 1 }; @@ -1513,6 +1514,7 @@ namespace Nc_Demo_Application.Database // Update positions type row["type"] = position.Type; + row["physicalType"] = position.PhysicalType; row["disabled"] = position.Disabled; // Save UpdatePositions(MagazinesPositionDataTable); @@ -1622,7 +1624,7 @@ namespace Nc_Demo_Application.Database }; // Set model data - status.action = (MAGAZINE_ACTIONS)Convert.ToInt32(row["action"]); + status.Action = (MAGAZINE_ACTIONS)Convert.ToInt32(row["action"]); status.Tool = tool; status.Tool.Id = Convert.ToInt32(row["tool_id"]); status.OriginMagazine = Convert.ToInt32(row["orig_mag"]); @@ -1641,7 +1643,7 @@ namespace Nc_Demo_Application.Database // Update local ncDatatable data foreach (DataRow row in MagazinesActionDataTable.Rows) { - row["action"] = (int)ncData.action; + row["action"] = (int)ncData.Action; row["tool_id"] = ncData.Tool.Id; row["orig_mag"] = ncData.OriginMagazine; row["orig_pos"] = ncData.OriginPosition; 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 006b747..fcd7827 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 @@ -59,6 +59,7 @@ namespace Nc_Demo_Application.Database.Models public int PositionId; public int MagazineId; public int Type; + public int PhysicalType; public bool Disabled; public bool IsMultiTool; public ShankDataModel Shank; @@ -89,7 +90,7 @@ namespace Nc_Demo_Application.Database.Models public class MagazineActionModel { - public MAGAZINE_ACTIONS action; + public MAGAZINE_ACTIONS Action; public int OriginMagazine; public int OriginPosition; public int DestinationMagazine; 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 5b03f73..4c71568 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 @@ -32,11 +32,11 @@ namespace Nc_Demo_Application { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - 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.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DemoApplicationForm)); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.serverStatusLabel = new System.Windows.Forms.Label(); this.ncDataPage = new System.Windows.Forms.TabPage(); this.magPositionOptionCheckbox = new System.Windows.Forms.CheckBox(); @@ -117,12 +117,6 @@ namespace Nc_Demo_Application this.label21 = new System.Windows.Forms.Label(); this.magActionAction = new System.Windows.Forms.ComboBox(); this.magazinesGridView = new System.Windows.Forms.DataGridView(); - this.magazineId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.positionId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.positionType = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ShankId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.magazineToolId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.disablePosition = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.familiesTab = new System.Windows.Forms.TabPage(); this.label18 = new System.Windows.Forms.Label(); this.shanksDataGridView = new System.Windows.Forms.DataGridView(); @@ -244,6 +238,13 @@ namespace Nc_Demo_Application this.refreshToolUI = new System.Windows.Forms.ToolStripButton(); this.removeTool = new System.Windows.Forms.ToolStripButton(); this.addTool = new System.Windows.Forms.ToolStripButton(); + this.magazineId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.positionId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.physicalType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.positionType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ShankId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.magazineToolId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.disablePosition = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.ncDataPage.SuspendLayout(); this.ncTabControl.SuspendLayout(); this.processPage.SuspendLayout(); @@ -1034,6 +1035,7 @@ namespace Nc_Demo_Application this.magazinesGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.magazineId, this.positionId, + this.physicalType, this.positionType, this.ShankId, this.magazineToolId, @@ -1043,58 +1045,6 @@ namespace Nc_Demo_Application this.magazinesGridView.Size = new System.Drawing.Size(978, 548); this.magazinesGridView.TabIndex = 0; // - // magazineId - // - this.magazineId.DataPropertyName = "magazineId"; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black; - this.magazineId.DefaultCellStyle = dataGridViewCellStyle3; - this.magazineId.FillWeight = 105.2829F; - this.magazineId.HeaderText = "Magazine Id"; - this.magazineId.Name = "magazineId"; - this.magazineId.ReadOnly = true; - this.magazineId.Resizable = System.Windows.Forms.DataGridViewTriState.False; - // - // positionId - // - this.positionId.DataPropertyName = "positionId"; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; - this.positionId.DefaultCellStyle = dataGridViewCellStyle4; - this.positionId.FillWeight = 94.61015F; - this.positionId.HeaderText = "Position Id"; - this.positionId.Name = "positionId"; - this.positionId.ReadOnly = true; - // - // positionType - // - this.positionType.DataPropertyName = "type"; - this.positionType.FillWeight = 100.1069F; - this.positionType.HeaderText = "Type"; - this.positionType.Name = "positionType"; - // - // ShankId - // - this.ShankId.DataPropertyName = "shankId"; - this.ShankId.HeaderText = "Shank Id"; - this.ShankId.Name = "ShankId"; - // - // magazineToolId - // - this.magazineToolId.DataPropertyName = "toolId"; - this.magazineToolId.HeaderText = "Tool Id"; - this.magazineToolId.Name = "magazineToolId"; - // - // disablePosition - // - this.disablePosition.DataPropertyName = "disabled"; - this.disablePosition.FalseValue = "0"; - this.disablePosition.HeaderText = "Disabled"; - this.disablePosition.Name = "disablePosition"; - this.disablePosition.TrueValue = "1"; - // // familiesTab // this.familiesTab.Controls.Add(this.label18); @@ -2057,7 +2007,7 @@ namespace Nc_Demo_Application this.versionLabel.Name = "versionLabel"; this.versionLabel.Size = new System.Drawing.Size(89, 20); this.versionLabel.TabIndex = 11; - this.versionLabel.Text = "Version: 29"; + this.versionLabel.Text = "Version: 30"; // // toolStrip5 // @@ -2321,6 +2271,64 @@ namespace Nc_Demo_Application this.addTool.Text = "toolStripButton1"; this.addTool.Click += new System.EventHandler(this.AddTool_Click); // + // magazineId + // + this.magazineId.DataPropertyName = "magazineId"; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black; + this.magazineId.DefaultCellStyle = dataGridViewCellStyle3; + this.magazineId.FillWeight = 105.2829F; + this.magazineId.HeaderText = "Magazine Id"; + this.magazineId.Name = "magazineId"; + this.magazineId.ReadOnly = true; + this.magazineId.Resizable = System.Windows.Forms.DataGridViewTriState.False; + // + // positionId + // + this.positionId.DataPropertyName = "positionId"; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; + this.positionId.DefaultCellStyle = dataGridViewCellStyle4; + this.positionId.FillWeight = 94.61015F; + this.positionId.HeaderText = "Position Id"; + this.positionId.Name = "positionId"; + this.positionId.ReadOnly = true; + // + // physicalType + // + this.physicalType.DataPropertyName = "physicalType"; + this.physicalType.HeaderText = "Physical Type"; + this.physicalType.Name = "physicalType"; + // + // positionType + // + this.positionType.DataPropertyName = "type"; + this.positionType.FillWeight = 100.1069F; + this.positionType.HeaderText = "Type"; + this.positionType.Name = "positionType"; + // + // ShankId + // + this.ShankId.DataPropertyName = "shankId"; + this.ShankId.HeaderText = "Shank Id"; + this.ShankId.Name = "ShankId"; + // + // magazineToolId + // + this.magazineToolId.DataPropertyName = "toolId"; + this.magazineToolId.HeaderText = "Tool Id"; + this.magazineToolId.Name = "magazineToolId"; + // + // disablePosition + // + this.disablePosition.DataPropertyName = "disabled"; + this.disablePosition.FalseValue = "0"; + this.disablePosition.HeaderText = "Disabled"; + this.disablePosition.Name = "disablePosition"; + this.disablePosition.TrueValue = "1"; + // // DemoApplicationForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2586,16 +2594,17 @@ namespace Nc_Demo_Application private System.Windows.Forms.TextBox maxEdgeXToolTxb; private System.Windows.Forms.Label label28; private System.Windows.Forms.TextBox maxToolTxb; - private System.Windows.Forms.DataGridViewTextBoxColumn magazineId; - private System.Windows.Forms.DataGridViewTextBoxColumn positionId; - private System.Windows.Forms.DataGridViewTextBoxColumn positionType; - private System.Windows.Forms.DataGridViewTextBoxColumn ShankId; - private System.Windows.Forms.DataGridViewTextBoxColumn magazineToolId; - private System.Windows.Forms.DataGridViewCheckBoxColumn disablePosition; private System.Windows.Forms.Label label32; private System.Windows.Forms.TextBox multitoolIdTxb; private System.Windows.Forms.CheckBox magPositionOptionCheckbox; private System.Windows.Forms.CheckBox familyOptCheckbox; + private System.Windows.Forms.DataGridViewTextBoxColumn magazineId; + private System.Windows.Forms.DataGridViewTextBoxColumn positionId; + private System.Windows.Forms.DataGridViewTextBoxColumn physicalType; + private System.Windows.Forms.DataGridViewTextBoxColumn positionType; + private System.Windows.Forms.DataGridViewTextBoxColumn ShankId; + private System.Windows.Forms.DataGridViewTextBoxColumn magazineToolId; + private System.Windows.Forms.DataGridViewCheckBoxColumn disablePosition; } } 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 38c8b0c..b100993 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 @@ -171,7 +171,7 @@ namespace Nc_Demo_Application magazinesGridView.DataSource = magazines; // Set UI components data MagazineActionModel magAction = DatabaseController.getInstance().ReadMagazinesAction(); - magActionAction.SelectedItem = magAction.action; + magActionAction.SelectedItem = magAction.Action; magActionToolId.Text = magAction.Tool.Id.ToString(); magActionOrigMag.Text = magAction.OriginMagazine.ToString(); magActionOrigPos.Text = magAction.OriginPosition.ToString(); @@ -729,7 +729,7 @@ namespace Nc_Demo_Application MagazineActionModel magAction = new MagazineActionModel() { - action = (MAGAZINE_ACTIONS)magActionAction.SelectedItem, + Action = (MAGAZINE_ACTIONS)magActionAction.SelectedItem, Tool = new MagazineActionToolModel() { Id = Convert.ToInt32(magActionToolId.Text) }, OriginMagazine = Convert.ToInt32(magActionOrigMag.Text), OriginPosition = Convert.ToInt32(magActionOrigPos.Text), 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 46c8073..2cc08d7 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 @@ -141,6 +141,9 @@ True + + True + True