From 9198ac12e4e2ff64a2cf65c32d576f02d54c346a Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 10 一月 2026 16:50:32 +0800
Subject: [PATCH] 1.S1F3_CurrentRecipe,S6F11_RecipeChange实现。

---
 SourceCode/Bond/Servo/CMaster.cpp |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index f27a523..fe03f97 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -1540,7 +1540,7 @@
 				unlock();
 			}
 		};
-		listener.onProcessStateChanged = [&](void* pEquipment, int slotNo, PROCESS_STATE state) -> void {
+		listener.onProcessStateChanged = [&](void* pEquipment, int slotNo, PROCESS_STATE prevState, PROCESS_STATE state) -> void {
 			ASSERT(1 <= slotNo && slotNo <= 8);
 			int eqid = ((CEquipment*)pEquipment)->getID();
 			CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(slotNo);
@@ -1558,7 +1558,12 @@
 			}
 
 			if (m_listener.onProcessStateChanged != nullptr) {
-				m_listener.onProcessStateChanged(this, (CEquipment*)pEquipment, slotNo, state);
+				m_listener.onProcessStateChanged(this, (CEquipment*)pEquipment, slotNo, prevState, state);
+			}
+		};
+		listener.onProcessDataReport = [&](void* pEquipment, const std::vector<CParam>& params) {
+			if (m_listener.onProcessDataReport != nullptr) {
+				m_listener.onProcessDataReport(this, (CEquipment*)pEquipment, params);
 			}
 		};
 		listener.onMapMismatch = [&](void* pEquipment, short scanMap, short downMap) {
@@ -1781,6 +1786,10 @@
 				strOut.append(szBuffer);
 			}
 			LOGD("<CMaster-%s>SVDataReport:%s", ((CEquipment*)pEquipment)->getName().c_str(), strOut.c_str());
+
+			if (m_listener.onSVDataReport != nullptr) {
+				m_listener.onSVDataReport(this, (CEquipment*)pEquipment, params);
+			}
 		};
 		listener.onPanelDataReport = [&](void* pEquipment, void* pContext) {
 			LOGD("<CMaster-%s>onPanelDataReport", ((CEquipment*)pEquipment)->getName().c_str());
@@ -1800,6 +1809,11 @@
 				}
 			}
 
+		};
+		listener.onReceivedJob = [&](void* pEquipment, int port, CJobDataS* pJobDataS) {
+			if (m_listener.onJobReceived != nullptr) {
+				m_listener.onJobReceived(this, (CEquipment*)pEquipment, port, pJobDataS);
+			}
 		};
 		pEquipment->setListener(listener);
 		pEquipment->setCcLink(&m_cclink);
@@ -2082,8 +2096,8 @@
 				static bool inited = false;
 				static SERVO::CGlass simGlass;
 				static SERVO::CVcrEventReport simVcr;
-				static SERVO::CProcessJob simPj("SIM_PJ_001");
-				static SERVO::CControlJob simCj("SIM_CJ_001");
+				static SERVO::CProcessJob simPj("PJ1001");
+				static SERVO::CControlJob simCj("CJ5007");
 
 				if (!inited) {
 					inited = true;
@@ -2115,8 +2129,9 @@
 					}
 				};
 				auto fireProcessState = [&](SERVO::CEquipment* pEq, int slotNo, SERVO::PROCESS_STATE st) {
-					if (m_listener.onProcessStateChanged != nullptr && pEq != nullptr) {
-						m_listener.onProcessStateChanged(this, pEq, slotNo, st);
+					// Drive equipment state so listeners receive prev/current states consistently.
+					if (pEq != nullptr) {
+						pEq->fireSetProcessState(slotNo, st);
 					}
 				};
 
@@ -2814,6 +2829,9 @@
 
 
 		this->saveState();
+		if (m_listener.onControlJobChanged) {
+			m_listener.onControlJobChanged(this);
+		}
 
 		return (int)m_processJobs.size();
 	}

--
Gitblit v1.9.3