From d24917a7422efa5aa1d3cff2ef70ad754cebaedf Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 19 六月 2025 11:31:00 +0800
Subject: [PATCH] 1.生成玻璃的JobDataS数据,采用新的JobNo等id

---
 SourceCode/Bond/Servo/CPageGraph2.cpp |    3 +--
 SourceCode/Bond/Servo/CLoadPort.h     |    4 +++-
 SourceCode/Bond/Servo/CLoadPort.cpp   |   33 +++++++++++++++++----------------
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 601a73c..cbae095 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -22,6 +22,7 @@
 		m_transferMode = TransferMode::AGVMode;
 		m_bEnable = FALSE;
 		m_bAutoChangeEnable = FALSE;
+		m_nNextCassetteSequenceNo = 0;
 	}
 
 	CLoadPort::~CLoadPort()
@@ -485,6 +486,16 @@
 		Unlock();
 
 		return pStep;
+	}
+
+	short CLoadPort::getNextCassetteSequenceNo()
+	{
+		m_nNextCassetteSequenceNo++;
+		if (m_nNextCassetteSequenceNo >= 1000) {
+			m_nNextCassetteSequenceNo = 0;
+		}
+
+		return (m_nIndex + 1) * 1000 + m_nNextCassetteSequenceNo;
 	}
 
 	void CLoadPort::setIndex(unsigned int index)
@@ -1138,13 +1149,8 @@
 	/*
 	 * 生成测试用的玻璃列表
 	 */
-	int CLoadPort::testGenerateGlassList(MaterialsType type, const char* pszPrefix, int startSuffix)
+	int CLoadPort::testGenerateGlassList(MaterialsType type)
 	{
-		static unsigned short nJobSequenceNo = 0;
-		static unsigned short nCassetteSequenceNo = 0;
-		nCassetteSequenceNo++;
-
-
 		// 如果非空就不生成了
 		Lock();
 		if (hasGlass()) {
@@ -1155,21 +1161,16 @@
 
 
 		char szBuffer[64];
-		int suffix = startSuffix;
 		for (int i = 0; i < 1; i++) {
 			if (!m_slot[i].isEnable()) continue;
 
 			CJobDataS js;
-			sprintf_s(szBuffer, "%s%d", pszPrefix, suffix++);
+			js.setCassetteSequenceNo(getNextCassetteSequenceNo());
+			js.setJobSequenceNo(i);
+			sprintf_s(szBuffer, 64, "%05d%05d", js.getCassetteSequenceNo(), js.getJobSequenceNo());
+			js.setGlass1Id(szBuffer);
+			js.setJobType(1);
 			js.setMaterialsType((int)type);
-			js.setCassetteSequenceNo(nCassetteSequenceNo);
-			js.setJobSequenceNo(nJobSequenceNo);
-			if (type == MaterialsType::G1) {
-				js.setGlass1Id(szBuffer);
-			}
-			else if (type == MaterialsType::G2) {
-				js.setGlass2Id(szBuffer);
-			}
 
 			CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass();
 			pGlass->addPath(m_nID, 0);
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index e0e42d0..0910af3 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -39,6 +39,7 @@
 		void localAutoChangeEnable(BOOL bEnable);
 
 	public:
+		short getNextCassetteSequenceNo();
 		void setIndex(unsigned int index);
 		unsigned int getIndex();
 		BOOL isEnable();
@@ -54,7 +55,7 @@
 		int getQTimeFlag();
 		int getCassetteMappingState();
 		int getCassetteStatus();
-		int testGenerateGlassList(MaterialsType type, const char* pszPrefix, int startSuffix);
+		int testGenerateGlassList(MaterialsType type);
 
 	public:
 		static std::string& getPortTypeDescription(PortType portType, std::string& strDescription);
@@ -89,6 +90,7 @@
 		BOOL m_bEnable;
 		BOOL m_bAutoChangeEnable;
 		CPortStatusReport m_portStatusReport;
+		int m_nNextCassetteSequenceNo;
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 380852e..8c9050c 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -213,8 +213,7 @@
 			BOOL bTestGenerate = FALSE;
 			SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
 			if (pEquipment->getID() == EQ_ID_LOADPORT4 && !pEquipment->hasGlass()) {
-				((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G1, 
-					"P20250320G1X", 1);
+				((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G1);
 				bTestGenerate = TRUE;
 			}
 			/*

--
Gitblit v1.9.3