From 047c7cbd047e11fba8d7872e69a11a13e463aec4 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 13 十月 2025 17:40:39 +0800
Subject: [PATCH] 1.保存单条记录。

---
 SourceCode/Bond/Servo/Model.cpp |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index b100f14..8530738 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -49,12 +49,18 @@
 	for (int i = 0; i < 4; i++) {
 		m_configuration.getPortParms(i, portEnable, portType, portMode,
 			cassetteType, transferMode, autoChangeEnable);
-		m_master.setPortType(i, portEnable, portType, portMode, cassetteType,
+		m_master.setPortTypeEx(i, portEnable, portType, portMode, cassetteType,
 			transferMode, autoChangeEnable);
 
 		int seed = m_configuration.getPortCassetteSnSeed(i + 1);
 		m_master.setPortCassetteSnSeed(i + 1, seed);
 	}
+}
+
+void CModel::setPortType(unsigned int index, SERVO::PortType type)
+{
+	m_master.setPortType(index, (int)type);
+	m_configuration.setPortType(index, (int)type);
 }
 
 void CModel::setPortCassetteType(unsigned int index, SERVO::CassetteType type)
@@ -250,9 +256,18 @@
 			alarmData.strUnitName = alarmManager.getUnitNameById(alarmData.nDeviceId, alarmData.nUnitId);
 			alarmData.strStartTime = CToolUnits::timeToString2(CToolUnits::getTimestamp());
 			alarmData.strEndTime = "";
-
+			alarmData.strDescription = "";
+			
 			const AlarmInfo* alarmInfo = alarmManager.getAlarmInfoByID(alarmData.nId);
-			alarmData.strDescription = alarmInfo != nullptr ? alarmInfo->strAlarmText : "";
+			if (alarmInfo != nullptr) {
+				if (alarmInfo->strDescription.empty()) {
+					alarmData.strDescription = alarmInfo->strAlarmText;
+				}
+				else {
+					alarmData.strDescription = alarmInfo->strAlarmText + "," + alarmInfo->strDescription + ".";
+				}
+			}
+
 
 			int nAlarmEventId = 0;
 			bool result = alarmManager.addAlarm(alarmData, nAlarmEventId);
@@ -459,9 +474,8 @@
 	// 加截Job
 	strMasterDataFile.Format(_T("%s\\MasterState.dat"), (LPTSTR)(LPCTSTR)m_strWorkDir);
 	std::string strPath = std::string((LPTSTR)(LPCTSTR)strMasterDataFile);
-	if (!m_master.loadState(strPath)) {
-		LOGE("<Master>加载MasterState.dat文件失败.");
-	}
+	m_master.setStateFile(strPath);
+
 
 
 	// 加载警告信息
@@ -482,6 +496,10 @@
 
 int CModel::term()
 {
+	m_configuration.setPortCassetteSnSeed(1, m_master.getPortCassetteSnSeed(1));
+	m_configuration.setPortCassetteSnSeed(2, m_master.getPortCassetteSnSeed(2));
+	m_configuration.setPortCassetteSnSeed(3, m_master.getPortCassetteSnSeed(3));
+	m_configuration.setPortCassetteSnSeed(4, m_master.getPortCassetteSnSeed(4));
 	m_hsmsPassive.saveCache();
 	m_hsmsPassive.term();
 	CLog::GetLog()->SetOnLogCallback(nullptr);

--
Gitblit v1.9.3