From 6c92ade0aeb6a505f2ab8108dcbdab20e37a9fac Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期三, 28 一月 2026 21:29:47 +0800
Subject: [PATCH] 1.EQStatusChange事件上报

---
 SourceCode/Bond/Servo/Model.cpp |   84 +++++++++++++++++++++++++++++++++++------
 1 files changed, 71 insertions(+), 13 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 6cbe9c2..2c1b261 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -525,9 +525,9 @@
 		if (pReport != nullptr) {
 			m_hsmsPassive.withVariableLock([&] {
 				m_hsmsPassive.setVariableValue("VCRPanelID", pReport->getGlassId().c_str());
-				int nRet = m_hsmsPassive.requestEventReportSend_OCR_PanelID_Read_OK();
+				int nRet = m_hsmsPassive.requestEventReportSend_OCR_PanelID_Read(pReport->getVcrResult());
 				if (nRet != ER_NOERROR) {
-					LOGE("<CModel>requestEventReportSend_OCR_PanelID_Read_OK failed, ret=%d", nRet);
+					LOGE("<CModel>requestEventReportSend_OCR_PanelID_Read failed, ret=%d", nRet);
 				}
 			});
 		}
@@ -631,6 +631,27 @@
 		(void)pMaster;
 		(void)port;
 		if (pEquipment == nullptr || pJobDataS == nullptr) return;
+		{
+			const std::string& g1 = pJobDataS->getGlass1Id();
+			const std::string& g2 = pJobDataS->getGlass2Id();
+			std::string glassId;
+			if (!g1.empty() && !g2.empty()) {
+				glassId = g1 + "+" + g2;
+			}
+			else if (!g1.empty()) {
+				glassId = g1;
+			}
+			else {
+				glassId = g2;
+			}
+			const int slotNo = pJobDataS->getTargetSlotNo();
+			m_hsmsPassive.withVariableLock([&] {
+				m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+				m_hsmsPassive.setVariableValue("SubEqpSlot", slotNo);
+				m_hsmsPassive.setVariableValue("MaterialId", glassId.c_str());
+				m_hsmsPassive.requestEventReportSend("GlassReceivedJob");
+			});
+		}
 		const int eqId = pEquipment->getID();
 		const int recipeId = pJobDataS->getMasterRecipe();
 		std::string recipe = RecipeManager::getInstance().getPPIDById(recipeId);
@@ -663,6 +684,30 @@
 			m_hsmsPassive.requestEventReportSend("RecipeChanged");
 		});
 	};
+	masterListener.onJobSentOut = [&](void* pMaster, SERVO::CEquipment* pEquipment, int port, SERVO::CJobDataS* pJobDataS) {
+		(void)pMaster;
+		(void)port;
+		if (pEquipment == nullptr || pJobDataS == nullptr) return;
+		const std::string& g1 = pJobDataS->getGlass1Id();
+		const std::string& g2 = pJobDataS->getGlass2Id();
+		std::string glassId;
+		if (!g1.empty() && !g2.empty()) {
+			glassId = g1 + "+" + g2;
+		}
+		else if (!g1.empty()) {
+			glassId = g1;
+		}
+		else {
+			glassId = g2;
+		}
+		const int slotNo = pJobDataS->getSourceSlotNo();
+		m_hsmsPassive.withVariableLock([&] {
+			m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+			m_hsmsPassive.setVariableValue("SubEqpSlot", slotNo);
+			m_hsmsPassive.setVariableValue("MaterialId", glassId.c_str());
+			m_hsmsPassive.requestEventReportSend("GlassSentOutJob");
+		});
+	};
 	masterListener.onLoadPortStatusChanged = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short status, __int64 data) {
 		LOGE("<CModel>onLoadPortStatusChanged. status = %d", status);
 		static std::map<int, short> s_prevPortStatus;
@@ -681,7 +726,7 @@
 			m_hsmsPassive.withVariableLock([&] {
 				m_hsmsPassive.setVariableValue(stateVid, (__int64)status);
 				m_hsmsPassive.setVariableValue(modeVid, (__int64)pLoadPort->getPortMode());
-				m_hsmsPassive.setVariableValue("PortStateChangePortId", pLoadPort->getID());
+				m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 				m_hsmsPassive.setVariableValue("PortState", (__int64)status);
 				m_hsmsPassive.requestEventReportSend("PortStateChange");
 			});
@@ -708,7 +753,7 @@
 			SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment);
 			m_hsmsPassive.withVariableLock([&] {
 				if (pLoadPort != nullptr) {
-					m_hsmsPassive.setVariableValue("BlockedPortId", pLoadPort->getID());
+					m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 				}
 				m_hsmsPassive.requestEventReportSend_Port_Blocked();
 			});
