From b7392b564b8ab6d987e449a5b412273e8c89112c Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 15 五月 2025 11:09:43 +0800
Subject: [PATCH] 1.Bonder进料检测和限制;

---
 SourceCode/Bond/Servo/CVacuumBake.cpp |    6 +-
 SourceCode/Bond/Servo/CAligner.cpp    |   20 ++++++
 SourceCode/Bond/Servo/CFliper.cpp     |    6 +-
 SourceCode/Bond/Servo/CAligner.h      |    1 
 SourceCode/Bond/Servo/CBonder.h       |    6 -
 SourceCode/Bond/Servo/CBonder.cpp     |  103 +++++----------------------------
 Document/chatdpt.docx                 |    0 
 7 files changed, 45 insertions(+), 97 deletions(-)

diff --git a/Document/chatdpt.docx b/Document/chatdpt.docx
new file mode 100644
index 0000000..0ee5a39
--- /dev/null
+++ b/Document/chatdpt.docx
Binary files differ
diff --git a/SourceCode/Bond/Servo/CAligner.cpp b/SourceCode/Bond/Servo/CAligner.cpp
index dc4a93b..e07f04e 100644
--- a/SourceCode/Bond/Servo/CAligner.cpp
+++ b/SourceCode/Bond/Servo/CAligner.cpp
@@ -68,4 +68,24 @@
 
 		return m_glassList.empty();
 	}
+
+	BOOL CAligner::onPreStoredJob(int port, CJobDataB* pJobDataB)
+	{
+		CJobDataS* pJobDataS = getJobDataS(pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
+		if (pJobDataS == nullptr) {
+			LOGE("<CAligner-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(),
+				pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
+			return FALSE;
+		}
+
+		// 只能一片一片的对位
+		Lock();
+		if (!m_glassList.empty()) {
+			Unlock();
+			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器或单元存在玻璃片,不能进料,请注意风险!", m_strName.c_str());
+			return FALSE;
+		}
+
+		return TRUE;
+	}
 }
diff --git a/SourceCode/Bond/Servo/CAligner.h b/SourceCode/Bond/Servo/CAligner.h
index acf53e1..66ac974 100644
--- a/SourceCode/Bond/Servo/CAligner.h
+++ b/SourceCode/Bond/Servo/CAligner.h
@@ -20,6 +20,7 @@
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
         virtual BOOL glassWillArrive(CGlass* pGlass);
+        virtual BOOL onPreStoredJob(int port, CJobDataB* pJobDataB);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index 16f2d39..a1a47b1 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -6,7 +6,6 @@
 	CBonder::CBonder() : CEquipment()
 	{
 		m_nIndex = 0;
-		m_bPermittedStore = FALSE;
 	}
 
 	CBonder::~CBonder()
@@ -88,17 +87,6 @@
 		}
 
 		{
-			// eq process
-			// 使用CEqReadStep替换CEqProcessStep
-			/*
-			CEqProcessStep* pStep = new CEqProcessStep();
-			pStep->setName(STEP_PROCESS);
-			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x347 : 0x647);
-			pStep->setProcessDev(m_nIndex == 0 ? 0xab55 : 0xeb55);
-			if (addStep(STEP_ID_PROCESS_DATA_REPORT, pStep) != 0) {
-				delete pStep;
-			}
-			*/
 			CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0xab55 : 0xeb55), 538 * 2,
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
@@ -299,45 +287,6 @@
 			}
 		}
 
