From ded981a2ac5dbb456bafce5468d7289bc45e313b Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 10 一月 2026 21:07:48 +0800
Subject: [PATCH] 1.S7F5查询PPID

---
 SourceCode/Bond/Servo/Model.cpp |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 31788e7..fb2cf9d 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -10,6 +10,7 @@
 #include "RecipeManager.h"
 #include "GlassLogDb.h"
 #include "CParam.h"
+#include "CJobDataS.h"
 #include <algorithm>
 #include <iomanip>
 #include <sstream>
@@ -189,6 +190,21 @@
 		if (ids.empty()) {
 			m_master.enableEventReport(bEnable);
 		}
+	};
+	listener.onDeletePPID = [&](void* pFrom, const std::vector<std::string>& ppids) -> bool {
+		(void)pFrom;
+		bool allOk = true;
+		std::vector<std::string> targets = ppids;
+		if (targets.empty()) {
+			// L:0 => delete all PPIDs
+			targets = RecipeManager::getInstance().getAllPPID();
+		}
+		for (auto& ppid : targets) {
+			bool ok = RecipeManager::getInstance().deleteRecipeByPPID(ppid);
+			allOk = allOk && ok;
+			LOGI("<CModel>DeletePPID: %s, result=%s", ppid.c_str(), ok ? "OK" : "FAIL");
+		}
+		return allOk;
 	};
 	listener.onEnableDisableAlarmReport = [&](void* pFrom, bool bEnable, unsigned int id) -> void {
 		LOGI("onEnableDisableAlarmReport bEnable:%s, id:%d", bEnable ? _T("YES") : _T("NO"), id);
@@ -495,6 +511,42 @@
 		notifyPtrAndInt(RX_CODE_EQ_ROBOT_TASK, pTask, nullptr, code);
 
 	};
+	masterListener.onJobReceived = [&](void* pMaster, SERVO::CEquipment* pEquipment, int port, SERVO::CJobDataS* pJobDataS) {
+		(void)pMaster;
+		(void)port;
+		if (pEquipment == nullptr || pJobDataS == nullptr) return;
+		const int eqId = pEquipment->getID();
+		const int recipeId = pJobDataS->getMasterRecipe();
+		std::string recipe = RecipeManager::getInstance().getPPIDById(recipeId);
+		if (recipe.empty()) {
+			recipe = std::to_string(recipeId);
+		}
+		const std::string prev = pEquipment->getCurrentRecipe();
+		if (recipe.empty() || recipe == prev) {
+			pEquipment->setCurrentRecipe(recipe);
+			return;
+		}
+		pEquipment->setCurrentRecipe(recipe);
+		m_hsmsPassive.withVariableLock([&] {
+			m_hsmsPassive.setVariableValue("Clock", CToolUnits::getCurrentTimeString().c_str());
+			m_hsmsPassive.setVariableValue("EQPPExecName", recipe.c_str());
+			m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str());
+			const char* recipeVid = nullptr;
+			switch (eqId) {
+			case EQ_ID_Bonder1: recipeVid = "Bonder1CurrentRecipe"; break;
+			case EQ_ID_Bonder2: recipeVid = "Bonder2CurrentRecipe"; break;
+			case EQ_ID_VACUUMBAKE: recipeVid = "VacuumBakeCurrentRecipe"; break;
+			case EQ_ID_BAKE_COOLING: recipeVid = "BakeCoolingCurrentRecipe"; break;
+			case EQ_ID_MEASUREMENT: recipeVid = "MeasurementCurrentRecipe"; break;
+			case EQ_ID_EFEM: recipeVid = "EFEMCurrentRecipe"; break;
+			default: break;
+			}
+			if (recipeVid != nullptr) {
+				m_hsmsPassive.setVariableValue(recipeVid, recipe.c_str());
+			}
+			m_hsmsPassive.requestEventReportSend("RecipeChanged");
+		});
+	};
 	masterListener.onLoadPortStatusChanged = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short status, __int64 data) {
 		LOGE("<CModel>onLoadPortStatusChanged. status = %d", status);
 		static std::map<int, short> s_prevPortStatus;

--
Gitblit v1.9.3