From 6e0341c6356cdb6e527fbd89d1dc876f4e47ce46 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期五, 09 一月 2026 20:37:50 +0800
Subject: [PATCH] 1.Trace Data,ProcessData, SVData等上报

---
 SourceCode/Bond/Servo/CLoadPort.cpp |  115 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 60 insertions(+), 55 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 13df4d9..0df47b8 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -1,4 +1,4 @@
-#include "stdafx.h"
+锘�#include "stdafx.h"
 #include "CLoadPort.h"
 #include "CGlassPool.h"
 #include "Servo.h"
@@ -17,6 +17,7 @@
 		m_bAutoChangeEnable = FALSE;
 		m_nNextCassetteSequenceNo = 0;
 		m_isCompareMapsBeforeProceeding = FALSE;
+		m_downloadCassetteMap = 0;
 	}
 
 	CLoadPort::~CLoadPort()
@@ -40,16 +41,16 @@
 		CEquipment::term();
 	}
 
-	// 必须要实现的虚函数,在此初始化Pin列表
+	// 蹇呴』瑕佸疄鐜扮殑铏氬嚱鏁帮紝鍦ㄦ鍒濆鍖朠in鍒楄〃
 	void CLoadPort::initPins()
 	{
-		// 加入Pin初始化代码
+		// 鍔犲叆Pin鍒濆鍖栦唬鐮�
 		LOGD("<CLoadPort>initPins");
 		addPin(SERVO::PinType::INPUT, _T("In"));
 		addPin(SERVO::PinType::OUTPUT, _T("Out"));
 	}
 
