From aedb3b85fed48cb2cf0abb5fafa8e7591644c9f4 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 02 十二月 2024 08:53:06 +0800
Subject: [PATCH] Merge branch 'liuyang' into clh

---
 SourceCode/Bond/BondEq/View/IOMonitoringDlg.h |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
new file mode 100644
index 0000000..6f173fe
--- /dev/null
+++ b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
@@ -0,0 +1,69 @@
+锘�#pragma once
+#include "afxdialogex.h"
+#include "IOManager.h"
+#include "BLLabel.h"
+#include "CPLC.h"
+
+
+// CIOMonitoringDlg 瀵硅瘽妗�
+
+class CIOMonitoringDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CIOMonitoringDlg)
+
+public:
+	CIOMonitoringDlg(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CIOMonitoringDlg();
+	void SetIOManager(const std::string& machineName); // 璁剧疆 IOManager 鍜屾満鍣ㄥ悕
+	void SetPLC(CPLC* pPLC); // 璁剧疆 PLC
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_IO_MONITORING };
+#endif
+
+private:
+	CFont* GetOrCreateFont(int nFontSize);							// 鑾峰彇鎴栧垱寤哄瓧浣�
+	void SetDefaultFont();											// 璁剧疆榛樿瀛椾綋
+	void AdjustControls(float dScaleX, float dScaleY);				// 璋冩暣鎺т欢澶у皬
+	void AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight);	// 璋冩暣鎺т欢瀛椾綋澶у皬
+
+	void UpdatePageInfo();			// 鏇存柊鍒嗛〉淇℃伅
+	void CreateDynamicControls();	// 鍔ㄦ�佸垱寤烘帶浠�
+	void CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder = false, TextAlign alignment = AlignLeft, std::function<void()> clickCallback = nullptr); // 鍒涘缓闈欐�佹帶浠�
+	void DisplayCurrentPage();		// 鏄剧ず褰撳墠椤垫暟鎹�
+	void ClearDynamicControls();	// 娓呴櫎鍔ㄦ�佸垱寤虹殑鎺т欢
+	bool ParsePLCAddress(const CString& address, MC::SOFT_COMPONENT& component, int& addr); // 瑙f瀽 PLC 鍦板潃
+	void UpdatePLCStates();			// 瀹氭椂鍣ㄦ洿鏂扮姸鎬佺殑鏂规硶
+
+private:
+	CPLC* m_pPLC;
+	int m_nInitialWidth;
+	int m_nInitialHeight;
+	int m_nCurrentPage; // 褰撳墠椤�
+	int m_nTotalPages;	// 鎬婚〉鏁�
+	int m_nRowsPerPage; // 姣忛〉鏄剧ず鐨勮鏁�
+	int m_nCols;		// 姣忚鐨勬帶浠剁粍鏁�
+	std::string m_machineName; // 褰撳墠鏈哄櫒鍚�
+	std::map<int, CFont*> m_mapFonts;		// 瀛椾綋鏄犲皠
+	std::map<int, CRect> m_mapCtrlLayouts;	// 鎺т欢甯冨眬鏄犲皠
+	std::vector<IOData> m_displayData;		// 褰撳墠鏄剧ず鐨勬暟鎹�
+	std::vector<CString> m_inputPLCAddresses;  // 瀛樺偍 1 鍒� PLC 鍦板潃
+	std::vector<CString> m_outputPLCAddresses; // 瀛樺偍 4 鍒� PLC 鍦板潃
+
+private:
+	CStatic m_staticPageNum;
+	std::vector<CBLLabel*> m_staticControls; // 鍔ㄦ�佸垱寤虹殑闈欐�佹帶浠�
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnBnClickedButtonPrevPage();
+	afx_msg void OnBnClickedButtonNextPage();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnClose();
+};

--
Gitblit v1.9.3