admin
2025-07-17 6cd92a169cbc0db35042f243a09d976fd3e1445c
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#pragma once
#include "../common/CMyListCtrl.h"
#include "../common/NetworkApi.h"
#include <thread>
#include <map>
// MonitorDlg 对话框
 
 
struct TradeDelegateRecord {
    CString accountID;
    CString orderLocalID;
    CString securityID;
    CString securityName;
    int direction;
    CString orderSysID;
    CString insertTime;
    CString acceptTime;
    CString cancelTime;
    CString limitPrice;
    int volume;
    int volumeTraded;
    int orderStatus;
    int orderSubmitStatus;
    CString statusMsg;
    CString updateTime;
};
struct TradeDealRecord {
    CString tradeID;
    CString    orderSysID;
    CString    securityID;
    CString    direction;
    CString    price;
    CString    tradeTime;
    int    volume;
 
};
 
enum TaskType {
    REQUEST_TASK_ENV, // 环境更新
    REQUEST_TASK_L2_SUBSCRIPT,//L2订阅更新 
};
 
class MonitorDlg : public CDialogEx
{
    DECLARE_DYNAMIC(MonitorDlg)
 
private:
    //开盘啦数据警告
    bool kplDataWarning;
 
    CString searchCode;
 
    // 任务更新时间
    map<TaskType, string> taskUpdateTimeMap;
    
    const int MAX_LOG_LINES = 100;
    map<int,COLORREF> labelColors;
    static bool kill;
    static std::list<CodeInfo> l2CodesList;
    static std::list<CodeInfo> l2PositionCodesList;
    static list<TradeDelegateRecord> delegateList;
    static list<TradeDealRecord> dealList;
    static void requestL2CodeList(MonitorDlg* dlg);
    static void requestL2PositionCodeList(MonitorDlg* dlg);
    static void requestDelegateList(MonitorDlg* dlg);
    static void requestDealList(MonitorDlg* dlg);
    static void autoRefresh(MonitorDlg* dlg);
    static void requestSystemLog(MonitorDlg* dlg);
    static void requestL2ListenActiveCount(MonitorDlg* dlg);
 
 
    
 
    std::thread l2RefreshThread;
    std::thread l2PositionRefreshThread;
    std::thread delegateRefreshThread;
    std::thread dealRefreshThread;
    std::thread autoRefreshThread;
    std::thread systemLogThread;
    std::thread l2ListenActiveThread;
 
    std::list<CString> logList;
    int logStartIndex;
 
    void initView();
 
 
    static CString MonitorDlg::getOrderStatusDesc(int orderStatus);
    static CString MonitorDlg::getDirectionDesc(int direction);
 
public:
    MonitorDlg(CWnd* pParent = nullptr);   // 标准构造函数
    virtual ~MonitorDlg();
 
    // 对话框数据
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_MONITOR };
#endif
 
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
 
    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedButtonRefreshDelegate();
    afx_msg void OnBnClickedButtonRefreshDeal();
    afx_msg void OnBnClickedButtonRefreshPosition();
    afx_msg void OnBnClickedButtonRefreshMoney();
    afx_msg void OnBnClickedButtonFloatFrame();
    afx_msg void OnBnClickedButtonTradeRecord();
    CListCtrl listL2Codes;
    CMyListCtrl listDelegate;
    CMyListCtrl listDeal;
    virtual BOOL OnInitDialog();
    afx_msg void OnClose();
    CEdit editCode;
    afx_msg void OnBnClickedButtonExportL2();
    CStatic labelHXTradeChannel;
    CStatic labelJueJinState;
    afx_msg void OnBnClickedButtonInitData();
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    CStatic labelKPLDataInfo;
    CStatic labelDeviceInfo;
    CStatic labelMySQL;
    CStatic labelRedis;
    CStatic labelRedisTestResult;
    afx_msg void OnBnClickedButtonRedisTest();
    CStatic lableRedisAsyncTaskCount;
    CStatic labelTradeChannelState;
    afx_msg void OnBnClickedButtonSyncShszCodes();
    CStatic labelL2SubscriptCodesUpdateTime;
    CEdit editLog;
    CStatic labelL2ListenData;
    afx_msg void OnBnClickedButtonSaveRunningData();
    CListCtrl listL2PositionCodes;
    CStatic labelL2PositionSubscriptCodesUpdateTime;
    afx_msg void OnBnClickedButtonRepaireTask();
    afx_msg void OnBnClickedButtonSyncZyltVolume();
    CStatic labelTodayZyltVolumeCount;
    CEdit editSearchCode;
    CButton btnSearch;
    afx_msg void OnBnClickedButtonSearch();
    CStatic labelTodayKBarsCount;
    afx_msg void OnBnClickedButtonSyncKBars();
    CStatic labelDataServerState;
    CButton checkAutoPullLogs;
    afx_msg void OnBnClickedButtonOpenLowSuction();
    afx_msg void OnBnClickedButtonOpenProjectBuild();
    afx_msg void OnBnClickedButtonRestartSell();
};