d4df4bc5b8
Fix demo tool table config Added part program message
447 lines
15 KiB
C#
447 lines
15 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using static CMS_CORE_Library.Nc;
|
|
|
|
namespace CMS_CORE_Library.Models
|
|
{
|
|
public class DataStructures
|
|
{
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#region Constants
|
|
|
|
public static readonly string[] VALID_PP_FORMATS = { ".txt", ".cnc", ".ini" };
|
|
public static readonly string[] VALID_IMAGE_FORMATS = { ".jpg", ".jpeg", ".png" };
|
|
|
|
public const string PART_PRG_PATH = "C:\\PartPrg\\";
|
|
public const string MILLIMETERS = "mm";
|
|
public const string INCHES = "inches";
|
|
|
|
public const int USER_SOFTKEYS_NUMBER = 128;
|
|
public const int NC_SOFTKEYS_NUMBER = 32;
|
|
public const int MAX_PROCESS_NUMBER = 6;
|
|
public const int ALARMS_NUMBER = 1024;
|
|
public const int MAX_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
|
|
{
|
|
NOT_READY = 0,
|
|
READY = 1,
|
|
LOADING = 2,
|
|
UNLOADING = 3,
|
|
EXCHANGE = 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,
|
|
|
|
|
|
MAGAZINE_TOOL_BUFFER = 7,
|
|
MAGAZINE_LOADING_STATION = 9
|
|
}
|
|
|
|
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 enum PROGRAM_TYPE_ENUM
|
|
{
|
|
NONE = 0,
|
|
PART_PROGRAM = 1,
|
|
JOB = 2
|
|
}
|
|
|
|
public enum M155_TYPE
|
|
{
|
|
REAL = 0,
|
|
MULTIPLE_BUTTONS = 1,
|
|
SHOW_VAL = 2
|
|
}
|
|
|
|
public enum SCADA_MEM_TYPE
|
|
{
|
|
BOOL = 0,
|
|
BYTE = 1,
|
|
WORD = 2,
|
|
INT = 3,
|
|
REAL = 4
|
|
}
|
|
|
|
public enum ASSISTED_TOOLING_ACTION
|
|
{
|
|
NONE = 0,
|
|
EXCHANGE = 1,
|
|
UNLOAD = 2
|
|
}
|
|
|
|
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");
|
|
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.SELECTED_PROCESS, "error_selected_process_not_found");
|
|
public static CmsError OSAI_TT_FOLDER_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND, "osai_tt_folder_not_found_error");
|
|
|
|
|
|
#endregion Cms Errors Codes
|
|
|
|
#endregion Constants
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#region Data structure models
|
|
|
|
// R-W MEMORY Cell
|
|
public 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 bool CanLoadProgram;
|
|
}
|
|
|
|
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 M155InputIsNeededModel
|
|
{
|
|
public uint Process;
|
|
public bool IsNeeded;
|
|
public M155_TYPE Type;
|
|
public string Message;
|
|
public double Value;
|
|
public Dictionary<byte, string> Buttons;
|
|
}
|
|
|
|
public struct M154DataModel
|
|
{
|
|
public uint Process;
|
|
public bool IsNeeded;
|
|
public string[] Parameters;
|
|
}
|
|
|
|
public struct MtConnectDataNeededModel
|
|
{
|
|
public uint Process;
|
|
public bool IsNeeded;
|
|
}
|
|
|
|
public class SoftKeysModel
|
|
{
|
|
public uint Id;
|
|
public bool Active;
|
|
public bool Value;
|
|
}
|
|
|
|
public class ToolInSpindleModel
|
|
{
|
|
public string ToolName;
|
|
public int ChildId;
|
|
}
|
|
|
|
public class HeadDataModel
|
|
{
|
|
public uint Id;
|
|
public byte Process;
|
|
public byte Override;
|
|
public short Load_Abrasive;
|
|
public int ActualSpeed_Pressure;
|
|
public short MountedTool_Vacum;
|
|
|
|
public bool IsActive;
|
|
public bool IsSelected;
|
|
public bool OverrideEditable;
|
|
public bool AbrasiveIsActive;
|
|
|
|
public bool Configured;
|
|
public ROTATION Rotation;
|
|
public uint WorkedTime;
|
|
|
|
public ToolInSpindleModel Tool;
|
|
}
|
|
|
|
public class AxisModel
|
|
{
|
|
public int Id;
|
|
public string Name;
|
|
public bool IsSelectable;
|
|
public AXIS_TYPE Type;
|
|
}
|
|
|
|
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 class SelectedProcessData
|
|
{
|
|
public short Origin { get; set; }
|
|
|
|
public short ActiveOffsetId { get; set; }
|
|
|
|
public string ProcessMessage { get; set; }
|
|
}
|
|
|
|
public class AssistedToolingModel
|
|
{
|
|
public bool IsActive { get; set; }
|
|
public ushort ToolId { get; set; }
|
|
public ushort MagazineId { get; set; }
|
|
public ushort PositionId { get; set; }
|
|
public ASSISTED_TOOLING_ACTION Action { get; set; }
|
|
}
|
|
|
|
public enum ORIGIN
|
|
{
|
|
NONE = 0,
|
|
G54 = 1,
|
|
G55 = 2,
|
|
G56 = 3,
|
|
G57 = 4,
|
|
G505 = 5
|
|
}
|
|
|
|
public enum QUEUE_STATUS
|
|
{
|
|
NOT_ACTIVE = 0,
|
|
RUNNING = 1,
|
|
WAITING_OPERATOR = 2,
|
|
CLOSING = 3
|
|
}
|
|
|
|
public enum AXIS_TYPE
|
|
{
|
|
LINEAR = 0,
|
|
ROTATING = 1
|
|
}
|
|
#endregion Data structure models
|
|
}
|
|
} |