From 5ac19ed86f52c5a92c8b9703dc9a81b3f30b5d85 Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Thu, 21 Feb 2019 12:44:42 +0000 Subject: [PATCH] --- CMS_CORE_Library/Fanuc/Nc_Fanuc.cs | 5 ++++- CMS_CORE_Library/Models/CmsError.cs | 3 ++- CMS_CORE_Library/Models/DataStructures.cs | 1 + CMS_CORE_Library/Models/SiemensToolModels.cs | 4 ++-- CMS_CORE_Library/Osai/Nc_Osai.cs | 7 +++++-- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 3 +++ CMS_CORE_Library/ToolConfigurations.cs | 10 +++++----- CMS_CORE_Library/Utils/Nc_Utils.cs | 2 +- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 66a46c9..e72bfbc 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -720,7 +720,7 @@ namespace CMS_CORE_Library.Fanuc { //List val = new List(); //// Read ints - //CmsError cmsError = MEM_RWDWordList(R, 0, COUNTERS_DATA.MemType, COUNTERS_DATA.Address, COUNTERS_DATA.SubAddress, COUNTERS_DATA.Size / 4, ref val); + //CmsError cmsError = MEM_RWDWordList(R, 0, COUNTERS_DATA.MemType, COUNTERS_DATA.Address, COUNTERS_DATA.Size / 4, ref val); //if (cmsError.IsError()) // return cmsError; @@ -1325,6 +1325,9 @@ namespace CMS_CORE_Library.Fanuc procNumber = (ushort)(i + 1); } + if (procNumber == 0) + return SELECTED_PROCESS_ERROR; + return NO_ERROR; } diff --git a/CMS_CORE_Library/Models/CmsError.cs b/CMS_CORE_Library/Models/CmsError.cs index 2a17d8a..429f822 100644 --- a/CMS_CORE_Library/Models/CmsError.cs +++ b/CMS_CORE_Library/Models/CmsError.cs @@ -57,6 +57,7 @@ FILE_NOT_FOUND = 22, PLC_NOT_RUNNING = 23, HMI_NOT_RESPONDING = 24, - PROGRAM_IS_SELECTED = 25 + PROGRAM_IS_SELECTED = 25, + SELECTED_PROCESS = 26 } } \ No newline at end of file diff --git a/CMS_CORE_Library/Models/DataStructures.cs b/CMS_CORE_Library/Models/DataStructures.cs index 0489b4e..7e9d91c 100644 --- a/CMS_CORE_Library/Models/DataStructures.cs +++ b/CMS_CORE_Library/Models/DataStructures.cs @@ -179,6 +179,7 @@ namespace CMS_CORE_Library.Models public static CmsError PLC_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.PLC_NOT_RUNNING, "error_plc_not_running"); public static CmsError HMI_NOT_RESPONDING_ERROR = new CmsError(CMS_ERROR_CODES.HMI_NOT_RESPONDING, "error_hmi_not_responding"); public static CmsError PROGRAM_IS_SELECTED_ERROR = new CmsError(CMS_ERROR_CODES.PROGRAM_IS_SELECTED, "error_program_is_selected"); + public static CmsError SELECTED_PROCESS_ERROR = new CmsError(CMS_ERROR_CODES.PROGRAM_IS_SELECTED, "error_selected_process_not_found"); #endregion Cms Errors Codes diff --git a/CMS_CORE_Library/Models/SiemensToolModels.cs b/CMS_CORE_Library/Models/SiemensToolModels.cs index 43f75da..4b30821 100644 --- a/CMS_CORE_Library/Models/SiemensToolModels.cs +++ b/CMS_CORE_Library/Models/SiemensToolModels.cs @@ -168,8 +168,8 @@ namespace CMS_CORE_Library.Models public string SubCategory; public bool ReadOnly; public Dictionary SelectValues; - public uint MinValue; - public uint MaxValue; + public int MinValue; + public int MaxValue; } public class FamiliesConfiguration diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index 18218b8..6efc4ec 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -652,7 +652,7 @@ namespace CMS_CORE_Library.Osai { List val = new List(); // Read ints - CmsError cmsError = MEM_RWDWordList(R, 0, COUNTERS_DATA.MemType, COUNTERS_DATA.Address, COUNTERS_DATA.SubAddress, COUNTERS_DATA.Size / 4, ref val); + CmsError cmsError = MEM_RWDWordList(R, 0, COUNTERS_DATA.MemType, COUNTERS_DATA.Address, COUNTERS_DATA.Size / 4, ref val); if (cmsError.IsError()) return cmsError; @@ -1414,6 +1414,9 @@ namespace CMS_CORE_Library.Osai procNumber = (ushort)(i + 1); } + if (procNumber == 0) + return SELECTED_PROCESS_ERROR; + return NO_ERROR; } @@ -3871,7 +3874,7 @@ namespace CMS_CORE_Library.Osai try { //Execute the method - nReturn = OpenNC.GetActivePartProgram(procNumber, out Level, out mainPath, out SubPath, out errorClass, out errorNum); + nReturn = OpenNC.GetActivePartProgramFullPath(procNumber, out Level, out mainPath, out SubPath, out errorClass, out errorNum); //If there's an error launch exception\ if (errorClass != 0 || errorNum != 0 || nReturn == 0) diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index bb936db..70bd5ef 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -1611,6 +1611,9 @@ namespace CMS_CORE_Library.Siemens public override CmsError PROC_RSelectedProcess(ref ushort procNumber) { + if (SelectedProcess == 0) + return SELECTED_PROCESS_ERROR; + procNumber = SelectedProcess; //CmsError cmsError; //bool readValue = false; diff --git a/CMS_CORE_Library/ToolConfigurations.cs b/CMS_CORE_Library/ToolConfigurations.cs index 686853f..631c8f9 100644 --- a/CMS_CORE_Library/ToolConfigurations.cs +++ b/CMS_CORE_Library/ToolConfigurations.cs @@ -316,7 +316,7 @@ namespace CMS_CORE_Library ShankConfiguration = new List() { new FieldsConfiguration{ Name = "id", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, - new FieldsConfiguration{ Name = "balluf", Type = "int", SelectValues = null, Category = "balluf", ReadOnly = false, MinValue = 0, MaxValue = (uint)short.MaxValue }, + new FieldsConfiguration{ Name = "balluf", Type = "int", SelectValues = null, Category = "balluf", ReadOnly = false, MinValue = 0, MaxValue = short.MaxValue }, new FieldsConfiguration{ Name = "magazinePositionType", Type = "int", SelectValues = null, Category = "magPosType", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue }, new FieldsConfiguration{ Name = "magazineId", Type = "int", SelectValues = null, Category = "position", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue }, new FieldsConfiguration{ Name = "positionId", Type = "int", SelectValues = null, Category = "position", ReadOnly = true, MinValue = 0, MaxValue = byte.MaxValue }, @@ -343,10 +343,10 @@ namespace CMS_CORE_Library EdgeConfiguration = new List() { new FieldsConfiguration{Name = "id", Type = "int", SelectValues = null, Category = "general", ReadOnly = true, MinValue = 0, MaxValue = 0 }, - new FieldsConfiguration{Name = "length", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = uint.MaxValue }, - new FieldsConfiguration{Name = "radius", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = uint.MaxValue }, - new FieldsConfiguration{Name = "wearLength", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = uint.MaxValue }, - new FieldsConfiguration{Name = "wearRadius", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = uint.MaxValue } + new FieldsConfiguration{Name = "length", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue }, + new FieldsConfiguration{Name = "radius", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue }, + new FieldsConfiguration{Name = "wearLength", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = int.MinValue, MaxValue = int.MaxValue }, + new FieldsConfiguration{Name = "wearRadius", Type = "double", SelectValues = null, Category = "general", ReadOnly = false, MinValue = int.MinValue, MaxValue = int.MaxValue } }, EdgesAdditionalParamsConfiguration = new Dictionary>() // Set value runtime, based on NC vendor }; diff --git a/CMS_CORE_Library/Utils/Nc_Utils.cs b/CMS_CORE_Library/Utils/Nc_Utils.cs index 21807d3..6936fdc 100644 --- a/CMS_CORE_Library/Utils/Nc_Utils.cs +++ b/CMS_CORE_Library/Utils/Nc_Utils.cs @@ -123,7 +123,7 @@ namespace CMS_CORE_Library.Utils List uInt = new List(); // Fill the List - for (int i = 0; i < (UintVal.Count / 2); i = i + 2) + for (int i = 0; i < (UintVal.Count); i = i + 2) { WordTOUint(out uint value, UintVal[i], UintVal[i + 1]); uInt.Add(value);