This commit is contained in:
@@ -129,10 +129,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
private static DataSvc SelectedProcessSvc;
|
||||
|
||||
private static ushort SelectedProcess = 0;
|
||||
private static Hashtable MachineAxesPosition = new Hashtable();
|
||||
private static Hashtable ToGoAxesPosition = new Hashtable();
|
||||
private static Hashtable InterpAxesPosition = new Hashtable();
|
||||
private static Hashtable ProgrammedAxisPosition = new Hashtable();
|
||||
private static Dictionary<string, double> MachineAxesPosition = new Dictionary<string, double>();
|
||||
private static Dictionary<string, double> ToGoAxesPosition = new Dictionary<string, double>();
|
||||
private static Dictionary<string, double> InterpAxesPosition = new Dictionary<string, double>();
|
||||
private static Dictionary<string, double> ProgrammedAxisPosition = new Dictionary<string, double>();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1773,11 +1773,11 @@ namespace CMS_CORE_Library.Siemens
|
||||
axes = new Dictionary<string, double>();
|
||||
// Cycle between axes
|
||||
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
|
||||
foreach (DictionaryEntry axis in InterpAxesPosition)
|
||||
// axes = InterpAxesPosition.ToDictionary(x => x.Key, x => x.Value); This code throws exceptions
|
||||
foreach (var axis in InterpAxesPosition.ToList())
|
||||
{
|
||||
axes.Add(axis.Key.ToString(), Convert.ToDouble(axis.Value));
|
||||
axes.Add(axis.Key, axis.Value);
|
||||
}
|
||||
// axes = InterpAxesPosition.ToDictionary(x => x.Key, x => x.Value); This throws exceptions
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1795,11 +1795,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Cycle between axes
|
||||
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
|
||||
foreach (DictionaryEntry axis in MachineAxesPosition)
|
||||
foreach (var axis in MachineAxesPosition.ToList())
|
||||
{
|
||||
axes.Add(axis.Key.ToString(), Convert.ToDouble(axis.Value));
|
||||
axes.Add(axis.Key, axis.Value);
|
||||
}
|
||||
// axes = MachineAxesPosition.ToDictionary(x => x.Key, x => x.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1817,11 +1816,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Cycle between axes
|
||||
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
|
||||
foreach (DictionaryEntry axis in ProgrammedAxisPosition)
|
||||
foreach (var axis in ProgrammedAxisPosition.ToList())
|
||||
{
|
||||
axes.Add(axis.Key.ToString(), Convert.ToDouble(axis.Value));
|
||||
axes.Add(axis.Key, axis.Value);
|
||||
}
|
||||
// axes = ProgrammedAxisPosition.ToDictionary(x => x.Key, x => x.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1839,11 +1837,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Cycle between axes
|
||||
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
|
||||
foreach (DictionaryEntry axis in InterpAxesPosition)
|
||||
foreach (var axis in InterpAxesPosition.ToList())
|
||||
{
|
||||
axes.Add(axis.Key.ToString(), Convert.ToDouble(axis.Value));
|
||||
axes.Add(axis.Key, axis.Value);
|
||||
}
|
||||
// axes = MachineAxesPosition.ToDictionary(x => x.Key, x => x.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1861,11 +1858,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
// Cycle between axes
|
||||
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
|
||||
foreach (DictionaryEntry axis in ToGoAxesPosition)
|
||||
foreach (var axis in ToGoAxesPosition.ToList())
|
||||
{
|
||||
axes.Add(axis.Key.ToString(), Convert.ToDouble(axis.Value));
|
||||
axes.Add(axis.Key, axis.Value);
|
||||
}
|
||||
// axes = ToGoAxesPosition.ToDictionary(x => x.Key, x => x.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -5587,34 +5583,54 @@ namespace CMS_CORE_Library.Siemens
|
||||
}
|
||||
}
|
||||
|
||||
private void MountToolToMagazineList(int toolId, int magazineId, int positionId)
|
||||
private void MountToolToMagazineList(int toolId, int magazineId, int positionId)
|
||||
{
|
||||
// Remove tool from list
|
||||
MagazineMountedTools.RemoveAll(mountTool => PositionContainsTool(mountTool, toolId));
|
||||
|
||||
// If load magazine != 0, add new tool
|
||||
if (magazineId != 0 && positionId != 0)
|
||||
{
|
||||
// Find if position exist
|
||||
MountedToolModel mounted = MagazineMountedTools
|
||||
.Where(x => x.MagazineId == magazineId && x.PositionId == positionId)
|
||||
.FirstOrDefault();
|
||||
if (mounted != null)
|
||||
return;
|
||||
|
||||
// Find tool by id
|
||||
var tool = GetToolOrMultitool(toolId);
|
||||
if (tool != null)
|
||||
{
|
||||
if(magazineId == 9998)
|
||||
if (magazineId == 9998)
|
||||
{
|
||||
// Set magazine position as occupied
|
||||
// Get old tool position
|
||||
MountedToolModel toolMounted = MagazineMountedTools
|
||||
.Where(x => x.ToolId == toolId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if(toolMounted != null)
|
||||
{
|
||||
// Set magazine position as occupied
|
||||
var position = MagazinePositionsData.Where(x =>
|
||||
x.MagazineId == toolMounted.MagazineId
|
||||
&& x.PositionId == toolMounted.PositionId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (position != null)
|
||||
position.Occupied = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Free a position
|
||||
var position = MagazinePositionsData.Where(x => x.MagazineId == magazineId && x.PositionId == positionId).FirstOrDefault();
|
||||
if(position != null)
|
||||
position.Occupied = false;
|
||||
}
|
||||
|
||||
// Remove tool from list
|
||||
MagazineMountedTools.RemoveAll(mountTool => PositionContainsTool(mountTool, toolId));
|
||||
|
||||
// Find if position exist
|
||||
MountedToolModel mounted = MagazineMountedTools
|
||||
.Where(x => x.MagazineId == magazineId && x.PositionId == positionId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (mounted != null)
|
||||
return;
|
||||
|
||||
// Add tool to list
|
||||
MagazineMountedTools.Add(new MountedToolModel()
|
||||
{
|
||||
|
||||
@@ -277,9 +277,9 @@ namespace CMS_CORE_Library
|
||||
FamilyReadOnlyConfiguration = new List<FieldsConfiguration>()
|
||||
{
|
||||
new FieldsConfiguration{ Name = "name", Type = "string", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = 0},
|
||||
new FieldsConfiguration{ Name = "toolType", Type = "select", SelectValues = toolTypeCodeList, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "leftSize", Type = "int", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "rightSize", Type = "int", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "toolType", Type = "select", SelectValues = toolTypeCodeList, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "leftSize", Type = "int", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 1, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "rightSize", Type = "int", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 1, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "tcpTable", Type = "int", SelectValues = null, Category = "family", SubCategory = "tcp", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "gamma", Type = "int", SelectValues = null, Category = "family", SubCategory = "gamma", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
new FieldsConfiguration{ Name = "rotationType", Type = "int", SelectValues = null, Category = "family", SubCategory = "general", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue},
|
||||
|
||||
Reference in New Issue
Block a user