From fcfe1d4a6c0f06adb4716914901ccc76a88d8dba Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期五, 14 十一月 2025 13:52:10 +0800
Subject: [PATCH] 1.修复两个Job相关的问题;

---
 SourceCode/Bond/Servo/CControlJobManagerDlg.cpp |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
index 2e2d92c..2d8ee00 100644
--- a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
+++ b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
@@ -534,15 +534,6 @@
 	m_pControlJob->setPJs(pjs);
 	m_pControlJob->clearIssues();
 	int nRet = master.setProcessJobs(pjs);
-
-	// 娌℃湁闂鐨刾j瑕侀噴鏀�
-	for (auto pj : pjs) {
-		if (!pj->issues().empty()) {
-			delete pj;
-		}
-	}
-	pjs.clear();
-
 	if (nRet <= 0) {
 		std::string msg("鍚屾Process Job澶辫触!");
 		for (auto pj : pjs) {
@@ -559,11 +550,20 @@
 					msg.append("\n");
 				}
 			}
+			delete pj;
 		}
+		pjs.clear();
 		AfxMessageBox(msg.c_str());
-
 		return;
 	}
+
+	// 缁х画閲婃斁鏈夐棶棰樼殑 ProcessJob
+	for (auto pj : pjs) {
+		if (!pj->issues().empty()) {
+			delete pj;
+		}
+	}
+	pjs.clear();
 
 	nRet = master.setControlJob(*m_pControlJob);
 	if (nRet != 0) {
@@ -592,23 +592,25 @@
 		SERVO::CLoadPort* pLoadPort = pPorts[m_pjWarps[p].port];
 		for (int i = 0; i < SLOT_MAX; ++i) {
 			SERVO::CSlot* pSlot = pLoadPort->getSlot(i);
-			if (!pSlot) {
-				continue;
-			}
-			
+			if (!pSlot) continue;
+
+			SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
+			if (pGlass == nullptr) continue;
+
+			SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
+			if (pJobDataS == nullptr) continue;
+
+
 			// 璁剧疆 Panel ID 鍜屽嬀閫夋
 			SERVO::CProcessJob* pj = (SERVO::CProcessJob*)m_pjWarps[p].pj;
 			int nRecipeID = RecipeManager::getInstance().getIdByPPID(pj->recipeSpec());
 			RecipeInfo stRecipeInfo = RecipeManager::getInstance().getRecipeByPPID(pj->recipeSpec());
 			std::vector<DeviceRecipe> vecRecipeInfo = stRecipeInfo.vecDeviceList;
-			SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
-			SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
-			if (pGlass != nullptr && pJobDataS != nullptr) {
-				pGlass->setScheduledForProcessing(m_pjWarps[p].checkSlot[i]);
-				pGlass->setType(static_cast<SERVO::MaterialsType>(m_pjWarps[p].material[i]));
 
-				SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
-				pJobDataS->setLotId(pj->getLotId().c_str());
+			pGlass->setScheduledForProcessing(m_pjWarps[p].checkSlot[i]);
+			pGlass->setType(static_cast<SERVO::MaterialsType>(m_pjWarps[p].material[i]));
+
+			pJobDataS->setLotId(pj->getLotId().c_str());
 				pJobDataS->setProductId(pj->getProductId().c_str());
 				pJobDataS->setOperationId(pj->getOperationId().c_str());
 				pJobDataS->setMaterialsType(m_pjWarps[p].material[i]);

--
Gitblit v1.9.3