From b25d01dd43f27e34940de13a4efb54033f3007df Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 22 七月 2025 15:07:06 +0800
Subject: [PATCH] 1. 配方主界面列表添加设备的配方ID
---
SourceCode/Bond/Servo/PortConfigurationDlg.cpp | 92 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 78 insertions(+), 14 deletions(-)
diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
index 895648a..b60a1e1 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,37 @@
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);
+
+ SERVO::CSlot* pSlot = pPort->getSlot(0);
+ if (pSlot == nullptr) {
+ return;
+ }
+
+ SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
+ if (pGlass != nullptr) {
+ 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);
+ }
+ }
+
+ // 濉厖 Grid
+ FillGrid(pSlot, pGlass);
+}
+
void CPortConfigurationDlg::InitGrid()
{
if (m_wndGrid.GetSafeHwnd() == NULL) {
@@ -43,7 +78,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 +99,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("鍚敤"));
@@ -90,28 +123,41 @@
for (int i = 0; i < nRows; ++i) {
m_wndGrid.SetRowHeight(i, nEachRowHeight);
}
-
- FillGrid();
}
-void CPortConfigurationDlg::FillGrid()
+void CPortConfigurationDlg::FillGrid(SERVO::CSlot* pSlot, SERVO::CGlass* pGlass)
{
//CStringArray recipeOptions;
//recipeOptions.Add(_T("Recipe A"));
//recipeOptions.Add(_T("Recipe B"));
//recipeOptions.Add(_T("Recipe C"));
- for (int i = 1; i < 9; ++i) {
+ // 鍘婚櫎琛ㄥご锛屼粠绗�2琛屽紑濮嬪~鍏呮暟鎹�
+ for (int i = 1; i < SLOT_MAX + 1; ++i) {
CString strIndex;
strIndex.Format(_T("%d"), i);
m_wndGrid.SetItemText(i, 0, strIndex);
m_wndGrid.SetItemState(i, 0, GVIS_READONLY);
- // Checkbox
- m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellCheck));
- CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
- if (pCheck) {
- pCheck->SetCheck(FALSE);
+ if (i != 3) {
+ // Checkbox
+ m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellCheck));
+ CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
+ if (pCheck) {
+ // 璁剧疆 Panel ID 鍜屽嬀閫夋
+ CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
+ if (pCheck && pSlot && pGlass) {
+ pCheck->SetCheck(pSlot->isEnable() ? TRUE : FALSE);
+ pCheck->SetText(pGlass ? pGlass->getID().c_str() : _T(""));
+ }
+ else {
+ pCheck->SetCheck(FALSE);
+ pCheck->SetText(_T(""));
+ }
+ }
+ }
+ else {
+ m_wndGrid.SetItemState(i, 1, GVIS_READONLY);
}
}
@@ -130,6 +176,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 +207,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