From 6da913343f320029f2a7b5b7c6aae7e8831a5fd4 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 10 三月 2025 18:22:01 +0800
Subject: [PATCH] 1.完善报警窗口,报警信息展示,有报警信息变化时刷新列表。
---
SourceCode/Bond/Servo/AlarmDlg.cpp | 29 +++++++++++++++--------------
SourceCode/Bond/Servo/Model.cpp | 3 +++
SourceCode/Bond/Servo/ServoDlg.cpp | 6 ++++--
SourceCode/Bond/Servo/Common.h | 3 +++
4 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/SourceCode/Bond/Servo/AlarmDlg.cpp b/SourceCode/Bond/Servo/AlarmDlg.cpp
index 83f7837..c1d8ecd 100644
--- a/SourceCode/Bond/Servo/AlarmDlg.cpp
+++ b/SourceCode/Bond/Servo/AlarmDlg.cpp
@@ -9,7 +9,7 @@
#include "Common.h"
#include <iomanip>
-#define PAGE_SIZE 10
+#define PAGE_SIZE 100
#define PAGE_BACKGROUND_COLOR RGB(252, 252, 255)
// CAlarmDlg 瀵硅瘽妗�
@@ -53,9 +53,12 @@
pAny->addRef();
int code = pAny->getCode();
- if (RX_CODE_STEP_EVENT_READDATA == code) {
- LOGI("<CAlarmDlg> Accept RX_CODE_STEP_EVENT_READDATA successfully!");
+ if (RX_CODE_ALARM_SET == code) {
+ UpdatePageData();
+
+
// 閫氱煡璁惧鐘舵��
+ /*
SERVO::CEqAlarmStep* pStep = nullptr;
if (pAny->getPtrValue("ptr", (void*&)pStep)) {
if (pStep != nullptr) {
@@ -70,21 +73,20 @@
alarmData.nUnitId = pStep->getUnitId();
alarmData.strDeviceName = alarmManager.getDeviceNameById(alarmData.nDeviceId);
alarmData.strUnitName = alarmManager.getUnitNameById(alarmData.nDeviceId, alarmData.nUnitId);
- alarmData.strStartTime = getCurrentTimeString();
- alarmData.strEndTime = "2000-01-01 00:00";
-
const AlarmInfo* pAlarmInfo = alarmManager.getAlarmInfoByID(pStep->getAlarmId());
alarmData.strDescription = pAlarmInfo != nullptr ? pAlarmInfo->strAlarmText : "";
-
- // 鎻掑叆鍒楄〃鎺т欢
- CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_ALARM);
- if (pListCtrl != nullptr) {
- InsertAlarmData(pListCtrl, alarmData);
+ if (pStep->getAlarmState() == 1) {
+ alarmData.strStartTime = getCurrentTimeString();
+ alarmData.strEndTime = "";
+ InsertAlarmData(&m_listCtrl, alarmData);
}
}
}
+ */
}
-
+ else if (RX_CODE_ALARM_CLEAR == code) {
+ UpdatePageData();
+ }
pAny->release();
}, [&]() -> void {
@@ -188,8 +190,7 @@
CString str;
str.Format(_T("%d"), alarmData.nId);
pListCtrl->SetItemText(nNewItem, 1, str); // 鎶ヨID
- str.Format(_T("%d"), alarmData.nSeverityLevel);
- pListCtrl->SetItemText(nNewItem, 2, str); // 绛夌骇
+ pListCtrl->SetItemText(nNewItem, 2, pszAlarmLevel[alarmData.nSeverityLevel % 2]); // 绛夌骇
pListCtrl->SetItemText(nNewItem, 3, alarmData.strDeviceName.c_str()); // 璁惧鍚嶇О
pListCtrl->SetItemText(nNewItem, 4, alarmData.strUnitName.c_str()); // 鍗曞厓鍚嶇О
pListCtrl->SetItemText(nNewItem, 5, alarmData.strStartTime.c_str()); // 寮�濮嬫椂闂�
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 92d40c2..99f56e0 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -11,6 +11,9 @@
#define RX_CODE_STEP_EVENT_READDATA 1005
#define RX_CODE_SELECT_EQUIPMENT 1006
#define RX_CODE_SELECT_STEP 1007
+#define RX_CODE_ALARM_SET 1008
+#define RX_CODE_ALARM_CLEAR 1009
+
/* Channel Name */
#define MC_CHANNEL1_NAME "McChannel1"
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 2429f3a..114fe5d 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -145,12 +145,15 @@
else {
LOGE("<CModel> Failed to add alarm.");
}
+
+ notifyPtr(RX_CODE_ALARM_SET, pStep);
}
else {
alarmManager.clearAlarmByAttributes(pEqAlarmStep->getAlarmId(),
pEqAlarmStep->getEquipment()->getID(),
pEqAlarmStep->getUnitId(),
CToolUnits::getCurrentTimeString());
+ notifyPtr(RX_CODE_ALARM_CLEAR, pStep);
}
m_hsmsPassive.requestAlarmReport(pEqAlarmStep->getAlarmState(),
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index bfed47e..b46a746 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -658,6 +658,7 @@
CRect rcWnd;
GetWindowRect(&rcWnd);
int nHeight = GetSystemMetrics(SM_CYSCREEN) - rcWnd.bottom - 38;
+ if (nHeight < 280) nHeight = 280;
m_pAlarmDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), nHeight);
}
ASSERT(m_pAlarmDlg);
@@ -686,6 +687,7 @@
CRect rcWnd;
GetWindowRect(&rcWnd);
int nHeight = GetSystemMetrics(SM_CYSCREEN) - rcWnd.bottom - 38;
+ if (nHeight < 280) nHeight = 280;
m_pLogDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), nHeight);
}
ASSERT(m_pLogDlg);
@@ -945,13 +947,13 @@
if (m_pLogDlg != nullptr && !m_pLogDlg->IsZoomed()) {
CRect rcWnd;
GetWindowRect(&rcWnd);
- m_pLogDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), 200);
+ m_pLogDlg->SetWindowPos(nullptr, rcWnd.left, rcWnd.bottom - 8, 0, 0, SWP_NOSIZE);
}
if (m_pAlarmDlg != nullptr && !m_pAlarmDlg->IsZoomed()) {
CRect rcWnd;
GetWindowRect(&rcWnd);
- m_pAlarmDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), 200);
+ m_pAlarmDlg->SetWindowPos(nullptr, rcWnd.left, rcWnd.bottom - 8, 0, 0, SWP_NOSIZE);
}
CDialogEx::OnMove(x, y);
--
Gitblit v1.9.3