Fix tool table siemens

This commit is contained in:
Lucio Maranta
2019-10-01 15:31:34 +00:00
parent b52047213c
commit 63a60ec94c
3 changed files with 16 additions and 3 deletions
+3
View File
@@ -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);
+13 -2
View File
@@ -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
-1
View File
@@ -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 }
};