From 2aff4ac73e77d803ba3656057187956258713dbd Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期三, 17 十二月 2025 17:32:32 +0800
Subject: [PATCH] 1.生产面板,菜单项等;

---
 SourceCode/Bond/Servo/Servo.rc             |    1 
 SourceCode/Bond/Servo/CPanelProduction.cpp |    8 ++--
 SourceCode/Bond/Servo/ServoDlg.cpp         |   55 +++++++++++++++++++++++++++
 SourceCode/Bond/Servo/ServoDlg.h           |    6 +++
 4 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/SourceCode/Bond/Servo/CPanelProduction.cpp b/SourceCode/Bond/Servo/CPanelProduction.cpp
index 7a56fe0..0f01b3f 100644
--- a/SourceCode/Bond/Servo/CPanelProduction.cpp
+++ b/SourceCode/Bond/Servo/CPanelProduction.cpp
@@ -7,8 +7,6 @@
 #include "afxdialogex.h"
 #include "Common.h"
 #include "VerticalLine.h"
-#include <cstring>
-#include <vector>
 
 
 // CPanelProduction dialog
@@ -120,6 +118,8 @@
 
 void CPanelProduction::OnBnClickedButtonClose()
 {
-	ShowWindow(SW_HIDE);
-	GetParent()->SendMessage(ID_MSG_PANEL_RESIZE, m_nPanelWidth, 0);
+	CWnd* pParent = GetParent();
+	if (pParent != nullptr) {
+		pParent->PostMessage(WM_COMMAND, ID_MENU_WND_TEST_PANEL, 0);
+	}
 }
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index 8184b63..3f3b197 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
@@ -1566,6 +1566,7 @@
     BEGIN
         MENUITEM "日志窗口(&L)",                    ID_MENU_WND_LOG
         MENUITEM "警告窗口(A)",                     32781
+        MENUITEM SEPARATOR
         MENUITEM "测试面板(T)",                     ID_MENU_WND_TEST_PANEL
         MENUITEM "生产面板(P)",                     ID_MENU_WND_PRO_PANEL
     END
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 34c48f1..248c5af 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -93,6 +93,7 @@
 	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
 	m_crBkgnd = APPDLG_BACKGROUND_COLOR;
 	m_hbrBkgnd = nullptr;
+	m_nLeftPanelType = 2;
 	m_pTerminalDisplayDlg = nullptr;
 	m_pObserver = nullptr;
 	m_pPanelMaster = nullptr;
@@ -142,6 +143,10 @@
 	ON_UPDATE_COMMAND_UI(ID_MENU_TEST_MESSAGE_CLEAR, &CServoDlg::OnUpdateMenuTestMessageClear)
 	ON_COMMAND(ID_MENU_TOOLS_CLIENT_LIST, &CServoDlg::OnMenuToolsClientList)
 	ON_UPDATE_COMMAND_UI(ID_MENU_TOOLS_CLIENT_LIST, &CServoDlg::OnUpdateMenuToolsClientList)
+	ON_COMMAND(ID_MENU_WND_TEST_PANEL, &CServoDlg::OnMenuWndTestPanel)
+	ON_UPDATE_COMMAND_UI(ID_MENU_WND_TEST_PANEL, &CServoDlg::OnUpdateMenuWndTestPanel)
+	ON_COMMAND(ID_MENU_WND_PRO_PANEL, &CServoDlg::OnMenuWndProPanel)
+	ON_UPDATE_COMMAND_UI(ID_MENU_WND_PRO_PANEL, &CServoDlg::OnUpdateMenuWndProPanel)
 	ON_COMMAND(ID_MENU_HELP_ABOUT, &CServoDlg::OnMenuHelpAbout)
 	ON_WM_INITMENUPOPUP()
 	ON_WM_TIMER()
@@ -435,7 +440,7 @@
 	m_pPanelProduction = new CPanelProduction();
 	m_pPanelProduction->setPanelWidth(nPanelWidth);
 	m_pPanelProduction->Create(IDD_PANEL_PRODUCTION, this);
