From 829fe6c6bc33d53fda9c31fd45a37e1df87befff Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 30 一月 2026 11:16:24 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/PageRecipe.cpp |   67 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/SourceCode/Bond/Servo/PageRecipe.cpp b/SourceCode/Bond/Servo/PageRecipe.cpp
index 864ea5a..841a96f 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 瀵硅瘽妗�
@@ -38,7 +39,7 @@
 	}
 
 	m_listPPID.InsertColumn(0, _T(""), LVCFMT_RIGHT, 0); // 闅愯棌鍒�
-	m_listPPID.InsertColumn(1, _T("No."), LVCFMT_LEFT, width[1]);
+	m_listPPID.InsertColumn(1, _T("No."), LVCFMT_CENTER, width[1]);
 	m_listPPID.InsertColumn(2, _T("PPID"), LVCFMT_LEFT, width[2]);
 	m_listPPID.InsertColumn(3, _T("鐪熺┖鐑樼儰"), LVCFMT_LEFT, width[6]);
 	m_listPPID.InsertColumn(4, _T("Bonder1"), LVCFMT_LEFT, width[4]);
@@ -66,9 +67,9 @@
 
 	m_listPPID.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]);
 	m_listPPID.InsertColumn(1, _T("No."), LVCFMT_CENTER, width[1]);
-	m_listPPID.InsertColumn(2, _T("Recipe ID"), LVCFMT_CENTER, width[2]);
-	m_listPPID.InsertColumn(3, _T("Recipe 鍚嶇О"), LVCFMT_CENTER, width[3]);
-	m_listPPID.InsertColumn(4, _T("Recipe 鍙傛暟"), LVCFMT_CENTER, width[4]);
+	m_listPPID.InsertColumn(2, _T("Recipe ID"), LVCFMT_LEFT, width[2]);
+	m_listPPID.InsertColumn(3, _T("Recipe 鍚嶇О"), LVCFMT_LEFT, width[3]);
+	m_listPPID.InsertColumn(4, _T("Recipe 鍙傛暟"), LVCFMT_LEFT, width[4]);
 }
 
 void CPageRecipe::UpdateRecipeByPPID(const CString& strPPID)
@@ -137,9 +138,12 @@
 	// 閬嶅巻鏁版嵁骞舵彃鍏ュ埌CListCtrl涓�
 	for (int i = 0; i < static_cast<int>(vecRecipe.size()); ++i) {
 		const RecipeInfo& recipe = vecRecipe[i];
+		// 鍘熺▼搴忚姹侾PID鏈夊瓙閰嶆柟锛屽厛娉ㄩ噴
+		/*
 		if (recipe.vecDeviceList.empty() || recipe.vecDeviceList.size() > 6){
 			continue;
 		}
+		*/
 
 		m_listPPID.InsertItem(i, _T("")); // 绗�0鍒楃┖鐧�
 
@@ -158,7 +162,7 @@
 				str.Format(_T("%d"), recipe.vecDeviceList.at(j).nRecipeID);
 			}
 			else {
-				str.Format(_T("%s"), CA2T(strRecipeName.c_str()));
+				str.Format(_T("%s"), strRecipeName.c_str());
 			}
 	
 			m_listPPID.SetItemText(i, j + 3, str);
@@ -385,13 +389,12 @@
 
 void CPageRecipe::OnBnClickedButtonNew()
 {
-	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
-	//CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
-	//int nSel = pComboBox->GetCurSel();
-	//SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nSel);
-	//if (pEq == nullptr) {
-	//	return;
-	//}
+	int rc = UX_CanExecute(L"recipe");
+	if (rc != 1) {
+		AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+		return;
+	}
+	UX_RecordAction(L"recipe");
 
 	CRecipeDeviceBindDlg dlg(this);
 	if (dlg.DoModal() == IDOK) {
@@ -451,6 +454,13 @@
 
 void CPageRecipe::OnBnClickedButtonModify()
 {
+	int rc = UX_CanExecute(L"recipe");
+	if (rc != 1) {
+		AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+		return;
+	}
+	UX_RecordAction(L"recipe");
+
 	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
 	CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
 	if (pComboBox == nullptr || !::IsWindow(pComboBox->m_hWnd)) {
@@ -491,6 +501,13 @@
 
 void CPageRecipe::OnBnClickedButtonDelete()
 {
+	int rc = UX_CanExecute(L"recipe");
+	if (rc != 1) {
+		AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+		return;
+	}
+	UX_RecordAction(L"recipe");
+
 	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
 	POSITION pos = m_listPPID.GetFirstSelectedItemPosition();
 	if (!pos) { 
@@ -517,6 +534,13 @@
 
 void CPageRecipe::OnBnClickedButtonDeleteAll()
 {
+	int rc = UX_CanExecute(L"recipe");
+	if (rc != 1) {
+		AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+		return;
+	}
+	UX_RecordAction(L"recipe");
+
 	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
 	if (IDYES != AfxMessageBox(_T("纭畾瑕佸垹闄ゅ叏閮ㄩ厤鏂硅褰曞悧锛�"), MB_YESNO | MB_ICONWARNING)) {
 		return;
@@ -588,17 +612,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()
@@ -769,4 +801,13 @@
 		}
 	}
 	return result;
+}
+
+BOOL CPageRecipe::PreTranslateMessage(MSG* pMsg)
+{
+	if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
+		return TRUE;
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
 }
\ No newline at end of file

--
Gitblit v1.9.3