From e53508d682792915e26ff02b10f5f2f9bf93d959 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期一, 04 八月 2025 18:23:54 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/EAPSimulator/CHsmsActive.cpp     |   10 +++++
 SourceCode/Bond/EAPSimulator/Resource.h          |   25 ++++++------
 SourceCode/Bond/Servo/HsmsPassive.h              |    3 +
 .gitignore                                       |    2 +
 Document/SECS通讯整理.xlsx                           |    0 
 SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp |    7 +++
 SourceCode/Bond/EAPSimulator/CHsmsActive.h       |    3 +
 SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h   |    1 
 SourceCode/Bond/Servo/HsmsPassive.cpp            |   15 ++++---
 SourceCode/Bond/EAPSimulator/EAPSimulator.rc     |    0 
 SourceCode/Bond/Servo/Model.cpp                  |   14 +++++++
 SourceCode/Bond/Servo/Common.h                   |    6 ++
 12 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0999df4..38a88e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,5 @@
 *.tlog
 *.pch
 SourceCode/Bond/EAPSimulator/x64/
+Document/___CEID_________________.csv
+Document/______CEID__.csv
diff --git "a/Document/SECS\351\200\232\350\256\257\346\225\264\347\220\206.xlsx" "b/Document/SECS\351\200\232\350\256\257\346\225\264\347\220\206.xlsx"
index 722b726..e7ecf9c 100644
--- "a/Document/SECS\351\200\232\350\256\257\346\225\264\347\220\206.xlsx"
+++ "b/Document/SECS\351\200\232\350\256\257\346\225\264\347\220\206.xlsx"
Binary files differ
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
index 96ed8dd..1605306 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -289,6 +289,16 @@
 	return 0;
 }
 
+int CHsmsActive::hsmsQueryPPIDList()
+{
+	IMessage* pMessage = nullptr;
+	int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 7 | REPLY, 19, ++m_nSystemByte);
+	m_pActive->sendMessage(pMessage);
+	HSMS_Destroy1Message(pMessage);
+
+	return 0;
+}
+
 int CHsmsActive::replyAck0(IMessage* pMessage)
 {
 	return 0;
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.h b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
index 7a93948..d6ff5b6 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.h
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -61,6 +61,9 @@
 	int hsmsTransmitSpooledData();
 	int hsmsPurgeSpooledData();
 
+	// 查询PPID List
+	int hsmsQueryPPIDList();
+
 	// 通过的reply函数
 	void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
 
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
index b126259..a7c343f 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
index c3c4fb7..f95c6ee 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -87,6 +87,7 @@
 	ON_BN_CLICKED(IDC_BUTTON_CONFIGURE_SPOOLING, &CEAPSimulatorDlg::OnBnClickedButtonConfigureSpooling)
 	ON_BN_CLICKED(IDC_BUTTON_TRANSMIT_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonTransmitSpooledData)
 	ON_BN_CLICKED(IDC_BUTTON_PURGE_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonPurgeSpooledData)
+	ON_BN_CLICKED(IDC_BUTTON_QUERY_PPID_LIST, &CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList)
 END_MESSAGE_MAP()
 
 
@@ -273,6 +274,7 @@
 	GetDlgItem(IDC_BUTTON_CONFIGURE_SPOOLING)->EnableWindow(enabled);	
 	GetDlgItem(IDC_BUTTON_TRANSMIT_SPOOLED_DATA)->EnableWindow(enabled);
 	GetDlgItem(IDC_BUTTON_PURGE_SPOOLED_DATA)->EnableWindow(enabled);
+	GetDlgItem(IDC_BUTTON_QUERY_PPID_LIST)->EnableWindow(enabled);	
 }
 
 void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -369,3 +371,8 @@
 {
 	theApp.m_model.m_pHsmsActive->hsmsPurgeSpooledData();
 }
+
+void CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList()
+{
+	theApp.m_model.m_pHsmsActive->hsmsQueryPPIDList();
+}
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
index adc1a71..c243873 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -56,4 +56,5 @@
 	afx_msg void OnBnClickedButtonConfigureSpooling();
 	afx_msg void OnBnClickedButtonTransmitSpooledData();
 	afx_msg void OnBnClickedButtonPurgeSpooledData();
+	afx_msg void OnBnClickedButtonQueryPpidList();
 };
diff --git a/SourceCode/Bond/EAPSimulator/Resource.h b/SourceCode/Bond/EAPSimulator/Resource.h
index f8b9864..f3daccf 100644
--- a/SourceCode/Bond/EAPSimulator/Resource.h
+++ b/SourceCode/Bond/EAPSimulator/Resource.h
@@ -22,31 +22,32 @@
 #define IDC_BUTTON_DATETIME_SYNC        1006
 #define IDC_BUTTON_TERMINAL_DISPLAY     1007
 #define IDC_COMBO_TID                   1008
-#define IDC_BUTTON_ED_EVENT_REPORT      1008
 #define IDC_EDIT_TEXT                   1009
-#define IDC_BUTTON_ED_ALARM_REPORT      1009
 #define IDC_BUTTON_SEND                 1010
-#define IDC_BUTTON_DEFINE_REPORT        1010
 #define IDC_BUTTON_LINE_REPORT          1011
 #define IDC_RADIO_ENABLE                1012
-#define IDC_BUTTON_LINE_REPORT2         1012
-#define IDC_BUTTON_CONFIGURE_SPOOLING   1012
 #define IDC_RADIO_DISABLE               1013
-#define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1013
 #define IDC_EDIT_CEID                   1014
