C3204
2026-01-13 510dc693e91b291f36667088f47923591d25c98f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using LB_SmartVision.Forms.Pages.SettingPage;
using LB_SmartVision.ProcessRun;
using LB_SmartVision.Tool;
using LB_VisionProcesses.Cameras;
using LB_VisionProcesses.Communicators;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace LB_SmartVision
{
    public enum LogInfoType { INFO, WARN, PASS, ERROR, NOSHOW }
 
    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");
        }
 
        /// <summary>
        /// 流程集合(Key:流程名,Value:运行步骤集合)
        /// </summary>
        public static ObservableConcurrentDictionary<string, ProcessRunBll> dicProcesses { get; set; } = new ObservableConcurrentDictionary<string, ProcessRunBll>();
 
        /// <summary>
        /// 相机集合(Key:相机SN,Value:相机句柄)
        /// </summary>
        public static ObservableConcurrentDictionary<string, BaseCamera> dicCameras { get; set; } = new ObservableConcurrentDictionary<string, BaseCamera>();
 
        /// <summary>
        /// 通讯集合(Key:通讯名,Value:通讯句柄)
        /// </summary>
        public static ObservableConcurrentDictionary<string, BaseCommunicator> dicCommunicators { get; set; } = new ObservableConcurrentDictionary<string, BaseCommunicator>();
 
        /// <summary>
        /// 触发流程设置集合
        /// </summary>
        public static ConcurrentDictionary<int, ConcurrentDictionary<string, string>> dicProcessSetting { get; set; } = new ConcurrentDictionary<int, ConcurrentDictionary<string, string>>();
 
        /// <summary>
        /// 布局集合
        /// </summary>
        public static ConcurrentDictionary<int, Layout> dicLayout { get; set; } = new ConcurrentDictionary<int, Layout>();
 
        /// <summary>
        /// 表格集合
        /// </summary>
        public static ConcurrentDictionary<string, CsvSetting> dicCsvSetting { get; set; } = new ConcurrentDictionary<string, CsvSetting>();
 
        public static string allProcessConnectionStringPath
            => GlobalVar.strApplicationPath + "\\所有产品\\" + GlobalVar.strProductName + "\\A_ProcessConnections.json";
 
        #region 相机
        public static ConcurrentDictionary<string, string> allCamerasConnectionString = new ConcurrentDictionary<string, string>();
        public static string allCamerasConnectionStringPath
            => GlobalVar.strApplicationPath + "\\所有产品\\" + GlobalVar.strProductName + "\\A_CameraConnections.json";
        #endregion
 
        #region 通讯口
        public static ConcurrentDictionary<string, string> allCommunicatorsConnectionString = new ConcurrentDictionary<string, string>();
        public static string allCommunicatorsConnectionStringPath
            => GlobalVar.strApplicationPath + "\\所有产品\\" + GlobalVar.strProductName + "\\A_CommunicatorConnections.json";
 
        #endregion
 
        #region 流程
        public static Dictionary<string, object> ControlStates { get; set; } = new Dictionary<string, object>();
 
        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
 
        /// <summary>
        /// 软件路径
        /// </summary>
        public static string strApplicationPath = Application.StartupPath;
 
        /// <summary>
        /// 产品名称
        /// </summary>
        public static string strProductName = "产品0";
 
        /// <summary>
        /// 存储日志路径
        /// </summary>
        public static string strPathLog = Application.StartupPath + "生产日志\\" + DateTime.Now.ToString("yyyyMMdd");
 
 
        /// <summary>
        /// 存储日志路径
        /// </summary>
        public static string strPathCsv = Application.StartupPath + "生产数据\\" + DateTime.Now.ToString("yyyyMMdd");
 
        /// <summary>
        /// 软件开启日期
        /// </summary>
        public static string strStartTime = string.Empty;
    }
}