From 7784fe230849d70345758d787a71f079a5cec9d7 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 20 五月 2025 13:54:03 +0800
Subject: [PATCH] 1.添加并连接CMeasurement

---
 SourceCode/Bond/Servo/CLoadPort.cpp |   57 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 9cab3d1..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) {							\
@@ -206,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);
 	}
 
@@ -515,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