From db9d120efcfe76bb73df089dca8986eca9ee0e6f Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期三, 10 十二月 2025 10:11:37 +0800
Subject: [PATCH] 1.扫码上报,但未在配置中设置变量;

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

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index dd3206c..c886f66 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -33,6 +33,7 @@
 #include "CControlJobManagerDlg.h"
 #include "CUserManager2.h"
 #include "CUserManager2Dlg.h"
+#include "CUserXLogDlg.h"
 
 
 #ifdef _DEBUG
@@ -371,7 +372,7 @@
 
 	// model init
 	theApp.m_model.init();
-	SetTimer(TIMER_ID_LOGIN, 1000, nullptr);
+	SetTimer(TIMER_ID_LOGIN, 1500, nullptr);
 
 	// 鑿滃崟
 	CMenu menu;
@@ -1017,15 +1018,14 @@
 LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam)
 {
 	int id = (int)lParam;
-	if (id == IDC_BUTTON_RUN || id == IDC_BUTTON_STOP) {
-		UserRole emRole = UserManager::getInstance().getCurrentUserRole();
-		if (emRole != UserRole::SuperAdmin) {
-			AfxMessageBox(_T("褰撳墠鐢ㄦ埛骞堕潪绠$悊鍛橈紒锛侊紒")); 
-			return 1;
-		}
-	}
-
 	if (id == IDC_BUTTON_RUN) {
+		int rc = UX_CanExecute(L"start");
+		if (rc != 1) {
+			AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+			return 0;
+		}
+		UX_RecordAction(L"start");
+
 		if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) {
 			AfxMessageBox("褰撳墠鏈夋満鍙板彂鐢熼敊璇紝涓嶈兘鍚姩锛岃纭瑙e喅闂鍚庡啀灏濊瘯閲嶆柊鍚姩锛�");
 		}
@@ -1062,6 +1062,13 @@
 		}
 	}
 	else if (id == IDC_BUTTON_STOP) {
+		int rc = UX_CanExecute(L"stop");
+		if (rc != 1) {
+			AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+			return 0;
+		}
+		UX_RecordAction(L"stop");
+
 		if (theApp.m_model.getMaster().stop() == 0) {
 			m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
 		}
@@ -1101,7 +1108,21 @@
 			CUserManager2Dlg dlg;
 			dlg.DoModal();
 		}
-
+		else if (menuId == 1) {
+			CUserXLogDlg dlg;
+			dlg.DoModal();
+		}
+		else if (menuId == 2) {
+			CLoginDlg2 dlg;
+			if (dlg.DoModal() == IDOK) {
+				bool bRet = CUserManager2::getInstance().login((LPTSTR)(LPCTSTR)dlg.m_strUsername,
+					(LPTSTR)(LPCTSTR)dlg.m_strPassword);
+				if (!bRet) {
+					AfxMessageBox("鐧诲綍澶辫触锛岃妫�鏌ョ敤鎴峰悕鎴栧瘑鐮佹槸鍚︽纭紒");
+				}
+				UpdateLoginStatus();
+			}
+		}
 
 		/*
 		SystemLogManager& logManager = SystemLogManager::getInstance();

--
Gitblit v1.9.3