From ebc5dba7e2b0dccb9583faefa21ffd3454792788 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 20 五月 2025 14:32:43 +0800
Subject: [PATCH] 1.修改名称,ID等;

---
 SourceCode/Bond/Servo/CLoadPort.cpp |   72 ++++++++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 32ee535..d3879c3 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -1,5 +1,7 @@
 #include "stdafx.h"
 #include "CLoadPort.h"
+#include "CGlassPool.h"
+#include "Servo.h"
 
 
 #define CHECK_READ_STEP_SIGNAL2(addr, data, size) {							\
@@ -181,21 +183,22 @@
 	{
 		__super::getAttributeVector(attrubutes);
 
+		unsigned int weight = 101;
 		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Index",
-			std::to_string(m_nIndex).c_str(), ""));
+			std::to_string(m_nIndex).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Type",
-			getPortTypeDescription(m_nType, strTemp).c_str(), ""));
+			getPortTypeDescription(m_nType, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Mode",
-			getPortModeDescription(m_nMode, strTemp).c_str(), ""));
+			getPortModeDescription(m_nMode, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("CassetteType",
-			getPortCassetteTypeDescription(m_nCassetteType, strTemp).c_str(), ""));
+			getPortCassetteTypeDescription(m_nCassetteType, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("TransferMode",
-			getPortTransferModeDescription(m_nTransferMode, strTemp).c_str(), ""));
+			getPortTransferModeDescription(m_nTransferMode, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Enable",
-			m_bEnable ? "Eanble" : "Disable", ""));
+			m_bEnable ? "Eanble" : "Disable", "", weight++));
 		attrubutes.addAttribute(new CAttribute("Auto Change",
-			m_bAutoChangeEnable ? "Eanble" : "Disable", ""));
+			m_bAutoChangeEnable ? "Eanble" : "Disable", "", weight++));
 	}
 
 	int CLoadPort::recvIntent(CPin* pPin, CIntent* pIntent)
@@ -205,19 +208,6 @@
 
 	int CLoadPort::outputGlass(int port)
 	{
-		// 如果列表中没有Panel,模拟生成10张
-		if (m_glassList.empty()) {
-			static int ii = 0;
-			char szBuffer[64];
-			LOGI("<CLoadPort>模拟生成10张PANEL");
-			for (int i = 0; i < 10; i++) {
-				sprintf_s(szBuffer, "P20250320A1A%d", ++ii);
-				CGlass* pGlass = new CGlass();
-				pGlass->setID(szBuffer);
-				addGlassToList(pGlass);
-			}
-		}
-
 		return __super::outputGlass(port);
 	}
 
@@ -514,4 +504,46 @@
 
 		return 0;
 	}
+
+	/*
+	 * 生成测试用的玻璃列表
+	 */
+	int CLoadPort::testGenerateGlassList(MaterialsType type, int count, const char* pszPrefix, int startSuffix)
+	{
+		// 如果非空就不生成了
+		Lock();
+		if (!m_glassList.empty()) {
+			Unlock();
+			return -1;
+		}
+		Unlock();
+
+
+		char szBuffer[64];
+		int suffix = startSuffix;
+		for (int i = 0; i < count; i++) {
+			CJobDataB jb;
+			CJobDataS js;
+
+			sprintf_s(szBuffer, "%s%d", pszPrefix, suffix++);
+			jb.setGlassId(szBuffer);
+			js.setMaterialsType((int)type);
+			if (type == MaterialsType::G1) {
+				js.setGlass1Id(szBuffer);
+			}
+			else if (type == MaterialsType::G2) {
+				js.setGlass2Id(szBuffer);
+			}
+
+			CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass();
+			pGlass->setID(szBuffer);
+			pGlass->setJobDataB(&jb);
+			pGlass->setType(type);
+			pGlass->setJobDataS(&js);
+			addGlassToList(pGlass);
+		}
+
+		return 0;
+	}
+
 }

--
Gitblit v1.9.3