From 334b16b4abb4cbe3d1d4e4f211efd6f4468ae09f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 19 九月 2025 15:12:52 +0800
Subject: [PATCH] 1.ControlJob和ProcessJob的中断操作,强制结批增加字符串描述原因,方便生产跟踪。

---
 SourceCode/Bond/Servo/CControlJobManagerDlg.cpp |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 114 insertions(+), 5 deletions(-)

diff --git a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
index 0bf7d67..5b19f07 100644
--- a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
+++ b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
@@ -6,6 +6,7 @@
 #include "CControlJobManagerDlg.h"
 #include "afxdialogex.h"
 #include "ToolUnits.h"
+#include "RecipeManager.h"
 
 
 bool CControlJobManagerDlg::m_bHasState = false;
@@ -423,6 +424,14 @@
 
 void CControlJobManagerDlg::OnBnClickedButtonBathCompletion()
 {
+	// 鍏堟鏌ュ綋鍓峬aster
+	auto& master = theApp.m_model.getMaster();
+	if (!master.canCreateControlJob()) {
+		AfxMessageBox("褰撳墠Master鏈夋湭缁撴壒鐨凧ob, 璇峰厛缁撴壒澶勭悊");
+		return;
+	}
+
+
 	// 鍏堝簲鐢�
 	for (int i = 0; i < 3; i++) {
 		if (m_pages[i]->IsWindowVisible()) {
@@ -446,8 +455,8 @@
 
 
 
-	auto& master = theApp.m_model.getMaster();
 
+	int EQID[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
 	std::vector<SERVO::CProcessJob*> pjs;
 	for (auto item : m_pjWarps) {
 		if (!item.addToCj) continue;
@@ -461,14 +470,14 @@
 		}
 		if (!bCheck) continue;
 
-
+		SERVO::CLoadPort* pPort = (SERVO::CLoadPort*)master.getEquipment(EQID[item.port]);
 		SERVO::CProcessJob* pScr = (SERVO::CProcessJob*)item.pj;
 		SERVO::CProcessJob * pj = new SERVO::CProcessJob(pScr->id());
 		pj->setRecipe(SERVO::RecipeMethod::NoTuning, pScr->recipeSpec());
 
 		std::vector<SERVO::CarrierSlotInfo> carriers;
 		SERVO::CarrierSlotInfo csi;
-		csi.carrierId = "Port" + std::to_string(item.port + 1);
+		csi.carrierId = pPort->getCassetteId();
 		for (int i = 0; i < 8; i++) {
 			if (item.checkSlot[i]) {
 				csi.slots.push_back(i);
@@ -487,8 +496,108 @@
 		return;
 	}
 
-
 	m_pControlJob->setPJs(pjs);
+	m_pControlJob->clearIssues();
 	int nRet = master.setProcessJobs(pjs);
-	master.setControlJob(*m_pControlJob);
+	if (nRet <= 0) {
+		std::string msg("鍚屾Process Job澶辫触!");
+		for (auto pj : pjs) {
+			auto& issues = pj->issues();
+			if (!issues.empty()) {
+				msg.append("\n");
+				msg.append(pj->id());
+				msg.append(":\n");
+				for (auto i : issues) {
+					msg.append("[");
+					msg.append(std::to_string(i.code));
+					msg.append("]");
+					msg.append(i.text);
+					msg.append("\n");
+				}
+			}
+		}
+		AfxMessageBox(msg.c_str());
+
+		return;
+	}
+
+
+	nRet = master.setControlJob(*m_pControlJob);
+	if (nRet != 0) {
+		std::string msg("鍚屾ControlJob澶辫触!");
+		auto& issues = m_pControlJob->issues();
+		if (!issues.empty()) {
+			msg.append("\n");
+			for (auto i : issues) {
+				msg.append("[");
+				msg.append(std::to_string(i.code));
+				msg.append("]");
+				msg.append(i.text);
+				msg.append("\n");
+			}
+		}
+		AfxMessageBox(msg.c_str());
+		return;
+	}
+
+
+	// 鍋囪鎴愬姛锛岃鍒ゆ柇锛屽悓姝ュ埌slot鐨刧lass涓紝绫诲瀷绛�
+	if (true) {
+		auto& master = theApp.m_model.getMaster();
+		int EQID[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
+		for (int p = 0; p < 4; p++) {
+			SERVO::CLoadPort* pPort = (SERVO::CLoadPort*)master.getEquipment(EQID[p]);
+			for (int i = 0; i < SLOT_MAX; ++i) {
+				SERVO::CSlot* pSlot = pPort->getSlot(i);
+				if (!pSlot) {
+					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("LotID1");
+					pJobDataS->setProductId("ProductId1");
+					pJobDataS->setOperationId("OPerationId");
+					pJobDataS->setMaterialsType(m_pjWarps[p].material[i]);
+					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);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	AfxMessageBox("鏂偣妫�鏌ヤ竴涓嬫暟鎹�");
 }

--
Gitblit v1.9.3