From c8173fa96f226ff88412d07955fb340de4681ffc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 06 三月 2025 11:21:34 +0800
Subject: [PATCH] 1.实现 CIM model change指令下发到机器。与之前的从CC link读数据逻辑稍有不同,下发指令为写数据,因此,从原CStep派生两个类,CReadStep(用于读数据),CWriteStep(用于写数据),然后根据使用场景选择合适的基数做应用层逻辑。已完成待测试验证
---
SourceCode/Bond/Servo/ServoDlg.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index f6b355c..922f768 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -90,6 +90,7 @@
m_pLogDlg = nullptr;
m_pTerminalDisplayDlg = nullptr;
m_pObserver = nullptr;
+ m_pPanelMaster = nullptr;
}
void CServoDlg::DoDataExchange(CDataExchange* pDX)
@@ -126,6 +127,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()
@@ -163,6 +167,19 @@
}
}
}
+ else if (RX_CODE_SELECT_STEP == code) {
+ SERVO::CStep* pStep = nullptr;
+ if (pAny->getPtrValue("ptr", (void*&)pStep)) {
+ ASSERT(pStep);
+ ASSERT(m_pPanelAttributes);
+ m_pPanelAttributes->loadDataFromStep(pStep);
+ if (!m_pPanelAttributes->IsWindowVisible()) {
+ m_pPanelAttributes->ShowWindow(SW_SHOW);
+ Resize();
+ }
+ }
+ }
+
pAny->release();
}, [&]() -> void {
// onComplete
@@ -277,6 +294,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));
@@ -293,6 +312,16 @@
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_pPanelAttributes = new CPanelAttributes();
+ m_pPanelAttributes->Create(IDD_PANEL_ATTRIBUTES, this);
+ // m_pPanelAttributes->ShowWindow(SW_SHOW);
+
// 调整初始窗口位置
@@ -317,6 +346,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
@@ -533,6 +569,18 @@
m_pTerminalDisplayDlg = nullptr;
}
+ if (m_pPanelMaster != nullptr) {
+ m_pPanelMaster->DestroyWindow();
+ delete m_pPanelMaster;
+ m_pPanelMaster = nullptr;
+ }
+
+ if (m_pPanelAttributes != nullptr) {
+ m_pPanelAttributes->DestroyWindow();
+ delete m_pPanelAttributes;
+ m_pPanelAttributes = nullptr;
+ }
+
if (m_hbrBkgnd != nullptr) {
::DeleteObject(m_hbrBkgnd);
}
@@ -731,6 +779,19 @@
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_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());
@@ -828,3 +889,26 @@
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