using System; namespace CMS_CORE_Library.Models { public class CmsError { public CMS_ERROR_CODES errorCode; public string localizationKey; public Exception exception; public CmsError(CMS_ERROR_CODES errorCode, string message, Exception exception) { this.errorCode = errorCode; this.localizationKey = message; this.exception = exception; } public CmsError(CMS_ERROR_CODES errorCode, string message) { this.errorCode = errorCode; this.localizationKey = message; } public bool IsError() { if (errorCode == CMS_ERROR_CODES.OK) return false; else return true; } public static CmsError InternalError(string message, Exception exception) { return new CmsError(CMS_ERROR_CODES.INTERNAL_ERROR, message, exception); } public static CmsError NcError(string message) { return new CmsError(CMS_ERROR_CODES.NC_PROD_ERROR, message); } } public enum CMS_ERROR_CODES : uint { OK = 0, NC_PROD_ERROR = 1, NOT_CONNECTED = 2, PROC_NOT_FOUND = 3, FUNCTION_NOT_ALLOWED = 4, BIT_NOT_IN_RANGE = 5, BYTE_NOT_IN_RANGE = 6, INTERNAL_ERROR = 7, INCORRECT_PARAMETERS = 8, NC_LANGUAGE_ERROR = 9, SIEMENS_ENVIRONMENT_NOT_FOUND = 10, SIEMENS_HMI_NOT_RUNNING = 11, MAX_TOOL_REACHED = 12, MAX_EDGES_PER_TOOL_REACHED = 13, MAX_FAMILY_REACHED = 14, MAX_MULTITOOL_REACHED = 15, MAX_TOOLS_PER_MULTITOOL_REACHED = 16, MAX_MULTITOOL_LOCATION_REACHED = 17, MAG_POS_OCCUPIED = 18, MAGAZINE_OCCUPIED = 19, TOOL_IS_MOUNTED = 20, TOOL_AND_POSITION_NOT_MATCHING = 21, FILE_NOT_FOUND = 22, PLC_NOT_RUNNING = 23, HMI_NOT_RESPONDING = 24, PROGRAM_IS_SELECTED = 25, SELECTED_PROCESS = 26, OSAI_TT_FOLDER_NOT_FOUND = 27, OPTION_NOT_CONSISTENT = 28, WRONG_CMS_PP = 29, SIEMENS_TOOL_TABLE_ERROR = 30, PLC_IP_NOT_FOUND = 31, PLC_MEM_CONF_ERROR = 32, S7NET_READ_ERROR = 33, S7NET_WRITE_ERROR = 34 } }