From f56051fa3102feb35ea60650ebda80f49e62d025 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 05 八月 2025 14:54:24 +0800
Subject: [PATCH] 1. SGMeasurement实现规划的地址 2. 优化读取位时输入的地址不是8的倍数的问题 3. 添加读写心跳的功能

---
 SourceCode/Bond/Servo/Model.cpp |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 1a63ddd..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()
@@ -56,6 +57,12 @@
 {
 	m_master.setPortCassetteType(index, type);
 	m_configuration.setPortCassetteType(index, (int)type);
+}
+
+void CModel::setPortEnable(unsigned int index, BOOL bEnable)
+{
+	m_master.setPortEnable(index, bEnable);
+	m_configuration.setPortEnable(index, bEnable);
 }
 
 int CModel::init()
@@ -131,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);
@@ -142,6 +162,8 @@
 	m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile);
 	strVarialbleFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
 	m_hsmsPassive.loadCollectionEvents((LPTSTR)(LPCTSTR)strVarialbleFile);
+	strVarialbleFile.Format(_T("%s\\HsmsPassive.cache"), (LPTSTR)(LPCTSTR)m_strWorkDir);
+	m_hsmsPassive.loadCacheFromFile(strVarialbleFile);
 
 
 	SERVO::MasterListener masterListener;
@@ -305,9 +327,9 @@
 		notifyPtrAndInt(RX_CODE_EQ_ROBOT_TASK, pTask, nullptr, code);
 
 	};
-	masterListener.onLoadPortInUse = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short scanMap) {
-		LOGE("<CModel>onLoadPortInUse. scanMap = %d", scanMap);
-		notifyPtr(RX_CODE_LOADPORT_INUSE, pEquipment);
+	masterListener.onLoadPortStatusChanged = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short status, __int64 data) {
+		LOGE("<CModel>onLoadPortStatusChanged. status = %d", status);
+		notifyPtr(RX_CODE_LOADPORT_STATUS_CHANGED, pEquipment);
 	};
 	m_master.setListener(masterListener);
 
@@ -331,6 +353,7 @@
 
 int CModel::term()
 {
+	m_hsmsPassive.saveCache();
 	m_hsmsPassive.term();
 	CLog::GetLog()->SetOnLogCallback(nullptr);
 	m_master.term();

--
Gitblit v1.9.3