From 980048d93f7ee401639d441d65f4f885749fd898 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 06 六月 2025 17:54:09 +0800
Subject: [PATCH] 1.Glass List页面修改为Slot并以Slot的形式展现数据,不论有无Glass

---
 SourceCode/Bond/Servo/CPageGraph2.cpp     |    2 +-
 SourceCode/Bond/Servo/CEquipmentPage2.cpp |   34 ++++++++++++++++++----------------
 SourceCode/Bond/Servo/CEquipment.cpp      |    6 ++++++
 SourceCode/Bond/Servo/Servo.rc            |    0 
 SourceCode/Bond/Servo/CEquipment.h        |    3 +++
 5 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 2bc7c6e..f5cfa15 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -1192,6 +1192,12 @@
 		return nullptr;
 	}
 
+	CSlot* CEquipment::getSlot(int index)
+	{
+		if (index >= SLOT_MAX) return nullptr;
+		return &m_slot[index];
+	}
+
 	CGlass* CEquipment::getGlassFromSlot(int slotNo)
 	{
 		CSlot* pSlot = nullptr;
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index ac4b84c..8152520 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -150,6 +150,9 @@
 		// unitNo: 0:local; Others:unit No
 		int recipeParameterRequest(short masterRecipeId, short localRecipeId, short unitNo);
 
+		// 获取指定的Slot
+		CSlot* getSlot(int index);
+
 		// 获取一个可用的槽位
 		CSlot* getAvailableSlot();
 
diff --git a/SourceCode/Bond/Servo/CEquipmentPage2.cpp b/SourceCode/Bond/Servo/CEquipmentPage2.cpp
index f566568..0a09494 100644
--- a/SourceCode/Bond/Servo/CEquipmentPage2.cpp
+++ b/SourceCode/Bond/Servo/CEquipmentPage2.cpp
@@ -74,22 +74,29 @@
 	ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL);
 	m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]);
 	m_listCtrl.InsertColumn(1, _T("ID"), LVCFMT_LEFT, width[1]);
-	m_listCtrl.InsertColumn(2, _T("璐村悎"), LVCFMT_LEFT, width[2]);
-	m_listCtrl.InsertColumn(3, _T("鏃堕棿"), LVCFMT_LEFT, width[3]);
-	m_listCtrl.SetColumnWidth(3, LVSCW_AUTOSIZE_USEHEADER);
+	m_listCtrl.InsertColumn(2, _T("鍚嶇О"), LVCFMT_LEFT, width[2]);
+	m_listCtrl.InsertColumn(3, _T("Glass ID"), LVCFMT_LEFT, width[3]);
+	m_listCtrl.InsertColumn(4, _T("璐村悎Glass ID"), LVCFMT_LEFT, width[4]);
+	m_listCtrl.InsertColumn(5, _T("鏃堕棿"), LVCFMT_LEFT, width[5]);
+	m_listCtrl.SetColumnWidth(5, LVSCW_AUTOSIZE_USEHEADER);
 
 
 	ASSERT(m_pEquipment);
 	for (int i = 0; i < SLOT_MAX; i++) {
-		SERVO::CGlass* pGlass = m_pEquipment->getGlassFromSlot(i+1);
-		if (pGlass != nullptr) {
-			pGlass->addRef();
-			SERVO::CGlass* pBuddy = pGlass->getBuddy();
+		SERVO::CSlot* pSlot = m_pEquipment->getSlot(i);
+		if (pSlot != nullptr && pSlot->isEnable()) {
 			int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T(""));
-			m_listCtrl.SetItemData(index, (DWORD_PTR)pGlass);
-			m_listCtrl.SetItemText(index, 1, pGlass->getID().c_str());
-			if (pBuddy != nullptr) {
-				m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str());
+			m_listCtrl.SetItemData(index, (DWORD_PTR)pSlot);
+			m_listCtrl.SetItemText(index, 1, std::to_string(pSlot->getNo()).c_str());
+			m_listCtrl.SetItemText(index, 2, pSlot->getName().c_str());
+
+			SERVO::CGlass* pGlass = (SERVO::CGlass*)pSlot->getContext();
+			if (pGlass != nullptr) {
+				m_listCtrl.SetItemText(index, 3, pGlass->getID().c_str());
+				SERVO::CGlass* pBuddy = pGlass->getBuddy();
+				if (pBuddy != nullptr) {
+					m_listCtrl.SetItemText(index, 4, pBuddy->getID().c_str());
+				}
 			}
 		}
 	}
@@ -122,11 +129,6 @@
 		strItem.Format(_T("Col_%d_Width"), i);
 		strTemp.Format(_T("%d"), rect.right - rect.left);
 		WritePrivateProfileString("EquipmentPage2ListCtrl", strItem, strTemp, strIniFile);
-	}
-
-	for (int i = 0; i < m_listCtrl.GetItemCount(); i++) {
-		SERVO::CGlass* pGlass = (SERVO::CGlass*)m_listCtrl.GetItemData(i);
-		pGlass->release();
 	}
 }
 
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 5c6e012..d095b21 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -148,7 +148,7 @@
 		CEquipmentPage2* pPage2 = new CEquipmentPage2();
 		pPage2->setEquipment(pEquipment);
 		pPage2->Create(IDD_PAGE_EQUIPMENT2);
-		dlg.addPage(pPage2, "Glass");
+		dlg.addPage(pPage2, "Slots");
 
 		if (pEquipment->getID() == EQ_ID_EFEM) {
 			CEquipmentPage3* pPage3 = new CEquipmentPage3();
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index 2f13140..8a548dd 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ

--
Gitblit v1.9.3