-	// 必须要实现的虚函数,在此初始化Slot信息
+	// 蹇呴』瑕佸疄鐜扮殑铏氬嚱鏁帮紝鍦ㄦ鍒濆鍖朣lot淇℃伅
 	void CLoadPort::initSlots()
 	{
 		for (int i = 0; i < SLOT_MAX; i++) {
@@ -351,9 +352,9 @@
 		CEquipment::onTimer(nTimerid);
 
 
-		// 从配置读出的enable,初始化时写给efem
+		// 浠庨厤缃鍑虹殑enable锛屽垵濮嬪寲鏃跺啓缁檈fem
 		static int i_enable[4] = { 0 };
-		if ((++i_enable[m_nIndex]) == 10 + m_nIndex) {
+		if ((++i_enable[m_nIndex]) == 20 + m_nIndex) {
 			eablePort(m_bEnable, [&](int code) -> int {
 				LOGI("<LoadPort-%d>eablePort:code=%d", m_nIndex, code);
 				return 0;
@@ -362,8 +363,7 @@
 
 
 
-		// 模拟测试
-		/*
+		// 妯℃嫙娴嬭瘯
 		if (m_nIndex == 0) {
 			static int ii = 0;
 			ii++;
@@ -376,6 +376,7 @@
 				portStatusReport.setCassetteId("CID1001");
 				int nRet = portStatusReport.serialize(szBuffer, 64);
 				decodePortStatusReport(pStep, szBuffer, 64);
+				LOGI("<CLoadPort>Port1杞藉叆妯℃嫙鏁版嵁锛� id:CID1001 map: 0xf");
 			}
 		}
 		if (m_nIndex == 1) {
@@ -390,9 +391,9 @@
 				portStatusReport.setCassetteId("CID1004");
 				int nRet = portStatusReport.serialize(szBuffer, 64);
 				decodePortStatusReport(pStep, szBuffer, 64);
+				LOGI("<CLoadPort>Port2杞藉叆妯℃嫙鏁版嵁锛� id:CID1004 map: 0xff");
 			}
 		}
-		*/
 	}
 
 	void CLoadPort::serialize(CArchive& ar)
@@ -505,6 +506,9 @@
 	void CLoadPort::setIndex(unsigned int index)
 	{
 		m_nIndex = index;
+
+		std::string id = "Port" + std::to_string(index + 1);
+		m_portStatusReport.setCassetteId(id.c_str());
 	}
 
 	unsigned int CLoadPort::getIndex()
@@ -555,6 +559,11 @@
 	std::string& CLoadPort::getCassetteId()
 	{
 		return m_portStatusReport.getCassetteId();
+	}
+
+	void CLoadPort::simulateSetCassetteId(const char* pszCarrierId)
+	{
+		m_portStatusReport.setCassetteId(pszCarrierId);
 	}
 
 	int CLoadPort::getLoadingCassetteType()
@@ -931,27 +940,15 @@
 		m_portStatusReport.copyEx(portStatusReport);
 
 
-		// 当port状态为InUse, 比较map
+		// 褰損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) {
@@ -960,7 +957,7 @@
 		}
 
 
-		// 缓存Attribute,用于调试时显示信息
+		// 缂撳瓨Attribute锛岀敤浜庤皟璇曟椂鏄剧ず淇℃伅
 		unsigned int weight = 201;
 		CAttributeVector& attrubutes = pStep->attributeVector();
 		m_portStatusReport.getAttributeVector(attrubutes, weight);
@@ -985,17 +982,17 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备设置Port type<%d>", m_nIndex, (int)type);
+		LOGI("<CLoadPort-%d>鍑嗗璁剧疆Port type<%d>", m_nIndex, (int)type);
 		short value = (short)type;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
 				m_portType = type;
-				LOGI("<CLoadPort-%d>设置Port type成功.", m_nIndex);
+				LOGI("<CLoadPort-%d>璁剧疆Port type鎴愬姛.", m_nIndex);
 			}
 			else {
-				LOGE("<CLoadPort-%d>设置Port type失败,code:%d", m_nIndex, code);
+				LOGE("<CLoadPort-%d>璁剧疆Port type澶辫触锛宑ode:%d", m_nIndex, code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1015,17 +1012,17 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备%s Port", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+		LOGI("<CLoadPort-%d>鍑嗗%s Port", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"));
 		short value = bEnable ? 1 : 2;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
 				m_bEnable = bEnable;
-				LOGI("<CLoadPort-%d>%s Port成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+				LOGI("<CLoadPort-%d>%s Port鎴愬姛.", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"));
 			}
 			else {
-				LOGE("<CLoadPort-%d>%s  Port失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
+				LOGE("<CLoadPort-%d>%s  Port澶辫触锛宑ode:%d", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"), code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1044,17 +1041,17 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备设置Port mode<%d>", m_nIndex, (int)mode);
+		LOGI("<CLoadPort-%d>鍑嗗璁剧疆Port mode<%d>", m_nIndex, (int)mode);
 		short value = (short)mode;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
 				m_portMode = mode;
-				LOGI("<CLoadPort-%d>设置Port mode成功.", m_nIndex);
+				LOGI("<CLoadPort-%d>璁剧疆Port mode鎴愬姛.", m_nIndex);
 			}
 			else {
-				LOGE("<CLoadPort-%d>设置Port mode失败,code:%d", m_nIndex, code);
+				LOGE("<CLoadPort-%d>璁剧疆Port mode澶辫触锛宑ode:%d", m_nIndex, code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1074,16 +1071,16 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备设置Cassette Type<%d>", m_nIndex, (int)type);
+		LOGI("<CLoadPort-%d>鍑嗗璁剧疆Cassette Type<%d>", m_nIndex, (int)type);
 		short value = (short)type;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
-				LOGI("<CLoadPort-%d>设置Cassette Type成功.", m_nIndex);
+				LOGI("<CLoadPort-%d>璁剧疆Cassette Type鎴愬姛.", m_nIndex);
 			}
 			else {
-				LOGE("<CLoadPort-%d>设置Cassette Type失败,code:%d", m_nIndex, code);
+				LOGE("<CLoadPort-%d>璁剧疆Cassette Type澶辫触锛宑ode:%d", m_nIndex, code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1102,17 +1099,17 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备设置Transfer mode<%d>", m_nIndex, (int)mode);
+		LOGI("<CLoadPort-%d>鍑嗗璁剧疆Transfer mode<%d>", m_nIndex, (int)mode);
 		short value = (short)mode;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
 				m_transferMode = mode;
-				LOGI("<CLoadPort-%d>设置Transfer mode成功.", m_nIndex + 1);
+				LOGI("<CLoadPort-%d>璁剧疆Transfer mode鎴愬姛.", m_nIndex + 1);
 			}
 			else {
-				LOGE("<CLoadPort-%d>设置Transfer mode失败,code:%d", m_nIndex + 1, code);
+				LOGE("<CLoadPort-%d>璁剧疆Transfer mode澶辫触锛宑ode:%d", m_nIndex + 1, code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1131,17 +1128,17 @@
 			return -1;
 		}
 
-		LOGI("<CLoadPort-%d>准备%s Auto Change", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+		LOGI("<CLoadPort-%d>鍑嗗%s Auto Change", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"));
 		short value = bEnable ? 1 : 2;
 		pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
 			// test
 			code = WOK;
 			if (code == WOK) {
 				m_bAutoChangeEnable = bEnable;
-				LOGI("<CLoadPort-%d>%s Auto Change成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+				LOGI("<CLoadPort-%d>%s Auto Change鎴愬姛.", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"));
 			}
 			else {
-				LOGE("<CLoadPort-%d>%s  Auto Change失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
+				LOGE("<CLoadPort-%d>%s  Auto Change澶辫触锛宑ode:%d", m_nIndex, bEnable ? _T("鍚敤") : _T("绂佺敤"), code);
 			}
 			if (onWritedBlock != nullptr) {
 				return onWritedBlock(code);
@@ -1189,17 +1186,20 @@
 
 	short CLoadPort::getDownloadCassetteMap()
 	{
-		// 暂时未实现此功能
-		short map = 0;
-		return map;
+		return m_downloadCassetteMap;
+	}
+
+	void CLoadPort::setDownloadCassetteMap(short map)
+	{
+		m_downloadCassetteMap = map;
 	}
 
 	/*
-	 * 生成测试用的玻璃列表
+	 * 鐢熸垚娴嬭瘯鐢ㄧ殑鐜荤拑鍒楄〃
 	 */
 	int CLoadPort::testGenerateGlassList(MaterialsType type)
 	{
-		// 如果非空就不生成了
+		// 濡傛灉闈炵┖灏变笉鐢熸垚浜�
 		Lock();
 		if (hasGlass()) {
 			Unlock();
@@ -1233,11 +1233,11 @@
 	}
 
 	/*
-	 * 根据efem扫描到的map,生成玻璃列表
+	 * 鏍规嵁efem鎵弿鍒扮殑map锛岀敓鎴愮幓鐠冨垪琛�
 	 */
 	int CLoadPort::generateGlassList(short map)
 	{
-		// 先释放较早前的数据
+		// 鍏堥噴鏀捐緝鏃╁墠鐨勬暟鎹�
 		Lock();
 		for (int i = 0; i < SLOT_MAX; i++) {
 			m_slot[i].setContext(nullptr);
@@ -1245,7 +1245,7 @@
 		Unlock();
 
 
-		// 根据map生成新的
+		// 鏍规嵁map鐢熸垚鏂扮殑
 		char szBuffer[64];
 		for (int i = 0; i < SLOT_MAX; i++) {
 			if (!m_slot[i].isEnable()) continue;
@@ -1317,4 +1317,9 @@
 	{
 		m_isCompareMapsBeforeProceeding = bCompare;
 	}
+
+	BOOL CLoadPort::isCompareMapsBeforeProceeding() const
+	{
+		return m_isCompareMapsBeforeProceeding;
+	}
 }

--
Gitblit v1.9.3