From af08046fe1cddba171826f619d823dee02a79ca0 Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期三, 27 十一月 2024 16:38:37 +0800
Subject: [PATCH] 1. 添加IO模块,包括界面和管理类
---
SourceCode/Bond/BondEq/Resource.h | 0
SourceCode/Bond/BondEq/BondEq.rc | 0
SourceCode/Bond/BondEq/View/UserManagerDlg.cpp | 19 -
SourceCode/Bond/BondEq/FileManager/IOManager.h | 31 ++
SourceCode/Bond/BondEq/View/IOMonitoringDlg.cpp | 356 +++++++++++++++++++++++
SourceCode/Bond/BondEq/View/IOMonitoringDlg.h | 59 +++
SourceCode/Bond/BondEq/FileManager/IOManager.cpp | 401 ++++++++++++++++++++++++++
SourceCode/Bond/BondEq/BondEqDlg.cpp | 17
SourceCode/Bond/BondEq/BondEq.vcxproj | 4
9 files changed, 866 insertions(+), 21 deletions(-)
diff --git a/SourceCode/Bond/BondEq/BondEq.rc b/SourceCode/Bond/BondEq/BondEq.rc
index 3f6cde0..addf288 100644
--- a/SourceCode/Bond/BondEq/BondEq.rc
+++ b/SourceCode/Bond/BondEq/BondEq.rc
Binary files differ
diff --git a/SourceCode/Bond/BondEq/BondEq.vcxproj b/SourceCode/Bond/BondEq/BondEq.vcxproj
index 3b13edb..4594fa2 100644
--- a/SourceCode/Bond/BondEq/BondEq.vcxproj
+++ b/SourceCode/Bond/BondEq/BondEq.vcxproj
@@ -222,6 +222,7 @@
<ClInclude Include="DBManager\UserManager.h" />
<ClInclude Include="EQState.h" />
<ClInclude Include="EQStateMonitor.h" />
+ <ClInclude Include="FileManager\IOManager.h" />
<ClInclude Include="FileManager\pugiconfig.hpp" />
<ClInclude Include="FileManager\pugixml.hpp" />
<ClInclude Include="FileManager\RecipeManager.h" />
@@ -254,6 +255,7 @@
<ClInclude Include="VerticalLine.h" />
<ClInclude Include="View\AxisSettingsDlg.h" />
<ClInclude Include="View\ChangePasswordDlg.h" />
+ <ClInclude Include="View\IOMonitoringDlg.h" />
<ClInclude Include="View\LoginDlg.h" />
<ClInclude Include="View\SystemLogManagerDlg.h" />
<ClInclude Include="View\UserManagerDlg.h" />
@@ -289,6 +291,7 @@
<ClCompile Include="DBManager\UserManager.cpp" />
<ClCompile Include="EQState.cpp" />
<ClCompile Include="EQStateMonitor.cpp" />
+ <ClCompile Include="FileManager\IOManager.cpp" />
<ClCompile Include="FileManager\pugixml.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
@@ -326,6 +329,7 @@
<ClCompile Include="VerticalLine.cpp" />
<ClCompile Include="View\AxisSettingsDlg.cpp" />
<ClCompile Include="View\ChangePasswordDlg.cpp" />
+ <ClCompile Include="View\IOMonitoringDlg.cpp" />
<ClCompile Include="View\LoginDlg.cpp" />
<ClCompile Include="View\SystemLogManagerDlg.cpp" />
<ClCompile Include="View\UserManagerDlg.cpp" />
diff --git a/SourceCode/Bond/BondEq/BondEqDlg.cpp b/SourceCode/Bond/BondEq/BondEqDlg.cpp
index 3ae9e32..23ac8d5 100644
--- a/SourceCode/Bond/BondEq/BondEqDlg.cpp
+++ b/SourceCode/Bond/BondEq/BondEqDlg.cpp
@@ -15,8 +15,10 @@
#include "ChangePasswordDlg.h"
#include "UserManagerDlg.h"
#include "SystemLogManagerDlg.h"
-#include "AxisSettingsDlg.h"
+// test
+#include "AxisSettingsDlg.h"
+#include "IOMonitoringDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -480,10 +482,15 @@
void CBondEqDlg::OnMenuFileSettings()
{
- CAxisSettingsDlg axisDlg;
- axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
- axisDlg.SetRecipeName(_T("Default"));
- axisDlg.DoModal();
+ // Cavity VacuumBake AfterBake AOI
+ CIOMonitoringDlg dlg;
+ dlg.SetIOManager("Cavity");
+ dlg.DoModal();
+
+ //CAxisSettingsDlg axisDlg;
+ //axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
+ //axisDlg.SetRecipeName(_T("Default"));
+ //axisDlg.DoModal();
/*
CSettingsDlg dlg;
diff --git a/SourceCode/Bond/BondEq/FileManager/IOManager.cpp b/SourceCode/Bond/BondEq/FileManager/IOManager.cpp
new file mode 100644
index 0000000..b02088d
--- /dev/null
+++ b/SourceCode/Bond/BondEq/FileManager/IOManager.cpp
@@ -0,0 +1,401 @@
+#include "stdafx.h"
+#include "IOManager.h"
+#include <fstream>
+#include <iostream>
+#include "ToolUnits.h"
+
+IOManager::IOManager() {
+ m_directory = CToolUnits::getCurrentExePath() + _T("\\Config");
+ if (!CToolUnits::isDirectory(m_directory)) {
+ CToolUnits::createDir(m_directory.c_str());
+ }
+}
+
+void IOManager::addMachine(const std::string& machineName, const std::vector<IOData>& data) {
+ m_machines[machineName] = data;
+}
+
+void IOManager::addDefaultMachineData(const std::string& machineName) {
+ if (machineName == "Cavity") {
+ std::vector<IOData> defaultData = {
+ {"X1000", "Unit1_急停 EMO", "Y1010", "Unit1_四色灯-红"},
+ {"X1001", "Unit1_总进气压力检", "Y1011", "Unit1_四色灯-黄"},
+ {"X1002", "Unit1_伺服电柜烟感报警", "Y1012", "Unit1_四色灯-绿"},
+ {"X1003", "Unit1_加热电柜烟感报警", "Y1013", "Unit1_四色灯-蓝"},
+ {"X1004", "安全继电器检", "Y1014", "Unit1_蜂鸣器-1"},
+ {"X1005", "", "Y1015", "Unit1_蜂鸣器-2"},
+ {"X1006", "", "Y1016", "Unit1_蜂鸣器-3"},
+ {"X1007", "Unit1_安全门磁检1", "Y1017", "Unit1_蜂鸣器-4"},
+ {"X1008", "Unit1_安全门磁检2", "Y1018", "Unit1_机台照明"},
+ {"X1009", "Unit1_安全门磁检3", "Y1019", "Unit1_安全门锁屏蔽"},
+ {"X100A", "Unit1_安全门磁检4", "Y101A", ""},
+ {"X100B", "Unit1_安全门磁检5", "Y101B", ""},
+ {"X100C", "Unit1_安全门磁检6", "Y101C", ""},
+ {"X100D", "Unit1_安全门锁检1", "Y101D", "Unit1_安全门锁1"},
+ {"X100E", "Unit1_安全门锁检2", "Y101E", "Unit1_安全门锁2"},
+ {"X100F", "Unit1_安全门锁检3", "Y101F", "Unit1_安全门锁3"},
+ {"X1020", "Unit1_分子泵-Alam(8-14)", "Y1030", "Unit1_分子泵启动(1-9)"},
+ {"X1021", "Unit1_分子泵-远程/本地模式(7-15)", "Y1031", "Unit1_分子泵联锁装置(2-10)"},
+ {"X1022", "Unit1_分子泵-正常运行(4-12)", "Y1032", "Unit1_分子泵通断插板阀"},
+ {"X1023", "Unit1_分子泵通断插板阀原位", "Y1033", "Unit1_气囊通断阀"},
+ {"X1024", "Unit1_分子泵通断插板阀到位", "Y1034", ""},
+ {"X1025", "Unit1_腔体托片左气缸原位", "Y1035", "Unit1_腔体托片左气缸原位"},
+ {"X1026", "Unit1_腔体托片左气缸到位", "Y1036", "Unit1_腔体托片左气缸到位"},
+ {"X1027", "Unit1_腔体托片右气缸原位", "Y1037", "Unit1_腔体托片右气缸原位"},
+ {"X1028", "Unit1_腔体托片右气缸到位", "Y1038", "Unit1_腔体托片右气缸到位"},
+ {"X1029", "Unit1_门阀升降气缸原位", "Y1039", "Unit1_门阀升降气缸"},
+ {"X102A", "Unit1_门阀升降气缸到位", "Y103A", ""},
+ {"X102B", "Unit1_腔体破真空气阀原位", "Y103B", "Unit1_腔体破真空气阀"},
+ {"X102C", "Unit1_腔体破真空气阀到位", "Y103C", "Unit1_分子泵排气阀"},
+ {"X102D", "Unit1_下腔平台真空检", "Y103D", "Unit1_下腔平台吸真空"},
+ {"X102E", "Unit1_分子泵排气阀原位", "Y103E", "Unit1_下腔平台破真空"},
+ {"X102F", "Unit1_分子泵排气阀到位", "Y103F", ""},
+ {"X1040", "Unit1_上加热已上电", "Y1050", "Unit1_上加热上电"},
+ {"X1041", "Unit1_上主温控表报警", "Y1051", "Unit1_下加热上电"},
+ {"X1042", "Unit1_上监控温控表报警1", "Y1052", ""},
+ {"X1043", "Unit1_上监控温控表报警2", "Y1053", ""},
+ {"X1044", "Unit1_上监控温控表报警3", "Y1054", ""},
+ {"X1045", "Unit1_上监控温控表报警4", "Y1055", ""},
+ {"X1046", "Unit1_上监控温控表报警5", "Y1056", ""},
+ {"X1047", "Unit1_下加热已上电", "Y1057", ""},
+ {"X1048", "Unit1_下主温控表报警", "Y1058", ""},
+ {"X1049", "Unit1_下监控温控表报警1", "Y1059", ""},
+ {"X104A", "Unit1_下监控温控表报警2", "Y105A", ""},
+ {"X104B", "Unit1_下监控温控表报警3", "Y105B", ""},
+ {"X104C", "Unit1_下监控温控表报警4", "Y105C", ""},
+ {"X104D", "Unit1_下监控温控表报警5", "Y105D", ""},
+ {"X104E", "", "Y105E", ""},
+ {"X104F", "", "Y105F", ""},
+ {"X1060", "Unit1_干泵-DVP运行检测-11", "Y1070", "Unit1_干泵-DVP启动-1"},
+ {"X1061", "Unit1_干泵-MBP运行检测-12", "Y1071", "Unit1_干泵-MBP启动-2"},
+ {"X1062", "Unit1_干泵-错误报警中-14", "Y1072", "Unit1_干泵-异常解除-3"},
+ {"X1063", "Unit1_干泵-错误警告中-16", "Y1073", ""},
+ {"X1064", "Unit1_干泵-远程/本地模式-18", "Y1074", "Unit1_氮气通断电磁阀1"},
+ {"X1065", "Unit1_干泵-紧急停止中-20", "Y1075", "Unit1_氮气通断电磁阀2"},
+ {"X1066", "", "Y1076", "Unit1_氮气通断电磁阀3"},
+ {"X1067", "", "Y1077", "Unit1_氮气通断电磁阀4"},
+ {"X1068", "", "Y1078", "Unit1_加热板水冷通断电磁阀1"},
+ {"X1069", "", "Y1079", "Unit1_加热板水冷通断电磁阀2"},
+ {"X106A", "", "Y107A", "Unit1_加热板水冷通断电磁阀3"},
+ {"X106B", "", "Y107B", "Unit1_加热板水冷通断电磁阀4"},
+ {"X106C", "", "Y107C", "Unit1_腔体底板通断电磁阀1"},
+ {"X106D", "Unit1_水箱上液位检", "Y107D", "Unit1_腔体底板通断电磁阀2"},
+ {"X106E", "Unit1_水箱中液位检", "Y107E", "Unit1_水箱进水阀"},
+ {"X106F", "Unit1_水箱下液位检", "Y107F", "Unit1_水箱出水阀"},
+ {"X1080", "Unit2_急停 EMO", "Y1090", "Unit2_四色灯-红"},
+ {"X1081", "Unit2_总进气压力检", "Y1091", "Unit2_四色灯-黄"},
+ {"X1082", "Unit2_伺服电柜烟感报警", "Y1092", "Unit2_四色灯-绿"},
+ {"X1083", "Unit2_加热电柜烟感报警", "Y1093", "Unit2_四色灯-蓝"},
+ {"X1084", "安全继电器检", "Y1094", "Unit2_蜂鸣器-1"},
+ {"X1085", "", "Y1095", "Unit2_蜂鸣器-2"},
+ {"X1086", "", "Y1096", "Unit2_蜂鸣器-3"},
+ {"X1087", "Unit2_安全门磁检1", "Y1097", "Unit2_蜂鸣器-4"},
+ {"X1088", "Unit2_安全门磁检2", "Y1098", "Unit2_机台照明"},
+ {"X1089", "Unit2_安全门磁检3", "Y1099", "Unit2_安全门锁屏蔽"},
+ {"X108A", "Unit2_安全门磁检4", "Y109A", ""},
+ {"X108B", "Unit2_安全门磁检5", "Y109B", ""},
+ {"X108C", "Unit2_安全门磁检6", "Y109C", ""},
+ {"X108D", "Unit2_安全门锁检1", "Y109D", "Unit2_安全门锁1"},
+ {"X108E", "Unit2_安全门锁检2", "Y109E", "Unit2_安全门锁2"},
+ {"X108F", "Unit2_安全门锁检3", "Y109F", "Unit2_安全门锁3"},
+ {"X10A0", "Unit2_分子泵-Alam(8-14)", "Y10B0", "Unit2_分子泵启动(1-9)"},
+ {"X10A1", "Unit2_分子泵-远程/本地模式(7-15)", "Y10B1", "Unit2_分子泵联锁装置(2-10)"},
+ {"X10A2", "Unit2_分子泵-正常运行(4-12)", "Y10B2", "Unit2_分子泵通断插板阀"},
+ {"X10A3", "", "Y10B3", "Unit2_气囊通断阀"},
+ {"X10A4", "", "Y10B4", ""},
+ {"X10A5", "Unit2_腔体托片左气缸原位", "Y10B5", "Unit2_腔体托片左气缸原位"},
+ {"X10A6", "Unit2_腔体托片左气缸到位", "Y10B6", "Unit2_腔体托片左气缸到位"},
+ {"X10A7", "Unit2_腔体托片右气缸原位", "Y10B7", "Unit2_腔体托片右气缸原位"},
+ {"X10A8", "Unit2_腔体托片右气缸到位", "Y10B8", "Unit2_腔体托片右气缸到位"},
+ {"X10A9", "Unit2_门阀升降气缸原位", "Y10B9", "Unit2_门阀升降气缸"},
+ {"X10AA", "Unit2_门阀升降气缸到位", "Y10BA", ""},
+ {"X10AB", "Unit2_腔体破真空气阀原位", "Y10BB", "Unit2_腔体破真空气阀"},
+ {"X10AC", "Unit2_腔体破真空气阀到位", "Y10BC", "Unit2_分子泵排气阀"},
+ {"X10AD", "Unit2_下腔平台真空检", "Y10BD", "Unit2_下腔平台吸真空"},
+ {"X10AE", "Unit2_分子泵排气阀原位", "Y10BE", "Unit2_下腔平台破真空"},
+ {"X10AF", "Unit2_分子泵排气阀到位", "Y10BF", ""},
+ {"X10C0", "Unit2_上加热已上电", "Y10D0", "Unit2_上加热上电"},
+ {"X10C1", "Unit2_上主温控表报警", "Y10D1", "Unit2_下加热上电"},
+ {"X10C2", "Unit2_上监控温控表报警1", "Y10D2", ""},
+ {"X10C3", "Unit2_上监控温控表报警2", "Y10D3", ""},
+ {"X10C4", "Unit2_上监控温控表报警3", "Y10D4", ""},
+ {"X10C5", "Unit2_上监控温控表报警4", "Y10D5", ""},
+ {"X10C6", "Unit2_上监控温控表报警5", "Y10D6", ""},
+ {"X10C7", "Unit2_下加热已上电", "Y10D7", ""},
+ {"X10C8", "Unit2_下主温控表报警", "Y10D8", ""},
+ {"X10C9", "Unit2_下监控温控表报警1", "Y10D9", ""},
+ {"X10CA", "Unit2_下监控温控表报警2", "Y10DA", ""},
+ {"X10CB", "Unit2_下监控温控表报警3", "Y10DB", ""},
+ {"X10CC", "Unit2_下监控温控表报警4", "Y10DC", ""},
+ {"X10CD", "Unit2_下监控温控表报警5", "Y10DD", ""},
+ {"X10CE", "", "Y10DE", ""},
+ {"X10CF", "", "Y10DF", ""},
+ {"X10E0", "Unit2_干泵-DVP运行检测-11", "Y10F0", "Unit2_干泵-DVP启动-1"},
+ {"X10E1", "Unit2_干泵-MBP运行检测-12", "Y10F1", "Unit2_干泵-MBP启动-2"},
+ {"X10E2", "Unit2_干泵-错误报警中-14", "Y10F2", "Unit2_干泵-异常解除-3"},
+ {"X10E3", "Unit2_干泵-错误警告中-16", "Y10F3", ""},
+ {"X10E4", "Unit2_干泵-远程/本地模式-18", "Y10F4", "Unit2_氮气通断电磁阀1"},
+ {"X10E5", "Unit2_干泵-紧急停止中-20", "Y10F5", "Unit2_氮气通断电磁阀2"},
+ {"X10E6", "", "Y10F6", "Unit2_氮气通断电磁阀3"},
+ {"X10E7", "", "Y10F7", "Unit2_氮气通断电磁阀4"},
+ {"X10E8", "", "Y10F8", "Unit2_加热板水冷通断电磁阀1"},
+ {"X10E9", "", "Y10F9", "Unit2_加热板水冷通断电磁阀2"},
+ {"X10EA", "", "Y10FA", "Unit2_加热板水冷通断电磁阀3"},
+ {"X10EB", "", "Y10FB", "Unit2_加热板水冷通断电磁阀4"},
+ {"X10EC", "", "Y10FC", "Unit2_腔体底板通断电磁阀1"},
+ {"X10ED", "Unit2_水箱上液位检", "Y10FD", "Unit2_腔体底板通断电磁阀2"},
+ {"X10EE", "Unit2_水箱中液位检", "Y10FE", "Unit2_水箱进水阀"},
+ {"X10EF", "Unit2_水箱下液位检", "Y10FF", "Unit2_水箱出水阀"}
+ };
+ m_machines[machineName] = defaultData;
+ }
+ else if (machineName == "VacuumBake") {
+ std::vector<IOData> defaultData = {
+ {"X1100", "急停 EMO", "Y1110", "四色灯-红"},
+ {"X1101", "总进气压力检", "Y1111", "四色灯-黄"},
+ {"X1102", "A加热电柜烟感报警", "Y1112", "四色灯-绿"},
+ {"X1103", "B加热电柜烟感报警", "Y1113", "四色灯-蓝"},
+ {"X1104", "安全继电器检", "Y1114", "蜂鸣器-1"},
+ {"X1105", "", "Y1115", "蜂鸣器-2"},
+ {"X1106", "", "Y1116", "蜂鸣器-3"},
+ {"X1107", "", "Y1117", "蜂鸣器-4"},
+ {"X1108", "", "Y1118", "机台照明"},
+ {"X1109", "", "Y1119", "安全门锁屏蔽"},
+ {"X110A", "安全门磁检1", "Y111A", ""},
+ {"X110B", "安全门磁检2", "Y111B", ""},
+ {"X110C", "安全门锁检1", "Y111C", "安全门锁1"},
+ {"X110D", "安全门锁检2", "Y111D", "安全门锁2"},
+ {"X110E", "安全门锁检3", "Y111E", "安全门锁3"},
+ {"X110F", "安全门锁检4", "Y111F", "安全门锁4"},
+ {"X1120", "A腔门阀升降气缸原位", "Y1130", "A腔门阀升降气缸"},
+ {"X1121", "A腔门阀升降气缸到位", "Y1131", ""},
+ {"X1122", "A腔腔体总吸真空气阀原位", "Y1132", "A腔腔体总吸真空气阀"},
+ {"X1123", "A腔腔体总吸真空气阀到位", "Y1133", "A腔腔体总破真空气阀"},
+ {"X1124", "A腔腔体总破真空气阀原位", "Y1134", "A腔冷却水阀"},
+ {"X1125", "A腔腔体总破真空气阀到位", "Y1135", ""},
+ {"X1126", "A腔加热已上电", "Y1136", "A腔加热上电"},
+ {"X1127", "A腔主温控表报警", "Y1137", ""},
+ {"X1128", "A腔监控温控表报警1", "Y1138", ""},
+ {"X1129", "A腔监控温控表报警2", "Y1139", ""},
+ {"X112A", "A腔监控温控表报警3", "Y113A", ""},
+ {"X112B", "A腔监控温控表报警4", "Y113B", ""},
+ {"X112C", "A腔监控温控表报警5", "Y113C", ""},
+ {"X112D", "", "Y113D", ""},
+ {"X112E", "", "Y113E", ""},
+ {"X112F", "", "Y113F", ""},
+ {"X1140", "B腔门阀升降气缸原位", "Y1150", "B腔门阀升降气缸"},
+ {"X1141", "B腔门阀升降气缸到位", "Y1151", ""},
+ {"X1142", "B腔腔体总吸真空气阀原位", "Y1152", "B腔腔体总吸真空气阀"},
+ {"X1143", "B腔腔体总吸真空气阀到位", "Y1153", "B腔腔体总破真空气阀"},
+ {"X1144", "B腔腔体总破真空气阀原位", "Y1154", "B腔冷却水阀"},
+ {"X1145", "B腔腔体总破真空气阀到位", "Y1155", ""},
+ {"X1146", "B腔加热已上电", "Y1156", "B腔加热上电"},
+ {"X1147", "B腔主温控表报警", "Y1157", ""},
+ {"X1148", "B腔监控温控表报警1", "Y1158", ""},
+ {"X1149", "B腔监控温控表报警2", "Y1159", ""},
+ {"X114A", "B腔监控温控表报警3", "Y115A", ""},
+ {"X114B", "B腔监控温控表报警4", "Y115B", ""},
+ {"X114C", "B腔监控温控表报警5", "Y115C", ""},
+ {"X114D", "", "Y115D", ""},
+ {"X114E", "", "Y115E", ""},
+ {"X114F", "", "Y115F", ""},
+ {"X1160", "干泵-DVP运行检测-11", "Y1170", "干泵-DVP启动-1"},
+ {"X1161", "干泵-MBP运行检测-12", "Y1171", "干泵-MBP启动-2"},
+ {"X1162", "干泵-错误报警中-14", "Y1172", "干泵-异常解除-3"},
+ {"X1163", "干泵-错误警告中-16", "Y1173", ""},
+ {"X1164", "干泵-远程/本地模式-18", "Y1174", ""},
+ {"X1165", "干泵-紧急停止中-20", "Y1175", ""},
+ {"X1166", "", "Y1176", ""},
+ {"X1167", "", "Y1177", ""},
+ {"X1168", "", "Y1178", ""},
+ {"X1169", "", "Y1179", ""},
+ {"X116A", "", "Y117A", ""},
+ {"X116B", "", "Y117B", ""},
+ {"X116C", "", "Y117C", ""},
+ {"X116D", "", "Y117D", ""},
+ {"X116E", "", "Y117E", ""},
+ {"X116F", "", "Y117F", ""}
+ };
+ m_machines[machineName] = defaultData;
+ }
+ else if (machineName == "AfterBake") {
+ std::vector<IOData> defaultData = {
+ {"X200", "急停 EMO", "Y400", "四色灯-红"},
+ {"X201", "总进气压力检", "Y401", "四色灯-黄"},
+ {"X202", "A加热电柜烟感报警", "Y402", "四色灯-绿"},
+ {"X203", "B加热电柜烟感报警", "Y403", "四色灯-蓝"},
+ {"X204", "安全继电器检", "Y404", "蜂鸣器-1"},
+ {"X205", "上电箱温控报警", "Y405", "蜂鸣器-2"},
+ {"X206", "下电箱温控报警", "Y406", "蜂鸣器-3"},
+ {"X207", "", "Y407", "蜂鸣器-4"},
+ {"X208", "安全门磁检1", "Y408", "机台照明"},
+ {"X209", "安全门磁检2", "Y409", "安全门锁屏蔽"},
+ {"X20A", "安全门磁检3", "Y40A", ""},
+ {"X20B", "安全门磁检4", "Y40B", ""},
+ {"X20C", "安全门锁检1", "Y40C", "安全门锁1"},
+ {"X20D", "安全门锁检2", "Y40D", "安全门锁2"},
+ {"X20E", "安全门锁检3", "Y40E", "安全门锁3"},
+ {"X20F", "安全门锁检4", "Y40F", "安全门锁4"},
+ {"X210", "A上腔夹持气缸1原位", "Y410", "A上腔夹持气缸"},
+ {"X211", "A上腔夹持气缸1到位", "Y411", ""},
+ {"X212", "A上腔夹持气缸2原位", "Y412", "A腔水路通断阀"},
+ {"X213", "A上腔夹持气缸2到位", "Y413", ""},
+ {"X214", "A下腔加热已上电", "Y414", ""},
+ {"X215", "A下主温控表报警", "Y415", ""},
+ {"X216", "A下腔监控温控表报警1", "Y416", ""},
+ {"X217", "A下腔监控温控表报警2", "Y417", ""},
+ {"X218", "A下腔监控温控表报警3", "Y418", ""},
+ {"X219", "A下腔监控温控表报警4", "Y419", ""},
+ {"X21A", "A下腔监控温控表报警5", "Y41A", ""},
+ {"X21B", "", "Y41B", ""},
+ {"X21C", "腔体左上门磁", "Y41C", ""},
+ {"X21D", "腔体左下门磁", "Y41D", ""},
+ {"X21E", "腔体右上门磁", "Y41E", ""},
+ {"X21F", "腔体右下门磁", "Y41F", ""},
+ {"X220", "B上腔夹持气缸1原位", "Y420", "B上腔夹持气缸"},
+ {"X221", "B上腔夹持气缸1到位", "Y421", ""},
+ {"X222", "B上腔夹持气缸2原位", "Y422", "B腔水路通断阀"},
+ {"X223", "B上腔夹持气缸2到位", "Y423", ""},
+ {"X224", "B下腔加热已上电", "Y424", ""},
+ {"X225", "B下主温控表报警", "Y425", ""},
+ {"X226", "B下腔监控温控表报警1", "Y426", ""},
+ {"X227", "B下腔监控温控表报警2", "Y427", ""},
+ {"X228", "B下腔监控温控表报警3", "Y428", ""},
+ {"X229", "B下腔监控温控表报警4", "Y429", ""},
+ {"X22A", "B下腔监控温控表报警5", "Y42A", ""},
+ {"X22B", "", "Y42B", ""},
+ {"X22C", "A上腔有料检", "Y42C", ""},
+ {"X22D", "", "Y42D", ""},
+ {"X22E", "", "Y42E", ""},
+ {"X22F", "", "Y42F", ""}
+ };
+ m_machines[machineName] = defaultData;
+ }
+ else if (machineName == "AOI") {
+ std::vector<IOData> defaultData = {
+ {"X240", "急停 EMO", "Y440", "四色灯-红"},
+ {"X241", "总进气压力表", "Y441", "四色灯-黄"},
+ {"X242", "烟感报警", "Y442", "四色灯-绿"},
+ {"X243", "", "Y443", "四色灯-蓝"},
+ {"X244", "", "Y444", "蜂鸣器-1"},
+ {"X245", "左上门磁检", "Y445", "蜂鸣器-2"},
+ {"X246", "左下门磁检", "Y446", "蜂鸣器-3"},
+ {"X247", "右上门磁检", "Y447", "蜂鸣器-4"},
+ {"X248", "右下门磁检", "Y448", "机台照明"},
+ {"X249", "安全门磁检1", "Y449", "安全门锁屏蔽"},
+ {"X24A", "安全门磁检2", "Y44A", ""},
+ {"X24B", "安全门锁检1", "Y44B", "安全门锁1"},
+ {"X24C", "安全门锁检2", "Y44C", "安全门锁2"},
+ {"X24D", "检测搬臂压力检", "Y44D", ""},
+ {"X24E", "检测平台真空检", "Y44E", "检测平台吸真空"},
+ {"X24F", "检测平台有料检", "Y44F", "检测平台破真空"},
+ {"X250", "检测平台对位气缸A1原位", "Y450", "检测平台对位气缸A"},
+ {"X251", "检测平台对位气缸A1到位", "Y451", ""},
+ {"X252", "检测平台对位气缸A2原位", "Y452", ""},
+ {"X253", "检测平台对位气缸A2到位", "Y453", ""},
+ {"X254", "检测平台对位升降气缸A1原位", "Y454", "检测平台对位升降气缸A"},
+ {"X255", "检测平台对位升降气缸A1到位", "Y455", ""},
+ {"X256", "检测平台对位升降气缸A2原位", "Y456", ""},
+ {"X257", "检测平台对位升降气缸A2到位", "Y457", ""},
+ {"X258", "检测平台对位气缸B1原位", "Y458", "检测平台对位气缸B"},
+ {"X259", "检测平台对位气缸B1到位", "Y459", ""},
+ {"X25A", "检测平台对位气缸B2原位", "Y45A", ""},
+ {"X25B", "检测平台对位气缸B2到位", "Y45B", ""},
+ {"X25C", "检测平台对位升降气缸B1原位", "Y45C", "检测平台对位升降气缸B"},
+ {"X25D", "检测平台对位升降气缸B1到位", "Y45D", ""},
+ {"X25E", "检测平台对位升降气缸B2原位", "Y45E", ""},
+ {"X25F", "检测平台对位升降气缸B2到位", "Y45F", ""},
+ {"X260", "", "Y460", ""},
+ {"X261", "", "Y461", ""},
+ {"X262", "", "Y462", ""},
+ {"X263", "", "Y463", ""},
+ {"X264", "", "Y464", ""},
+ {"X265", "", "Y465", ""},
+ {"X266", "", "Y466", ""},
+ {"X267", "", "Y467", ""},
+ {"X268", "", "Y468", ""},
+ {"X269", "", "Y469", ""},
+ {"X26A", "", "Y46A", ""},
+ {"X26B", "", "Y46B", ""},
+ {"X26C", "", "Y46C", ""},
+ {"X26D", "", "Y46D", ""},
+ {"X26E", "", "Y46E", ""},
+ {"X26F", "", "Y46F", ""}
+ };
+ m_machines[machineName] = defaultData;
+ }
+}
+
+void IOManager::saveToFile(const std::string& machineName) {
+ std::ofstream file(m_directory + "/" + machineName + ".iom");
+ if (!file.is_open()) {
+ std::cerr << "Failed to open file for writing: " << machineName << ".iom" << std::endl;
+ return;
+ }
+
+ for (const auto& entry : m_machines[machineName]) {
+ file << entry.inputAddress << ","
+ << entry.inputDescription << ","
+ << entry.outputAddress << ","
+ << entry.outputDescription << "\n";
+ }
+
+ file.close();
+}
+
+bool IOManager::loadFromFile(const std::string& machineName) {
+ std::ifstream file(m_directory + "/" + machineName + ".iom");
+ if (!file.is_open()) {
+ std::cerr << "Failed to open file for reading: " << machineName << ".iom" << std::endl;
+ return false;
+ }
+
+ std::vector<IOData> data;
+ std::string line;
+ while (std::getline(file, line)) {
+ IOData entry;
+ size_t pos = 0;
+ pos = line.find(",");
+ entry.inputAddress = line.substr(0, pos);
+ line.erase(0, pos + 1);
+
+ pos = line.find(",");
+ entry.inputDescription = line.substr(0, pos);
+ line.erase(0, pos + 1);
+
+ pos = line.find(",");
+ entry.outputAddress = line.substr(0, pos);
+ line.erase(0, pos + 1);
+
+ entry.outputDescription = line;
+ data.push_back(entry);
+ }
+
+ m_machines[machineName] = data;
+ file.close();
+ return true;
+}
+
+void IOManager::printMachineData(const std::string& machineName) const {
+ auto it = m_machines.find(machineName);
+ if (it != m_machines.end()) {
+ for (const auto& entry : it->second) {
+ std::cout << "Input Address: " << entry.inputAddress
+ << ", Input Description: " << entry.inputDescription
+ << ", Output Address: " << entry.outputAddress
+ << ", Output Description: " << entry.outputDescription << std::endl;
+ }
+ }
+ else {
+ std::cerr << "Machine not found: " << machineName << std::endl;
+ }
+}
+
+std::vector<IOData> IOManager::GetMachineData(const std::string& machineName) const
+{
+ auto it = m_machines.find(machineName);
+ if (it != m_machines.end()) {
+ return it->second;
+ }
+ return {};
+}
\ No newline at end of file
diff --git a/SourceCode/Bond/BondEq/FileManager/IOManager.h b/SourceCode/Bond/BondEq/FileManager/IOManager.h
new file mode 100644
index 0000000..9d81cd3
--- /dev/null
+++ b/SourceCode/Bond/BondEq/FileManager/IOManager.h
@@ -0,0 +1,31 @@
+#ifndef IOMANAGER_H
+#define IOMANAGER_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+struct IOData {
+ std::string inputAddress;
+ std::string inputDescription;
+ std::string outputAddress;
+ std::string outputDescription;
+};
+
+class IOManager {
+public:
+ IOManager();
+
+ void addMachine(const std::string& machineName, const std::vector<IOData>& data);
+ void addDefaultMachineData(const std::string& machineName);
+ void saveToFile(const std::string& machineName);
+ bool loadFromFile(const std::string& machineName);
+ void printMachineData(const std::string& machineName) const;
+ std::vector<IOData> GetMachineData(const std::string& machineName) const;
+
+private:
+ std::string m_directory;
+ std::map<std::string, std::vector<IOData>> m_machines;
+};
+
+#endif // IOMANAGER_H
\ No newline at end of file
diff --git a/SourceCode/Bond/BondEq/Resource.h b/SourceCode/Bond/BondEq/Resource.h
index beecff5..88fd4b3 100644
--- a/SourceCode/Bond/BondEq/Resource.h
+++ b/SourceCode/Bond/BondEq/Resource.h
Binary files differ
diff --git a/SourceCode/Bond/BondEq/View/IOMonitoringDlg.cpp b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.cpp
new file mode 100644
index 0000000..1185f82
--- /dev/null
+++ b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.cpp
@@ -0,0 +1,356 @@
+锘�// IOMonitoringDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "BondEq.h"
+#include "afxdialogex.h"
+#include "IOMonitoringDlg.h"
+
+
+// CIOMonitoringDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CIOMonitoringDlg, CDialogEx)
+
+CIOMonitoringDlg::CIOMonitoringDlg(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_IO_MONITORING, pParent)
+{
+ m_nCurrentPage = 1;
+ m_nTotalPages = 1;
+ m_nRowsPerPage = 10;
+ m_nCols = 6;
+}
+
+CIOMonitoringDlg::~CIOMonitoringDlg()
+{
+ for (auto& pair : m_mapFonts) {
+ if (pair.second) {
+ pair.second->DeleteObject();
+ delete pair.second;
+ }
+ }
+ m_mapFonts.clear();
+
+ ClearDynamicControls();
+}
+
+void CIOMonitoringDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_STATIC_PAGE_NUMBER, m_staticPageNum);
+}
+
+void CIOMonitoringDlg::SetIOManager(const std::string& machineName)
+{
+ IOManager manager;
+ manager.loadFromFile(machineName);
+ m_machineName = machineName;
+
+ // 鍔犺浇鏁版嵁
+ m_displayData = manager.GetMachineData(machineName);
+
+ // 璁$畻椤垫暟
+ m_nCurrentPage = 1;
+ m_nTotalPages = (m_displayData.size() + m_nRowsPerPage - 1) / m_nRowsPerPage;
+}
+
+CFont* CIOMonitoringDlg::GetOrCreateFont(int nFontSize)
+{
+ auto it = m_mapFonts.find(nFontSize);
+ if (it != m_mapFonts.end()) {
+ return it->second;
+ }
+
+ CFont* font = new CFont();
+ LOGFONT logFont = { 0 };
+ _tcscpy_s(logFont.lfFaceName, _T("Segoe UI"));
+ logFont.lfHeight = -nFontSize;
+ logFont.lfQuality = CLEARTYPE_QUALITY;
+ font->CreateFontIndirect(&logFont);
+ m_mapFonts[nFontSize] = font;
+
+ return font;
+}
+
+void CIOMonitoringDlg::SetDefaultFont()
+{
+ CFont* defaultFont = GetOrCreateFont(12);
+
+ // 閬嶅巻鎵�鏈夋帶浠讹紝搴旂敤榛樿瀛椾綋
+ CWnd* pWnd = GetWindow(GW_CHILD);
+ while (pWnd) {
+ pWnd->SetFont(defaultFont, TRUE);
+ pWnd = pWnd->GetNextWindow();
+ }
+}
+
+void CIOMonitoringDlg::AdjustControls(float dScaleX, float dScaleY)
+{
+ CWnd* pWnd = GetWindow(GW_CHILD);
+ while (pWnd) {
+ int nCtrlID = pWnd->GetDlgCtrlID();
+ if (nCtrlID != -1 && m_mapCtrlLayouts.find(nCtrlID) != m_mapCtrlLayouts.end())
+ {
+ CRect originalRect = m_mapCtrlLayouts[nCtrlID];
+ CRect newRect(
+ static_cast<int>(originalRect.left * dScaleX),
+ static_cast<int>(originalRect.top * dScaleY),
+ static_cast<int>(originalRect.right * dScaleX),
+ static_cast<int>(originalRect.bottom * dScaleY));
+
+ pWnd->MoveWindow(&newRect);
+ AdjustControlFont(pWnd, newRect.Width(), newRect.Height());
+ }
+ pWnd = pWnd->GetNextWindow();
+ }
+}
+
+void CIOMonitoringDlg::AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight)
+{
+ TCHAR szClassName[256];
+ GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
+
+ // 鏍规嵁鎺т欢楂樺害鍔ㄦ�佽皟鏁村瓧浣撳ぇ灏�
+ int fontSize = nHeight / 2;
+ if (fontSize < 8) fontSize = 8;
+
+ // 鑾峰彇鎴栧垱寤哄瓧浣�
+ CFont* pFont = GetOrCreateFont(fontSize);
+
+ pWnd->SetFont(pFont);
+ pWnd->Invalidate(); // 鍒锋柊鎺т欢鏄剧ず
+}
+
+void CIOMonitoringDlg::UpdatePageInfo()
+{
+ // 鏍煎紡鍖栭〉鐮佷俊鎭负 "褰撳墠椤�/鎬婚〉鏁�"
+ CString pageInfo;
+ pageInfo.Format(_T("%d/%d 椤�"), m_nCurrentPage, m_nTotalPages);
+ m_staticPageNum.SetWindowText(pageInfo);
+}
+
+void CIOMonitoringDlg::CreateDynamicControls()
+{
+ CRect rect;
+ GetClientRect(&rect);
+
+ // 鑾峰彇鎸夐挳鐨勫ぇ灏�
+ CWnd* pPrevButton = GetDlgItem(IDC_BUTTON_PREV_PAGE);
+ CWnd* pNextButton = GetDlgItem(IDC_BUTTON_NEXT_PAGE);
+
+ CRect prevButtonRect, nextButtonRect;
+ pPrevButton->GetWindowRect(&prevButtonRect);
+ pNextButton->GetWindowRect(&nextButtonRect);
+
+ // 杞崲鎸夐挳鍧愭爣鍒板璇濇鐨勫潗鏍囩郴缁�
+ ScreenToClient(&prevButtonRect);
+ ScreenToClient(&nextButtonRect);
+
+ int buttonHeight = prevButtonRect.Height(); // 鎸夐挳鐨勯珮搴�
+ int topMargin = rect.Height() * 0.05; // 椤堕儴淇濈暀 5% 鐨勯珮搴�
+ int bottomMargin = buttonHeight + topMargin; // 搴曢儴淇濈暀鎸夐挳楂樺害鍔犻棿璺�
+ int sideMargin = topMargin; // 宸﹀彸闂磋窛涓庨《閮ㄩ棿璺濈浉鍚�
+ int groupSpacing = 20; // 涓ょ粍涔嬮棿鐨勯棿璺�
+ int verticalSpacing = 10; // 鍨傜洿闂磋窛
+
+ // 姣忚楂樺害鍜屽垪瀹藉害
+ int availableHeight = rect.Height() - topMargin - bottomMargin;
+ int rowHeight = (availableHeight / m_nRowsPerPage) - verticalSpacing; // 鎺т欢楂樺害鍖呭惈闂磋窛
+
+ int availableWidth = rect.Width() - 2 * sideMargin; // 鍙敤瀹藉害锛堝噺鍘诲乏鍙抽棿璺濓級
+ int colWidthSmall = availableWidth / 14; // 灏忓搴﹀垪鏇村皬
+ int colWidthLarge = availableWidth * 4 / 14; // 澶у搴﹀垪姣斾緥
+ int groupWidth = colWidthSmall * 2 + colWidthLarge; // 姣忕粍鎬诲搴�
+
+ for (int i = 0; i < m_nRowsPerPage; ++i)
+ {
+ // 姣忎竴琛岀殑璧峰 Y 鍧愭爣
+ int y = topMargin + i * (rowHeight + verticalSpacing);
+
+ // 鍒涘缓绗� 1 缁� (0, 1, 2)
+ int x = sideMargin; // 浠庡乏杈硅窛寮�濮�
+ CreateStaticControl(x, y, colWidthSmall, rowHeight, _T("OFF"), true);
+ x += colWidthSmall;
+ CreateStaticControl(x, y, colWidthSmall, rowHeight, _T("X1000"));
+ x += colWidthSmall;
+ CreateStaticControl(x, y, colWidthLarge, rowHeight, _T("鎻忚堪鏂囨湰"), false, true);
+
+ // 绗� 2 缁勮捣濮嬩綅缃紝鍔犱笂缁勯棿璺�
+ x += colWidthLarge + groupSpacing;
+
+ // 鍒涘缓绗� 2 缁� (3, 4, 5)
+ CreateStaticControl(x, y, colWidthSmall, rowHeight, _T("OFF"), true);
+ x += colWidthSmall;
+ CreateStaticControl(x, y, colWidthSmall, rowHeight, _T("Y1010"));
+ x += colWidthSmall;
+ CreateStaticControl(x, y, colWidthLarge, rowHeight, _T("鎻忚堪鏂囨湰"), false, true);
+ }
+}
+
+void CIOMonitoringDlg::CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder, bool alignLeft)
+{
+ DWORD style = WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE; // 纭繚鍨傜洿灞呬腑
+ if (hasBorder) {
+ style |= WS_BORDER; // 娣诲姞杈规
+ }
+ if (alignLeft) {
+ style |= SS_LEFT; // 宸﹀榻愭枃鏈�
+ }
+ else {
+ style |= SS_CENTER; // 灞呬腑鏂囨湰
+ }
+
+ CStatic* pStatic = new CStatic();
+ pStatic->Create(text, style, CRect(x, y, x + width, y + height), this);
+
+ // 鍔ㄦ�佽缃瓧浣撳ぇ灏�
+ CFont* pFont = GetOrCreateFont(height / 3);
+ pStatic->SetFont(pFont);
+
+ // 瀛樺偍鎺т欢鎸囬拡
+ m_staticControls.push_back(pStatic);
+}
+
+void CIOMonitoringDlg::DisplayCurrentPage()
+{
+ int startIndex = (m_nCurrentPage - 1) * m_nRowsPerPage;
+ int endIndex = min(startIndex + m_nRowsPerPage, static_cast<int>(m_displayData.size()));
+
+ for (int i = startIndex; i < endIndex; ++i)
+ {
+ const auto& data = m_displayData[i];
+ int row = i - startIndex;
+
+ m_staticControls[row * m_nCols + 0]->SetWindowText(_T("OFF"));
+ m_staticControls[row * m_nCols + 1]->SetWindowText(CString(data.inputAddress.c_str()));
+ m_staticControls[row * m_nCols + 2]->SetWindowText(CString(data.inputDescription.c_str()));
+ m_staticControls[row * m_nCols + 3]->SetWindowText(_T("OFF"));
+ m_staticControls[row * m_nCols + 4]->SetWindowText(CString(data.outputAddress.c_str()));
+ m_staticControls[row * m_nCols + 5]->SetWindowText(CString(data.outputDescription.c_str()));
+ }
+ UpdatePageInfo();
+}
+
+void CIOMonitoringDlg::ClearDynamicControls()
+{
+ for (auto* pStatic : m_staticControls)
+ {
+ if (pStatic)
+ {
+ pStatic->DestroyWindow();
+ delete pStatic;
+ }
+ }
+ m_staticControls.clear();
+}
+
+BEGIN_MESSAGE_MAP(CIOMonitoringDlg, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON_PREV_PAGE, &CIOMonitoringDlg::OnBnClickedButtonPrevPage)
+ ON_BN_CLICKED(IDC_BUTTON_NEXT_PAGE, &CIOMonitoringDlg::OnBnClickedButtonNextPage)
+ ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CIOMonitoringDlg 娑堟伅澶勭悊绋嬪簭
+
+
+BOOL CIOMonitoringDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+ CRect screenRect, dlgRect, clientRect;
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &screenRect, 0);
+
+ GetClientRect(&clientRect);
+ m_nInitialWidth = clientRect.Width();
+ m_nInitialHeight = clientRect.Height();
+
+ // 鍒濆鍖栭粯璁ゅ瓧浣�
+ CFont* pDefaultFont = GetOrCreateFont(12);
+
+ // 閬嶅巻鎵�鏈夊瓙鎺т欢锛岃褰曞垵濮嬩綅缃苟璁剧疆榛樿瀛椾綋
+ CWnd* pWnd = GetWindow(GW_CHILD);
+ while (pWnd) {
+ int nCtrlID = pWnd->GetDlgCtrlID();
+ if (nCtrlID != -1) {
+ // 璁板綍鎺т欢鍒濆甯冨眬
+ CRect ctrlRect;
+ pWnd->GetWindowRect(&ctrlRect);
+ ScreenToClient(&ctrlRect);
+ m_mapCtrlLayouts[nCtrlID] = ctrlRect;
+
+ // 璺宠繃鐗规畩鎺т欢锛堝 MFCGridCtrl锛�
+ TCHAR szClassName[256];
+ GetClassName(pWnd->m_hWnd, szClassName, sizeof(szClassName));
+ if (_tcsicmp(szClassName, _T("MFCGridCtrl")) == 0) {
+ pWnd = pWnd->GetNextWindow();
+ continue;
+ }
+
+ // 璁剧疆榛樿瀛椾綋
+ pWnd->SetFont(pDefaultFont);
+ }
+ pWnd = pWnd->GetNextWindow();
+ }
+
+ GetWindowRect(&dlgRect);
+ int dlgWidth = dlgRect.Width() * 2;
+ int dlgHeight = dlgRect.Height() * 2;
+
+ if (dlgWidth > screenRect.Width()) {
+ dlgWidth = screenRect.Width();
+ }
+ if (dlgHeight > screenRect.Height()) {
+ dlgHeight = screenRect.Height();
+ }
+
+ int centerX = screenRect.left + (screenRect.Width() - dlgWidth) / 2;
+ int centerY = screenRect.top + (screenRect.Height() - dlgHeight) / 2;
+ MoveWindow(centerX, centerY, dlgWidth, dlgHeight);
+
+ CreateDynamicControls();
+ DisplayCurrentPage();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+void CIOMonitoringDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogEx::OnSize(nType, cx, cy);
+
+ // TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+ if (nType == SIZE_MINIMIZED || m_mapCtrlLayouts.empty()) {
+ return;
+ }
+
+ float dScaleX = static_cast<float>(cx) / m_nInitialWidth;
+ float dScaleY = static_cast<float>(cy) / m_nInitialHeight;
+
+ // 閬嶅巻瀵硅瘽妗嗕腑鐨勬墍鏈夋帶浠�
+ AdjustControls(dScaleX, dScaleY);
+}
+
+void CIOMonitoringDlg::OnBnClickedButtonPrevPage()
+{
+ // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+ if (m_nCurrentPage > 1) {
+ --m_nCurrentPage;
+ DisplayCurrentPage();
+ }
+ else {
+ AfxMessageBox(_T("宸茬粡鏄涓�椤碉紒"));
+ }
+}
+
+void CIOMonitoringDlg::OnBnClickedButtonNextPage()
+{
+ // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+ if (m_nCurrentPage < m_nTotalPages) {
+ ++m_nCurrentPage;
+ DisplayCurrentPage();
+ }
+ else {
+ AfxMessageBox(_T("宸茬粡鏄渶鍚庝竴椤碉紒"));
+ }
+}
diff --git a/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
new file mode 100644
index 0000000..7b34501
--- /dev/null
+++ b/SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
@@ -0,0 +1,59 @@
+锘�#pragma once
+#include "afxdialogex.h"
+#include "IOManager.h"
+
+
+// CIOMonitoringDlg 瀵硅瘽妗�
+
+class CIOMonitoringDlg : public CDialogEx
+{
+ DECLARE_DYNAMIC(CIOMonitoringDlg)
+
+public:
+ CIOMonitoringDlg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁�
+ virtual ~CIOMonitoringDlg();
+ void SetIOManager(const std::string& machineName); // 璁剧疆 IOManager 鍜屾満鍣ㄥ悕
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_IO_MONITORING };
+#endif
+
+private:
+ CFont* GetOrCreateFont(int nFontSize); // 鑾峰彇鎴栧垱寤哄瓧浣�
+ void SetDefaultFont(); // 璁剧疆榛樿瀛椾綋
+ void AdjustControls(float dScaleX, float dScaleY); // 璋冩暣鎺т欢澶у皬
+ void AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight); // 璋冩暣鎺т欢瀛椾綋澶у皬
+
+ void UpdatePageInfo(); // 鏇存柊鍒嗛〉淇℃伅
+ void CreateDynamicControls(); // 鍔ㄦ�佸垱寤烘帶浠�
+ void CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder = false, bool alignLeft = false); // 鍒涘缓闈欐�佹帶浠�
+ void DisplayCurrentPage(); // 鏄剧ず褰撳墠椤垫暟鎹�
+ void ClearDynamicControls(); // 娓呴櫎鍔ㄦ�佸垱寤虹殑鎺т欢
+
+private:
+ int m_nInitialWidth;
+ int m_nInitialHeight;
+ int m_nCurrentPage; // 褰撳墠椤�
+ int m_nTotalPages; // 鎬婚〉鏁�
+ int m_nRowsPerPage; // 姣忛〉鏄剧ず鐨勮鏁�
+ int m_nCols; // 姣忚鐨勬帶浠剁粍鏁�
+ std::string m_machineName; // 褰撳墠鏈哄櫒鍚�
+ std::map<int, CFont*> m_mapFonts; // 瀛椾綋鏄犲皠
+ std::map<int, CRect> m_mapCtrlLayouts; // 鎺т欢甯冨眬鏄犲皠
+ std::vector<IOData> m_displayData; // 褰撳墠鏄剧ず鐨勬暟鎹�
+
+private:
+ CStatic m_staticPageNum;
+ std::vector<CStatic*> m_staticControls; // 鍔ㄦ�佸垱寤虹殑闈欐�佹帶浠�
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔
+
+ DECLARE_MESSAGE_MAP()
+public:
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnBnClickedButtonPrevPage();
+ afx_msg void OnBnClickedButtonNextPage();
+};
diff --git a/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp b/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
index 9daa3d1..10dddbd 100644
--- a/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
+++ b/SourceCode/Bond/BondEq/View/UserManagerDlg.cpp
@@ -440,23 +440,10 @@
int fontSize = nHeight / 2;
if (fontSize < 8) fontSize = 8;
- // 妫�鏌ュ瓧浣撴槸鍚﹀凡缁忓瓨鍦�
- auto it = m_mapFonts.find(fontSize);
- if (it == m_mapFonts.end()) {
- // 鍔ㄦ�佸垱寤烘柊瀛椾綋
- CFont* newFont = new CFont();
- LOGFONT logFont = { 0 };
- _tcscpy_s(logFont.lfFaceName, _T("Segoe UI"));
- logFont.lfHeight = -fontSize;
- logFont.lfQuality = CLEARTYPE_QUALITY; // 鍚敤 ClearType 鎶楅敮榻�
- newFont->CreateFontIndirect(&logFont);
+ // 鑾峰彇鎴栧垱寤哄瓧浣�
+ CFont* pFont = GetOrCreateFont(fontSize);
- // 瀛樺偍鍒板瓧浣撶鐞嗗鍣ㄤ腑
- m_mapFonts[fontSize] = newFont;
- it = m_mapFonts.find(fontSize);
- }
-
- pWnd->SetFont(it->second);
+ pWnd->SetFont(pFont);
pWnd->Invalidate(); // 鍒锋柊鎺т欢鏄剧ず
}
--
Gitblit v1.9.3