Fixed a lot of issues

This commit is contained in:
Nicola Carminati
2018-09-21 07:55:31 +00:00
parent 2375c26b25
commit 674c68ac1d
7 changed files with 93 additions and 55 deletions
+2
View File
@@ -305,6 +305,7 @@ namespace CMS_CORE_Library
public class QueueStatusModel
{
public int ProcessId;
public bool LoadNextProgram;
public QUEUE_STATUS Status;
public bool StartStopQueueEnabled;
@@ -741,6 +742,7 @@ namespace CMS_CORE_Library
public bool MultitoolOptionActive;
public bool FamilyOptionActive;
public bool MagPositionOptionActive;
public bool OffsetOptionActive;
public List<SiemensMagazineConfigModel> Magazines;
public List<FieldsConfiguration> ToolsConfiguration;
+48 -31
View File
@@ -1796,47 +1796,63 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError FILES_RQueueData(ref QueueStatusModel status)
public override CmsError FILES_RQueueData(ref List<QueueStatusModel> statusList)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
// Read status
byte readStatus = 0;
cmsError = MEM_RWByte(R, 0, QUEUE_STATUS_MEM.MemType, QUEUE_STATUS_MEM.Address, 0, ref readStatus);
// Read all the values
List<int> ints = new List<int>();
CmsError cmsError = MEM_RWIntegerList(R, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address, 6, ref ints);
if (cmsError.IsError())
return cmsError;
// Read next cmd
byte next = 0;
cmsError = MEM_RWByte(R, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address, 0, ref next);
int processId = 0;
// Foreach value
foreach(var val in ints)
{
byte[] bytes = BitConverter.GetBytes(val);
if (bytes[0] == 1)
{
// Read tool manager status
byte zero = 0;
cmsError = MEM_RWByte(W, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address + (processId * 4), 0, ref zero);
if (cmsError.IsError())
return cmsError;
}
QueueStatusModel tmpStatus = new QueueStatusModel()
{
LoadNextProgram = bytes[0] == 1,
Status = (QUEUE_STATUS)bytes[1],
StartStopQueueEnabled = bytes[2] == 1,
ProcessId = processId + 1
};
statusList.Add(tmpStatus);
processId += 1;
};
return NO_ERROR;
}
public override CmsError FILES_RQueueDataByProcess(ref QueueStatusModel status, int processId)
{
// Read all the values
int ints = 0;
CmsError cmsError = MEM_RWInteger(R, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address + ((processId - 1) * 4), ref ints);
if (cmsError.IsError())
return cmsError;
// Read start & stop
byte startStopActive = 0;
cmsError = MEM_RWByte(R, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address, 0, ref startStopActive);
if (cmsError.IsError())
return cmsError;
byte[] bytes = BitConverter.GetBytes(ints);
status = new QueueStatusModel()
{
LoadNextProgram = next == 1,
Status = (QUEUE_STATUS)readStatus,
StartStopQueueEnabled = startStopActive == 1
LoadNextProgram = bytes[0] == 1,
Status = (QUEUE_STATUS)bytes[1],
StartStopQueueEnabled = bytes[2] == 1,
ProcessId = processId
};
if (next == 1)
{
// Read tool manager status
byte val = 0;
cmsError = MEM_RWByte(W, 0, QUEUE_NEXT.MemType, QUEUE_NEXT.Address, 0, ref val);
if (cmsError.IsError())
return cmsError;
}
return NO_ERROR;
}
@@ -2988,7 +3004,8 @@ namespace CMS_CORE.Demo
internal static MEMORY_CELL MAGAZINES_ENABLED_CMD = new MEMORY_CELL(MEMORY_TYPE.Demo, 441, 4);
internal static MEMORY_CELL QUEUE_NEXT = new MEMORY_CELL(MEMORY_TYPE.Demo, 445, 1);
internal static MEMORY_CELL QUEUE_STATUS_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 446, 1);
internal static MEMORY_CELL QUEUE_CMD = new MEMORY_CELL(MEMORY_TYPE.Demo, 447, 1);
internal static MEMORY_CELL QUEUE_START_STOP_ACTIVE = new MEMORY_CELL(MEMORY_TYPE.Demo, 447, 1);
internal static MEMORY_CELL QUEUE_CMD = new MEMORY_CELL(MEMORY_TYPE.Demo, 448, 1);
}
#endregion Memory addresses
+11 -8
View File
@@ -144,11 +144,11 @@ namespace CMS_CORE.Fanuc
byte langToWrite = (byte)(ConvertToNCLanguage(Language) | 128);
// write the byte
CmsError cmsError = MEM_RWByte(W,0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 0, ref langToWrite);
CmsError cmsError = MEM_RWByte(W, 0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 0, ref langToWrite);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
@@ -1606,7 +1606,7 @@ namespace CMS_CORE.Fanuc
{
return NO_ERROR;
}
public override CmsError FILES_RGetFileInfo(string path, ref InfoFile fileInfo)
{
return NO_ERROR;
@@ -1740,11 +1740,14 @@ namespace CMS_CORE.Fanuc
return NO_ERROR;
}
public override CmsError FILES_RQueueData(ref QueueStatusModel status)
public override CmsError FILES_RQueueData(ref List<QueueStatusModel> statusList)
{
return NO_ERROR;
}
public override CmsError FILES_RQueueDataByProcess(ref QueueStatusModel status, int processId)
{ return NO_ERROR; }
public override CmsError FILES_WStartQueue()
{
return NO_ERROR;
@@ -1762,9 +1765,9 @@ namespace CMS_CORE.Fanuc
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Tools Management
#region Tools Management
public override CmsError TOOLS_RConfiguration(ref ToolTableConfiguration config)
{
@@ -1936,7 +1939,7 @@ namespace CMS_CORE.Fanuc
{
return NO_ERROR;
}
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
{
return NO_ERROR;
@@ -1998,7 +2001,7 @@ namespace CMS_CORE.Fanuc
default: return 0;
}
}
private CmsError ErrorHandler(short exNum)
{
if (exNum != 0)
+4 -2
View File
@@ -1366,8 +1366,10 @@ namespace CMS_CORE
public abstract CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName);
public abstract CmsError FILES_RQueueData(ref QueueStatusModel status);
public abstract CmsError FILES_RQueueData(ref List<QueueStatusModel> statusList);
public abstract CmsError FILES_RQueueDataByProcess(ref QueueStatusModel status, int processId);
public abstract CmsError FILES_WStartQueue();
public abstract CmsError FILES_WStopQueue();
+7 -3
View File
@@ -130,8 +130,9 @@ namespace CMS_CORE.Osai
public override CmsError NC_Disconnect()
{
//Set Connected to FALSE and close the session
OpenNC.Close();
Connected = false;
if(Connected)
OpenNC.Close();
Connected = false;
return NO_ERROR;
}
@@ -2312,11 +2313,14 @@ namespace CMS_CORE.Osai
return NO_ERROR;
}
public override CmsError FILES_RQueueData(ref QueueStatusModel status)
public override CmsError FILES_RQueueData(ref List<QueueStatusModel> statusList)
{
return NO_ERROR;
}
public override CmsError FILES_RQueueDataByProcess(ref QueueStatusModel status, int processId)
{ return NO_ERROR; }
public override CmsError FILES_WStartQueue()
{
return NO_ERROR;
+5 -1
View File
@@ -2142,11 +2142,15 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError FILES_RQueueData(ref QueueStatusModel status)
public override CmsError FILES_RQueueData(ref List<QueueStatusModel> statusList)
{
return NO_ERROR;
}
public override CmsError FILES_RQueueDataByProcess(ref QueueStatusModel status, int processId)
{ return NO_ERROR; }
public override CmsError FILES_WStartQueue()
{
return NO_ERROR;
+16 -10
View File
@@ -73,6 +73,14 @@ namespace CMS_CORE_Library
{7, "loading_point" }
};
private static Dictionary<int, string> cmsRotationTypeList = new Dictionary<int, string>()
{
{0, "none"},
{1, "clockWhise"},
{2, "counterClockWhise"},
{3, "doubleRotation"}
};
#endregion PRIVATE_SELECTS_VALUES
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -180,16 +188,14 @@ namespace CMS_CORE_Library
new FieldsConfiguration{ Name = "id", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0},
new FieldsConfiguration{ Name = "shankId", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0},
new FieldsConfiguration{ Name = "familyId", Type = "select", SelectValues = new Dictionary<int, string>(), Category = "general", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "offsetLength", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
//new FieldsConfiguration{ Name = "offsetLength", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "disabled", Type = "boolean", SelectValues = null, Category = "status", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "broken", Type = "boolean", SelectValues = null, Category = "status", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "measured", Type = "boolean", SelectValues = null, Category = "status", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "clockwiseRotation", Type = "boolean", SelectValues = null, Category = "status", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "counterClockwiseRotation", Type = "boolean", SelectValues = null, Category = "status", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "residualLife", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "offsetId1", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "offsetId2", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "offsetId3", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "residualLife", Type = "int", SelectValues = null, Category = "life", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "offsetId1", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "offsetId2", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
new FieldsConfiguration{ Name = "offsetId3", Type = "int", SelectValues = null, Category = "offset", ReadOnly = false, MinValue = 0, MaxValue = ushort.MaxValue},
};
public static FamiliesConfiguration NcFamilyFieldsConfig = new FamiliesConfiguration()
@@ -199,11 +205,11 @@ namespace CMS_CORE_Library
new FieldsConfiguration{ Name = "id", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0},
new FieldsConfiguration{ Name = "name", Type = "string", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = 0},
new FieldsConfiguration{ Name = "toolType", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "leftSize", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rightSize", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "leftSize", Type = "int", SelectValues = null, Category = "magazine", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rightSize", Type = "int", SelectValues = null, Category = "magazine", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "tcpTable", Type = "int", SelectValues = null, Category = "tcp", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "gamma", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rotationType", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rotationType", Type = "select", SelectValues = cmsRotationTypeList, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "cooling", Type = "boolean", SelectValues = null, Category = "cooling", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},
new FieldsConfiguration{ Name = "cooling1", Type = "boolean", SelectValues = null, Category = "cooling", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},