@@ -717,7 +762,7 @@
 			SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment);
 			m_hsmsPassive.withVariableLock([&] {
 				if (pLoadPort != nullptr) {
-					m_hsmsPassive.setVariableValue("LoadReadyPortId", pLoadPort->getID());
+					m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 				}
 				m_hsmsPassive.requestEventReportSend_Port_Load_Ready();
 			});
@@ -726,9 +771,9 @@
 			SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment);
 			m_hsmsPassive.withVariableLock([&] {
 				if (pLoadPort != nullptr) {
-					m_hsmsPassive.setVariableValue("UnloadReadyPortId", pLoadPort->getID());
+					m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 					if (prevStatus == PORT_INUSE) {
-						m_hsmsPassive.setVariableValue("ReadyToReleasePortId", pLoadPort->getID());
+						m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 						m_hsmsPassive.requestEventReportSend_Port_Ready_To_Release();
 					}
 				}
@@ -739,7 +784,7 @@
 			SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment);
 			m_hsmsPassive.withVariableLock([&] {
 				if (pLoadPort != nullptr) {
-					m_hsmsPassive.setVariableValue("LoadPortNotAssocPortId", pLoadPort->getID());
+					m_hsmsPassive.setVariableValue("PortId", pLoadPort->getID());
 				}
 				m_hsmsPassive.requestEventReportSend_LoadPortNotAssoc();
 			});
@@ -768,11 +813,6 @@
 
 			// SubEqp events (per equipment, ignore slot distinction except payload)
 			static std::map<int, SERVO::PROCESS_STATE> s_prevSubEqpState;
-			const auto prevEqState = s_prevSubEqpState[eqId];
-			if (prevEqState != state) {
-				// state change
-				m_hsmsPassive.requestEventReportSend("SubEqpStateChange");
-			}
 			if (state == SERVO::PROCESS_STATE::Processing) {
 				m_hsmsPassive.requestEventReportSend_SubEqpStart();
 			}
@@ -796,6 +836,16 @@
 			}
 		});
 	};
+	masterListener.onEqStatusChanged = [&](void* pMaster, SERVO::CEquipment* pEquipment, int unitId, int status, int reason) {
+		(void)pMaster;
+		if (pEquipment == nullptr) return;
+		m_hsmsPassive.withVariableLock([&] {
+			m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+			m_hsmsPassive.setVariableValue("SubEqpSlot", unitId);
+			m_hsmsPassive.setVariableValue("EquipmentStatus", (__int64)status);
+			m_hsmsPassive.requestEventReportSend("SubEqpStateChange");
+		});
+	};
 	masterListener.onSVDataReport = [&](void* pMaster, SERVO::CEquipment* pEquipment, const std::vector<CParam>& params) {
 		(void)pMaster;
 		const int eqId = pEquipment ? pEquipment->getID() : 0;
@@ -803,6 +853,10 @@
 		auto sendSv = [&](const auto& vidMap, const char* evName) {
 			const size_t count = (std::min)(params.size(), vidMap.size());
 			m_hsmsPassive.withVariableLock([&] {
+				if (pEquipment != nullptr) {
+					m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+				}
+				m_hsmsPassive.setVariableValue("SubEqpSlot", 0);
 				m_hsmsPassive.setVariableValue("Clock", CToolUnits::getCurrentTimeString().c_str());
 				for (size_t idx = 0; idx < count; ++idx) {
 					const std::string val = formatParamValue(params[idx]);
@@ -845,6 +899,10 @@
 		auto sendProcess = [&](const auto& vidMap, const char* evName) {
 			const size_t count = (std::min)(params.size(), vidMap.size());
 			m_hsmsPassive.withVariableLock([&] {
+				if (pEquipment != nullptr) {
+					m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+				}
+				m_hsmsPassive.setVariableValue("SubEqpSlot", 0);
 				m_hsmsPassive.setVariableValue("Clock", CToolUnits::getCurrentTimeString().c_str());
 				for (size_t idx = 0; idx < count; ++idx) {
 					const std::string val = formatParamValue(params[idx]);

--
Gitblit v1.9.3