From d68541dce155a682f65b7c3fbfbfbeef17ea5b8f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 12 五月 2025 12:00:41 +0800
Subject: [PATCH] 1.StoredJob, Fetched out Job实现; 2.CStep增加定制的Attribute, 以便通过的Step不使用getAttributeVector也能添加不一样的Attribute;

---
 SourceCode/Bond/Servo/CEquipment.cpp |   82 +++++++++++++++++++++++++++++++---------
 1 files changed, 63 insertions(+), 19 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index b14e096..0bf4132 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -203,48 +203,50 @@
 	void CEquipment::getAttributeVector(CAttributeVector& attrubutes)
 	{
 		attrubutes.clear();
+
+		unsigned int weight = 0;
 		attrubutes.addAttribute(new CAttribute("Network",
-			std::to_string(m_station.nNetNo).c_str(), ""));
+			std::to_string(m_station.nNetNo).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Station",
-			std::to_string(m_station.nStNo).c_str(), ""));
+			std::to_string(m_station.nStNo).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("ID",
-			std::to_string(m_nID).c_str(), ""));
+			std::to_string(m_nID).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Name",
-			m_strName.c_str(), ""));
+			m_strName.c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Description",
-			m_strDescription.c_str(), ""));
+			m_strDescription.c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Alive",
-			this->isAlive() ? _T("TRUE") : _T("FALSE"), ""));
+			this->isAlive() ? _T("TRUE") : _T("FALSE"), "", weight++));
 		attrubutes.addAttribute(new CAttribute("CIM State",
-			m_bCimState ? _T("ON") : _T("OFF"), ""));
+			m_bCimState ? _T("ON") : _T("OFF"), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Upstream",
-			m_bUpstreamInline ? _T("Inline") : _T("Offline"), ""));
+			m_bUpstreamInline ? _T("Inline") : _T("Offline"), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Downstream",
-			m_bDownstreamInline ? _T("Inline") : _T("Offline"), ""));
+			m_bDownstreamInline ? _T("Inline") : _T("Offline"), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Local Alarm",
-			m_bLocalAlarm ? _T("TRUE") : _T("FALSE"), ""));
+			m_bLocalAlarm ? _T("TRUE") : _T("FALSE"), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Auto Recipe Change",
-			m_bAutoRecipeChange ? _T("TRUE") : _T("FALSE"), ""));
+			m_bAutoRecipeChange ? _T("TRUE") : _T("FALSE"), "", weight++));
 		char szTemp[256];
 		for (int i = 0; i < VCR_MAX; i++) {
 			sprintf_s(szTemp, 256, "VCR-%d", i + 1);
 			attrubutes.addAttribute(new CAttribute(szTemp,
-				m_bVCREnable[i] ? _T("Enable") : _T("Disable"), ""));
+				m_bVCREnable[i] ? _T("Enable") : _T("Disable"), "", weight++));
 		}
 
 		for (auto item : m_inputPins) {
 			attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
-				std::to_string((int)item->getType()).c_str(), ""));
+				std::to_string((int)item->getType()).c_str(), "", weight++));
 		}
 
 		for (auto item : m_outputPins) {
 			attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
-				std::to_string((int)item->getType()).c_str(), ""));
+				std::to_string((int)item->getType()).c_str(), "", weight++));
 		}
 
 		for (auto item : m_glassList) {
 			attrubutes.addAttribute(new CAttribute("Glass",
-				item->getID().c_str(), ""));
+				item->getID().c_str(), "", weight++));
 		}
 	}
 
@@ -1059,12 +1061,12 @@
 		return m_recipesManager.decodeRecipeParameterReport(pszData, size);
 	}
 
-	int CEquipment::decodeFetchedOutJobReport(int port, const char* pszData, size_t size)
+	int CEquipment::decodeFetchedOutJobReport(CStep* pStep, int port, const char* pszData, size_t size)
 	{
 		int index = 0;
 		short unitOrPort, unitOrPortNo, subUnitNo, subSlotNo;
 		CJobDataB jobDataB;
-		int nRet = jobDataB.unserialize(&pszData[index], size);
+		int nRet = jobDataB.unserialize(&pszData[index], (int)size);
 		if (nRet < 0) return nRet;
 		index += nRet;
 
@@ -1076,6 +1078,25 @@
 		index += sizeof(short);
 		memcpy(&subSlotNo, &pszData[index], sizeof(short));
 		index += sizeof(short);
+
+
+		// 缓存Attribute,用于调试时显示信息
+		unsigned int weight = 201;
+		pStep->addAttribute(new CAttribute("UnitOrPort",
+			std::to_string(unitOrPort).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("UnitOrPortNo",
+			std::to_string(unitOrPortNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("SubUnitNo",
+			std::to_string(subUnitNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("SubSlotNo",
+			std::to_string(subSlotNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("CassetteSequenceNo",
+			std::to_string(jobDataB.getCassetteSequenceNo()).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("JobSequenceNo",
+			std::to_string(jobDataB.getJobSequenceNo()).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("GlassId",
+			jobDataB.getGlassId().c_str(), "", weight++));
+
 
 		onFetchedOut(port, jobDataB.getGlassId().c_str());
 
@@ -1084,15 +1105,17 @@
 
 	int CEquipment::onFetchedOut(int port, const char* pszGlassId)
 	{
+		LOGI("<CEquipment-%s>onFetchedOut:port:%d|GlassId:%s", 
+			m_strName.c_str(), port, pszGlassId);
 		return fetchedOut(pszGlassId);
 	}
 
-	int CEquipment::decodeStoredJobReport(int port, const char* pszData, size_t size)
+	int CEquipment::decodeStoredJobReport(CStep* pStep, int port, const char* pszData, size_t size)
 	{
 		int index = 0;
 		short unitOrPort, unitOrPortNo, subUnitNo, subSlotNo;
 		CJobDataB jobDataB;
-		int nRet = jobDataB.unserialize(&pszData[index], size);
+		int nRet = jobDataB.unserialize(&pszData[index], (int)size);
 		if (nRet < 0) return nRet;
 		index += nRet;
 
@@ -1105,6 +1128,25 @@
 		memcpy(&subSlotNo, &pszData[index], sizeof(short));
 		index += sizeof(short);
 
+
+		// 缓存Attribute,用于调试时显示信息
+		unsigned int weight = 201;
+		pStep->addAttribute(new CAttribute("UnitOrPort",
+			std::to_string(unitOrPort).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("UnitOrPortNo",
+			std::to_string(unitOrPortNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("SubUnitNo",
+			std::to_string(subUnitNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("SubSlotNo",
+			std::to_string(subSlotNo).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("CassetteSequenceNo",
+			std::to_string(jobDataB.getCassetteSequenceNo()).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("JobSequenceNo",
+			std::to_string(jobDataB.getJobSequenceNo()).c_str(), "", weight++));
+		pStep->addAttribute(new CAttribute("GlassId",
+			jobDataB.getGlassId().c_str(), "", weight++));
+
+
 		onStore(port, jobDataB.getGlassId().c_str());
 
 		return index;
@@ -1112,6 +1154,8 @@
 
 	int CEquipment::onStore(int port, const char* pszGlassId)
 	{
+		LOGI("<CEquipment-%s>onStore:port:%d|GlassId:%s",
+			m_strName.c_str(), port, pszGlassId);
 		return storedJob(pszGlassId);
 	}
 }
\ No newline at end of file

--
Gitblit v1.9.3