From 19261d011387ec57d646decc945aadaf8913eeab Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 10 三月 2025 09:05:54 +0800
Subject: [PATCH] Merge branch 'clh'

---
 SourceCode/Bond/Servo/ServoDlg.cpp |  141 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 118 insertions(+), 23 deletions(-)

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index bb7deba..90ee383 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -9,6 +9,7 @@
 #include "Common.h"
 #include "Log.h"
 #include "SecsTestDlg.h"
+#include "AlarmDlg.h"
 #include <chrono>
 #include <thread>
 #include <cmath>
@@ -90,6 +91,9 @@
 	m_pAlarmDlg = nullptr;
 	m_pTerminalDisplayDlg = nullptr;
 	m_pObserver = nullptr;
+	m_pPanelMaster = nullptr;
+	m_pPanelEquipment = nullptr;
+	m_pPanelAttributes = nullptr;
 }
 
 void CServoDlg::DoDataExchange(CDataExchange* pDX)
@@ -127,6 +131,9 @@
 	ON_WM_TIMER()
 	ON_WM_ERASEBKGND()
 	ON_BN_CLICKED(IDC_BUTTON_ALARM, &CServoDlg::OnBnClickedButtonAlarm)
+	ON_BN_CLICKED(IDC_BUTTON_ALARM, &CServoDlg::OnBnClickedButtonAlarm)
+	ON_NOTIFY(BYSERVOGRAPH_ITEM_CLICKED, IDC_SERVO_GRAPH1, &CServoDlg::OnGraphItemClicked)
+	ON_MESSAGE(ID_MSG_PANEL_RESIZE, OnPanelResize)
 END_MESSAGE_MAP()
 
 
@@ -164,6 +171,35 @@
 					}
 				}
 			}
+			else if (RX_CODE_SELECT_EQUIPMENT == code) {
+				SERVO::CEquipment* pEquipment = nullptr;
+				if (pAny->getPtrValue("ptr", (void*&)pEquipment)) {
+					ASSERT(pEquipment);
+					ASSERT(m_pPanelEquipment);
+					ASSERT(m_pPanelAttributes);
+					m_pPanelEquipment->SetEquipment(pEquipment);
+					m_pPanelAttributes->ShowWindow(SW_HIDE);
+					if (!m_pPanelEquipment->IsWindowVisible()) {
+						m_pPanelEquipment->ShowWindow(SW_SHOW);
+						Resize();
+					}
+				}
+			}
+			else if (RX_CODE_SELECT_STEP == code) {
+				SERVO::CStep* pStep = nullptr;
+				if (pAny->getPtrValue("ptr", (void*&)pStep)) {
+					ASSERT(pStep);
+					ASSERT(m_pPanelEquipment);
+					ASSERT(m_pPanelAttributes);
+					m_pPanelEquipment->ShowWindow(SW_HIDE);
+					m_pPanelAttributes->loadDataFromStep(pStep);
+					if (!m_pPanelAttributes->IsWindowVisible()) {
+						m_pPanelAttributes->ShowWindow(SW_SHOW);
+						Resize();
+					}
+				}
+			}
+
 			pAny->release();
 		}, [&]() -> void {
 			// onComplete
@@ -278,6 +314,8 @@
 	m_pGraph->SetBoxText(INDICATE_ROBOT_ARM2, "6", "Robot");
 
 
+
+
 	// Vacuum bake
 	m_pGraph->AddIndicateBox(INDICATE_VACUUM_BAKE, 396, 516, 48, RGB(22, 22, 22),
 		RGB(255, 127, 39), RGB(0, 176, 80));
@@ -294,6 +332,17 @@
 	m_pGraph->AddIndicateBox(INDICATE_MEASUREMENT, 736, 516, 48, RGB(22, 22, 22),
 		RGB(255, 127, 39), RGB(0, 176, 80));
 	m_pGraph->SetBoxText(INDICATE_MEASUREMENT, "13", "Measurement");
+
+
+
+	m_pPanelMaster = new CPanelMaster();
+	m_pPanelMaster->Create(IDD_PANEL_MASTER, this);
+	m_pPanelMaster->ShowWindow(SW_SHOW);
+	m_pPanelEquipment = new CPanelEquipment();
+	m_pPanelEquipment->Create(IDD_PANEL_EQUIPMENT, this);
+	m_pPanelAttributes = new CPanelAttributes();
+	m_pPanelAttributes->Create(IDD_PANEL_ATTRIBUTES, this);
+	
 
 
 	// 调整初始窗口位置
@@ -318,6 +367,13 @@
 
 	// 相当于延时调用master的初始化
 	theApp.m_model.m_master.init();
+
+
+	// 绑定数据
+	{
+		SERVO::CEquipment* pEquipment = theApp.m_model.m_master.getEquipment(EQ_ID_EFEM);
+		m_pGraph->SetIndicateBoxData(INDICATE_ROBOT_ARM1, pEquipment);
+	}
 
 
 	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
@@ -541,6 +597,24 @@
 		m_pTerminalDisplayDlg = nullptr;
 	}
 
