From 166fa1cb727d6fe6962bbd2b5c4a0c9da6088048 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 30 七月 2025 14:50:03 +0800
Subject: [PATCH] 1.获取配方后自动刷新列表; 2.HsmsAction序列化和反序列化,将来用于缓存上报的数据;

---
 SourceCode/Bond/Servo/CPageGraph2.cpp      |    5 ++
 SourceCode/Bond/Servo/HsmsAction.h         |    2 +
 SourceCode/Bond/Servo/HsmsPassive.cpp      |   13 ++++++
 SourceCode/Bond/HSMSSDK/Include/IMessage.h |    2 +
 SourceCode/Bond/Servo/HsmsAction.cpp       |   57 ++++++++++++++++++++++++++++
 SourceCode/Bond/Servo/PageRecipe.cpp       |    4 +
 6 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/HSMSSDK/Include/IMessage.h b/SourceCode/Bond/HSMSSDK/Include/IMessage.h
index 41d1767..fc9504b 100644
--- a/SourceCode/Bond/HSMSSDK/Include/IMessage.h
+++ b/SourceCode/Bond/HSMSSDK/Include/IMessage.h
@@ -29,4 +29,6 @@
 	virtual HEADER* getHeader() = 0;
 	virtual ISECS2Item* getBody() = 0;
 	virtual const char* toString() = 0;
+	virtual int serialize(char* pszBuffer, int nBufferSize) = 0;
+	virtual int unserialize(const char* pszBuffer, int nBufferSize) = 0;
 };
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index c22949a..a248cf4 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -255,6 +255,7 @@
 			*/
 
 			// 娴嬭瘯璁剧疆鏃堕棿
+			/*
 			if (pEquipment->getID() == EQ_ID_EFEM) {
 				CTime time = CTime::GetCurrentTime();
 				pEquipment->setDateTime((short)time.GetYear(),
@@ -264,7 +265,7 @@
 					(short)time.GetMinute(),
 					(short)time.GetSecond());
 			}
-
+			*/
 			
 			// 娴嬭瘯璁剧疆cim mode
 			/*
@@ -282,6 +283,8 @@
 				pEquipment->setEqMode((ii % 5) + 1);
 			}
 			*/
+
+			theApp.m_model.m_hsmsPassive.requestAlarmReport(1, 2, "abc");
 		}
 
 
diff --git a/SourceCode/Bond/Servo/HsmsAction.cpp b/SourceCode/Bond/Servo/HsmsAction.cpp
index fb85224..0792df5 100644
--- a/SourceCode/Bond/Servo/HsmsAction.cpp
+++ b/SourceCode/Bond/Servo/HsmsAction.cpp
@@ -107,3 +107,60 @@
 	return nResponseTime >= m_nTimeout;
 }
 
