From 6d140a6e6f2c24c9c7de46bb7c375ae4cbf931e7 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 10 一月 2026 10:38:26 +0800
Subject: [PATCH] 1.实现远程删除配方功能;

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

diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index d35b5b8..df773b6 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -1370,6 +1370,9 @@
 		else if (nStream == 7 && pHeader->function == 19) {
 			replyQueryPPIDList(pMessage);
 		}
+		else if (nStream == 7 && pHeader->function == 17) {
+			replyDeletePPID(pMessage);
+		}
 		else if (nStream == 10 && pHeader->function == 3) {
 			replyTerminalDisplay(pMessage);
 		}
@@ -2544,6 +2547,44 @@
 	return 0;
 }
 
+// S7F17 Delete Process Program (PPID list) / S7F18
+int CHsmsPassive::replyDeletePPID(IMessage* pRecv)
+{
+	if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
+		return ER_NOTSELECT;
+	}
+
+	bool allOk = true;
+	const bool deleteAll = (pRecv->getBody() == nullptr || pRecv->getBody()->getSubItemSize() == 0);
+	std::vector<std::string> ppids;
+	ISECS2Item* pBody = pRecv->getBody();
+	const int nCount = pBody ? pBody->getSubItemSize() : 0;
+	for (int i = 0; i < nCount; ++i) {
+		const char* pszPPID = nullptr;
+		if (pBody->getSubItemString(i, pszPPID) && pszPPID != nullptr) {
+			ppids.emplace_back(pszPPID);
+		}
+		else {
+			allOk = false;
+		}
+	}
+
+	if (deleteAll || !ppids.empty()) {
+		if (m_listener.onDeletePPID != nullptr) {
+			allOk = m_listener.onDeletePPID(this, ppids);
+		}
+		else {
+			// no handler provided; treat as failure
+			allOk = false;
+			LOGW("<HSMS>DeletePPID request ignored: no onDeletePPID listener");
+		}
+	}
+
+
+	replyAck(7, 18, pRecv->getHeader()->systemBytes, allOk ? BYTE(0) : BYTE(1), "ACKC7");
+	return 0;
+}
+
 // S7F19
 int CHsmsPassive::replyQueryPPIDList(IMessage* pRecv)
 {

--
Gitblit v1.9.3