-	m_pPanelProduction->ShowWindow(SW_SHOW);
+	SetLeftPanelType(m_nLeftPanelType, false);
 	m_pPanelEquipment = new CPanelEquipment();
 	m_pPanelEquipment->Create(IDD_PANEL_EQUIPMENT, this);
 	m_pPanelAttributes = new CPanelAttributes();
@@ -695,6 +700,28 @@
 	pCmdUI->Enable(TRUE);
 }
 
+void CServoDlg::OnMenuWndTestPanel()
+{
+	SetLeftPanelType(1);
+}
+
+void CServoDlg::OnUpdateMenuWndTestPanel(CCmdUI* pCmdUI)
+{
+	pCmdUI->Enable(TRUE);
+	pCmdUI->SetRadio(m_nLeftPanelType == 1);
+}
+
+void CServoDlg::OnMenuWndProPanel()
+{
+	SetLeftPanelType(2);
+}
+
+void CServoDlg::OnUpdateMenuWndProPanel(CCmdUI* pCmdUI)
+{
+	pCmdUI->Enable(TRUE);
+	pCmdUI->SetRadio(m_nLeftPanelType == 2);
+}
+
 void CServoDlg::OnMenuHelpAbout()
 {
 	theApp.m_model.getMaster().test();
@@ -916,6 +943,32 @@
 	m_pMyStatusbar->MoveWindow(0, y2, rcClient.Width(), STATUSBAR_HEIGHT);
 }
 
+void CServoDlg::SetLeftPanelType(int type, bool resize)
+{
+	if (type != 1 && type != 2) {
+		type = 1;
+	}
+
+	m_nLeftPanelType = type;
+	if (m_pPanelMaster != nullptr) {
+		m_pPanelMaster->ShowWindow(SW_HIDE);
+	}
+	if (m_pPanelProduction != nullptr) {
+		m_pPanelProduction->ShowWindow(SW_HIDE);
+	}
+	if (type == 1 && m_pPanelMaster != nullptr) {
+		m_pPanelMaster->ShowWindow(SW_SHOW);
+	}
+	else if (type == 2 && m_pPanelProduction != nullptr) {
+		m_pPanelProduction->ShowWindow(SW_SHOW);
+	}
+
+	if (resize && ::IsWindow(m_hWnd)) {
+		Resize();
+		DrawMenuBar();
+	}
+}
+
 void CServoDlg::OnClose()
 {
 	// TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
diff --git a/SourceCode/Bond/Servo/ServoDlg.h b/SourceCode/Bond/Servo/ServoDlg.h
index 1e3647f..81c5a5f 100644
--- a/SourceCode/Bond/Servo/ServoDlg.h
+++ b/SourceCode/Bond/Servo/ServoDlg.h
@@ -35,6 +35,7 @@
 private:
 	void InitRxWindows();
 	void Resize();
+	void SetLeftPanelType(int type, bool resize = true);
 	void ShowChildPage(int index);
 	void UpdateLoginStatus();
 	CString& GetRuntimeFormatText(CString& strText, const char* pszSuffix);
@@ -65,6 +66,7 @@
 	HICON m_hIcon;
 	COLORREF m_crBkgnd;
 	HBRUSH m_hbrBkgnd;
+	int m_nLeftPanelType; // 1: CPanelMaster, 2: CPanelProduction
 	CTopToolbar* m_pTopToolbar;
 	CPanelMaster* m_pPanelMaster;
 	CPanelProduction* m_pPanelProduction;
@@ -102,6 +104,10 @@
 	afx_msg void OnUpdateMenuTestMessageClear(CCmdUI* pCmdUI);
 	afx_msg void OnMenuToolsClientList();
 	afx_msg void OnUpdateMenuToolsClientList(CCmdUI* pCmdUI);
+	afx_msg void OnMenuWndTestPanel();
+	afx_msg void OnUpdateMenuWndTestPanel(CCmdUI* pCmdUI);
+	afx_msg void OnMenuWndProPanel();
+	afx_msg void OnUpdateMenuWndProPanel(CCmdUI* pCmdUI);
 	afx_msg void OnMenuHelpAbout();
 	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg LRESULT OnPanelResize(WPARAM wParam, LPARAM lParam);

--
Gitblit v1.9.3