From a056810ab4c5fa63777f6fdddfeb190bbd9a6f54 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 08 九月 2025 14:05:25 +0800
Subject: [PATCH] Merge branch 'liuyang'

---
 SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp |  113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 113 insertions(+), 0 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
+}

--
Gitblit v1.9.3