diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index 4212d84..e1e1c28 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -120,6 +120,9 @@ namespace CMS_CORE_Application sw.Restart(); N.NC_Connect(); + AssistedToolingModel a = new AssistedToolingModel(); + N.PLC_RAssistedToolingData(ref a); + sw.Stop(); Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds); diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 135e8d5..57ae673 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -3685,6 +3685,7 @@ namespace CMS_CORE_Library.Siemens private CmsError CheckToolData(ref SiemensToolModel tool) { + int toolId = tool.Id; //Check if the NC is Connected CmsError cmsError = CheckConnection(); if (cmsError.IsError()) @@ -3695,7 +3696,7 @@ namespace CMS_CORE_Library.Siemens return MAX_TOOL_REACHED_ERROR; // Check if family has reached max tool number string family = tool.FamilyName; - int toolsWithSameFamily = ToolTableData.Where(x => x.FamilyName == family).Count(); + int toolsWithSameFamily = ToolTableData.Where(x => x.FamilyName == family && x.Id != toolId).Count(); if (toolsWithSameFamily >= MAX_TOOLS_PER_FAMILY) return MAX_FAMILY_REACHED_ERROR; @@ -5896,7 +5897,7 @@ namespace CMS_CORE_Library.Siemens private void ActionsHandler(ToolInfo toolInfo) { - switch (toolInfo.action) + switch (toolInfo.action) { case ToolAction.TOOL_DELETED: { @@ -5964,10 +5965,20 @@ namespace CMS_CORE_Library.Siemens // Get tool new data SiemensToolModel newTool = CreateToolFromId((int)toolInfo.tNo, toolsStrings); + // *ASSISTED TOOLING FIX* + // After one reset in an assisted tooling procedure siemens send a "tool_data_changed" message + // Check if tool is not mounted and remove from magazine + int magIndex = MagazineMountedTools.FindIndex(x => x.ToolId == newTool.Id); + if ((magIndex > 0 && newTool.MagazineId == 0) || (magIndex == -1 && newTool.MagazineId != 0)) + { + MountToolToMagazineList(newTool.Id, newTool.MagazineId, newTool.PositionId); + } + // Replace the element if (newTool != null) ToolTableData[toolIndex] = newTool; } + //*SHANK FIX*else if (MULTITOOL_OPTION_ACTIVE) //{ // // Find if its a multitool diff --git a/CMS_CORE_Library/ToolConfigurations.cs b/CMS_CORE_Library/ToolConfigurations.cs index 5de66d6..04edd70 100644 --- a/CMS_CORE_Library/ToolConfigurations.cs +++ b/CMS_CORE_Library/ToolConfigurations.cs @@ -221,7 +221,6 @@ namespace CMS_CORE_Library 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 = "usedBySpindle", Type = "boolean", 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 } };