From 81df82be1f5f401b80780f65e5811685d9a8e4c4 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 19 九月 2025 18:03:24 +0800
Subject: [PATCH] 1.修复打开软件加载CControlJob时,玻璃context丢失的问题;

---
 SourceCode/Bond/Servo/Model.cpp |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index b100f14..c3a438d 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -250,9 +250,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 +468,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 +490,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