From 2246e85e7241fe910ed5e819c659fbf139b82054 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 22 七月 2025 09:53:34 +0800
Subject: [PATCH] 1. 本地测试Port配置修改,需要通过EFEM扫描结果设置可勾选项

---
 SourceCode/Bond/Servo/PortConfigurationDlg.cpp |   76 ++++++++++++++++++-------------------
 1 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
index b941707..b60a1e1 100644
--- a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
+++ b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -50,39 +50,24 @@
     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::CSlot* pSlot = pPort->getSlot(0);
+    if (pSlot == nullptr) {
+        return;
+    }
 
-        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;
-            }
+    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()
@@ -138,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);
         }
     }
 

--
Gitblit v1.9.3