using LB_SmartVision.Forms.Pages.LEDLightSourceControlPage; using LB_SmartVision.Forms.Pages.MotionControlPage; using LB_SmartVision.Forms.Pages.SettingPage; using LB_SmartVision.ProcessRun; using LB_SmartVision.Tool; using LB_VisionProcesses.BarcodeReaders; using LB_VisionProcesses.Cameras; using LB_VisionProcesses.Communicators; using System.Collections.Concurrent; namespace LB_SmartVision { public enum LogInfoType { INFO, WARN, PASS, ERROR, NOSHOW } public enum ProtocolType { Error, Normal, ProductChange, GetVersion, NpointCaltab, CenterCaltab } public class GlobalVar { static GlobalVar() { strApplicationPath = Application.StartupPath; strPathLog = Application.StartupPath + "生产日志\\" + DateTime.Now.ToString("yyyyMMdd"); strPathCsv = Application.StartupPath + "生产数据\\" + DateTime.Now.ToString("yyyyMMdd"); strStartTime = DateTime.Now.ToString("yyyyMMdd_HHmm"); } /// /// 读码器集合(Key:设备SN,Value:读码器句柄) /// public static ObservableConcurrentDictionary dicBarcodeReaders { get; set; } = new ObservableConcurrentDictionary(); /// /// 光源控制配置 /// public static Dictionary dicSerialPort { get; set; } = new Dictionary(); #region 读码器 public static ConcurrentDictionary allBarcodeReadersConnectionString = new ConcurrentDictionary(); public static string allBarcodeReadersConnectionStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_BarcodeReaderConnections.json"; #endregion public static string AllSerialPortPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_SerialPort.json"; /// /// 流程集合(Key:流程名,Value:运行步骤集合) /// public static ObservableConcurrentDictionary dicProcesses { get; set; } = new ObservableConcurrentDictionary(); /// /// 相机集合(Key:相机SN,Value:相机句柄) /// public static ObservableConcurrentDictionary dicCameras { get; set; } = new ObservableConcurrentDictionary(); /// /// 通讯集合(Key:通讯名,Value:通讯句柄) /// public static ObservableConcurrentDictionary dicCommunicators { get; set; } = new ObservableConcurrentDictionary(); /// /// 触发流程设置集合 /// public static ConcurrentDictionary> dicProcessSetting { get; set; } = new ConcurrentDictionary>(); /// /// 运动控数据制集合 Key:产品名称,Value: SN,RecordMotionControlData /// public static Dictionary> dicMPlcData { get; set; } = new Dictionary>(); public static string allMPlcDataPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_MPlcDatas.json"; /// /// 运动控数据制集合 Key:产品名称,Value: SN,RecordMotionControlData /// public static Dictionary> dicMotionControlData { get; set; } = new Dictionary>(); public static string allMotionControlDataPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_MotionControlDatas.json"; /// /// 布局集合 /// public static ConcurrentDictionary dicLayout { get; set; } = new ConcurrentDictionary(); /// /// 表格集合 /// public static ConcurrentDictionary dicCsvSetting { get; set; } = new ConcurrentDictionary(); public static string allProcessConnectionStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_ProcessConnections.json"; #region 相机 public static ConcurrentDictionary allCamerasConnectionString = new ConcurrentDictionary(); public static string allCamerasConnectionStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_CameraConnections.json"; #endregion #region 通讯口 public static ConcurrentDictionary allCommunicatorsConnectionString = new ConcurrentDictionary(); public static string allCommunicatorsConnectionStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_CommunicatorConnections.json"; #endregion #region 流程 public static Dictionary ControlStates { get; set; } = new Dictionary(); public static string allProcessPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\"; public static string allProcessSettingStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_ProcessSettings.json"; public static string allRunSettingStringPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_RunSettings.json"; public static string allProcessVarsPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_ProcessVars.json"; public static string allLayoutPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_AllLayout.json"; public static string allCsvPath => GlobalVar.strApplicationPath + "所有产品\\" + GlobalVar.strProductName + "\\A_AllCsv.json"; #endregion /// /// 软件路径 /// public static string strApplicationPath = Application.StartupPath; /// /// 产品名称 /// public static string strProductName = "产品0"; /// /// 存储日志路径 /// public static string strPathLog = Application.StartupPath + "生产日志\\" + DateTime.Now.ToString("yyyyMMdd"); /// /// 存储日志路径 /// public static string strPathCsv = Application.StartupPath + "生产数据\\" + DateTime.Now.ToString("yyyyMMdd"); /// /// 软件开启日期 /// public static string strStartTime = string.Empty; public static string strUserName = "未登录"; } }