| | |
| | | #include "InputDialog.h" |
| | | #include "ClientListDlg.h" |
| | | #include "CControlJobManagerDlg.h" |
| | | #include "AlarmManager.h" |
| | | #include "CUserManager2.h" |
| | | #include "CUserManager2Dlg.h" |
| | | #include "CUserXLogDlg.h" |
| | |
| | | m_pTopToolbar = nullptr; |
| | | m_pMyStatusbar = nullptr; |
| | | m_pRobotTaskDlg = nullptr; |
| | | m_pTab = nullptr; |
| | | m_pAlarmPopupDlg = nullptr; |
| | | } |
| | | |
| | | void CServoDlg::DoDataExchange(CDataExchange* pDX) |
| | |
| | | CString text; |
| | | if (cj != nullptr) { |
| | | std::string st = cj->getStateText(); |
| | | text.Format(_T("ControlJob: %S (%S)"), cj->id().c_str(), st.c_str()); |
| | | text.Format(_T("ControlJob: %s (%s)"), cj->id().c_str(), st.c_str()); |
| | | if (cj->state() == SERVO::CJState::Paused) { |
| | | text += _T(" [Paused]"); |
| | | } |
| | |
| | | //dlg.DoModal(); |
| | | } |
| | | } |
| | | else if (RX_CODE_ALARM_SET == code || RX_CODE_ALARM_CLEAR == code) { |
| | | RefreshAlarmBadge(); |
| | | } |
| | | |
| | | if (RX_CODE_PASSIVE_STATUS_CHANGED == code) { |
| | | int state = 0; |
| | |
| | | |
| | | theApp.m_model.getObservable()->observeOn(pRxWindows->mainThread()) |
| | | ->subscribe(m_pObserver); |
| | | } |
| | | } |
| | | |
| | | void CServoDlg::RefreshAlarmBadge() |
| | | { |
| | | if (m_pTopToolbar == nullptr) return; |
| | | auto activeAlarms = AlarmManager::getInstance().getActiveAlarms(); |
| | | |
| | | // 维护未读列表:当前活跃且未在已读集合中的报警 |
| | | std::unordered_set<int> activeIds; |
| | | m_unreadAlarms.clear(); |
| | | for (const auto& alarm : activeAlarms) { |
| | | activeIds.insert(alarm.nId); |
| | | if (m_ackAlarms.find(alarm.nId) == m_ackAlarms.end()) { |
| | | m_unreadAlarms.push_back(alarm); |
| | | } |
| | | } |
| | | // 移除已读集合中已不再活跃的告警 |
| | | for (auto it = m_ackAlarms.begin(); it != m_ackAlarms.end(); ) { |
| | | if (activeIds.find(*it) == activeIds.end()) { |
| | | it = m_ackAlarms.erase(it); |
| | | } |
| | | else { |
| | | ++it; |
| | | } |
| | | } |
| | | |
| | | int count = static_cast<int>(m_unreadAlarms.size()); |
| | | |
| | | auto* pBtn = dynamic_cast<CBlButton*>(m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)); |
| | | if (pBtn != nullptr) { |
| | | if (count <= 0) { |
| | | pBtn->SetBadgeNumber(0); |
| | | pBtn->ShowDotBadge(FALSE, RGB(255, 0, 0)); |
| | | pBtn->StopFlash(); |
| | | } |
| | | else if (count <= 9) { |
| | | pBtn->ShowDotBadge(FALSE, RGB(255, 0, 0)); |
| | | pBtn->SetBadgeNumber(count); |
| | | if (!pBtn->IsFlash()) pBtn->Flash(600); |
| | | } |
| | | else { |
| | | pBtn->SetBadgeNumber(0); |
| | | pBtn->ShowDotBadge(TRUE, RGB(255, 0, 0)); |
| | | if (!pBtn->IsFlash()) pBtn->Flash(600); |
| | | } |
| | | pBtn->EnableWindow(TRUE); |
| | | } |
| | | } |
| | | |
| | | void CServoDlg::RaiseTestAlarm() |
| | | { |
| | | theApp.m_model.raiseSoftAlarm(ALID_SOFTWARE_TEST_ALARM, "Test Alarm (Ctrl+Alt+T)"); |
| | | } |
| | | |
| | | void CServoDlg::ClearTestAlarm() |
| | | { |
| | | theApp.m_model.clearSoftAlarm(ALID_SOFTWARE_TEST_ALARM); |
| | | } |
| | | |
| | | void CServoDlg::MarkAlarmsRead() |
| | | { |
| | | auto* pBtn = dynamic_cast<CBlButton*>(m_pTopToolbar ? m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM) : nullptr); |
| | | for (const auto& alarm : m_unreadAlarms) { |
| | | m_ackAlarms.insert(alarm.nId); |
| | | } |
| | | m_unreadAlarms.clear(); |
| | | if (pBtn != nullptr) { |
| | | pBtn->SetBadgeNumber(0); |
| | | pBtn->ShowDotBadge(FALSE, RGB(255, 0, 0)); |
| | | pBtn->StopFlash(); |
| | | } |
| | | } |
| | | |
| | |
| | | (unsigned long long)(GetTickCount64() - boot_pages_begin), |
| | | (unsigned long long)(GetTickCount64() - boot_ui_begin)); |
| | | |
| | | CHmTab* m_pTab = CHmTab::Hook(GetDlgItem(IDC_TAB1)->m_hWnd); |
| | | m_pTab = CHmTab::Hook(GetDlgItem(IDC_TAB1)->m_hWnd); |
| | | m_pTab->SetPaddingLeft(20); |
| | | m_pTab->SetItemMarginLeft(18); |
| | | m_pTab->AddItem("状态图", FALSE); |
| | |
| | | |
| | | // 更新登录状态 |
| | | UpdateLoginStatus(); |
| | | // 初始化报警角标 |
| | | RefreshAlarmBadge(); |
| | | //SystemLogManager::getInstance.log(SystemLogManager::LogType::Info, _T("BondEq启动...")); |
| | | //SystemLogManager::getInstance. |
| | | |
| | |
| | | m_pMyStatusbar->DestroyWindow(); |
| | | delete m_pMyStatusbar; |
| | | m_pMyStatusbar = nullptr; |
| | | } |
| | | |
| | | if (m_pAlarmPopupDlg != nullptr) { |
| | | m_pAlarmPopupDlg->DestroyWindow(); |
| | | delete m_pAlarmPopupDlg; |
| | | m_pAlarmPopupDlg = nullptr; |
| | | } |
| | | |
| | | if (m_pRobotTaskDlg != nullptr) { |
| | |
| | | dlg.SetEFEM(pEFEM); |
| | | dlg.DoModal(); |
| | | } |
| | | else if (id == IDC_BUTTON_ALARM) { |
| | | if (m_pAlarmPopupDlg == nullptr) { |
| | | m_pAlarmPopupDlg = new CAlarmPopupDlg(); |
| | | m_pAlarmPopupDlg->Create(IDD_DIALOG_POPUP_ALARM, this); |
| | | m_pAlarmPopupDlg->CenterWindow(); |
| | | } |
| | | m_pAlarmPopupDlg->RefreshContent(); |
| | | m_pAlarmPopupDlg->ShowWindow(SW_SHOW); |
| | | MarkAlarmsRead(); |
| | | } |
| | | else if (id == IDC_BUTTON_SETTINGS) { |
| | | SERVO::CEquipment* pEq = theApp.m_model.m_master.getEquipment(EQ_ID_EFEM); |
| | | ((SERVO::CEFEM*)pEq)->printDebugRobotState(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | BOOL CServoDlg::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | if (pMsg->message == WM_KEYDOWN) { |
| | | const bool ctrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; |
| | | const bool alt = (GetKeyState(VK_MENU) & 0x8000) != 0; |
| | | if (ctrl && alt && pMsg->wParam == 'T') { |
| | | RaiseTestAlarm(); |
| | | return TRUE; |
| | | } |
| | | if (ctrl && alt && pMsg->wParam == 'Y') { |
| | | ClearTestAlarm(); |
| | | return TRUE; |
| | | } |
| | | } |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |
| | | |
| | | CString& CServoDlg::GetRuntimeFormatText(CString& strText, const char* pszSuffix) |
| | | { |
| | | ULONGLONG ullRunTime = (ULONGLONG)(theApp.m_model.getMaster().getRunTime() * 0.001); |