-		/*
-		{
-			CEqJobEventStep* pStep = new CEqJobEventStep();
-			pStep->setName(STEP_EQ_RECEIVED_JOB_UPS1);
-			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x300 : 0x600);
-			pStep->setJobDataDev(m_nIndex == 0 ? 0x8c90 : 0xcc90);
-			if (addStep(STEP_ID_RECIVE_JOB_UPS1, pStep) != 0) {
-				delete pStep;
-			}
-		}
-		{
-			CEqJobEventStep* pStep = new CEqJobEventStep();
-			pStep->setName(STEP_EQ_RECEIVED_JOB_UPS2);
-			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x301 : 0x601);
-			pStep->setJobDataDev(m_nIndex == 0 ? 0x8dd0 : 0xcdd0);
-			if (addStep(STEP_ID_RECIVE_JOB_UPS2, pStep) != 0) {
-				delete pStep;
-			}
-		}
-		{
-			CEqJobEventStep* pStep = new CEqJobEventStep();
-			pStep->setName(STEP_EQ_SENT_OUT_JOB_DOWNS1);
-			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x30a : 0x60a);
-			pStep->setJobDataDev(m_nIndex == 0 ? 0x8000 : 0xc000);
-			if (addStep(STEP_ID_SENT_OUT_JOB_DOWNS1, pStep) != 0) {
-				delete pStep;
-			}
-		}
-		{
-			CEqJobEventStep* pStep = new CEqJobEventStep();
-			pStep->setName(STEP_EQ_SENT_OUT_JOB_DOWNS2);
-			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x30b : 0x60b);
-			pStep->setJobDataDev(m_nIndex == 0 ? 0x8140 : 0xc140);
-			if (addStep(STEP_ID_SENT_OUT_JOB_DOWNS2, pStep) != 0) {
-				delete pStep;
-			}
-		}
-		*/
-
 		{
 			// Fetched Out Job Report #1~15
 			char szBuffer[256];
@@ -427,54 +376,36 @@
 		return m_nIndex;
 	}
 
