From bfffbdb8a6d7a3b4805c45583f8bf2101e7b2ad4 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期三, 21 一月 2026 11:34:38 +0800
Subject: [PATCH] 1.警告信息对话框显示;

---
 SourceCode/Bond/Servo/CPanelProduction.cpp |  121 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 116 insertions(+), 5 deletions(-)

diff --git a/SourceCode/Bond/Servo/CPanelProduction.cpp b/SourceCode/Bond/Servo/CPanelProduction.cpp
index 7a56fe0..f3a5ab2 100644
--- a/SourceCode/Bond/Servo/CPanelProduction.cpp
+++ b/SourceCode/Bond/Servo/CPanelProduction.cpp
@@ -1,4 +1,4 @@
-// CPanelProduction.cpp
+锘�// CPanelProduction.cpp
 //
 
 #include "stdafx.h"
@@ -7,8 +7,6 @@
 #include "afxdialogex.h"
 #include "Common.h"
 #include "VerticalLine.h"
-#include <cstring>
-#include <vector>
 
 
 // CPanelProduction dialog
@@ -22,6 +20,11 @@
 	m_hbrBkgnd = nullptr;
 	m_nPanelWidth = 288;
 	m_hPlaceholder = nullptr;
+	m_bShiftSummaryValid = FALSE;
+	m_pStatsThread = nullptr;
+	m_pAccordionWnd = nullptr;
+	m_pPageProdOverview = nullptr;
+	m_pPageCtrlState = nullptr;
 }
 
 CPanelProduction::~CPanelProduction()
@@ -40,6 +43,7 @@
 	ON_WM_SIZE()
 	ON_NOTIFY(BYVERTICALLINE_MOVEX, IDC_LINE1, &CPanelProduction::OnVLineMoveX)
 	ON_BN_CLICKED(IDC_BUTTON_CLOSE, &CPanelProduction::OnBnClickedButtonClose)
+	ON_WM_TIMER()
 END_MESSAGE_MAP()
 
 int CPanelProduction::getPanelWidth()
@@ -60,6 +64,34 @@
 	pLine1->SetBkgndColor(RGB(225, 225, 225));
 	pLine1->SetLineColor(RGB(198, 198, 198));
 	pLine1->EnableResize();