+	if (m_pPanelMaster != nullptr) {
+		m_pPanelMaster->DestroyWindow();
+		delete m_pPanelMaster;
+		m_pPanelMaster = nullptr;
+	}
+
+	if (m_pPanelEquipment != nullptr) {
+		m_pPanelEquipment->DestroyWindow();
+		delete m_pPanelEquipment;
+		m_pPanelEquipment = nullptr;
+	}
+
+	if (m_pPanelAttributes != nullptr) {
+		m_pPanelAttributes->DestroyWindow();
+		delete m_pPanelAttributes;
+		m_pPanelAttributes = nullptr;
+	}
+	
 	if (m_hbrBkgnd != nullptr) {
 		::DeleteObject(m_hbrBkgnd);
 	}
@@ -749,6 +823,25 @@
 
 	x = 0;
 	y = 0;
+	int nPanelWidth = 0;
+	if (m_pPanelMaster != nullptr) {
+		nPanelWidth = m_pPanelMaster->getPanelWidth();
+		m_pPanelMaster->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		x += nPanelWidth;
+	}
+
+	if (m_pPanelEquipment != nullptr && m_pPanelEquipment->IsWindowVisible()) {
+		nPanelWidth = m_pPanelEquipment->getPanelWidth();
+		m_pPanelEquipment->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		x += nPanelWidth;
+	}
+
+	if (m_pPanelAttributes != nullptr && m_pPanelAttributes->IsWindowVisible()) {
+		nPanelWidth = m_pPanelAttributes->getPanelWidth();
+		m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, rcClient.Height());
+		x += nPanelWidth;
+	}
+
 	pItem = GetDlgItem(IDC_SERVO_GRAPH1);
 	pItem->GetClientRect(&rcItem);
 	pItem->MoveWindow(x, y, rcItem.Width(), rcItem.Height());
@@ -858,27 +951,29 @@
 void CServoDlg::OnBnClickedButtonAlarm()
 {
 	// TODO: 在此添加控件通知处理程序代码
-	m_bShowAlarmWnd = !m_bShowAlarmWnd;
-
-	// 如果要显示报警窗口,则隐藏日志窗口
-	if (m_bShowAlarmWnd) {
-		m_bShowLogWnd = false;
-		if (m_pLogDlg != nullptr) {
-			m_pLogDlg->ShowWindow(SW_HIDE);
-			UpdateLogBtn();
-		}
-	}
-
-	if (m_pAlarmDlg == nullptr) {
-		m_pAlarmDlg = new CAlarmDlg();
-		m_pAlarmDlg->Create(IDD_DIALOG_ALARM, this);
-
-		CRect rcWnd;
-		GetWindowRect(&rcWnd);
-		m_pAlarmDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), 200);
-	}
-	ASSERT(m_pAlarmDlg);
-	m_pAlarmDlg->ShowWindow(m_bShowAlarmWnd ? SW_SHOW : SW_HIDE);
-
-	UpdateAlarmBtn();
+	CAlarmDlg dlg;
+	dlg.DoModal();
 }
+
+void CServoDlg::OnGraphItemClicked(NMHDR* pNMHDR, LRESULT* pResult)
+{
+	BYSERVOGRAPH_NMHDR* pGraphNmhdr = reinterpret_cast<BYSERVOGRAPH_NMHDR*>(pNMHDR);
+	CString s; s.Format(_T("OnGraphItemClicked %d"), pGraphNmhdr->dwData);
+	SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)m_pGraph->GetIndicateBoxData(pGraphNmhdr->dwData);
+	if (pEquipment != nullptr) {
+		AfxMessageBox(pEquipment->getName().c_str());
+	}
+	
+	
+	*pResult = 0;
+}
+
+LRESULT CServoDlg::OnPanelResize(WPARAM wParam, LPARAM lParam)
+{
+	int width = wParam;
+	// m_pPanel->SetPanelWidth(width);
+	Resize();
+
+	return 0;
+}
+

--
Gitblit v1.9.3