From 6dc80508b1c0f431007f8a8c947c152ec00c3d15 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期一, 08 九月 2025 09:24:05 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/ServoDlg.cpp |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index c1a4238..646641d 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -27,6 +27,7 @@
 #include "CPageReport.h"
 #include "CPageCollectionEvent.h"
 #include "CControlJobDlg.h"
+#include "InputDialog.h"
 
 
 #ifdef _DEBUG
@@ -93,6 +94,7 @@
 	m_pPanelAttributes = nullptr;
 	m_pPageGraph1 = nullptr;
 	m_pPageGraph2 = nullptr;
+	m_pPageGlassList = nullptr;
 	m_pPageAlarm = nullptr;
 	m_pPageLog = nullptr;
 	m_pPageTransferLog = nullptr;
@@ -364,6 +366,8 @@
 	m_pPageGraph1->Create(IDD_PAGE_GRAPH1, this);
 	m_pPageGraph2 = new CPageGraph2();
 	m_pPageGraph2->Create(IDD_PAGE_GRAPH2, this);
+	m_pPageGlassList = new CPageGlassList();
+	m_pPageGlassList->Create(IDD_PAGE_GLASS_LIST, this);
 	m_pPageRecipe = new CPageRecipe();
 	m_pPageRecipe->Create(IDD_PAGE_RECIPE, this);
 	m_pPageAlarm = new CPageAlarm();
@@ -378,10 +382,11 @@
 	m_pTab->SetItemMarginLeft(18);
 	m_pTab->AddItem("状态图", FALSE);
 	m_pTab->AddItem("连接图", TRUE);
+	m_pTab->AddItem("Glass", TRUE);
 	m_pTab->AddItem("配方", TRUE);
 	m_pTab->AddItem("报警", TRUE);
 	m_pTab->AddItem("日志", TRUE);
-	m_pTab->AddItem("搬运", TRUE);
+	m_pTab->AddItem("搬运任务", TRUE);
 	m_pTab->SetCurSel(0);
 	m_pTab->SetBkgndColor(RGB(222, 222, 222));
 	ShowChildPage(0);
@@ -732,6 +737,12 @@
 		m_pPageGraph2 = nullptr;
 	}
 
+	if (m_pPageGlassList != nullptr) {
+		m_pPageGlassList->DestroyWindow();
+		delete m_pPageGlassList;
+		m_pPageGlassList = nullptr;
+	}
+
 	if (m_pPageRecipe != nullptr) {
 		m_pPageRecipe->DestroyWindow();
 		delete m_pPageRecipe;
@@ -773,6 +784,7 @@
 	if (GetDlgItem(IDC_TAB1) == nullptr) return;
 	if (m_pPageGraph1 == nullptr) return;
 	if (m_pPageGraph2 == nullptr) return;
+	if (m_pPageGlassList == nullptr) return;
 	if (m_pPageRecipe == nullptr) return;
 	if (m_pPageAlarm == nullptr) return;
 	if (m_pPageLog == nullptr) return;
@@ -828,6 +840,7 @@
 
 	m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
 	m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
+	m_pPageGlassList->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
 	m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
 	m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
 	m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, y2 - y);
@@ -913,9 +926,11 @@
 
 void CServoDlg::ShowChildPage(int index)
 {
-	ASSERT(0 <= index && index < 6);
-	static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageRecipe, m_pPageAlarm, m_pPageLog, m_pPageTransferLog };
-	for (int i = 0; i < 6; i++) {
+	static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageGlassList, 
+		m_pPageRecipe, m_pPageAlarm, m_pPageLog, m_pPageTransferLog };
+	ASSERT(0 <= index && index < sizeof(pPages) / sizeof(CWnd*));
+
+	for (int i = 0; i < sizeof(pPages) / sizeof(CWnd*); i++) {
 		pPages[i]->ShowWindow(i == index ? SW_SHOW : SW_HIDE);
 	}
 }
@@ -956,6 +971,28 @@
 LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam)
 {
 	int id = (int)lParam;
+	if (id == IDC_BUTTON_RUN || id == IDC_BUTTON_STOP) {
+		//CInputDialog inputDialog(_T("验证用户"), _T("请输入用户密码:"));
+		//if (inputDialog.DoModal() != IDOK) {
+		//	AfxMessageBox(_T("取消验证!"));
+		//	return 0;
+		//}
+	
+		//CString inputText = inputDialog.GetInputText();
+		//std::string strPass = UserManager::getInstance().getCurrentPass();
+		//if (inputText.Compare(strPass.c_str()) != 0) {
+		//	AfxMessageBox(_T("密码错误!"));
+		//	SystemLogManager::getInstance().log(SystemLogManager::LogType::Info, _T("验证时,密码错误!"));
+		//	return 0;
+		//}
+		
+		UserRole emRole = UserManager::getInstance().getCurrentUserRole();
+		if (emRole != UserRole::SuperAdmin) {
+			AfxMessageBox(_T("当前用户并非管理员!!!")); 
+			return 1;
+		}
+	}
+
 	if (id == IDC_BUTTON_RUN) {
 		if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) {
 			AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!");

--
Gitblit v1.9.3