Refactor models
This commit is contained in:
@@ -0,0 +1,334 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using static CMS_CORE_Library.Nc;
|
||||
|
||||
namespace CMS_CORE_Library.Models
|
||||
{
|
||||
public class DataStructures
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Data structure models
|
||||
|
||||
// R-W MEMORY Cell
|
||||
internal struct MEMORY_CELL
|
||||
{
|
||||
public readonly MEMORY_TYPE MemType;
|
||||
public readonly int Address;
|
||||
public readonly int SubAddress; //Only for Siemens
|
||||
public readonly int Size;
|
||||
|
||||
public MEMORY_CELL(MEMORY_TYPE MType, int Addr, int SubAddr, int Sz)
|
||||
{
|
||||
MemType = MType;
|
||||
Address = Addr;
|
||||
SubAddress = SubAddr;
|
||||
Size = Sz;
|
||||
}
|
||||
|
||||
public MEMORY_CELL(MEMORY_TYPE MType, int Addr, int Sz)
|
||||
{
|
||||
MemType = MType;
|
||||
Address = Addr;
|
||||
SubAddress = 0;
|
||||
Size = Sz;
|
||||
}
|
||||
}
|
||||
|
||||
public class AlarmModel
|
||||
{
|
||||
public uint Id;
|
||||
public string Message;
|
||||
public bool IsWarning;
|
||||
public int Process;
|
||||
public DateTime DateTime;
|
||||
}
|
||||
|
||||
public class PlcAlarmModel
|
||||
{
|
||||
public uint Id;
|
||||
public bool IsWarning;
|
||||
public bool RestorationIsActive;
|
||||
public List<int> Process;
|
||||
}
|
||||
|
||||
public class ProcessDataModel
|
||||
{
|
||||
public uint Id;
|
||||
public string Type;
|
||||
public bool IsInAlarm;
|
||||
public string PartProgramName;
|
||||
public string Status;
|
||||
public bool Visible;
|
||||
public ushort Reps;
|
||||
public bool IsSelected;
|
||||
}
|
||||
|
||||
public class FunctionalityModel
|
||||
{
|
||||
public uint Id;
|
||||
public bool IsActive;
|
||||
}
|
||||
|
||||
public struct StrobeModel
|
||||
{
|
||||
public uint Id;
|
||||
public bool IsActive;
|
||||
}
|
||||
|
||||
public class AxisResetDataModel
|
||||
{
|
||||
public bool IsActive;
|
||||
public int Percentage;
|
||||
|
||||
public AxisResetDataModel()
|
||||
{
|
||||
IsActive = false;
|
||||
Percentage = 0;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as AxisResetDataModel;
|
||||
|
||||
if (IsActive == item.IsActive && Percentage == item.Percentage)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public struct CounterModel
|
||||
{
|
||||
public uint Id;
|
||||
public uint Value;
|
||||
}
|
||||
|
||||
public class SoftKeysModel
|
||||
{
|
||||
public uint Id;
|
||||
public bool Active;
|
||||
public bool Value;
|
||||
}
|
||||
|
||||
public class HeadDataModel
|
||||
{
|
||||
public uint Id;
|
||||
public byte Process;
|
||||
public byte Override;
|
||||
public ushort Load_Abrasive;
|
||||
public int ActualSpeed_Pressure;
|
||||
public short MountedTool_Vacum;
|
||||
|
||||
public bool IsActive;
|
||||
public bool IsSelected;
|
||||
public bool OverrideEditable;
|
||||
public bool AbrasiveIsActive;
|
||||
}
|
||||
|
||||
public class AxisModel
|
||||
{
|
||||
public int Id;
|
||||
public string Name;
|
||||
}
|
||||
|
||||
public class PreviewFileModel
|
||||
{
|
||||
public string Name;
|
||||
public string Path;
|
||||
public string AbsolutePath;
|
||||
public bool IsDirectory;
|
||||
}
|
||||
|
||||
public class InfoFile
|
||||
{
|
||||
public string Name;
|
||||
public DateTime CreationDate;
|
||||
public DateTime LastModDate;
|
||||
public List<string> Content;
|
||||
public string PreviewBase64;
|
||||
public string AbsolutePath;
|
||||
}
|
||||
|
||||
public class ActiveProgramDataModel
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public List<string> IsoLines { get; set; }
|
||||
public DateTime TimeLeft { get; set; }
|
||||
}
|
||||
|
||||
public class QueueStatusModel
|
||||
{
|
||||
public int ProcessId;
|
||||
public bool LoadNextProgram;
|
||||
public QUEUE_STATUS Status;
|
||||
public bool StartStopQueueEnabled;
|
||||
}
|
||||
|
||||
public enum QUEUE_STATUS
|
||||
{
|
||||
NOT_ACTIVE = 0,
|
||||
RUNNING = 1,
|
||||
WAITING_OPERATOR = 2,
|
||||
CLOSING = 3
|
||||
}
|
||||
|
||||
#endregion Data structure models
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Constants
|
||||
|
||||
public static readonly string[] VALID_PP_FORMATS = { ".txt", ".cnc", ".ini" };
|
||||
public static readonly string[] VALID_IMAGE_FORMATS = { ".jpg", ".jpeg", ".png" };
|
||||
|
||||
public static readonly string IMAGES_PATH = @"C:\CMS\STEP\pp_img\";
|
||||
|
||||
public const int USER_SOFTKEYS_NUMBER = 128;
|
||||
public const int NC_SOFTKEYS_NUMBER = 32;
|
||||
public const int PROCESS_NUMBER = 6;
|
||||
public const int ALARMS_NUMBER = 1024;
|
||||
public const int HEADS_NUMBER = 20;
|
||||
|
||||
public enum HEAD_OVERRIDE_SIGN
|
||||
{
|
||||
PLUS = 0,
|
||||
MINUS = 1
|
||||
}
|
||||
|
||||
/** <summary>Process-Status</summary> */
|
||||
|
||||
public enum PROC_STATUS : ushort
|
||||
{
|
||||
/** <summary>Idle-Status</summary> */
|
||||
IDLE = 1,
|
||||
/** <summary>Run-Status</summary> */
|
||||
RUN = 2,
|
||||
/** <summary>Hold-Status</summary> */
|
||||
HOLD = 3,
|
||||
/** <summary>Error-Status</summary> */
|
||||
ERROR = 4,
|
||||
/** <summary>Reset-Status</summary> */
|
||||
RESET = 5,
|
||||
/** <summary>Emergency-Status</summary> */
|
||||
EMERG = 6
|
||||
};
|
||||
|
||||
/** <summary>CMS-Process-Mode</summary> */
|
||||
|
||||
public enum PROC_MODE : ushort
|
||||
{
|
||||
/** <summary>Automatic-Mode</summary> */
|
||||
AUTO = 1,
|
||||
/** <summary>Edit-Mode</summary> */
|
||||
EDIT = 2,
|
||||
/** <summary>Mdi-Mode</summary> */
|
||||
MDI = 3,
|
||||
/** <summary>Remote-Mode</summary> */
|
||||
REMOTE = 4,
|
||||
/** <summary>Teach-Mode</summary> */
|
||||
TEACH = 5,
|
||||
/** <summary>Ref-Mode</summary> */
|
||||
REF = 6,
|
||||
/** <summary>Jog-Mode</summary> */
|
||||
JOG = 7,
|
||||
/** <summary>Joginc-Mode</summary> */
|
||||
JOGINC = 8,
|
||||
/** <summary>Ret_on_Profile-Mode</summary> */
|
||||
RETPROF = 9,
|
||||
/** <summary>Handle-Mode</summary> */
|
||||
HANDLE = 10,
|
||||
/** <summary>Restart-Mode</summary> */
|
||||
RESTART = 11,
|
||||
/** <summary>Error-Mode</summary> */
|
||||
ERROR = 12
|
||||
};
|
||||
|
||||
public enum MAGAZINE_ACTIONS
|
||||
{
|
||||
NONE = 0,
|
||||
LOADING = 1,
|
||||
UNLOADING = 2,
|
||||
TRANSFER = 4,
|
||||
GENERIC = 5
|
||||
}
|
||||
|
||||
public enum SIEMENS_MAGAZINE_TYPE
|
||||
{
|
||||
CHAIN = 1,
|
||||
REVOLVER = 3,
|
||||
BOX_MAGAZINE = 5,
|
||||
MAGAZINE_TOOL_BUFFER = 7,
|
||||
MAGAZINE_LOADING_STATION = 9
|
||||
}
|
||||
|
||||
public enum NC_MAGAZINE_TYPE
|
||||
{
|
||||
BOX_MAGAZINE = 0,
|
||||
DISK = 1,
|
||||
CHAIN = 2,
|
||||
}
|
||||
|
||||
public enum POSITION_TYPE
|
||||
{
|
||||
MAGAZINE_LOCATION = 1,
|
||||
SPINDLE = 2,
|
||||
GRIPPER = 3,
|
||||
LOADER = 4,
|
||||
TRANSFER_LOCATION = 5,
|
||||
LOADING_STATION = 6,
|
||||
LOADING_POINT = 7
|
||||
}
|
||||
|
||||
public enum ROTATION
|
||||
{
|
||||
NONE = 0,
|
||||
CLOCKWHISE = 1,
|
||||
COUNTERCLOCKWHISE = 2
|
||||
}
|
||||
|
||||
public enum SIEMENS_LIFE_TYPE
|
||||
{
|
||||
NONE = 0,
|
||||
TIME = 1,
|
||||
COUNT = 2,
|
||||
WEAR = 4
|
||||
}
|
||||
|
||||
public static IFormatProvider numberFormat = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();
|
||||
|
||||
#region Cms Errors Codes
|
||||
|
||||
public static CmsError NO_ERROR = new CmsError(CMS_ERROR_CODES.OK, "");
|
||||
public static CmsError NOT_CONNECTED_ERROR = new CmsError(CMS_ERROR_CODES.NOT_CONNECTED, "error_not_connected");
|
||||
public static CmsError PROC_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "error_process_not_found");
|
||||
public static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "error_function_not_allowed");
|
||||
public static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BIT_NOT_IN_RANGE, "error_bit_not_in_range");
|
||||
public static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BYTE_NOT_IN_RANGE, "error_byte_not_in_range");
|
||||
public static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "error_incorrect_parameters");
|
||||
public static CmsError INCORRECT_LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "error_invalid_language");
|
||||
public static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "error_siemens_enviroment_not_found_error");
|
||||
public static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "error_siemens_hmi_not_running");
|
||||
public static CmsError MAX_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOL_REACHED, "error_max_tool_reached");
|
||||
public static CmsError MAX_EDGES_PER_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_EDGES_PER_TOOL_REACHED, "error_max_edges_per_tool_reached");
|
||||
public static CmsError MAX_FAMILY_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_FAMILY_REACHED, "error_max_family_reached");
|
||||
public static CmsError MAX_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_MULTITOOL_REACHED, "error_max_multitools_reached");
|
||||
public static CmsError MAX_TOOLS_PER_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOLS_PER_MULTITOOL_REACHED, "error_max_tools_per_multitool_reached");
|
||||
public static CmsError MAX_MULTITOOL_LOCATION_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_MULTITOOL_LOCATION_REACHED, "error_max_multitools_location_reached");
|
||||
public static CmsError MAGAZINE_POSITION_OCCUPIED_ERROR = new CmsError(CMS_ERROR_CODES.MAG_POS_OCCUPIED, "error_magazine_position_occupied");
|
||||
public static CmsError MAGAZINE_BUSY_ERROR = new CmsError(CMS_ERROR_CODES.MAGAZINE_OCCUPIED, "error_magazine_occupied");
|
||||
public static CmsError TOOL_IS_MOUNTED_ERROR = new CmsError(CMS_ERROR_CODES.TOOL_IS_MOUNTED, "error_tool_mounted");
|
||||
public static CmsError TOOL_AND_POSITION_NOT_MATCHING_ERROR = new CmsError(CMS_ERROR_CODES.TOOL_IS_MOUNTED, "error_tool_and_position_not_matching");
|
||||
public static CmsError FILE_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FILE_NOT_FOUND, "error_file_not_found");
|
||||
|
||||
#endregion Cms Errors Codes
|
||||
|
||||
#endregion Constants
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user