From bea6407b376a4e426f0b120bae569fba6ab867db Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 08 十一月 2025 17:55:47 +0800
Subject: [PATCH] 1.CMaster.cpp 第 1644/1667/1691 行在记录 SV 曲线时通过 getGlassFromSlot(0) 取玻璃,而各设备的 initSlots() 都是从 1 开始编号(例如 CBonder.cpp (line 408)、CVacuumBake.cpp (line 415) 等)。槽位 0 永远不存在,所以 pGlass 始终是 nullptr,pGlass->addSVData(...) 的分支从未执行。结果 SERVO::CGlass::m_svDatas 里没有任何曲线数据,GlassJson::ToPrettyString 生成的 pretty 字符串也就没有 sv_datas,导出 CSV 时自然读不到曲线。 同一段代码还有一个潜在 Bug:虽然判断了 channel - 1 < bonderTypes.size(),但真正索引却用的是 bonderTypes[channel]。索引偏移会导致数据类型错位,最后一个通道甚至可能越界。即使修正了槽位,这里也需要同步改成 bonderTypes[channel - 1](另外两处 vacuumbakeTypes、coolingTypes 也一样)。

---
 SourceCode/Bond/BondEq/View/IOMonitoringDlg.h |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
index 6f173fe..5c04590 100644
--- a/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
+++ b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
@@ -28,13 +28,18 @@
 	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();	// 娓呴櫎鍔ㄦ�佸垱寤虹殑鎺т欢
+	void UpdatePageInfo();			 // 鏇存柊鍒嗛〉淇℃伅
+	void CreateDynamicControls();	 // 鍔ㄦ�佸垱寤烘帶浠�
+	CWnd* CreateStaticControl(UINT id, int x, int y, int width, int height, const CString& text, bool hasBorder = false, TextAlign alignment = AlignLeft, std::function<void()> clickCallback = nullptr); // 鍒涘缓闈欐�佹帶浠�
+	CWnd* GetStaticControl(UINT id); // 鑾峰彇闈欐�佹帶浠�
+	CString& GetStaticControlAddrText(UINT id, CString& strAddr); // 鑾峰彇闈欐�佹帶浠跺湴鍧�鏂囨湰
+	void DisplayCurrentPage();		 // 鏄剧ず褰撳墠椤垫暟鎹�
+	void ClearDynamicControls();	 // 娓呴櫎鍔ㄦ�佸垱寤虹殑鎺т欢
 	bool ParsePLCAddress(const CString& address, MC::SOFT_COMPONENT& component, int& addr); // 瑙f瀽 PLC 鍦板潃
-	void UpdatePLCStates();			// 瀹氭椂鍣ㄦ洿鏂扮姸鎬佺殑鏂规硶
+	bool GeneratePLCAddress(MC::SOFT_COMPONENT component, int addr, CString& address, bool bHexFormat = false); // 鐢熸垚 PLC 鍦板潃
+	void ReadPLCData(MC::SOFT_COMPONENT softComponent, int startAddr, int endAddr, std::function<void(IMcChannel*, int, char*, unsigned int, int)> callback); // 璇诲彇 PLC 鏁版嵁
+	void ReadPLCStates();			 // 瀹氭椂鍣ㄨPLC
+	void UpdatePLCStatesToUI();		 // 瀹氭椂鍣ㄦ洿鏂扮姸鎬佺殑鏂规硶
 
 private:
 	CPLC* m_pPLC;
@@ -48,6 +53,8 @@
 	std::map<int, CFont*> m_mapFonts;		// 瀛椾綋鏄犲皠
 	std::map<int, CRect> m_mapCtrlLayouts;	// 鎺т欢甯冨眬鏄犲皠
 	std::vector<IOData> m_displayData;		// 褰撳墠鏄剧ず鐨勬暟鎹�
+	std::vector<BOOL> m_inputStates;        // 杈撳叆鐘舵��
+	std::vector<BOOL> m_outputStates;	    // 杈撳嚭鐘舵��
 	std::vector<CString> m_inputPLCAddresses;  // 瀛樺偍 1 鍒� PLC 鍦板潃
 	std::vector<CString> m_outputPLCAddresses; // 瀛樺偍 4 鍒� PLC 鍦板潃
 
@@ -64,6 +71,7 @@
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnBnClickedButtonPrevPage();
 	afx_msg void OnBnClickedButtonNextPage();
+	afx_msg LRESULT OnIoClicked(WPARAM wParam, LPARAM lParam);
 	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg void OnClose();
 };

--
Gitblit v1.9.3