From 173172803858304548943d530d59be6d93136841 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期六, 21 六月 2025 16:46:18 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CAttributeVector.cpp |   12 +++++++++---
 SourceCode/Bond/Servo/CMaster.cpp          |    2 +-
 SourceCode/Bond/Servo/CLoadPort.cpp        |    2 +-
 SourceCode/Bond/Servo/CAttributeVector.h   |    3 ++-
 SourceCode/Bond/Servo/CStep.cpp            |   13 ++++++++++---
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/SourceCode/Bond/Servo/CAttributeVector.cpp b/SourceCode/Bond/Servo/CAttributeVector.cpp
index 79e1776..d7c52b7 100644
--- a/SourceCode/Bond/Servo/CAttributeVector.cpp
+++ b/SourceCode/Bond/Servo/CAttributeVector.cpp
@@ -17,15 +17,15 @@
 		m_attributes.clear();
 	}
 
-	void CAttributeVector::addAttribute(CAttribute* pAttribute, BOOL bReplace/* = FALSE*/)
+	BOOL CAttributeVector::addAttribute(CAttribute* pAttribute, BOOL bReplace/* = FALSE*/)
 	{
 		if (!pAttribute) { 
-			return;
+			return FALSE;
 		}
 
 		const std::string& name = pAttribute->getName();
 		if (name.empty()) { 
-			return;
+			return FALSE;
 		}
 
 		if (bReplace) {
@@ -41,6 +41,7 @@
 		}
 
 		m_attributes.push_back(pAttribute);
+		return TRUE;
 	}
 
 	void CAttributeVector::addAttributeVector(CAttributeVector& av)
@@ -80,4 +81,9 @@
 		ASSERT(index < m_attributes.size());
 		return m_attributes[index];
 	}
+
+	std::vector<CAttribute*>& CAttributeVector::getAttributes()
+	{
+		return m_attributes;
+	}
 }
diff --git a/SourceCode/Bond/Servo/CAttributeVector.h b/SourceCode/Bond/Servo/CAttributeVector.h
index f4cb330..0240f6f 100644
--- a/SourceCode/Bond/Servo/CAttributeVector.h
+++ b/SourceCode/Bond/Servo/CAttributeVector.h
@@ -11,13 +11,14 @@
 		virtual ~CAttributeVector();
 
 	public:
-		void addAttribute(CAttribute* pAttribute, BOOL bReplace = FALSE);
+		BOOL addAttribute(CAttribute* pAttribute, BOOL bReplace = FALSE);
 		void addAttributeVector(CAttributeVector& av);
 		void clear();
 		void sortWithWeight();
 		unsigned int size();
 		bool empty();
 		CAttribute* getAttribute(unsigned int index);
+		std::vector<CAttribute*>& getAttributes();
 
 	private:
 		std::vector<CAttribute*> m_attributes;
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 5ac81cb..d2366f1 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -300,7 +300,7 @@
 			pStep->setName(pszName[m_nIndex]);
 			pStep->setWriteSignalDev(0x128 + m_nIndex);
 			pStep->setDataDev(dev[m_nIndex]);
-			if (addStep(STEP_ID_PROT1_TYPE_AUTO_CHANGE_REPLY + m_nIndex, pStep) != 0) {
+			if (addStep(STEP_ID_PROT1_CASSETTE_TYPE_CHANGE_REPLY + m_nIndex, pStep) != 0) {
 				delete pStep;
 			}
 		}
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 009aeae..6498901 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -698,7 +698,7 @@
 				// Aligner -> Fliper(G2)
 				// Aligner -> VacuumBake(G1)
 				if (!rmd.armState[1]) {
-					m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType, 2);
+					m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType);
 					if (m_pActiveRobotTask != nullptr) {
 						m_pActiveRobotTask->pick();
 						std::string strDescription = m_pActiveRobotTask->getDescription();
diff --git a/SourceCode/Bond/Servo/CStep.cpp b/SourceCode/Bond/Servo/CStep.cpp
index d1907c7..4ac3dfd 100644
--- a/SourceCode/Bond/Servo/CStep.cpp
+++ b/SourceCode/Bond/Servo/CStep.cpp
@@ -94,9 +94,16 @@
 	void CStep::addAttributeVector(CAttributeVector& attributeVector)
 	{
 		// 添加attribute时,要前删除存在的同名的attribute
-		unsigned int size = attributeVector.size();
-		for (unsigned int i = 0; i < size; i++) {
-			m_attributeVector.addAttribute(attributeVector.getAttribute(i), TRUE);
+		std::vector<CAttribute*>& srcs = attributeVector.getAttributes();
+		auto it = srcs.begin();
+		while (it != srcs.end()) {
+			BOOL bAdd = m_attributeVector.addAttribute((*it), TRUE);
+			if (bAdd) {
+				it = srcs.erase(it);
+			}
+			else {
+				++it;
+			}
 		}
 	}
 

--
Gitblit v1.9.3