LAPTOP-T815PCOQ\25526
2024-11-27 af08046fe1cddba171826f619d823dee02a79ca0
1. 添加IO模块,包括界面和管理类
已添加4个文件
已修改5个文件
887 ■■■■■ 文件已修改
SourceCode/Bond/BondEq/BondEq.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/BondEq.vcxproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/BondEqDlg.cpp 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/FileManager/IOManager.cpp 401 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/FileManager/IOManager.h 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/Resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/View/IOMonitoringDlg.cpp 356 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/View/IOMonitoringDlg.h 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/View/UserManagerDlg.cpp 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/BondEq/BondEq.rc
Binary files differ
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" />
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;
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 {};
}
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
SourceCode/Bond/BondEq/Resource.h
Binary files differ
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: åœ¨æ­¤æ·»åŠ æŽ§ä»¶é€šçŸ¥å¤„ç†ç¨‹åºä»£ç 
    if (m_nCurrentPage > 1) {
        --m_nCurrentPage;
        DisplayCurrentPage();
    }
    else {
        AfxMessageBox(_T("已经是第一页!"));
    }
}
void CIOMonitoringDlg::OnBnClickedButtonNextPage()
{
    // TODO: åœ¨æ­¤æ·»åŠ æŽ§ä»¶é€šçŸ¥å¤„ç†ç¨‹åºä»£ç 
    if (m_nCurrentPage < m_nTotalPages) {
        ++m_nCurrentPage;
        DisplayCurrentPage();
    }
    else {
        AfxMessageBox(_T("已经是最后一页!"));
    }
}
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();
};
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(); // åˆ·æ–°æŽ§ä»¶æ˜¾ç¤º
}