From 6b80da0fe2a6053b39802a6701db6df0ab1fde24 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 05 九月 2025 17:27:35 +0800
Subject: [PATCH] 1. 添加设备配方参数显示界面
---
SourceCode/Bond/Servo/Servo.vcxproj | 2
SourceCode/Bond/Servo/Servo.vcxproj.filters | 2
SourceCode/Bond/Servo/resource.h | 0
SourceCode/Bond/Servo/Servo.vcxproj.user | 2
SourceCode/Bond/Servo/DeviceRecipeParamDlg.h | 34 +++++++++++
SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp | 113 +++++++++++++++++++++++++++++++++++++
SourceCode/Bond/Servo/Servo.rc | 0
SourceCode/Bond/Servo/PageRecipe.cpp | 11 +++
8 files changed, 162 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp b/SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp
new file mode 100644
index 0000000..02dfd83
--- /dev/null
+++ b/SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp
@@ -0,0 +1,113 @@
+锘�// DeviceRecipeParamDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "afxdialogex.h"
+#include "DeviceRecipeParamDlg.h"
+
+
+// CDeviceRecipeParamDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CDeviceRecipeParamDlg, CDialogEx)
+
+CDeviceRecipeParamDlg::CDeviceRecipeParamDlg(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_DEVICE_RECIPE_PARAM, pParent)
+{
+ m_pEquipment = nullptr;
+ m_nDeviceRecipeID = 0;
+ m_strDeviceRecipeName = _T("");
+}
+
+CDeviceRecipeParamDlg::~CDeviceRecipeParamDlg()
+{
+}
+
+void CDeviceRecipeParamDlg::setEquipment(SERVO::CEquipment* pEquipment)
+{
+ m_pEquipment = pEquipment;
+}
+
+void CDeviceRecipeParamDlg::setDeviceRecipeID(int nDeviceRecipeID)
+{
+ m_nDeviceRecipeID = nDeviceRecipeID;
+}
+
+void CDeviceRecipeParamDlg::setDeviceRecipeName(const CString& strDeviceRecipeName)
+{
+ m_strDeviceRecipeName = strDeviceRecipeName;
+}
+
+void CDeviceRecipeParamDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST_RECIPE_PARAM, m_wndRecipeParamList);
+}
+
+
+BEGIN_MESSAGE_MAP(CDeviceRecipeParamDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CDeviceRecipeParamDlg 娑堟伅澶勭悊绋嬪簭
+
+BOOL CDeviceRecipeParamDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+ CRect rc;
+ m_wndRecipeParamList.GetClientRect(&rc);
+ int nColWidth = rc.Width() / 2;
+ m_wndRecipeParamList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
+ m_wndRecipeParamList.InsertColumn(0, _T("鍙傛暟鍚�"), LVCFMT_LEFT, nColWidth);
+ m_wndRecipeParamList.InsertColumn(1, _T("鍙傛暟鍊�"), LVCFMT_LEFT, nColWidth);
+
+ if (nullptr == m_pEquipment) {
+ return FALSE;
+ }
+
+ CString strTitle;
+ if (!m_strDeviceRecipeName.IsEmpty()) {
+ strTitle.Format(_T("%s - %s 閰嶆柟鍙傛暟"), m_pEquipment->getName().c_str(), m_strDeviceRecipeName);
+ }
+ else {
+ strTitle.Format(_T("%s 閰嶆柟鍙傛暟"), m_pEquipment->getName().c_str());
+ }
+ SetWindowText(strTitle);
+
+ SERVO::CRecipeList* pRecipeList = m_pEquipment->getRecipeList(0);
+ ASSERT(pRecipeList);
+ auto rawDatas = pRecipeList->getParamsRawData();
+ for (auto item : rawDatas) {
+ if (m_nDeviceRecipeID != 0 && item.first != m_nDeviceRecipeID) {
+ continue;
+ }
+
+ std::vector<CParam> params;
+ m_pEquipment->parsingParams((const char*)item.second.data(), item.second.size(), params);
+ for (auto p : params) {
+ CString strName(p.getName().c_str());
+ CString strValue;
+
+ switch (p.getValueType()) {
+ case PVT_INT:
+ strValue.Format(_T("%d"), p.getIntValue());
+ break;
+ case PVT_DOUBLE:
+ strValue.Format(_T("%.6f"), p.getDoubleValue());
+ break;
+ default:
+ strValue = _T("鏈煡绫诲瀷");
+ break;
+ }
+
+ int nCount = m_wndRecipeParamList.GetItemCount();
+ int nIndex = m_wndRecipeParamList.InsertItem(nCount, strName);
+ m_wndRecipeParamList.SetItemText(nIndex, 1, strValue);
+ }
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
diff --git a/SourceCode/Bond/Servo/DeviceRecipeParamDlg.h b/SourceCode/Bond/Servo/DeviceRecipeParamDlg.h
new file mode 100644
index 0000000..d273c84
--- /dev/null
+++ b/SourceCode/Bond/Servo/DeviceRecipeParamDlg.h
@@ -0,0 +1,34 @@
+锘�#pragma once
+#include "afxdialogex.h"
+
+
+// CDeviceRecipeParamDlg 瀵硅瘽妗�
+
+class CDeviceRecipeParamDlg : public CDialogEx
+{
+ DECLARE_DYNAMIC(CDeviceRecipeParamDlg)
+
+public:
+ CDeviceRecipeParamDlg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁�
+ virtual ~CDeviceRecipeParamDlg();
+
+ void setEquipment(SERVO::CEquipment* pEquipment);
+ void setDeviceRecipeID(int nDeviceRecipeID);
+ void setDeviceRecipeName(const CString& strDeviceRecipeName);
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_DEVICE_RECIPE_PARAM };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔
+ virtual BOOL OnInitDialog();
+ DECLARE_MESSAGE_MAP()
+
+private:
+ int m_nDeviceRecipeID;
+ CString m_strDeviceRecipeName;
+ SERVO::CEquipment* m_pEquipment;
+ CListCtrl m_wndRecipeParamList;
+};
diff --git a/SourceCode/Bond/Servo/PageRecipe.cpp b/SourceCode/Bond/Servo/PageRecipe.cpp
index 05ee4ad..8984870 100644
--- a/SourceCode/Bond/Servo/PageRecipe.cpp
+++ b/SourceCode/Bond/Servo/PageRecipe.cpp
@@ -8,6 +8,7 @@
#include "MsgDlg.h"
#include "InputDialog.h"
#include "RecipeDeviceBindDlg.h"
+#include "DeviceRecipeParamDlg.h"
// CPageRecipe 瀵硅瘽妗�
@@ -588,17 +589,25 @@
return;
}
- CString strText = m_listPPID.GetItemText(nItem, 2);
+ CString strRecipeID = m_listPPID.GetItemText(nItem, 2);
+ CString strRecipeName = m_listPPID.GetItemText(nItem, 3);
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
int nEqSel = pComboBox->GetCurSel();
if (nEqSel == CB_ERR) {
return;
}
+ int nRecipeID = _ttoi(strRecipeID);
SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nEqSel);
if (pEq == nullptr) {
return;
}
+
+ CDeviceRecipeParamDlg dlg(this);
+ dlg.setDeviceRecipeID(nRecipeID);
+ dlg.setDeviceRecipeName(strRecipeName);
+ dlg.setEquipment(pEq);
+ dlg.DoModal();
}
void CPageRecipe::OnCbnSelchangeComboEquipment()
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index d8c898b..f2c6199 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index a4e27f1..565b685 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -222,6 +222,7 @@
<ClInclude Include="CPortStatusReport.h" />
<ClInclude Include="CRobotTaskDlg.h" />
<ClInclude Include="CVariable.h" />
+ <ClInclude Include="DeviceRecipeParamDlg.h" />
<ClInclude Include="GridControl\CellRange.h" />
<ClInclude Include="GridControl\GridCell.h" />
<ClInclude Include="GridControl\GridCellBase.h" />
@@ -377,6 +378,7 @@
<ClCompile Include="CPortStatusReport.cpp" />
<ClCompile Include="CRobotTaskDlg.cpp" />
<ClCompile Include="CVariable.cpp" />
+ <ClCompile Include="DeviceRecipeParamDlg.cpp" />
<ClCompile Include="GridControl\GridCell.cpp" />
<ClCompile Include="GridControl\GridCellBase.cpp" />
<ClCompile Include="GridControl\GridCellButton.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 6ef9bf8..2cd9e80 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -181,6 +181,7 @@
<ClCompile Include="CExpandableListCtrl.cpp" />
<ClCompile Include="CControlJobDlg.cpp" />
<ClCompile Include="CParam.cpp" />
+ <ClCompile Include="DeviceRecipeParamDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AlarmManager.h" />
@@ -368,6 +369,7 @@
<ClInclude Include="CExpandableListCtrl.h" />
<ClInclude Include="CControlJobDlg.h" />
<ClInclude Include="CParam.h" />
+ <ClInclude Include="DeviceRecipeParamDlg.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.user b/SourceCode/Bond/Servo/Servo.vcxproj.user
index 82c7903..0c03257 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.user
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.user
@@ -7,6 +7,6 @@
<RemoteDebuggerCommand>\\DESKTOP-IODBVIQ\Servo\Debug\Servo.exe</RemoteDebuggerCommand>
<RemoteDebuggerWorkingDirectory>\\DESKTOP-IODBVIQ\Servo\Debug\</RemoteDebuggerWorkingDirectory>
<RemoteDebuggerServerName>DESKTOP-IODBVIQ</RemoteDebuggerServerName>
- <DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
index 6dad237..2801142 100644
--- a/SourceCode/Bond/Servo/resource.h
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ
--
Gitblit v1.9.3