#pragma once
|
#include "CExpandableListCtrl.h"
|
#include "GlassLogDb.h"
|
#include <unordered_map>
|
|
// ====== 编译开关说明 ======
|
// USE_MOCK_SENSOR_DATA: 1=启用模拟传感器数据生成;0=使用真实数据
|
// 在 CPageGlassList.cpp 中定义
|
|
|
// CPageGlassList 对话框
|
|
class CPageGlassList : public CDialogEx
|
{
|
DECLARE_DYNAMIC(CPageGlassList)
|
|
public:
|
CPageGlassList(CWnd* pParent = nullptr); // 标准构造函数
|
virtual ~CPageGlassList();
|
|
private:
|
COLORREF m_crBkgnd;
|
HBRUSH m_hbrBkgnd;
|
IObserver* m_pObserver;
|
|
// 搜索关键字
|
GlassLogDb::Filters m_filters;
|
std::string m_strStatus;
|
|
// 页码
|
int m_nCurPage;
|
int m_nTotalPages;
|
|
// 日期
|
char m_szTimeStart[64];
|
char m_szTimeEnd[64];
|
|
// 控件
|
CDateTimeCtrl m_dateTimeStart;
|
CDateTimeCtrl m_dateTimeEnd;
|
CExpandableListCtrl m_listCtrl;
|
|
private:
|
int m_nColCount = 0;
|
bool m_rebuilding = false;
|
|
private:
|
void InitRxWindows();
|
void Resize();
|
void InitStatusCombo();
|
void InitTimeRangeCombo();
|
void InitDateTimeControls();
|
void LoadData();
|
void UpdatePageData();
|
void UpdatePageControls();
|
void InsertWipRow(SERVO::CGlass* pGlass);
|
static bool GlassMatchesFilters(const SERVO::CGlass& g,
|
const GlassLogDb::Filters& f,
|
bool useEndTime = false);
|
void UpdateWipData();
|
bool eraseGlassInVector(SERVO::CGlass* pGlass, std::vector<SERVO::CGlass*>& glasses);
|
void UpdateWipRow(unsigned int index, SERVO::CGlass* pGlass);
|
bool WriteAnsiStringAsUtf8ToFile(const CString& ansiContent, const CString& filePath);
|
void ExportToCsv(const GlassLogDb::Row& row, const CString& filePath);
|
void ExportToJson(const GlassLogDb::Row& row, const CString& filePath);
|
void ExportBasicInfo(CString& csvContent, const GlassLogDb::Row& row);
|
void ExportProcessParams(CString& csvContent, const GlassLogDb::Row& row);
|
void ExportSensorData(CString& csvContent, const GlassLogDb::Row& row);
|
static std::vector<std::string> getMachineColumnOrder(int machineId, const std::unordered_map<std::string, std::vector<SERVO::SVDataItem>>* actualData = nullptr);
|
static std::string timePointToString(const std::chrono::system_clock::time_point& tp);
|
static int64_t timePointToMs(const std::chrono::system_clock::time_point& tp);
|
void GenerateMockSVData(SERVO::CGlass& glass);
|
double GenerateMockValue(int machineId, const std::string& dataType, int index);
|
|
// 对话框数据
|
#ifdef AFX_DESIGN_TIME
|
enum { IDD = IDD_PAGE_GLASS_LIST };
|
#endif
|
|
protected:
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
virtual BOOL OnInitDialog();
|
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
afx_msg void OnDestroy();
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
afx_msg void OnCbnSelchangeComboDatetime();
|
afx_msg void OnCbnSelchangeComboStatusFilter();
|
afx_msg void OnBnClickedButtonSearch();
|
afx_msg void OnBnClickedButtonExport();
|
afx_msg void OnBnClickedButtonPrevPage();
|
afx_msg void OnBnClickedButtonNextPage();
|
afx_msg void OnShowFullText(NMHDR* pNMHDR, LRESULT* pResult);
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
DECLARE_MESSAGE_MAP()
|
public:
|
afx_msg void OnBnClickedButtonExportRow();
|
};
|