From d3c3d619a2fc92c8d5b2929031cf7e946d57b44a Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 13 五月 2025 10:08:37 +0800
Subject: [PATCH] 1.合并后修复;

---
 SourceCode/Bond/Servo/CEquipment.cpp |  144 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 119 insertions(+), 25 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index b14e096..3b15620 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++));
 		}
 	}
 
@@ -820,7 +822,7 @@
 		return pGlass;
 	}
 
-	int CEquipment::fetchedOut(const char* pszGlassId)
+	int CEquipment::fetchedOutJob(const char* pszGlassId)
 	{
 		if (m_pArm == nullptr) {
 			return -1;
@@ -1059,12 +1061,62 @@
 		return m_recipesManager.decodeRecipeParameterReport(pszData, size);
 	}
 
-	int CEquipment::decodeFetchedOutJobReport(int port, const char* pszData, size_t size)
+	int CEquipment::decodeReceivedJobReport(CStep* pStep, int port, const char* pszData, size_t size)
+	{
+		CJobDataS jobDataS;
+		int nRet = jobDataS.unserialize(&pszData[0], (int)size);
+		if (nRet < 0) return nRet;
+
+		// 缓存Attribute,用于调试时显示信息
+		unsigned int weight = 201;
+		CAttributeVector attrubutes;
+		jobDataS.getAttributeVector(attrubutes, weight);
+		pStep->addAttributeVector(attrubutes);
+
+
+		onReceivedJob(port, &jobDataS);
+
+		return nRet;
+	}
+
+	int CEquipment::onReceivedJob(int port, CJobDataS* pJobDataS)
+	{
+		LOGI("<CEquipment-%s>onReceivedJob.", m_strName.c_str());
+		// return fetchedOutJob(pszGlassId);
+		return 0;
+	}
+
+	int CEquipment::decodeSentOutJobReport(CStep* pStep, int port, const char* pszData, size_t size)
+	{
+		CJobDataS jobDataS;
+		int nRet = jobDataS.unserialize(&pszData[0], (int)size);
+		if (nRet < 0) return nRet;
+
+		// 缓存Attribute,用于调试时显示信息
+		unsigned int weight = 201;
+		CAttributeVector attrubutes;
+		jobDataS.getAttributeVector(attrubutes, weight);
+		pStep->addAttributeVector(attrubutes);
+
+
+		onReceivedJob(port, &jobDataS);
+
+		return nRet;
+	}
+
+	int CEquipment::onSentOutJob(int port, CJobDataS* pJobDataS)
+	{
+		LOGI("<CEquipment-%s>onSentOutJob.", m_strName.c_str());
+		// return fetchedOutJob(pszGlassId);
+		return 0;
+	}
+
+	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;
 
@@ -1077,22 +1129,43 @@
 		memcpy(&subSlotNo, &pszData[index], sizeof(short));
 		index += sizeof(short);
 
-		onFetchedOut(port, jobDataB.getGlassId().c_str());
+
+		// 缓存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++));
+
+
+		onFetchedOutJob(port, jobDataB.getGlassId().c_str());
 
 		return index;
 	}
 
-	int CEquipment::onFetchedOut(int port, const char* pszGlassId)
+	int CEquipment::onFetchedOutJob(int port, const char* pszGlassId)
 	{
-		return fetchedOut(pszGlassId);
+		LOGI("<CEquipment-%s>onFetchedOutJob:port:%d|GlassId:%s", 
+			m_strName.c_str(), port, pszGlassId);
+		return fetchedOutJob(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,13 +1178,34 @@
 		memcpy(&subSlotNo, &pszData[index], sizeof(short));
 		index += sizeof(short);
 
-		onStore(port, jobDataB.getGlassId().c_str());
+
+		// 缓存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++));
+
+
+		onStoreJob(port, jobDataB.getGlassId().c_str());
 
 		return index;
 	}
 
-	int CEquipment::onStore(int port, const char* pszGlassId)
+	int CEquipment::onStoreJob(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