-	int CBonder::onReceivedJob(int port, CJobDataS* pJobDataS)
+	BOOL CBonder::onPreStoredJob(int port, CJobDataB* pJobDataB)
 	{
-		m_bPermittedStore = FALSE;
+		CJobDataS* pJobDataS = getJobDataS(pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
+		if (pJobDataS == nullptr) {
+			LOGE("<CBonder-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(),
+				pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
+			return FALSE;
+		}
+
+		// 如果为空,可以进G1或G2
+		// 如果有一片玻璃,当前玻璃为G1则可进G2, 当前玻璃为G2则可进G1
+		BOOL bCheck = FALSE;
 		Lock();
 		size_t size = m_glassList.size();
 		if (size == 0) {
-			m_bPermittedStore = TRUE;
+			bCheck = TRUE;
 		}
 		else if (size == 1) {
 			CGlass* pGlass = m_glassList.front();
-			if ( (pGlass->getType() == MaterialsType::G1 && pJobDataS->getMaterialsType() == (int)MaterialsType::G2)
+			if ((pGlass->getType() == MaterialsType::G1 && pJobDataS->getMaterialsType() == (int)MaterialsType::G2)
 				|| (pGlass->getType() == MaterialsType::G2 && pJobDataS->getMaterialsType() == (int)MaterialsType::G1)) {
-				m_bPermittedStore = TRUE;
+				bCheck = TRUE;
 			}
 		}
 		Unlock();
 
-		if (m_bPermittedStore) {
-			return CEquipment::onReceivedJob(port, pJobDataS);
+		if (!bCheck) {
+			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器不满足进料条件,或已存在两片玻璃,或G2与G1不匹配,请注意风险!", m_strName.c_str());
 		}
-		else {
-			return -1;
-		}
-	}
 
-	int CBonder::onSentOutJob(int port, CJobDataS* pJobDataS)
-	{
-		CEquipment::onSentOutJob(port, pJobDataS);
-
-		return 0;
-	}
-
-	int CBonder::onProcessData(CProcessData* pProcessData)
-	{
-		CEquipment::onProcessData(pProcessData);
-
-
-		return 0;
-	}
-
-	// Bonder检查腔体玻璃信息,如腔体为空可进G1或G2,
-	// 如腔体只有一片G1,可进G2,如腔体只有一片G2, 可进G1
-	// 其它情况不可进片
-	int CBonder::storedJob(CJobDataB* pJobDataB)
-	{
-		if (!m_bPermittedStore)
-			return -1;
-
-		return CEquipment::storedJob(pJobDataB);
+		return bCheck;
 	}
 }
diff --git a/SourceCode/Bond/Servo/CBonder.h b/SourceCode/Bond/Servo/CBonder.h
index 089878d..746639a 100644
--- a/SourceCode/Bond/Servo/CBonder.h
+++ b/SourceCode/Bond/Servo/CBonder.h
@@ -21,10 +21,7 @@
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
         virtual BOOL glassWillArrive(CGlass* pGlass);
-        virtual int storedJob(CJobDataB* pJobDataB);
-        virtual int onReceivedJob(int port, CJobDataS* pJobDataS);
-        virtual int onSentOutJob(int port, CJobDataS* pJobDataS);
-        virtual int onProcessData(CProcessData* pProcessData);
+        virtual BOOL onPreStoredJob(int port, CJobDataB* pJobDataB);
 
     public:
         void setIndex(unsigned int index);
@@ -32,7 +29,6 @@
 
     private:
         unsigned int m_nIndex;
-        BOOL m_bPermittedStore;
     };
 }
 
diff --git a/SourceCode/Bond/Servo/CFliper.cpp b/SourceCode/Bond/Servo/CFliper.cpp
index cdc0431..891aac4 100644
--- a/SourceCode/Bond/Servo/CFliper.cpp
+++ b/SourceCode/Bond/Servo/CFliper.cpp
@@ -72,7 +72,7 @@
 	{
 		CJobDataS* pJobDataS = getJobDataS(pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
 		if (pJobDataS == nullptr) {
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(), 
+			LOGE("<CFliper-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(), 
 				pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
 			return FALSE;
 		}
@@ -81,12 +81,12 @@
 		Lock();
 		if (!m_glassList.empty()) {
 			Unlock();
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器或单元存在玻璃片,不能进料,请注意风险!", m_strName.c_str());
+			LOGE("<CFliper-%s>onPreFetchedOutJob,当前机器或单元存在玻璃片,不能进料,请注意风险!", m_strName.c_str());
 			return FALSE;
 		}
 
 		if (pJobDataS->getMaterialsType() != (int)MaterialsType::G2) {
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器或单元只能进G2玻璃片,请注意风险!", m_strName.c_str());
+			LOGE("<CFliper-%s>onPreFetchedOutJob,当前机器或单元只能进G2玻璃片,请注意风险!", m_strName.c_str());
 			return FALSE;
 		}
 
diff --git a/SourceCode/Bond/Servo/CVacuumBake.cpp b/SourceCode/Bond/Servo/CVacuumBake.cpp
index 30e6da5..71b7143 100644
--- a/SourceCode/Bond/Servo/CVacuumBake.cpp
+++ b/SourceCode/Bond/Servo/CVacuumBake.cpp
@@ -72,7 +72,7 @@
 	{
 		CJobDataS* pJobDataS = getJobDataS(pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
 		if (pJobDataS == nullptr) {
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(),
+			LOGE("<CVacuumBake-%s>onPreFetchedOutJob,找不到对应的JobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), 注意排查风险!", m_strName.c_str(),
 				pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
 			return FALSE;
 		}
@@ -81,12 +81,12 @@
 		Lock();
 		if (!m_glassList.empty()) {
 			Unlock();
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器或单元存在玻璃片,不能进料,请注意风险!", m_strName.c_str());
+			LOGE("<CVacuumBake-%s>onPreFetchedOutJob,当前机器或单元存在玻璃片,不能进料,请注意风险!", m_strName.c_str());
 			return FALSE;
 		}
 
 		if (pJobDataS->getMaterialsType() != (int)MaterialsType::G1) {
-			LOGE("<CEquipment-%s>onPreFetchedOutJob,当前机器或单元只能进G2玻璃片,请注意风险!", m_strName.c_str());
+			LOGE("<CVacuumBake-%s>onPreFetchedOutJob,当前机器或单元只能进G2玻璃片,请注意风险!", m_strName.c_str());
 			return FALSE;
 		}
 

--
Gitblit v1.9.3