-#define IDC_BUTTON_PURGE_SPOOLED_DATA   1014
 #define IDC_LIST1                       1015
-#define IDC_EDIT_CE_NAME                1015
 #define IDC_LIST2                       1016
-#define IDC_EDIT_CE_DESCRIPTIONS        1016
 #define IDC_BUTTON_ADD_RPTID            1017
-#define IDC_EDIT_CE_RPTID               1017
 #define IDC_BUTTON_DEL_REPORT           1018
 #define IDC_BUTTON_ADD_VID              1019
 #define IDC_BUTTON_DEL_VID              1020
 #define IDC_GROUP_IDS                   1021
 #define IDC_EDIT_ID                     1022
-#define IDC_BUTTON1                     1023
+#define IDC_EDIT_CE_DESCRIPTIONS        1023
+#define IDC_BUTTON_ED_EVENT_REPORT      1025
+#define IDC_BUTTON_ED_ALARM_REPORT      1026
+#define IDC_BUTTON_DEFINE_REPORT        1027
+#define IDC_BUTTON_LINE_REPORT2         1028
+#define IDC_BUTTON_CONFIGURE_SPOOLING   1029
+#define IDC_BUTTON_PURGE_SPOOLED_DATA   1030
+#define IDC_EDIT_CE_NAME                1031
+#define IDC_BUTTON_QUERY_PPID_LIST		1032
+#define IDC_EDIT_CE_RPTID               1033
+#define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1034
+
 
 // Next default values for new objects
 // 
@@ -54,7 +55,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        141
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         1025
+#define _APS_NEXT_CONTROL_VALUE         1035
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 0aa7cfa..3031752 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -548,4 +548,8 @@
 #define ROBOT_EVENT_FINISH		1   // 正常完成
 #define ROBOT_EVENT_ERROR		2   // 出现错误
 #define ROBOT_EVENT_ABORT		3   // 人为中止
-#define ROBOT_EVENT_RESTORE		4   // 回撤
\ No newline at end of file
+#define ROBOT_EVENT_RESTORE		4   // 回撤
+
+
+/* PPID名字最大长度 */
+#define PPID_NAME_MAX			80
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index d3534c3..9dca68a 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -1314,19 +1314,20 @@
 	if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
 		return ER_NOTSELECT;
 	}
-
+	if (m_listener.onQueryPPIDList == nullptr) {
+		return ER_NO_PPID_LIST;
+	}
 
 	IMessage* pMessage = NULL;
 	HSMS_Create1Message(pMessage, m_nSessionId, 7, 20, pRecv->getHeader()->systemBytes);
 	ASSERT(pMessage);
 
 	ISECS2Item* pItem = pMessage->getBody();
-	pItem->addItem("banana1", "PPID1");
-	pItem->addItem("banana2", "PPID2");
-	pItem->addF8Item(-123.45, "PPID2");
-	pItem->addF4Item(-568.99f, "PPID2");
-	pItem->addF8Item(456.456, "PPID2");
-	pItem->addF4Item(123.123f, "PPID2");
+	auto ppids = m_listener.onQueryPPIDList(this);
+	for (auto item : ppids) {
+		pItem->addItem(item.c_str(), "PPID");
+	}
+
 	m_pPassive->sendMessage(pMessage);
 	LOGI("<HSMS>[SECS Msg SEND]S7F20 (SysByte=%u)", pMessage->getHeader()->systemBytes);
 	HSMS_Destroy1Message(pMessage);
diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index 3fa3b73..64bccc0 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -22,6 +22,7 @@
 #define ER_PARAM_ERROR			-3
 #define ER_NO_EVENT				-4
 #define ER_UNLINK_EVENT_REPORT	-5
+#define ER_NO_PPID_LIST			-6
 
 
 /*
@@ -67,6 +68,7 @@
 typedef std::function<void(void* pFrom, SYSTEMTIME& time)> DATETIMESYNC;
 typedef std::function<void(void* pFrom, bool bEnable, std::vector<unsigned int>& ids)> EDEVENTREPORT;
 typedef std::function<void(void* pFrom, bool bEnable, unsigned int id)> EDALARMREPORT;
+typedef std::function<std::vector<std::string> (void* pFrom)> QUERYPPIDLIST;
 typedef struct _SECSListener
 {
 	SECSEQOFFLINE				onEQOffLine;
@@ -77,6 +79,7 @@
 	DATETIMESYNC				onDatetimeSync;
 	EDEVENTREPORT				onEnableDisableEventReport;
 	EDALARMREPORT				onEnableDisableAlarmReport;
+	QUERYPPIDLIST				onQueryPPIDList;
 } SECSListener;
 
 
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index ace0bd4..70685aa 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -7,6 +7,7 @@
 #include "AlarmManager.h"
 #include "CGlassPool.h"
 #include "TransferManager.h"
+#include "RecipeManager.h"
 
 
 CModel::CModel()
@@ -137,6 +138,19 @@
 			m_master.enableAlarmReport(bEnable);
 		}
 	};
+	listener.onQueryPPIDList = [&](void* pFrom) ->std::vector<std::string> {
+		std::vector<std::string> ppids;
+		auto temp = RecipeManager::getInstance().getAllPPID();
+		for (auto item : temp) {
+			if (item.length() > PPID_NAME_MAX) {
+				ppids.push_back(item.substr(0, PPID_NAME_MAX));
+			}
+			else {
+				ppids.push_back(item);
+			}
+		}
+		return ppids;
+	};
 	m_hsmsPassive.setListener(listener);
 	m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType);
 	m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev);

--
Gitblit v1.9.3