388 lines
16 KiB
C#
388 lines
16 KiB
C#
using System.IO;
|
|
using System.Reflection;
|
|
|
|
namespace Thermo.Active.Model
|
|
{
|
|
public static class Constants
|
|
{
|
|
public static bool IS_BETA = false;
|
|
public static string NOT_FOUND_ALARM_MESSAGE = "Alarm_id_{0} : Message not found";
|
|
public static string NOT_CONFIGURATED_ALARM_MESSAGE = "Alarm_id_{0} : Message not configurated";
|
|
public static string CMS_CONNECT_SETUP_ALARM_MESSAGE = "Error during CMS-Connect setup: Redis Db Not Found";
|
|
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
|
|
|
//Costanti Tipo metreica utensili
|
|
public const string RADIUS_METRIC = "RADIUS";
|
|
public const string DIAM_METRIC = "DIAMETER";
|
|
|
|
public const string DEFAULT_FAM_NAME = "Family";
|
|
|
|
public enum SCADA_ELEMENT_TYPE
|
|
{
|
|
BUTTON = 0,
|
|
IMAGE = 1,
|
|
INPUT = 2,
|
|
PROGRESS_BAR = 3,
|
|
LABEL = 4,
|
|
NEGATE_IMAGE = 5
|
|
}
|
|
|
|
public struct SCADA_ACTION
|
|
{
|
|
public static string READ = "read";
|
|
public static string WRITE = "write";
|
|
}
|
|
|
|
public const int MIN_CMS_ROLE = 100;
|
|
public const int MIN_ADMIN_ROLE = 30;
|
|
|
|
public enum ROLE_IDS
|
|
{
|
|
CMS_SERVICE = 1,
|
|
CMS_UT = 2,
|
|
CUSTOMER_ADMIN = 3,
|
|
CUSTOMER_OPERATOR = 4,
|
|
CUSTOMER_MAINTAINER = 5
|
|
}
|
|
|
|
public enum ACTIONS
|
|
{
|
|
READ,
|
|
WRITE
|
|
}
|
|
|
|
public enum ERROR_LEVEL
|
|
{
|
|
INFO = 1,
|
|
WARNING = 2,
|
|
ERROR = 3,
|
|
FATAL = 4
|
|
}
|
|
|
|
public enum SOFTKEY_TYPE
|
|
{
|
|
TOGGLE = 0,
|
|
PROCEDURE = 1,
|
|
GROUP = 2
|
|
}
|
|
|
|
public enum HEAD_TYPE
|
|
{
|
|
SPINDLE = 0,
|
|
WJ = 1,
|
|
AWJ = 2,
|
|
LASER = 3
|
|
}
|
|
|
|
public enum TACT_PARAM_TYPE
|
|
{
|
|
ND = 0,
|
|
General,
|
|
Positions,
|
|
Cycle,
|
|
Heats,
|
|
Pyrometer,
|
|
Drawing,
|
|
UpperPlate,
|
|
Cooling,
|
|
Vacuum,
|
|
Extraction,
|
|
Options
|
|
}
|
|
|
|
public enum TACT_MBLOCK_TYPE
|
|
{
|
|
ND = 0,
|
|
HEATING,
|
|
DRAWING,
|
|
MOVEMENT,
|
|
VACUUM,
|
|
COOLING,
|
|
EXTRACTION
|
|
}
|
|
|
|
public enum TACT_MBLOCK_SECTION
|
|
{
|
|
ND = 0,
|
|
HEATING,
|
|
FORMING,
|
|
EXTRACTION
|
|
}
|
|
|
|
public enum MAINTENANCE_UNIT_OF_MEASURE
|
|
{
|
|
mm = 0,
|
|
D = 1,
|
|
H = 2,
|
|
M = 3
|
|
}
|
|
|
|
public enum ALARM_SOURCE
|
|
{
|
|
NC = 0,
|
|
PLC = 1
|
|
}
|
|
|
|
public enum ALARM_TYPE
|
|
{
|
|
ERROR = 0,
|
|
WARNING = 1
|
|
}
|
|
|
|
// Maintenances types
|
|
public enum MAINTENANCE_TYPE
|
|
{
|
|
EXP_DATE = 0,
|
|
MACHINE_INTERVAL = 1,
|
|
TIME_INTERVAL = 2
|
|
}
|
|
|
|
public enum QUEUE_ITEM_STATUS
|
|
{
|
|
NOT_ACTIVE = 0,
|
|
RUNNING = 1,
|
|
WAITING_OPERATOR = 2,
|
|
FINISHED = 3
|
|
}
|
|
|
|
public const int MAX_NUM_OF_WATCHDOG_ERROR = 4;
|
|
|
|
public static class NC_VENDOR
|
|
{
|
|
public const string DEMO = "DEMO";
|
|
public const string FANUC = "FANUC";
|
|
public const string SIEMENS = "SIEMENS";
|
|
public const string OSAI = "OSAI";
|
|
public const string S7NET = "S7NET";
|
|
}
|
|
|
|
// Database config
|
|
public const string DATABASE_USER = "root";
|
|
|
|
public const string DATABASE_PWD = "root";
|
|
public const string DATABASE_NAME = "ThermoActive";
|
|
|
|
// Registry key
|
|
public const string REGISTER_MACHINE_ID_KEY_NAME = "MachineUniqueId";
|
|
|
|
// Token fields Keys
|
|
public const string AUTHENTICATION_TYPE = "Bearer";
|
|
public const string MACHINE_ID_KEY = "machineId";
|
|
|
|
public const string ROLE_LEVEL_KEY = "roleLevel";
|
|
public const string USERNAME_KEY = "username";
|
|
public const string USER_ID_KEY = "id";
|
|
|
|
// Names in the xml file
|
|
public const string SERVER_CONFIG_KEY = "serverConfig";
|
|
|
|
public const string NC_CONFIG_KEY = "ncConfig";
|
|
public const string PROD_SFT_CONFIG_KEY = "softwareProdConfig";
|
|
public const string AREAS_CONFIG_KEY = "areasConfig";
|
|
|
|
// Active Areas
|
|
public class AREAS
|
|
{
|
|
public const string PRODUCTION_KEY = "production";
|
|
public const string REPORT_KEY = "report";
|
|
public const string ALARMS_KEY = "alarms";
|
|
public const string MAINTENANCE_KEY = "maintenance";
|
|
public const string UTILITIES_KEY = "utilities";
|
|
public const string SCADA_KEY = "scada";
|
|
public const string GENERAL_KEY = "general";
|
|
public const string UNDER_HOOD = "underHood";
|
|
public const string JOBEDITOR_KEY = "jobeditor";
|
|
public const string USERS_KEY = "users";
|
|
public const string THERMO_KEY = "thermo";
|
|
public const string RISC_KEY = "risc";
|
|
}
|
|
|
|
// Config File Names
|
|
public static readonly string BASE_PATH = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
//public static readonly string BASE_PATH = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).Replace("\\lib", "");
|
|
|
|
#if DEBUG
|
|
public static readonly string CLIENT_PATH_64 = BASE_PATH + @"\Client_Debug\x64\" + CLIENT_EXE_NAME;
|
|
public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client_Debug\x86\" + CLIENT_EXE_NAME;
|
|
public static string WEBSITE_DIRECTORY = Path.Combine(BASE_PATH, "..", "wwwroot");
|
|
#else
|
|
public static readonly string CLIENT_PATH_64 = BASE_PATH + @"\Client\x64\" + CLIENT_EXE_NAME;
|
|
public static readonly string CLIENT_PATH_86 = BASE_PATH + @"\Client\x86\" + CLIENT_EXE_NAME;
|
|
public static string WEBSITE_DIRECTORY = BASE_PATH + "\\view";
|
|
#endif
|
|
public const string CONFIG_DIRECTORY = "Config\\";
|
|
public const string RECIPE_DIRECTORY = "Recipes\\";
|
|
public const string RECIPE_TEMPLATE_PATH = CONFIG_DIRECTORY + RECIPE_DIRECTORY + "template.json";
|
|
public const string LIVE_RECIPE_PATH = TEMP_FOLDER + RECIPE_DIRECTORY + "current.json";
|
|
public const string RESOURCE_DIRECTORY = @"Thermo.Active.Config.Config.";
|
|
public const string SERVER_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + @"serverConfigValidator.xsd";
|
|
public const string SERVER_CONFIG_PATH = CONFIG_DIRECTORY + "serverConfig.xml";
|
|
|
|
public const string AREAS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "areasConfigValidator.xsd";
|
|
public const string AREAS_CONFIG_PATH = CONFIG_DIRECTORY + "areasConfig.xml";
|
|
|
|
public const string MAINTENANCES_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "maintenancesConfigValidator.xsd";
|
|
public const string CUSTOMER_CONTACTS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "customerContactConfigValidator.xsd";
|
|
public const string MAINTENANCES_CONFIG_PATH = CONFIG_DIRECTORY + "maintenancesConfig.xml";
|
|
public const string CUSTOMER_CONTACTS = CMS_FOLDER_PATH + "ContactInfo.xml";
|
|
|
|
|
|
public const string USER_SOFTKEYS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "userSoftKeyConfigValidator.xsd";
|
|
public const string USER_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "userSoftKeyConfig.xml";
|
|
|
|
public const string ALARMS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "alarmsConfigValidator.xsd";
|
|
public const string ALARMS_CONFIG_PATH = CONFIG_DIRECTORY + "alarmsConfig.xml";
|
|
|
|
public const string HEADS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "headsConfigValidator.xsd";
|
|
public const string HEADS_CONFIG_PATH = CONFIG_DIRECTORY + "headsConfig.xml";
|
|
|
|
public const string RECIPE_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "recipeConfigValidator.xsd";
|
|
public const string RECIPE_CONFIG_PATH = CONFIG_DIRECTORY + "recipeConfig.xml";
|
|
|
|
public const string MODBLOCK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "moduleBlockConfigValidator.xsd";
|
|
public const string MODBLOCK_CONFIG_PATH = CONFIG_DIRECTORY + "moduleBlockConfig.xml";
|
|
|
|
public const string RISK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "risk2007Validator.xsd";
|
|
public const string RISK_CONFIG_PATH = CONFIG_DIRECTORY + "risk2007.xml";
|
|
|
|
public const string NC_SOFTKEYS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "ncSoftKeyConfigValidator.xsd";
|
|
public const string NC_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfig.xml";
|
|
|
|
public const string CMS_CONNECT_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "cmsConnectConfigValidator.xsd";
|
|
public const string CMS_CONNECT_CONFIG_PATH = CONFIG_DIRECTORY + "cmsConnectConfig.xml";
|
|
|
|
public const string MACROS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "macrosConfigValidator.xsd";
|
|
public const string MACROS_CONFIG_PATH = CONFIG_DIRECTORY + "macrosConfig.xml";
|
|
|
|
public const string MAIN_PROGRAM_CONFIG_PATH = CONFIG_DIRECTORY + "customMainProgram.txt";
|
|
|
|
|
|
public static string LANGUAGE_PACK_DIRECTORY = BASE_PATH + "\\languages\\";
|
|
public static string LANGUAGE_SCHEMA_PATH = BASE_PATH + "\\LanguageValidator.xsd";
|
|
|
|
|
|
public const string SCADA_PAGES_SCHEMA_PATH = RESOURCE_DIRECTORY + "scadaValidator.xsd";
|
|
public static string CANDY_DUMMYFILE_PATH = BASE_PATH + "\\dll.dll";
|
|
public static string PARTPRG_LIST_FILE = "activePP.list";
|
|
|
|
// MVVM Messages to server UI
|
|
public const string SEND_STOP_SERVER = "STOP_SERVER";
|
|
|
|
public const string SEND_MESSAGE = "SEND_MESSAGE";
|
|
public const string SEND_STOP_THREADS = "SEND_STOP_THREADS";
|
|
public const string SEND_NC_STATUS = "NC_STATUS";
|
|
public const string SEND_THREADS_STATUS = "THREAD_STATUS";
|
|
public const string SEND_CMSCONNECT_GW_REBOOT_STATUS = "SEND_CMSCONNECT_GW_REBOOT_STATUS";
|
|
public const string SHOW_MSG_UI = "SHOW_MSG_UI";
|
|
public const string SEND_ERROR_TO_UI = "SEND_ERROR_TO_UI";
|
|
|
|
// MVVM Messages to signalR tasks
|
|
public const string SEND_ALARMS = "SEND_ALARMS";
|
|
|
|
public const string SEND_POWER_ON_DATA = "SEND_POWER_ON_DATA";
|
|
public const string SEND_GENERIC_DATA = "SEND_GENERIC_DATA";
|
|
public const string SEND_AXES = "SEND_AXES";
|
|
public const string SEND_PROCESSES_DATA = "SEND_PROCESSES_STATUS";
|
|
public const string SEND_FUNCTIONALITY_DATA = "SEND_FUNCTION_DATA";
|
|
public const string SEND_EXPIRED_MAINTENANCES_DATA = "SEND_EXPIRED_MAINTENANCES_DATA";
|
|
public const string SEND_USER_SOFTKEYS_DATA = "SEND_USER_SOFTKEYS_DATA";
|
|
public const string SEND_NC_SOFTKEYS_DATA = "SEND_NC_SOFTKEYS_DATA";
|
|
public const string SEND_HEADS_DATA = "SEND_HEADS_DATA";
|
|
public const string SEND_AXIS_NAMES_DATA = "SEND_AXIS_NAMES_DATA";
|
|
public const string SEND_ACTIVE_PROGRAM_DATA = "SEND_ACTIVE_PROGRAM_DATA";
|
|
public const string SEND_QUEUE_DATA = "SEND_QUEUE_DATA";
|
|
public const string SEND_M155_DATA = "SEND_M155_DATA";
|
|
public const string SEND_SCADA_DATA = "SEND_SCADA_DATA";
|
|
|
|
// MVVM Messages for Thermo active specs
|
|
public const string SEND_THERMO_RECIPE_FULL = "SEND_THERMO_RECIPE_FULL";
|
|
public const string SEND_THERMO_RECIPE_OVERWIEW = "SEND_THERMO_RECIPE_OVERWIEW";
|
|
public const string SEND_THERMO_MODULE_DATA = "SEND_THERMO_MODULE_DATA";
|
|
public const string SEND_THERMO_WARMERS_DATA = "SEND_THERMO_WARMERS_DATA";
|
|
public const string SEND_THERMO_AREA_DATA = "SEND_THERMO_AREA_DATA";
|
|
public const string SEND_THERMO_GAUGE_DATA = "SEND_THERMO_GAUGE_DATA";
|
|
public const string SEND_THERMO_PROD_INFO_DATA = "SEND_THERMO_PROD_INFO_DATA";
|
|
public const string SEND_THERMO_PROD_CYCLE_DATA = "SEND_THERMO_PROD_CYCLE_DATA";
|
|
|
|
public const string BROADCAST_DATA = "BROADCAST_DATA";
|
|
|
|
// ID prefix
|
|
public const string MAINTENANCE_PREFIX_ID = "maint_";
|
|
|
|
public const string MAINTENANCE_DESC_PREFIX_ID = "maint_desc_";
|
|
public const string SOFTKEY_PREFIX_ID = "softkey_";
|
|
public const string SOFTKEY_HEAD_ID = "Head_";
|
|
public const string ALARM_PREFIX = "alarm_";
|
|
|
|
public static class FUNCTIONALITY_NAMES
|
|
{
|
|
public const string GENERAL = "general";
|
|
public const string USER_FUNCTIONS = "userFunctions";
|
|
public const string NC_DATA = "ncData";
|
|
public const string ALARM_CMD = "alarmCmd";
|
|
public const string STARTUP_ICONS = "startupIcons";
|
|
public const string PROCESS_CMD = "processCmd";
|
|
public const string NC_SOFTKEY = "ncSoftkeys";
|
|
public const string USER_SOFTKEY = "userSoftkeys";
|
|
public const string HEADS_CMD = "headsCmd";
|
|
public const string MAINTENANCE = "maintenance";
|
|
public const string AXES_SELECTION = "axesSoftkeys";
|
|
public const string THERMO_MANAGER = "thermoManager";
|
|
public const string RISC_MANAGER = "riscManager";
|
|
}
|
|
|
|
public static class API_ERROR_KEYS
|
|
{
|
|
public const string INCORRECT_PARAMETERS = "error_incorrect_parameters";
|
|
public const string OPTION_NOT_ACTIVE = "error_option_not_active";
|
|
public const string ID_ALREADY_EXIST = "error_id_already_exist";
|
|
public const string PASSWORD_IS_INVALID = "error_password_is_invalid";
|
|
public const string IMPORT_FILE_NOT_VALID = "error_import_file_not_valid";
|
|
public const string DUPLICATED_USERNAME = "error_duplicated_username";
|
|
public const string CUSTOMER_FILE_INVALID = "contactinfo_error_customer_configfile";
|
|
}
|
|
|
|
// File paths
|
|
public const string CLIENT_EXE_NAME = @"Active_Client.exe";
|
|
public const string CLIENT_EXE_NAME_NOEXT = @"Active_Client";
|
|
public const string MAINTENANCE_ATTACHMENT_PATH = @"C:\CMS\Active\attachment\maintenance\";
|
|
public const string CMS_FOLDER_PATH = @"C:\CMS\";
|
|
|
|
public const string ALARM_ATTACHMENT_PATH = @"C:\CMS\Active\attachment\alarm\";
|
|
public const string TEMP_FOLDER = @"C:\CMS\ThermoActive\TMP\";
|
|
public const string TEMP_PP_FOLDER = TEMP_FOLDER + @"pp\";
|
|
public const string JOB_TMP_DIRECTORY = TEMP_PP_FOLDER + @"job\";
|
|
public const string QUEUE_TMP_FOLDER = TEMP_PP_FOLDER + @"queue\";
|
|
public const string PART_PRG_IMAGES = TEMP_FOLDER + @"pp_img\";
|
|
|
|
public const string SCADA_DIRECTORY = @"C:\CMS\Active\scada\";
|
|
|
|
public static readonly string[] VALID_FILE_EXTENSIONS = { "", ".txt", ".cnc", ".ini", ".mpf", ".spf" };
|
|
public static readonly string[] VALID_IMAGE_EXTENSIONS = { ".jpg", ".jpeg", ".png", ".bmp", ".gif" };
|
|
public const double EPSILON = 0.001;
|
|
public static string QUEUE_FILE_NAME = "pp";
|
|
public const string JOB_MAIN_FILENAME = "main.cnc";
|
|
public const string JOB_METADATA_FILENAME = "metadata.json";
|
|
public static string[] JOB_EXTENSIONS = { ".job", ".zip" };
|
|
|
|
public static string[] DATE_TIME_FORMATS = new[] {
|
|
"M-d-yyyy HH:mm",
|
|
"dd-MM-yyyy HH:mm",
|
|
"MM-dd-yyyy HH:mm",
|
|
"M/d/yyyy HH:mm",
|
|
"dd/MM/yyyy HH:mm",
|
|
"MM/dd/yyyy HH:mm"
|
|
};
|
|
|
|
public static string[] DATE_FORMATS = new[] {
|
|
"M-d-yyyy",
|
|
"dd-MM-yyyy",
|
|
"MM-dd-yyyy",
|
|
"M/d/yyyy",
|
|
"dd/MM/yyyy",
|
|
"MM/dd/yyyy",
|
|
"dd.MM.yyyy",
|
|
"MM.dd.yyyy"
|
|
};
|
|
}
|
|
} |