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/EAPSimulator/CHsmsActive.cpp | 13 ++++++
SourceCode/Bond/EAPSimulator/Resource.h | 6 ++-
SourceCode/Bond/Servo/HsmsPassive.h | 1
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp | 16 +++++++
SourceCode/Bond/EAPSimulator/CHsmsActive.h | 1
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h | 1
SourceCode/Bond/Servo/HsmsPassive.cpp | 58 +++++++++++++++++++++++++++-
SourceCode/Bond/EAPSimulator/EAPSimulator.rc | 10 +++--
8 files changed, 96 insertions(+), 10 deletions(-)
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
index b06c325..2a94e6a 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -408,6 +408,19 @@
return 0;
}
+int CHsmsActive::hsmsProcessProgramRequest(const char* pszPPID)
+{
+ if (pszPPID == nullptr || strlen(pszPPID) == 0) return -1;
+ IMessage* pMessage = nullptr;
+ if (HSMS_Create1Message(pMessage, m_nSessionId, 7 | REPLY, 5, ++m_nSystemByte) != 0 || pMessage == nullptr) {
+ return -1;
+ }
+ pMessage->getBody()->setString(pszPPID, "PPID");
+ m_pActive->sendMessage(pMessage);
+ HSMS_Destroy1Message(pMessage);
+ return 0;
+}
+
int CHsmsActive::hsmsCarrierActionRequest(unsigned int DATAID,
const char* pszCarrierAction,
const char* pszCarrierId,
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.h b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
index b8f3234..66ab134 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.h
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -92,6 +92,7 @@
// 鏌ヨPPID List
int hsmsQueryPPIDList();
int hsmsDeletePPID(const std::vector<std::string>& ppids); // S7F17
+ int hsmsProcessProgramRequest(const char* pszPPID); // S7F5
// S3F17
// 鍗″專鍔ㄤ綔璇锋眰
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
index b577063..fb5266e 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
@@ -54,10 +54,10 @@
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n"
"LANGUAGE 4, 2\r\n"
- "#include ""res\\EAPSimulator.rc2"" // 闂�?Microsoft Visual C++ 缂傛牞绶惃鍕カ濠�?\n"
- "#include ""l.CHS\\afxres.rc"" // 閺嶅洤鍣紒鍕\r\n"
+ "#include ""res\\EAPSimulator.rc2"" // 闂�?Microsoft Visual C++ 缂傚倹鐗炵欢顐︽儍閸曨喚銈繝?\n"
+ "#include ""l.CHS\\afxres.rc"" // 闁哄秴娲ら崳顖滅磼閸曨亝顐絓r\n"
"#if !defined(_AFXDLL)\r\n"
- "#include ""l.CHS\\afxribbon.rc"" // MFC 閸旂喕鍏橀崠鍝勬嫲閹貉冨煑閺壜ょカ濠�?\n"
+ "#include ""l.CHS\\afxribbon.rc"" // MFC 闁告梻鍠曢崗姗�宕犻崫鍕闁硅矇鍐ㄧ厬闁哄銈囥偒婵�?\n"
"#endif\r\n"
"#endif\r\n"
"\0"
@@ -127,7 +127,9 @@
PUSHBUTTON "S1F3_QueryPJSpace",IDC_BUTTON_QUERY_PJ_SPACE,350,82,108,14
PUSHBUTTON "S16F15_Create PJ",IDC_BUTTON_CREATE_PJ,350,101,108,14
PUSHBUTTON "S14F9_Create CJ",IDC_BUTTON_CREATE_CJ,14,120,108,14
- EDITTEXT IDC_EDIT_DELETE_PPID,283,152,79,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_PPID_REQ,284,170,78,14,ES_AUTOHSCROLL
+ PUSHBUTTON "S7F5_Request PP",IDC_BUTTON_PP_REQUEST,364,170,95,14
+ EDITTEXT IDC_EDIT_DELETE_PPID,284,152,78,14,ES_AUTOHSCROLL
PUSHBUTTON "S7F17_Delete PPID",IDC_BUTTON_DELETE_PPID,364,152,95,14
END
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
index 90c57ae..47b1c44 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -107,6 +107,7 @@
ON_BN_CLICKED(IDC_BUTTON_QUERY_ALL_SVID, &CEAPSimulatorDlg::OnBnClickedButtonQueryAllSvid)
ON_BN_CLICKED(IDC_BUTTON_QUERY_ALL_CEID, &CEAPSimulatorDlg::OnBnClickedButtonQueryAllCeid)
ON_BN_CLICKED(IDC_BUTTON_QUERY_CURRENT_RECIPE, &CEAPSimulatorDlg::OnBnClickedButtonQueryCurrentRecipe)
+ ON_BN_CLICKED(IDC_BUTTON_PP_REQUEST, &CEAPSimulatorDlg::OnBnClickedButtonPpRequest)
END_MESSAGE_MAP()
@@ -295,7 +296,7 @@
::SendMessage(hCombo, CB_SETCURSEL, 0, 0);
}
- CRect rcBtn(140, 168, 14 + 140 + 140, 168 + 14);
+ CRect rcBtn(140, 168, 14 + 140 + 118, 168 + 14);
MapDialogRect(&rcBtn);
HWND hBtn = ::CreateWindow(_T("BUTTON"), _T("S1F3_CurrentRecipe"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
@@ -678,3 +679,16 @@
theApp.m_model.m_pHsmsActive->hsmsSelectedEquipmentStatusRequest(svid);
}
+
+void CEAPSimulatorDlg::OnBnClickedButtonPpRequest()
+{
+ CString strPPID;
+ GetDlgItemText(IDC_EDIT_PPID_REQ, strPPID);
+ strPPID.Trim();
+ std::string ppid = CT2A(strPPID);
+ if (ppid.empty()) {
+ AfxMessageBox(_T("璇疯緭鍏� PPID"));
+ return;
+ }
+ theApp.m_model.m_pHsmsActive->hsmsProcessProgramRequest(ppid.c_str());
+}
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
index 53604db..caf52d1 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -73,4 +73,5 @@
afx_msg void OnBnClickedButtonQueryAllSvid();
afx_msg void OnBnClickedButtonQueryAllCeid();
afx_msg void OnBnClickedButtonQueryCurrentRecipe();
+ afx_msg void OnBnClickedButtonPpRequest();
};
diff --git a/SourceCode/Bond/EAPSimulator/Resource.h b/SourceCode/Bond/EAPSimulator/Resource.h
index be43ee7..e03fff6 100644
--- a/SourceCode/Bond/EAPSimulator/Resource.h
+++ b/SourceCode/Bond/EAPSimulator/Resource.h
@@ -69,14 +69,16 @@
#define IDC_BUTTON_DELETE_PPID 1051
#define IDC_COMBO_EQ_FOR_RECIPE 1052
#define IDC_BUTTON_QUERY_CURRENT_RECIPE 1053
+#define IDC_EDIT_PPID_REQ 1054
+#define IDC_BUTTON_PP_REQUEST 1055
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 145
+#define _APS_NEXT_RESOURCE_VALUE 146
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1054
+#define _APS_NEXT_CONTROL_VALUE 1056
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index df773b6..301cf6a 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -3,6 +3,7 @@
#include "Log.h"
#include "Model.h"
#include "Common.h"
+#include "RecipeManager.h"
#include <time.h>
#include <iostream>
#include <time.h>
@@ -11,6 +12,7 @@
#include <algorithm>
#include <set>
#include <regex>
+#include <sstream>
// ControlState values (keep in sync with Model::ControlState / VariableList.txt)
static constexpr uint8_t kControlStateOnlineRemote = 5;
@@ -587,8 +589,8 @@
Lock();
int maxId = 0;
for (auto v : m_variabels) {
- if (v != nullptr && v->getVarialbleId() > maxId) {
- maxId = v->getVarialbleId();
+ if (v != nullptr && static_cast<int>(v->getVarialbleId()) > maxId) {
+ maxId = static_cast<int>(v->getVarialbleId());
}
}
outId = maxId + 1;
@@ -1373,6 +1375,9 @@
else if (nStream == 7 && pHeader->function == 17) {
replyDeletePPID(pMessage);
}
+ else if (nStream == 7 && pHeader->function == 5) {
+ replyProcessProgramRequest(pMessage);
+ }
else if (nStream == 10 && pHeader->function == 3) {
replyTerminalDisplay(pMessage);
}
@@ -1412,7 +1417,12 @@
return -1;
}
- int nBufSize = file.GetLength();
+ ULONGLONG len = file.GetLength();
+ if (len > INT_MAX) {
+ file.Close();
+ return -1;
+ }
+ int nBufSize = static_cast<int>(len);
char* pszBuffer = new char[nBufSize];
file.Read(pszBuffer, nBufSize);
file.Close();
@@ -2585,6 +2595,48 @@
return 0;
}
+// S7F5 Process Program Request -> reply S7F6 with PPID + PPBODY
+int CHsmsPassive::replyProcessProgramRequest(IMessage* pRecv)
+{
+ if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
+ return ER_NOTSELECT;
+ }
+ ISECS2Item* pBody = pRecv->getBody();
+ const char* pszPPID = nullptr;
+ if (pBody == nullptr || !pBody->getString(pszPPID) || pszPPID == nullptr) {
+ return ER_PARAM_ERROR;
+ }
+ std::string ppid(pszPPID);
+ std::string ppbody;
+ // 绠�鍗曡仛鍚堬細浠� RecipeManager 鍙栬澶囬厤鏂癸紝鎷兼垚鏂囨湰
+ auto recipeInfo = RecipeManager::getInstance().getRecipeByPPID(ppid);
+ if (!recipeInfo.strPPID.empty()) {
+ for (const auto& dev : recipeInfo.vecDeviceList) {
+ if (!ppbody.empty()) ppbody.append("\n");
+ ppbody.append(dev.strDeviceName);
+ ppbody.append(",");
+ ppbody.append(std::to_string(dev.nRecipeID));
+ ppbody.append(",");
+ ppbody.append(dev.strRecipeName);
+ // 闄勫姞鍙傛暟澶у皬淇℃伅锛堢洰鍓嶇己灏戝叿浣撳弬鏁板垪琛級
+ ppbody.append(",paramsSize=");
+ ppbody.append(std::to_string(dev.paramsRawData.size()));
+ }
+ }
+
+ IMessage* pMessage = nullptr;
+ if (HSMS_Create1Message(pMessage, m_nSessionId, 7, 6, pRecv->getHeader()->systemBytes) != 0 || pMessage == nullptr) {
+ return ER_CREATED_MESSAGE;
+ }
+ ISECS2Item* pRspBody = pMessage->getBody(); // top-level L:2
+ pRspBody->addItem(ppid.c_str(), "PPID");
+ pRspBody->addItem(ppbody.c_str(), "PPBODY");
+ m_pPassive->sendMessage(pMessage);
+ LogSecsMessageBrief("<HSMS>[SEND]", pMessage);
+ HSMS_Destroy1Message(pMessage);
+ return 0;
+}
+
// S7F19
int CHsmsPassive::replyQueryPPIDList(IMessage* pRecv)
{
diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index d9e7e96..c81a935 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -255,6 +255,7 @@
int replyPurgeSpooledData(IMessage* pRecv);
int replyQueryPPIDList(IMessage* pRecv);
int replyDeletePPID(IMessage* pRecv); // S7F17/S7F18
+ int replyProcessProgramRequest(IMessage* pRecv); // S7F5/S7F6
int replyTerminalDisplay(IMessage* pRecv);
int replyCreateObj(IMessage* pRecv);
int replyPRJobMultiCreate(IMessage* pRecv);
--
Gitblit v1.9.3