From 829fe6c6bc33d53fda9c31fd45a37e1df87befff Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 30 一月 2026 11:16:24 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CPageProdOverview.cpp |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CPageProdOverview.cpp b/SourceCode/Bond/Servo/CPageProdOverview.cpp
new file mode 100644
index 0000000..11813f4
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPageProdOverview.cpp
@@ -0,0 +1,165 @@
+锘�// CPageProOverview.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CPageProdOverview.h"
+#include "afxdialogex.h"
+#include "CPanelProduction.h"
+
+namespace
+{
+	constexpr UINT_PTR kTimerRefreshId = 2001;
+	constexpr UINT kTimerRefreshIntervalMs = 10000;
+}
+
+IMPLEMENT_DYNAMIC(CPageProdOverview, CDialogEx)
+
+CPageProdOverview::CPageProdOverview(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_PROD_OVERVIEW, pParent)
+	, m_clrBackground(RGB(240, 240, 240))
+{
+}
+
+CPageProdOverview::~CPageProdOverview()
+{
+}
+
+void CPageProdOverview::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+void CPageProdOverview::SetBackgroundColor(COLORREF color)
+{
+	m_clrBackground = color;
+	m_brushBackground.DeleteObject();
+	m_brushBackground.CreateSolidBrush(m_clrBackground);
+	if (::IsWindow(m_hWnd)) {
+		Invalidate();
+	}
+}
+
+BEGIN_MESSAGE_MAP(CPageProdOverview, CDialogEx)
+	ON_WM_CTLCOLOR()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+BOOL CPageProdOverview::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+
+	// 浣跨敤鑷畾涔夋爣绛�
+	if (CWnd* pDay = GetDlgItem(IDC_PROD_DAY_OUTPUT)) {
+		m_labelDayOut.SubclassWindow(pDay->GetSafeHwnd());
+		m_labelDayOut.setFontSize(28);
+		m_labelDayOut.setNoteTextColor(RGB(128, 128, 128));
+		m_labelDayOut.setNote1(_T("鐧界彮浜у嚭"));
+		m_labelDayOut.setBackground(m_clrBackground);
+		m_labelDayOut.setForeground(RGB(18, 18, 18), TRUE);
+	}
+	if (CWnd* pNight = GetDlgItem(IDC_PROD_NIGHT_OUTPUT)) {
+		m_labelNightOut.SubclassWindow(pNight->GetSafeHwnd());
+		m_labelNightOut.setFontSize(28);
+		m_labelNightOut.setNoteTextColor(RGB(128, 128, 128));
+		m_labelNightOut.setNote1(_T("澶滅彮浜у嚭"));
+		m_labelNightOut.setBackground(m_clrBackground);
+		m_labelNightOut.setForeground(RGB(18, 18, 18), TRUE);
+	}
+	if (CWnd* pDayTakt = GetDlgItem(IDC_PROD_DAY_TAKT)) {
+		m_labelDayTakt.SubclassWindow(pDayTakt->GetSafeHwnd());
+		m_labelDayTakt.setFontSize(28);
+		m_labelDayTakt.setNoteTextColor(RGB(128, 128, 128));
+		m_labelDayTakt.setNote1(_T("鐧界彮骞冲潎TT"));
+		m_labelDayTakt.setBackground(m_clrBackground);
+		m_labelDayTakt.setForeground(RGB(18, 18, 18), TRUE);
+	}
+	if (CWnd* pNightTakt = GetDlgItem(IDC_PROD_NIGHT_TAKT)) {
+		m_labelNightTakt.SubclassWindow(pNightTakt->GetSafeHwnd());
+		m_labelNightTakt.setFontSize(28);
+		m_labelNightTakt.setNoteTextColor(RGB(128, 128, 128));
+		m_labelNightTakt.setNote1(_T("澶滅彮骞冲潎TT"));
+		m_labelNightTakt.setBackground(m_clrBackground);
+		m_labelNightTakt.setForeground(RGB(18, 18, 18), TRUE);
+	}
+
+	RefreshData();
+	m_timerId = SetTimer(kTimerRefreshId, kTimerRefreshIntervalMs, nullptr);
+	return TRUE;
+}
+
+HBRUSH CPageProdOverview::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	if (nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_STATIC) {
+		if (m_brushBackground.GetSafeHandle() == NULL) {
+			m_brushBackground.CreateSolidBrush(m_clrBackground);
+		}
+		pDC->SetBkMode(TRANSPARENT);
+		return (HBRUSH)m_brushBackground.GetSafeHandle();
+	}
+
+	return hbr;
+}
+
+void CPageProdOverview::OnDestroy()
+{
+	if (m_timerId != 0) {
+		KillTimer(m_timerId);
+		m_timerId = 0;
+	}
+	CDialogEx::OnDestroy();
+}
+
+void CPageProdOverview::OnSize(UINT nType, int cx, int cy)
+{
+	CDialogEx::OnSize(nType, cx, cy);
+}
+
+void CPageProdOverview::OnTimer(UINT_PTR nIDEvent)
+{
+	if (nIDEvent == kTimerRefreshId) {
+		RefreshData();
+	}
+	CDialogEx::OnTimer(nIDEvent);
+}
+
+void CPageProdOverview::RefreshData()
+{
+	auto* pPanel = dynamic_cast<CPanelProduction*>(GetParent());
+	if (pPanel == nullptr) {
+		pPanel = dynamic_cast<CPanelProduction*>(GetParent() ? GetParent()->GetParent() : nullptr);
+	}
+	if (pPanel == nullptr) {
+		m_labelDayOut.setText(_T("--"));
+		m_labelNightOut.setText(_T("--"));
+		m_labelDayTakt.setText(_T("--"));
+		m_labelNightTakt.setText(_T("--"));
+		return;
+	}
+
+	ProductionShiftSummary day;
+	ProductionShiftSummary night;
+	if (!pPanel->TryGetDayNightSummaries(day, night)) {
+		m_labelDayOut.setText(_T("--"));
+		m_labelNightOut.setText(_T("--"));
+		m_labelDayTakt.setText(_T("--"));
+		m_labelNightTakt.setText(_T("--"));
+		return;
+	}
+
+	CString text;
+	text.Format(_T("%lld"), day.output.pairsTotal);
+	m_labelDayOut.setText(text);
+	text.Format(_T("%lld"), night.output.pairsTotal);
+	m_labelNightOut.setText(text);
+
+	text.Format(_T("%.1fs"), day.output.avgTaktSeconds);
+	m_labelDayTakt.setText(text);
+	text.Format(_T("%.1fs"), night.output.avgTaktSeconds);
+	m_labelNightTakt.setText(text);
+}

--
Gitblit v1.9.3