From 7667ca13252c267bc87d56ec1277badaefb90e55 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 16 十二月 2025 10:38:54 +0800
Subject: [PATCH] 1.Check SlotMap,ProceedWithSlotMap,SlotMap Verify OK上报实现,但某些数据需要和客户协商。已写入注释

---
 SourceCode/Bond/Servo/HsmsPassive.h               |    3 +
 SourceCode/Bond/x64/Debug/CollectionEventList.txt |    2 
 SourceCode/Bond/Servo/HsmsPassive.cpp             |   15 +++++++
 SourceCode/Bond/Servo/CLoadPort.h                 |    1 
 SourceCode/Bond/Servo/Model.cpp                   |   37 +++++++++++++++++-
 SourceCode/Bond/Servo/CLoadPort.cpp               |   29 +++++---------
 SourceCode/Bond/x64/Debug/VariableList.txt        |    3 +
 7 files changed, 69 insertions(+), 21 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 73549bf..c50245b 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -937,25 +937,13 @@
 
 		// 褰損ort鐘舵�佷负InUse, 姣旇緝map
 		if (m_portStatusReport.getPortStatus() == PORT_INUSE) {
-			if (m_isCompareMapsBeforeProceeding) {
-				short scanMap = getScanCassetteMap();
-				short downloadMap = getDownloadCassetteMap();
-				if (scanMap == downloadMap) {
-					generateGlassList(scanMap);
-					this->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr);
-				}
-				else {
-					this->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr);
+			// 鐢熸垚鐜荤拑鍒楄〃锛氭潵鑷� EFEM 鎵弿鍒扮殑 map
+			generateGlassList(getScanCassetteMap());
 
-					// 鎶涘嚭鍒板簲鐢ㄥ眰鍋氭彁绀�
-					if (m_listener.onMapMismatch != nullptr) {
-						m_listener.onMapMismatch(this, scanMap, downloadMap);
-					}
-				}
-			}
-			else {
-				// 鎶涘嚭鍒板簲鐢ㄥ眰鍋氶�夋嫨瑕佸姞宸ョ殑鐗囧瓙
-				generateGlassList(getScanCassetteMap());
+			// CompareMapsBeforeProceeding锛氫笉鍦ㄦ澶勮嚜鍔� Start/Cancel锛屾敼涓虹瓑寰� Host 鍐崇瓥锛圥roceedWithCarrier/ProceedWithSlotMap/CarrierRelease锛�
+			// Host 鍐崇瓥鍏ュ彛锛歋3F17 CarrierAction -> listener.onCarrierAction -> CMaster::proceedWithCarrier()/carrierRelease()
+			if (m_isCompareMapsBeforeProceeding) {
+				// 杩欓噷浠呯瓑寰咃紝鍏蜂綋涓婃姤鐢变笂灞傚湪 PORT_INUSE 浜嬩欢涓Е鍙戯紙S6F11 CheckSlotMap锛�
 			}
 		}
 		if (m_listener.onPortStatusChanged != nullptr) {
@@ -1324,4 +1312,9 @@
 	{
 		m_isCompareMapsBeforeProceeding = bCompare;
 	}
+
+	BOOL CLoadPort::isCompareMapsBeforeProceeding() const
+	{
+		return m_isCompareMapsBeforeProceeding;
+	}
 }
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index 1169f7e..91101d2 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -86,6 +86,7 @@
 			ONWRITED onWritedBlock);
 		CStep* getCassetteCtrlCmdStep();
 		void setCompareMapsBeforeProceeding(BOOL bCompare);
+		BOOL isCompareMapsBeforeProceeding() const;
 
 	private:
 		int decodePortStatusReport(CStep* pStep, const char* pszData, size_t size);
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 29e53c9..2766b98 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -2523,6 +2523,21 @@
 	return requestEventReportSend("CarrierID_Readed");
 }
 
+int CHsmsPassive::requestEventReportSend_CheckSlotMap()
+{
+	return requestEventReportSend("CheckSlotMap");
+}
+
+int CHsmsPassive::requestEventReportSend_SlotMapVerificationOK()
+{
+	return requestEventReportSend("SlotMapVerificationOK");
+}
+
+int CHsmsPassive::requestEventReportSend_SlotMapVerificationNG()
+{
+	return requestEventReportSend("SlotMapVerificationNG");
+}
+
 int CHsmsPassive::requestEventReportSend_Port_Unload_Ready()
 {
 	return requestEventReportSend("Port_Unload_Ready");
diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index 08fd3c0..7d9d596 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -203,6 +203,9 @@
 	int requestEventReportSend(unsigned int CEID);
 	int requestEventReportSend(const char* pszEventName);
 	int requestEventReportSend_CarrierID_Readed();
+	int requestEventReportSend_CheckSlotMap();
+	int requestEventReportSend_SlotMapVerificationOK();
+	int requestEventReportSend_SlotMapVerificationNG();
 	int requestEventReportSend_Port_Unload_Ready();
 	int requestEventReportSend_Port_Load_Ready();
 	int requestEventReportSend_Port_Ready_To_Release();
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 310da04..aa0f8eb 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -173,12 +173,39 @@
 				return CAACK_3;
 			}
 