+
+	CString strExpandIcon, strCloseIcon;
+	strExpandIcon.Format(_T("%s\\res\\arrow_down.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+	strCloseIcon.Format(_T("%s\\res\\arrow_right.ico"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+
+	m_pAccordionWnd = CAccordionWnd::FromHandle(GetDlgItem(IDC_ACCORDION_WND1)->m_hWnd);
+	m_pAccordionWnd->SetBkgndColor(m_crBkgnd);
+	m_pAccordionWnd->SetFrameColor(RGB(220, 220, 200), TRUE);
+	m_pAccordionWnd->Setpadding(PADDING_LEFT, 2);
+	m_pAccordionWnd->Setpadding(PADDING_TOP, 2);
+	m_pAccordionWnd->Setpadding(PADDING_RIGHT, 2);
+	m_pAccordionWnd->Setpadding(PADDING_BOTTOM, 2);
+	m_pAccordionWnd->LoadExpandIcon(strExpandIcon, strCloseIcon);
+
+	m_pPageCtrlState = new CPageCtrlState();
+	m_pPageCtrlState->SetBackgroundColor(m_crBkgnd);
+	m_pPageCtrlState->Create(IDD_PROD_CTRL_STATE, GetDlgItem(IDC_ACCORDION_WND1));
+	m_pPageCtrlState->ShowWindow(SW_HIDE);
+	m_pAccordionWnd->AddItem("鐘舵��", m_pPageCtrlState, 120, TRUE, TRUE);
+
+	m_pPageProdOverview = new CPageProdOverview();
+	m_pPageProdOverview->SetBackgroundColor(m_crBkgnd);
+	m_pPageProdOverview->Create(IDD_PROD_OVERVIEW, GetDlgItem(IDC_ACCORDION_WND1));
+	m_pPageProdOverview->ShowWindow(SW_HIDE);
+	m_pAccordionWnd->AddItem("鐢熶骇鎬昏", m_pPageProdOverview, 280, TRUE, TRUE);
+
+	SetTimer(1, 1000 * 10, nullptr);
+	StartStatsThread();
 
 	return TRUE;  // return TRUE unless you set the focus to a control
 				  // Exception: OCX property pages should return FALSE
@@ -83,7 +115,20 @@
 
 void CPanelProduction::OnDestroy()
 {
+	StopStatsThread();
+
 	CDialogEx::OnDestroy();
+
+	if (m_pPageCtrlState != nullptr) {
+		m_pPageCtrlState->DestroyWindow();
+		delete m_pPageCtrlState;
+		m_pPageCtrlState = nullptr;
+	}
+	if (m_pPageProdOverview != nullptr) {
+		m_pPageProdOverview->DestroyWindow();
+		delete m_pPageProdOverview;
+		m_pPageProdOverview = nullptr;
+	}
 
 	if (m_hbrBkgnd != nullptr) {
 		::DeleteObject(m_hbrBkgnd);
@@ -101,6 +146,9 @@
 	GetClientRect(&rcClient);
 	pItem = GetDlgItem(IDC_LINE1);
 	pItem->MoveWindow(rcClient.right - 3, 0, 3, rcClient.Height());
+
+	pItem = GetDlgItem(IDC_ACCORDION_WND1);
+	pItem->MoveWindow(5, 5, rcClient.Width() - 10, rcClient.Height() - 10);
 }
 
 #define PRODUCTION_PANEL_MIN_WIDTH		88
@@ -120,6 +168,69 @@
 
 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);
+	}
+}
+
+BOOL CPanelProduction::TryGetDayNightSummaries(ProductionShiftSummary& outDay, ProductionShiftSummary& outNight)
+{
+	CSingleLock lock(&m_csShiftSummary, TRUE);
+	if (!m_bShiftSummaryValid) return FALSE;
+	outDay = m_daySummary;
+	outNight = m_nightSummary;
+	return TRUE;
+}
+
+void CPanelProduction::StartStatsThread()
+{
+	if (m_pStatsThread != nullptr) return;
+
+	m_evStopStats.ResetEvent();
+
+	m_pStatsThread = AfxBeginThread(&CPanelProduction::StatsThreadProc, this, THREAD_PRIORITY_BELOW_NORMAL, 0, 0);
+	if (m_pStatsThread != nullptr) {
+		m_pStatsThread->m_bAutoDelete = FALSE;
+	}
+}
+
+void CPanelProduction::StopStatsThread()
+{
+	if (m_pStatsThread == nullptr) return;
+
+	m_evStopStats.SetEvent();
+	const DWORD rc = WaitForSingleObject(m_pStatsThread->m_hThread, 5000);
+	if (rc == WAIT_OBJECT_0) {
+		delete m_pStatsThread;
+	}
+	m_pStatsThread = nullptr;
+}
+
+UINT CPanelProduction::StatsThreadProc(LPVOID pParam)
+{
+	CPanelProduction* self = reinterpret_cast<CPanelProduction*>(pParam);
+	if (self == nullptr) return 0;
+
+	const DWORD intervalMs = 5000;
+	for (;;) {
+		if (self->m_evStopStats.Lock(intervalMs)) break;
+
+		ProductionShiftSummary daySummary;
+		ProductionShiftSummary nightSummary;
+		if (ProductionStats::ComputeDayNightSummaries(theApp.m_model.m_configuration, daySummary, nightSummary)) {
+			CSingleLock lock(&self->m_csShiftSummary, TRUE);
+			self->m_daySummary = std::move(daySummary);
+			self->m_nightSummary = std::move(nightSummary);
+			self->m_bShiftSummaryValid = TRUE;
+		}
+	}
+
+	return 0;
+}
+
+void CPanelProduction::OnTimer(UINT_PTR nIDEvent)
+{
+	// TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
+	CDialogEx::OnTimer(nIDEvent);
 }

--
Gitblit v1.9.3