From d06ab39efafbcb2a7b1ec4cb83e18fa3485789a9 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期六, 29 三月 2025 08:55:56 +0800
Subject: [PATCH] 1.修改两个函数名称;

---
 SourceCode/Bond/Servo/AlarmManager.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/Servo/AlarmManager.cpp b/SourceCode/Bond/Servo/AlarmManager.cpp
index 74b1006..3283979 100644
--- a/SourceCode/Bond/Servo/AlarmManager.cpp
+++ b/SourceCode/Bond/Servo/AlarmManager.cpp
@@ -89,7 +89,7 @@
             unit_id TEXT NOT NULL,
             description TEXT NOT NULL,
             start_time DATETIME NOT NULL,
-            end_time DATETIME NOT NULL,
+            end_time DATETIME,
             FOREIGN KEY (device_id) REFERENCES devices(device_id),
             FOREIGN KEY (unit_id) REFERENCES units(unit_id)
         )
@@ -127,7 +127,7 @@
 
     // 插入单元数据
     for (int i = 1; i <= 3; ++i) {
-        for (int j = 1; j <= 3; ++j) {
+        for (int j = 0; j <= 3; ++j) {
             int unitId = j;
             std::string deviceId = std::to_string(i);
             std::string unitName = "Unit" + std::to_string(j);
@@ -144,6 +144,7 @@
         }
     }
 
+    /*
     // 初始化随机数生成器
     std::random_device rd;
     std::mt19937 gen(rd());
@@ -181,6 +182,7 @@
             std::cerr << "Failed to insert alarm data." << std::endl;
         }
     }
+    */
 }
 
 // 添加报警信息
@@ -717,7 +719,7 @@
 }
 
 // 通过多个属性查找并解除报警(更新结束时间)
-bool AlarmManager::clearAlarmByAttributes(int nId, int nSeverityLevel, int nDeviceId, int nUnitId, const std::string& strDescription, const std::string& endTime) {
+bool AlarmManager::clearAlarmByAttributes(int nId, int nDeviceId, int nUnitId, const std::string& endTime) {
     if (!m_pDB) {
         return false;
     }
@@ -729,10 +731,8 @@
     for (AlarmDataMap::const_iterator it = m_mapCache.begin(); it != m_mapCache.end(); ++it) {
         const AlarmData& alarm = it->second;
         if (alarm.nId == nId &&
-            alarm.nSeverityLevel == nSeverityLevel &&
             alarm.nDeviceId == nDeviceId &&
-            alarm.nUnitId == nUnitId &&
-            alarm.strDescription == strDescription) {
+            alarm.nUnitId == nUnitId) {
 
             alarmEventId = it->first;
             break;

--
Gitblit v1.9.3