From 9e9e63ef44ff672989d7b78bf37afb2054267671 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 22 九月 2025 15:47:04 +0800
Subject: [PATCH] 1.完善工艺批次逻辑; 2.PortType保存到本地,不再同步到efem

---
 SourceCode/Bond/Servo/CMaster.cpp |   97 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 92 insertions(+), 5 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 922cf67..960294c 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -1480,6 +1480,8 @@
 								if (m_listener.onCjEnd != nullptr) {
 									m_listener.onCjEnd(this, pJob);
 								}
+
+								completeControlJob();
 							}
 						}
 					}
@@ -1533,17 +1535,58 @@
 				for (auto pj : pjs) {
 					auto carrier = pj->getCarrier(pPort->getCassetteId());
 					if (carrier != nullptr) {
+						carrier->contexts.clear();
 						for (auto slot : carrier->slots) {
 							CGlass* pGlass = pPort->getGlassFromSlot(slot);
 							carrier->contexts.push_back((void*)pGlass);
 							if (pGlass != nullptr) {
 								pGlass->setProcessJob(pj);
+
+								PJWarp& jpWarp = pj->getPjWarp();
+								int nRecipeID = RecipeManager::getInstance().getIdByPPID(pj->recipeSpec());
+								RecipeInfo stRecipeInfo = RecipeManager::getInstance().getRecipeByPPID(pj->recipeSpec());
+								std::vector<DeviceRecipe> vecRecipeInfo = stRecipeInfo.vecDeviceList;
+
+								pGlass->setScheduledForProcessing(jpWarp.checkSlot[slot-1]);
+								pGlass->setType(static_cast<SERVO::MaterialsType>(jpWarp.material[slot-1]));
+
+								SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
+								if (pJobDataS != nullptr) {
+									SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
+									pJobDataS->setLotId(pj->getLotId().c_str());
+									pJobDataS->setProductId(pj->getProductId().c_str());
+									pJobDataS->setOperationId(pj->getOperationId().c_str());
+									pJobDataS->setMaterialsType(jpWarp.material[slot - 1]);
+									pJobDataS->setMasterRecipe(nRecipeID);
+									for (const auto& info : vecRecipeInfo) {
+										const std::string& name = info.strDeviceName;
+										short nRecipeID = (short)info.nRecipeID;
+
+										if (name == EQ_NAME_EFEM) {
+											pJobDataS->setDeviceRecipeId(0, nRecipeID);
+										}
+										else if (name == EQ_NAME_BONDER1) {
+											pJobDataS->setDeviceRecipeId(1, nRecipeID);
+										}
+										else if (name == EQ_NAME_BONDER2) {
+											pJobDataS->setDeviceRecipeId(2, nRecipeID);
+										}
+										else if (name == EQ_NAME_BAKE_COOLING) {
+											pJobDataS->setDeviceRecipeId(3, nRecipeID);
+										}
+										else if (name == EQ_NAME_VACUUMBAKE) {
+											pJobDataS->setDeviceRecipeId(4, nRecipeID);
+										}
+										else if (name == EQ_NAME_MEASUREMENT) {
+											pJobDataS->setDeviceRecipeId(5, nRecipeID);
+										}
+									}
+
+								}
 							}
 						}
 					}
 				}
-
-
 			}
 			
 			if (m_listener.onLoadPortStatusChanged != nullptr) {
@@ -2268,11 +2311,19 @@
 		return 0;
 	}
 
-	void CMaster::setPortType(unsigned int index, BOOL enable, int type, int mode,
-		int cassetteType, int transferMode, BOOL autoChangeEnable)
+	void CMaster::setPortType(unsigned int index, int type)
 	{
 		ASSERT(index < 4);
 		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4};
+		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]);
+		pPort->localSetPortType((SERVO::PortType)type);
+	}
+
+	void CMaster::setPortTypeEx(unsigned int index, BOOL enable, int type, int mode,
+		int cassetteType, int transferMode, BOOL autoChangeEnable)
+	{
+		ASSERT(index < 4);
+		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
 		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]);
 		pPort->localEanblePort(enable);
 		pPort->localSetPortType((SERVO::PortType)type);
@@ -2779,7 +2830,43 @@
 	}
 
 
-	bool CMaster::completeControlJob(std::string description)
+	bool CMaster::completeControlJob()
+	{
+		if (m_pControlJob == nullptr) {
+			return false;
+		}
+		for (auto item : m_processJobs) {
+			if (item->state() != PJState::Completed) return false;
+		}
+		if (m_pControlJob->state() != CJState::Completed)
+			return false;
+
+
+
+		// 释放Job相关
+		for (auto item : m_processJobs) {
+			delete item;
+		}
+		m_processJobs.clear();
+		if (m_pControlJob != nullptr) {
+			delete m_pControlJob;
+			m_pControlJob = nullptr;
+		}
+
+		// 注意要释放引用
+		m_inProcesJobs.clear();
+		m_completeProcessJobs.clear();
+		m_queueGlasses.clear();
+		m_inProcesGlasses.clear();
+		m_completeGlasses.clear();
+
+
+		saveState();
+
+		return true;
+	}
+
+	bool CMaster::forceCompleteControlJob(std::string description)
 	{
 		if (m_pControlJob == nullptr || m_state != SERVO::MASTERSTATE::READY) {
 			return false;

--
Gitblit v1.9.3