+int CHsmsAction::serialize(char* pszBuffer, int nBufferSize)
+{
+	int index = 0;
+	if (pszBuffer == nullptr) {
+		index += sizeof(int);
+		index += sizeof(m_nTimeout);
+		index += sizeof(int);
+		index += sizeof(BOOL);
+		index += m_pSendMessage->serialize(pszBuffer, nBufferSize);
+
+		return index;
+	}
+	else {
+		memcpy(&pszBuffer[index], &m_nAction, sizeof(int));
+		index += sizeof(int);
+
+		memcpy(&pszBuffer[index], &m_nTimeout, sizeof(int));
+		index += sizeof(int);
+
+		memcpy(&pszBuffer[index], &m_nResponseTime, sizeof(int));
+		index += sizeof(int);
+
+		memcpy(&pszBuffer[index], &m_bNeedWaitReply, sizeof(BOOL));
+		index += sizeof(BOOL);
+
+		index += m_pSendMessage->serialize(&pszBuffer[index], nBufferSize - index);
+
+		return index;
+	}
+}
+
+int CHsmsAction::unserialize(const char* pszBuffer, int nBufferSize)
+{
+	int index = 0;
+	if (index + sizeof(int) > nBufferSize) return -1;
+	memcpy(&m_nAction, &pszBuffer[index], sizeof(int));
+	index += sizeof(int);
+
+	if (index + sizeof(int) > nBufferSize) return -1;
+	memcpy(&m_nTimeout, &pszBuffer[index], sizeof(int));
+	index += sizeof(int);
+
+	if (index + sizeof(int) > nBufferSize) return -1;
+	memcpy(&m_nResponseTime, &pszBuffer[index], sizeof(int));
+	index += sizeof(int);
+
+	if (index + sizeof(BOOL) > nBufferSize) return -1;
+	memcpy(&m_bNeedWaitReply, &pszBuffer[index], sizeof(BOOL));
+	index += sizeof(BOOL);
+
+	HSMS_Create1Message(m_pSendMessage, 1, 1 | REPLY, 1, 1);
+	int nRet = m_pSendMessage->unserialize(&pszBuffer[index], nBufferSize - index);
+	if (nRet < 0) return nRet;
+
+	return index + nRet;
+}
+
diff --git a/SourceCode/Bond/Servo/HsmsAction.h b/SourceCode/Bond/Servo/HsmsAction.h
index 5be2bbb..12a3160 100644
--- a/SourceCode/Bond/Servo/HsmsAction.h
+++ b/SourceCode/Bond/Servo/HsmsAction.h
@@ -28,6 +28,8 @@
 	HANDLE getEvent();
 	int responseTimeIncrement();
 	BOOL incrementAndCheckTimeout();
+	int serialize(char* pszBuffer, int nBufferSize);
+	int unserialize(const char* pszBuffer, int nBufferSize);
 
 private:
 	int m_nAction;
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 22840c2..902f236 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -669,6 +669,7 @@
 	SetEvent(m_hCimWorkEvent);
 	Unlock();
 
+
 	return ER_NOERROR;
 }
 
@@ -1230,6 +1231,18 @@
 	SetEvent(m_hCimWorkEvent);
 	Unlock();
 
+	int size = pAction->serialize(nullptr, 0);;
+	if (size > 0) {
+		char* pszBuffer = new char[size];
+		pAction->serialize(pszBuffer, size);
+		AfxMessageBox("abc");
+
+		CHsmsAction* pAction2 = new CHsmsAction();
+		pAction2->unserialize(pszBuffer, size);
+		AfxMessageBox("def");
+		m_pPassive->sendMessage(pAction2->getSendMessage());
+	}
+
 	return ER_NOERROR;
 }
 
diff --git a/SourceCode/Bond/Servo/PageRecipe.cpp b/SourceCode/Bond/Servo/PageRecipe.cpp
index 6863f01..a625647 100644
--- a/SourceCode/Bond/Servo/PageRecipe.cpp
+++ b/SourceCode/Bond/Servo/PageRecipe.cpp
@@ -440,7 +440,7 @@
 	else {
 		// enable port
 		CMsgDlg msgDlg("璇风瓑寰�", "姝e湪鑾峰彇閰嶆柟...");
-		pEq->masterRecipeListRequest(0, [&](int status) -> void {
+		pEq->masterRecipeListRequest(0, [&, pEq](int status) -> void {
 			if (status == SS_FAILED || status == SS_TIMEOUT) {
 				CString strMsg;
 				strMsg.Format(status == SS_FAILED ? _T("鑾峰彇閰嶆柟澶辫触锛�") : _T("鑾峰彇閰嶆柟瓒呮椂锛�"));
@@ -460,6 +460,8 @@
 				msgDlg.SetMessage((LPTSTR)(LPCTSTR)strMsg);
 				msgDlg.SetMarquee(FALSE, 0);
 				msgDlg.SetCompleteCode(0);
+				SERVO::CRecipeList* pRecipeList = pEq->getRecipeList(0);
+				FillRecipeListToListCtrl(pRecipeList);
 			}
 		});
 		msgDlg.DoModal();

--
Gitblit v1.9.3