From 2a21061d88d5533065dc57cfae0b1f2c1952e06f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 22 八月 2025 16:01:32 +0800
Subject: [PATCH] 1.PorcessJob和Glass关系绑定; 2.对话框显示ProcessJob、Glass等数据;

---
 SourceCode/Bond/Servo/CLoadPort.cpp |   58 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 37f3139..7cc6006 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -9,8 +9,8 @@
 	CLoadPort::CLoadPort() : CEquipment()
 	{
 		m_nIndex = 0;
-		m_portType = PortType::Loading;
-		m_portMode = PortMode::ReadyToLoad;
+		m_portType = PortType::Both;
+		m_portMode = PortMode::OutOfService;
 		m_cassetteType = CassetteType::G1;
 		m_transferMode = TransferMode::AGVMode;
 		m_bEnable = FALSE;
@@ -115,6 +115,7 @@
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
 						m_portMode = (PortMode)CToolUnits::toInt16(pszData);
+						LOGI("<LoadPort-%d>m_portMode:%d", m_nIndex, m_portMode);
 					}
 					return 0;
 				});
@@ -349,22 +350,47 @@
 	{
 		CEquipment::onTimer(nTimerid);
 
+
+		// 从配置读出的enable,初始化时写给efem
+		static int i_enable[4] = { 0 };
+		if ((++i_enable[m_nIndex]) == 10 + m_nIndex) {
+			eablePort(m_bEnable, [&](int code) -> int {
+				LOGI("<LoadPort-%d>eablePort:code=%d", m_nIndex, code);
+				return 0;
+				});
+		}
+
+
+
 		// 模拟测试
-		/*
 		if (m_nIndex == 0) {
 			static int ii = 0;
 			ii++;
-			if (ii == 20) {
-				char szBuffer[64];
+			if (ii == 50) {
+				char szBuffer[64] = {0};
 				CStep* pStep = getStepWithName(STEP_EQ_PORT1_INUSE);
 				CPortStatusReport portStatusReport;
 				portStatusReport.setPortStatus(PORT_INUSE);
 				portStatusReport.setJobExistenceSlot(0xf);
+				portStatusReport.setCassetteId("CID1001");
 				int nRet = portStatusReport.serialize(szBuffer, 64);
 				decodePortStatusReport(pStep, szBuffer, 64);
 			}
 		}
-		*/
+		if (m_nIndex == 1) {
+			static int ii = 0;
+			ii++;
+			if (ii == 55) {
+				char szBuffer[64] = { 0 };
+				CStep* pStep = getStepWithName(STEP_EQ_PORT2_INUSE);
+				CPortStatusReport portStatusReport;
+				portStatusReport.setPortStatus(PORT_INUSE);
+				portStatusReport.setJobExistenceSlot(0xff );
+				portStatusReport.setCassetteId("CID1004");
+				int nRet = portStatusReport.serialize(szBuffer, 64);
+				decodePortStatusReport(pStep, szBuffer, 64);
+			}
+		}
 	}
 
 	void CLoadPort::serialize(CArchive& ar)
@@ -373,23 +399,11 @@
 
 		if (ar.IsStoring()) {
 			ar << m_nIndex;
-			//ar << (int)m_portType;
-			//ar << (int)m_portMode;
-			//ar << (int)m_cassetteType;
-			//ar << (int)m_transferMode;
-			//ar << m_bEnable;
-			//ar << m_bAutoChangeEnable;
 			m_portStatusReport.serialize(ar);
 		}
 		else {
 			int temp;
 			ar >> m_nIndex;
-			//ar >> temp; m_portType = (PortType)temp;
-			//ar >> temp; m_portMode = (PortMode)temp;
-			//ar >> temp; m_cassetteType = (CassetteType)temp;
-			//ar >> temp; m_transferMode = (TransferMode)temp;
-			//ar >> m_bEnable;
-			//ar >> m_bAutoChangeEnable;
 			m_portStatusReport.serialize(ar);
 		}
 	}
@@ -924,12 +938,12 @@
 			else {
 				// 抛出到应用层做选择要加工的片子
 				generateGlassList(getScanCassetteMap());
-				if (m_listener.onPortInUse != nullptr) {
-					m_listener.onPortInUse(this, getScanCassetteMap());
-				}
 			}
 		}
-
+		if (m_listener.onPortStatusChanged != nullptr) {
+			m_listener.onPortStatusChanged(this, portStatusReport.getPortStatus(),
+				getScanCassetteMap());
+		}
 
 
 		// 缓存Attribute,用于调试时显示信息

--
Gitblit v1.9.3