+			const unsigned int portIndex = PTN - 1;
+			SERVO::CLoadPort* pLoadPort = (SERVO::CLoadPort*)m_master.getEquipment(EQ_ID_LOADPORT1 + portIndex);
+
 			if (_strcmpi(pszCarrierAction, "ProceedWithCarrier") == 0) {
-				m_master.proceedWithCarrier(PTN);
+				// 鏂囨。娴佺▼锛歅roceedWithCarrier 涔嬪悗璁惧杩涘叆 Check SlotMap锛圵FH锛夛紝
+				// 鐪熸鐨勨�滃紑濮嬧�濈敱 ProceedWithSlotMap 鍐崇瓥瑙﹀彂銆�
+				// 浠呭綋鏈紑鍚� CompareMapsBeforeProceeding 鏃讹紝鎵嶆部鐢ㄦ棫閫昏緫鐩存帴 Start銆�
+				if (pLoadPort == nullptr || !pLoadPort->isCompareMapsBeforeProceeding()) {
+					m_master.proceedWithCarrier(portIndex);
+				}
+				return CAACK_0;
+			}
+			else if (_strcmpi(pszCarrierAction, "ProceedWithSlotMap") == 0) {
+				// TODO(Host鍗忓晢):
+				// 鏂囨。涓� ProceedWithSlotMap 鍙兘浼氭惡甯� LotID / PanelIDList / SlotMap 绛夋暟鎹紙鏈�澶�13鐗囷級鐢ㄤ簬鏍煎紡鏍¢獙涓庣粦瀹氥��
+				// 褰撳墠 S3F17 瑙f瀽缁撴瀯浠呮敮鎸� {DATAID, CarrierAction, CarrierID, PTN}锛屽皻鏈疄鐜颁笂杩版墿灞曞瓧娈电殑瑙f瀽/鏍¢獙銆�
+				// 鏈潵鑻ュ鎴风‘璁� SECS-II 缁撴瀯锛岄渶瑕佸湪 CHsmsPassive::replyCarrierAction() 鎵╁睍瑙f瀽骞跺湪姝ゅ钀藉簱/鏍¢獙銆�
+				// 浠呭湪 CompareMapsBeforeProceeding 鍚敤锛圚ost 妯″紡锛変笅鍏佽姝ゅ姩浣�
+				if (pLoadPort == nullptr || !pLoadPort->isCompareMapsBeforeProceeding()) {
+					strErrorTxt = "rejected - SlotMap check disabled";
+					return CAACK_5;
+				}
+
+				m_hsmsPassive.setVariableValue("SlotMapScan", pLoadPort->getScanCassetteMap());
+				m_hsmsPassive.setVariableValue("SlotMapDownload", pLoadPort->getDownloadCassetteMap());
+				m_hsmsPassive.requestEventReportSend_SlotMapVerificationOK();
+
+				// Host 纭 SlotMap 鍚庡啀寮�濮嬪姞宸�/娴佺▼
+				m_master.proceedWithCarrier(portIndex);
 				return CAACK_0;
 			}
 			else if (_strcmpi(pszCarrierAction, "CarrierRelease") == 0) {
-				m_master.carrierRelease(PTN);
+				m_master.carrierRelease(portIndex);
 				return CAACK_0;
 			}
 
@@ -410,6 +437,12 @@
 			SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment);
 			if (pLoadPort != nullptr) {
 				m_hsmsPassive.setVariableValue("CarrierID", pLoadPort->getCassetteId().c_str());
+				if (prevStatus != PORT_INUSE && pLoadPort->isCompareMapsBeforeProceeding()) {
+					// TODO(Host鍗忓晢):
+					// 鏂囨。涓爣鏄庯細1-Empty锛�3-Exist锛屽洜姝ゆ垜浠彲鑳介渶瑕佸皢uint鐨刴ap杞崲涓簂ist涓婁紶 
+					m_hsmsPassive.setVariableValue("SlotMap", pLoadPort->getScanCassetteMap());
+					m_hsmsPassive.requestEventReportSend_CheckSlotMap();
+				}
 			}
 			m_hsmsPassive.requestEventReportSend_CarrierID_Readed();
 		}
diff --git a/SourceCode/Bond/x64/Debug/CollectionEventList.txt b/SourceCode/Bond/x64/Debug/CollectionEventList.txt
index 535ec73..4d223c8 100644
--- a/SourceCode/Bond/x64/Debug/CollectionEventList.txt
+++ b/SourceCode/Bond/x64/Debug/CollectionEventList.txt
@@ -11,7 +11,7 @@
 10051,CarrierIDWaitingForHost,,(10051)
 10052,CarrierIDVerificationOK,,(10052)
 10053,CarrierIDVerificationNG,,(10052)
-10061,SlotMapWaitingForHost,,(10061)
+10061,CheckSlotMap,,(10061)
 10062,SlotMapVerificationOK,,(10062)
 10063,SlotMapVerificationNG,,(10062)
 10071,GlassIDReadWaitingForHost,,(10071)
diff --git a/SourceCode/Bond/x64/Debug/VariableList.txt b/SourceCode/Bond/x64/Debug/VariableList.txt
index 92ab60b..ba0e3cd 100644
--- a/SourceCode/Bond/x64/Debug/VariableList.txt
+++ b/SourceCode/Bond/x64/Debug/VariableList.txt
@@ -50,3 +50,6 @@
 5013,TestVID,U1,娴嬭瘯娣诲姞鍙橀噺55
 5014,VCRPanelID,A20,Panel id,鏉ヨ嚜璇荤爜鍣�
 5015,ReadyToReleasePortId,U1,"Port ID"
+10200,SlotMap,U2,SlotMap(Scan)
+10201,SlotMapScan,U2,SlotMap(Scan)
+10202,SlotMapDownload,U2,SlotMap(Download)

--
Gitblit v1.9.3