From 2ebccf831b56d30089924f2eefa2d790e2b8f3fc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 07 八月 2025 09:20:21 +0800
Subject: [PATCH] 1.为CVariable增加值的设置和获取 2.当发生Port状态改变为InUse时,此时也刚好获取到CarrierID,上报S6F11_CarrierID_Readed

---
 SourceCode/Bond/Servo/CGlass.cpp |  194 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 193 insertions(+), 1 deletions(-)

diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index e9847f9..6c1b30f 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -5,12 +5,32 @@
 namespace SERVO {
 	CGlass::CGlass()
 	{
-
+		m_pPath = nullptr;
+		m_type = MaterialsType::G1;
+		m_pBuddy = nullptr;
+		m_nOriginPort = 0;
+		m_nOriginSlot = 0;
+		m_bScheduledForProcessing = FALSE;
 	}
 
 	CGlass::~CGlass()
 	{
 
+	}
+
+	void CGlass::reset()
+	{
+		CPath* pPath = m_pPath;
+		while (pPath != nullptr) {
+			CPath* pTemp = pPath->getNext();
+			delete pPath;
+			pPath = pTemp;
+		}
+		m_pPath = nullptr;
+
+		if (m_pBuddy != nullptr) {
+			m_pBuddy->release();
+		}
 	}
 
 	std::string& CGlass::getClassName()
@@ -29,6 +49,16 @@
 		return strText;
 	}
 
+	MaterialsType CGlass::getType()
+	{
+		return m_type;
+	}
+
+	void CGlass::setType(MaterialsType type)
+	{
+		m_type = type;
+	}
+
 	void CGlass::setID(const char* pszID)
 	{
 		m_strID = pszID;
@@ -39,19 +69,181 @@
 		return m_strID;
 	}
 
+	void CGlass::setOriginPort(int port, int slot)
+	{
+		m_nOriginPort = port;
+		m_nOriginSlot = slot;
+	}
+
+	void CGlass::getOrginPort(int& port, int& slot)
+	{
+		port = m_nOriginPort;
+		slot = m_nOriginSlot;
+	}
+
+	BOOL CGlass::isScheduledForProcessing()
+	{
+		return m_bScheduledForProcessing;
+	}
+	
+	void CGlass::setScheduledForProcessing(BOOL bProcessing)
+	{
+		m_bScheduledForProcessing = bProcessing;
+	}
+
+	CPath* CGlass::getPath()
+	{
+		return m_pPath;
+	}
+
+	CPath* CGlass::getPathWithEq(unsigned int nEqId, unsigned int nUnit)
+	{
+		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;
+		}
+		else {
+			m_pPath->addPath(pPath);
+		}
+	}
+
 	void CGlass::serialize(CArchive& ar)
 	{
 		if (ar.IsStoring())
 		{
 			Lock();
+			ar << (int)m_type;
 			WriteString(ar, m_strID);
+			ar << m_nOriginPort;
+			ar << m_nOriginSlot;
+			ar << m_bScheduledForProcessing;
+			ar << (ULONGLONG)m_pPath;
+			if (m_pPath != nullptr) {
+				m_pPath->serialize(ar);
+			}
+			char temp[JOBDATAS_SIZE] = { 0 };
+			m_jobDataS.serialize(temp, JOBDATAS_SIZE);
+			ar.Write(temp, JOBDATAS_SIZE);
+			ar << (ULONGLONG)m_pBuddy;
+			WriteString(ar, m_strBuddyId);
 			Unlock();
 		}
 		else
 		{
+			ULONGLONG ullPath;
+			int type;
+
 			Lock();
+			ar >> type;
+			m_type = (MaterialsType)type;
 			ReadString(ar, m_strID);
+			ar >> m_nOriginPort;
+			ar >> m_nOriginSlot;
+			ar >> m_bScheduledForProcessing;
+			ar >> ullPath;
+			if (ullPath != 0) {
+				m_pPath = new CPath();
+				m_pPath->serialize(ar);
+			}
+			char temp[JOBDATAS_SIZE];
+			ar.Read(temp, JOBDATAS_SIZE);
+			m_jobDataS.unserialize(temp, JOBDATAS_SIZE);
+			ar >> ullPath;	m_pBuddy = (CGlass*)ullPath;
+			ReadString(ar, m_strBuddyId);
 			Unlock();
 		}
 	}
+
+	void CGlass::setJobDataS(CJobDataS* pJobDataS)
+	{
+		m_jobDataS.copy(pJobDataS);
+	}
+
+	void CGlass::updateJobDataS(CJobDataS* pJobDataS)
+	{
+		m_jobDataS.update(pJobDataS);
+	}
+
+	CJobDataS* CGlass::getJobDataS()
+	{
+		return &m_jobDataS;
+	}
+
+	BOOL CGlass::setBuddy(CGlass* pGlass)
+	{
+		if (m_pBuddy != nullptr) return FALSE;
+		if (pGlass->getType() == this->getType()) return FALSE;
+		m_pBuddy = pGlass;
+		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;
+	}
+
+	CGlass* CGlass::getBuddy()
+	{
+		return m_pBuddy;
+	}
+
+	std::string& CGlass::getBuddyId()
+	{
+		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