From adf46e4da2f53d171cc5a0e95340d751ebacf763 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 26 六月 2025 14:25:31 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/PortConfigurationDlg.cpp | 76 +++++++++++++++++++++++++++++++++++--
1 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
index 895648a..b941707 100644
--- a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
+++ b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -19,7 +19,11 @@
CPortConfigurationDlg::CPortConfigurationDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_DIALOG_PORT_CONFIGURATION, pParent)
{
-
+ // 鍒濆鍖栨垚鍛樺彉閲�
+ m_pPort[0] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT1));
+ m_pPort[1] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT2));
+ m_pPort[2] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT3));
+ m_pPort[3] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT4));
}
CPortConfigurationDlg::~CPortConfigurationDlg()
@@ -35,6 +39,52 @@
return -1; // 鏈煡绔彛
}
+void CPortConfigurationDlg::LoadPortConfigToUI(SERVO::CLoadPort* pPort)
+{
+ if (!pPort) {
+ return;
+ }
+
+ SetDlgItemText(IDC_EDIT_LOTID, "");
+ SetDlgItemText(IDC_EDIT_PRODUCTID, "");
+ SetDlgItemText(IDC_EDIT_OPERATIONID, "");
+ m_comboMaterialsType.SetCurSel(0);
+
+ bool bJobInfoSet = false;
+ for (int i = 0; i < SLOT_MAX; ++i) {
+ SERVO::CSlot* pSlot = pPort->getSlot(i);
+ if (!pSlot) {
+ continue;
+ }
+
+ SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
+ int nRow = i + 1;
+
+ // 璁剧疆 Panel ID 鍜屽嬀閫夋
+ CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(nRow, 1));
+ if (pCheck && pGlass) {
+ pCheck->SetCheck(pSlot->isEnable() ? TRUE : FALSE);
+ pCheck->SetText(pGlass ? pGlass->getID().c_str() : _T(""));
+ }
+ else {
+ pCheck->SetCheck(FALSE);
+ pCheck->SetText(_T(""));
+ }
+
+ // 鍥炲~ Job 淇℃伅锛堝彧鍙栫涓�涓湁鏁� Glass锛�
+ if (!bJobInfoSet && pGlass) {
+ SERVO::CJobDataS* pJS = pGlass->getJobDataS();
+ if (pJS) {
+ SetDlgItemText(IDC_EDIT_LOTID, CString(pJS->getLotId().c_str()));
+ SetDlgItemText(IDC_EDIT_PRODUCTID, CString(pJS->getProductId().c_str()));
+ SetDlgItemText(IDC_EDIT_OPERATIONID, CString(pJS->getOperationId().c_str()));
+ m_comboMaterialsType.SetCurSel(pJS->getMaterialsType() - 1);
+ bJobInfoSet = true;
+ }
+ }
+ }
+}
+
void CPortConfigurationDlg::InitGrid()
{
if (m_wndGrid.GetSafeHwnd() == NULL) {
@@ -43,7 +93,7 @@
const int nCols = 2;
const int nFixRows = 1;
- const int nRows = 9;
+ const int nRows = SLOT_MAX + 1; // 瀛樺湪琛ㄥご锛屾墍浠� +1
int nColIdx = 0;
m_wndGrid.DeleteAllItems();
@@ -64,8 +114,6 @@
// 璁剧疆鍒楀
m_wndGrid.SetColumnWidth(nColIdx, 50);
m_wndGrid.SetItemText(0, nColIdx++, _T("Slot ID"));
- m_wndGrid.SetColumnWidth(nColIdx, 150);
- m_wndGrid.SetItemText(0, nColIdx++, _T("Panel ID"));
m_wndGrid.SetColumnWidth(nColIdx, 60);
m_wndGrid.SetItemText(0, nColIdx++, _T("鍚敤"));
@@ -130,6 +178,7 @@
BEGIN_MESSAGE_MAP(CPortConfigurationDlg, CDialogEx)
+ ON_CBN_SELCHANGE(IDC_COMBO_PORT, &CPortConfigurationDlg::OnSelchangeComboPort)
ON_BN_CLICKED(IDC_BUTTON_APPLY, &CPortConfigurationDlg::OnBnClickedButtonApply)
END_MESSAGE_MAP()
@@ -160,14 +209,31 @@
for (const auto& item : materialTypes) {
m_comboMaterialsType.AddString(item);
}
- m_comboMaterialsType.SetCurSel(0); // 榛樿閫夋嫨绗竴涓墿鏂欑被鍨�
+ m_comboMaterialsType.SetCurSel(0); // 榛樿閫夋嫨绗竴涓墿鏂欑被鍨�
InitGrid();
+ LoadPortConfigToUI(m_pPort[0]); // 榛樿鍔犺浇绗竴涓鍙g殑閰嶇疆
+
+ // 璁剧疆瀵硅瘽妗嗘爣棰�
+ SetWindowText(_T("Port Configuration"));
+
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
+void CPortConfigurationDlg::OnSelchangeComboPort()
+{
+ // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+ int selPort = m_comboPort.GetCurSel();
+ if (selPort < 0 || selPort >= 4) {
+ return; // 鏃犳晥閫夋嫨
+ }
+
+ // 鍔犺浇閫変腑绔彛鐨勯厤缃埌 UI
+ LoadPortConfigToUI(m_pPort[selPort]);
+}
+
void CPortConfigurationDlg::OnBnClickedButtonApply()
{
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
--
Gitblit v1.9.3