From bfe14e41fa5b07771d78af4511ba18d706bc23cc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:07:52 +0800
Subject: [PATCH] 1.Spooling Config功能EAP模拟测试;

---
 SourceCode/Bond/Servo/CGlass.cpp |  116 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 86 insertions(+), 30 deletions(-)

diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index e2b6259..6d1a1ee 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -8,9 +8,16 @@
 		m_pPath = nullptr;
 		m_type = MaterialsType::G1;
 		m_pBuddy = nullptr;
+		m_nOriginPort = 0;
+		m_nOriginSlot = 0;
 	}
 
 	CGlass::~CGlass()
+	{
+
+	}
+
+	void CGlass::reset()
 	{
 		CPath* pPath = m_pPath;
 		while (pPath != nullptr) {
@@ -20,7 +27,7 @@
 		}
 		m_pPath = nullptr;
 
-		if (m_pBuddy != nullptr	&& m_type == MaterialsType::G1) {
+		if (m_pBuddy != nullptr) {
 			m_pBuddy->release();
 		}
 	}
@@ -61,17 +68,16 @@
 		return m_strID;
 	}
 
-	CPath* CGlass::getPathWithSiteID(unsigned int nSiteId)
+	void CGlass::setOriginPort(int port, int slot)
 	{
-		CPath* pPath = m_pPath;
-		while (pPath != nullptr) {
-			if (nSiteId == pPath->getSiteID()) {
-				return pPath;
-			}
-			pPath = pPath->getNext();
-		}
+		m_nOriginPort = port;
+		m_nOriginSlot = slot;
+	}
 
-		return nullptr;
+	void CGlass::getOrginPort(int& port, int& slot)
+	{
+		port = m_nOriginPort;
+		slot = m_nOriginSlot;
 	}
 
 	CPath* CGlass::getPath()
@@ -79,9 +85,23 @@
 		return m_pPath;
 	}
 
-	void CGlass::addPath(unsigned int nSiteId)
+	CPath* CGlass::getPathWithEq(unsigned int nEqId, unsigned int nUnit)
 	{
-		CPath* pPath = new CPath(nSiteId);
+		CPath* pTemp = m_pPath;
+		while (pTemp != nullptr) {
+			if (pTemp->getEqID() == nEqId && pTemp->getUnit() == nUnit) {
+				return pTemp;
+			}
+
+			pTemp = pTemp->getNext();
+		}
+
+		return nullptr;
+	}
+
+	void CGlass::addPath(unsigned int nEqId, unsigned int nUnit)
+	{
+		CPath* pPath = new CPath(nEqId, nUnit);
 		if (m_pPath == nullptr) {
 			m_pPath = pPath;
 		}
@@ -97,13 +117,13 @@
 			Lock();
 			ar << (int)m_type;
 			WriteString(ar, m_strID);
+			ar << m_nOriginPort;
+			ar << m_nOriginSlot;
 			ar << (ULONGLONG)m_pPath;
 			if (m_pPath != nullptr) {
 				m_pPath->serialize(ar);
 			}
 			char temp[JOBDATAS_SIZE] = { 0 };
-			m_jobDataB.serialize(temp, JOBDATAB_SIZE);
-			ar.Write(temp, JOBDATAB_SIZE);
 			m_jobDataS.serialize(temp, JOBDATAS_SIZE);
 			ar.Write(temp, JOBDATAS_SIZE);
 			ar << (ULONGLONG)m_pBuddy;
@@ -119,35 +139,30 @@
 			ar >> type;
 			m_type = (MaterialsType)type;
 			ReadString(ar, m_strID);
+			ar >> m_nOriginPort;
+			ar >> m_nOriginSlot;
 			ar >> ullPath;
 			if (ullPath != 0) {
 				m_pPath = new CPath();
 				m_pPath->serialize(ar);
 			}
 			char temp[JOBDATAS_SIZE];
-			ar.Read(temp, JOBDATAB_SIZE);
-			m_jobDataB.unserialize(temp, JOBDATAB_SIZE);
 			ar.Read(temp, JOBDATAS_SIZE);
 			m_jobDataS.unserialize(temp, JOBDATAS_SIZE);
-			ar >> ullPath;					// 这是m_pBuddy, 用不上
+			ar >> ullPath;	m_pBuddy = (CGlass*)ullPath;
 			ReadString(ar, m_strBuddyId);
 			Unlock();
 		}
 	}
 
-	void CGlass::setJobDataB(CJobDataB* pJobDataB)
-	{
-		m_jobDataB.copy(pJobDataB);
-	}
-
-	CJobDataB* CGlass::getJobDataB()
-	{
-		return &m_jobDataB;
-	}
-
 	void CGlass::setJobDataS(CJobDataS* pJobDataS)
 	{
 		m_jobDataS.copy(pJobDataS);
+	}
+
+	void CGlass::updateJobDataS(CJobDataS* pJobDataS)
+	{
+		m_jobDataS.update(pJobDataS);
 	}
 
 	CJobDataS* CGlass::getJobDataS()
@@ -160,9 +175,16 @@
 		if (m_pBuddy != nullptr) return FALSE;
 		if (pGlass->getType() == this->getType()) return FALSE;
 		m_pBuddy = pGlass;
-		if (m_type == MaterialsType::G1) {
-			m_pBuddy->addRef();
-		}
+		m_pBuddy->addRef();
+		m_strBuddyId = m_pBuddy->getID();
+
+		return TRUE;
+	}
+
+	BOOL CGlass::forceSetBuddy(CGlass* pGlass)
+	{
+		m_pBuddy = pGlass;
+		m_pBuddy->addRef();
 		m_strBuddyId = m_pBuddy->getID();
 
 		return TRUE;
@@ -177,4 +199,38 @@
 	{
 		return m_strBuddyId;
 	}
+
+	int CGlass::processEnd(unsigned int nEqId, unsigned int nUnit)
+	{
+		CPath* pPath = getPathWithEq(nEqId, nUnit);
+		if (pPath == nullptr) return -1;
+
+		pPath->processEnd();
+		return 0;
+	}
+
+	BOOL CGlass::isProcessed(unsigned int nEqId, unsigned int nUnit)
+	{
+		CPath* pPath = getPathWithEq(nEqId, nUnit);
+		if (pPath == nullptr) return FALSE;
+
+		return pPath->isProcessEnd();
+	}
+
+	int CGlass::setInspResult(unsigned int nEqId, unsigned int nUnit, InspResult result)
+	{
+		CPath* pPath = getPathWithEq(nEqId, nUnit);
+		if (pPath == nullptr) return -1;
+			
+		pPath->setInspResult(result);
+		return 0;
+	}
+
+	InspResult CGlass::getInspResult(unsigned int nEqId, unsigned int nUnit)
+	{
+		CPath* pPath = getPathWithEq(nEqId, nUnit);
+		if (pPath == nullptr) return InspResult::NotInspected;
+
+		return pPath->getInspResult();
+	}
 }

--
Gitblit v1.9.3