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/CPagePortProperty.cpp     |    5 +
 SourceCode/Bond/Servo/Configuration.h           |    1 
 SourceCode/Bond/Servo/ProcessJob.h              |   26 ++++++++
 SourceCode/Bond/x64/Debug/EqsGraph.ini          |    2 
 SourceCode/Bond/Servo/ProcessJob.cpp            |   40 +++++++++++++
 SourceCode/Bond/Servo/Model.h                   |    1 
 SourceCode/Bond/Servo/CCjPage2.h                |    8 --
 SourceCode/Bond/Servo/CMaster.cpp               |   56 +++++++++++++++++-
 SourceCode/Bond/Servo/Configuration.cpp         |   10 +++
 SourceCode/Bond/Servo/CControlJobManagerDlg.cpp |   19 +++++-
 SourceCode/Bond/Servo/CMaster.h                 |    3 
 SourceCode/Bond/Servo/Model.cpp                 |    8 ++
 12 files changed, 160 insertions(+), 19 deletions(-)

diff --git a/SourceCode/Bond/Servo/CCjPage2.h b/SourceCode/Bond/Servo/CCjPage2.h
index b72fa15..e9561cd 100644
--- a/SourceCode/Bond/Servo/CCjPage2.h
+++ b/SourceCode/Bond/Servo/CCjPage2.h
@@ -5,14 +5,6 @@
 
 
 
-struct PJWarp {
-	BOOL addToCj;
-	void* pj;
-	int port;
-	BOOL checkSlot[8];
-	int material[8];
-};
-
 // CPjPage1 瀵硅瘽妗�
 
 class CCjPage2 : public CCjPageBase
diff --git a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
index dc22f39..037b595 100644
--- a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
+++ b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
@@ -475,7 +475,17 @@
 		if (!bCheck) continue;
 
 		SERVO::CProcessJob* pScr = (SERVO::CProcessJob*)item.pj;
+		pScr->setPjWarp(item);
+		pScr->setLotId("LotID1");
+		pScr->setProductId("ProductId1");
+		pScr->setOperationId("OperationId");
+		pScr->setRecipe(SERVO::RecipeMethod::NoTuning, pScr->recipeSpec());
+
 		SERVO::CProcessJob * pj = new SERVO::CProcessJob(pScr->id());
+		pj->setPjWarp(item);
+		pj->setLotId("LotID1");
+		pj->setProductId("ProductId1");
+		pj->setOperationId("OperationId");
 		pj->setRecipe(SERVO::RecipeMethod::NoTuning, pScr->recipeSpec());
 
 		std::vector<SERVO::CarrierSlotInfo> carriers;
@@ -560,13 +570,14 @@
 	for (int p = 0; p < 4; p++) {
 		if (m_pjWarps[p].port == -1) continue;
 		ASSERT(0 <= m_pjWarps[p].port && m_pjWarps[p].port <= 3);
+
 		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;
 			}
-
+			
 			// 璁剧疆 Panel ID 鍜屽嬀閫夋
 			SERVO::CProcessJob* pj = (SERVO::CProcessJob*)m_pjWarps[p].pj;
 			int nRecipeID = RecipeManager::getInstance().getIdByPPID(pj->recipeSpec());
@@ -579,9 +590,9 @@
 				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->setLotId(pj->getLotId().c_str());
+				pJobDataS->setProductId(pj->getProductId().c_str());
+				pJobDataS->setOperationId(pj->getOperationId().c_str());
 				pJobDataS->setMaterialsType(m_pjWarps[p].material[i]);
 				pJobDataS->setMasterRecipe(nRecipeID);
 
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index d6831e5..960294c 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -1541,12 +1541,52 @@
 							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) {
@@ -2271,12 +2311,20 @@
 		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);
 		pPort->localSetPortMode((SERVO::PortMode)mode);
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index e014f7c..be3fea6 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -107,8 +107,9 @@
         int abortCurrentTask();
         int restoreCurrentTask();
         int resendCurrentTask();
-        void setPortType(unsigned int index, BOOL enable, int type, int mode,
+        void setPortTypeEx(unsigned int index, BOOL enable, int type, int mode,
             int cassetteType, int transferMode, BOOL autoChangeEnable);
+        void setPortType(unsigned int index, int type);
         void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
         void setPortEnable(unsigned int index, BOOL bEnable);
         void setCompareMapsBeforeProceeding(BOOL bCompare);
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.cpp b/SourceCode/Bond/Servo/CPagePortProperty.cpp
index 0c241c9..3b8f4e5 100644
--- a/SourceCode/Bond/Servo/CPagePortProperty.cpp
+++ b/SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -196,8 +196,12 @@
 	CMsgDlg msgDlg("璇风瓑寰�", "姝e湪鎿嶄綔锛岃绛夊緟...");
 	msgDlg.SetData((DWORD_PTR)this);
 
+	// 淇敼涓哄彧淇濆瓨鍦ㄦ湰鍦伴厤缃�
 	ASSERT(m_pPort != nullptr);
 	int index = ((CComboBox*)GetDlgItem(IDC_COMBO_PORT_TYPE))->GetCurSel();
+	theApp.m_model.setPortType(m_pPort->getIndex(), SERVO::PortType(index + 1));
+
+	/*
 	m_pPort->setPortType(SERVO::PortType(index + 1), [&](int code) -> int {
 		Sleep(100);
 		CString strMsg;
@@ -234,6 +238,7 @@
 
 	msgDlg.DoModal();
 	g_nMsgDlgShow = 1;
+	*/
 }
 
 void CPagePortProperty::OnCbnSelchangeComboPortMode()
diff --git a/SourceCode/Bond/Servo/Configuration.cpp b/SourceCode/Bond/Servo/Configuration.cpp
index 8b8d49a..a2434b1 100644
--- a/SourceCode/Bond/Servo/Configuration.cpp
+++ b/SourceCode/Bond/Servo/Configuration.cpp
@@ -136,6 +136,16 @@
 	return TRUE;
 }
 
+BOOL CConfiguration::setPortType(unsigned int index, int type)
+{
+	if (index >= 4) return FALSE;
+	if (type < 1 || 7 < type) return FALSE;
+
+	static char* pszSection[] = { "Port1", "Port2", "Port3", "Port4" };
+	WritePrivateProfileString(pszSection[index], _T("Type"), std::to_string(type).c_str(), m_strFilepath);
+	return true;
+}
+
 BOOL CConfiguration::setPortCassetteType(unsigned int index, int cassetteType)
 {
 	if (index >= 4) return FALSE;
diff --git a/SourceCode/Bond/Servo/Configuration.h b/SourceCode/Bond/Servo/Configuration.h
index ea74b6a..0bf2628 100644
--- a/SourceCode/Bond/Servo/Configuration.h
+++ b/SourceCode/Bond/Servo/Configuration.h
@@ -24,6 +24,7 @@
 	int getFilterMode();
 	BOOL getPortParms(unsigned int index, BOOL& bEnable, int& type, int& mode,
 		int& cassetteType, int& transferMode, BOOL& bAutoChangeEnable);
+	BOOL setPortType(unsigned int index, int type);
 	BOOL setPortCassetteType(unsigned int index, int cassetteType);
 	BOOL setPortEnable(unsigned int index, BOOL bEnable);
 	BOOL isCompareMapsBeforeProceeding();
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index c3a438d..8530738 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -49,7 +49,7 @@
 	for (int i = 0; i < 4; i++) {
 		m_configuration.getPortParms(i, portEnable, portType, portMode,
 			cassetteType, transferMode, autoChangeEnable);
-		m_master.setPortType(i, portEnable, portType, portMode, cassetteType,
+		m_master.setPortTypeEx(i, portEnable, portType, portMode, cassetteType,
 			transferMode, autoChangeEnable);
 
 		int seed = m_configuration.getPortCassetteSnSeed(i + 1);
@@ -57,6 +57,12 @@
 	}
 }
 
+void CModel::setPortType(unsigned int index, SERVO::PortType type)
+{
+	m_master.setPortType(index, (int)type);
+	m_configuration.setPortType(index, (int)type);
+}
+
 void CModel::setPortCassetteType(unsigned int index, SERVO::CassetteType type)
 {
 	m_master.setPortCassetteType(index, type);
diff --git a/SourceCode/Bond/Servo/Model.h b/SourceCode/Bond/Servo/Model.h
index 98f5e49..e1b1563 100644
--- a/SourceCode/Bond/Servo/Model.h
+++ b/SourceCode/Bond/Servo/Model.h
@@ -15,6 +15,7 @@
 	SERVO::CMaster& getMaster();
 	void setWorkDir(const char* pszWorkDir);
 	void loadPortParams();
+	void setPortType(unsigned int index, SERVO::PortType type);;
 	void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
 	void setPortEnable(unsigned int index, BOOL bEnable);
 	int init();
diff --git a/SourceCode/Bond/Servo/ProcessJob.cpp b/SourceCode/Bond/Servo/ProcessJob.cpp
index e58845b..184b298 100644
--- a/SourceCode/Bond/Servo/ProcessJob.cpp
+++ b/SourceCode/Bond/Servo/ProcessJob.cpp
@@ -466,4 +466,44 @@
 
         return nullptr;
     }
+
+    void CProcessJob::setLotId(std::string strLotId)
+    {
+        m_strLotId = strLotId;
+    }
+
+    std::string& CProcessJob::getLotId()
+    {
+        return m_strLotId;
+    }
+
+    void CProcessJob::setProductId(std::string strProductId)
+    {
+        m_strProductId = strProductId;
+    }
+
+    std::string& CProcessJob::getProductId()
+    {
+        return m_strProductId;
+    }
+
+    void CProcessJob::setOperationId(std::string strOperationId)
+    {
+        m_strOperationId = strOperationId;
+    }
+
+    std::string& CProcessJob::getOperationId()
+    {
+        return m_strOperationId;
+    }
+
+    void CProcessJob::setPjWarp(PJWarp pjWarp)
+    {
+        m_pjWarp = pjWarp;
+    }
+
+    PJWarp& CProcessJob::getPjWarp()
+    {
+        return m_pjWarp;
+    }
 }
diff --git a/SourceCode/Bond/Servo/ProcessJob.h b/SourceCode/Bond/Servo/ProcessJob.h
index 35fd2da..bbc8926 100644
--- a/SourceCode/Bond/Servo/ProcessJob.h
+++ b/SourceCode/Bond/Servo/ProcessJob.h
@@ -8,6 +8,16 @@
 #include <chrono>
 #include <optional>
 
+
+
+struct PJWarp {
+    BOOL addToCj;
+    void* pj;
+    int port;
+    BOOL checkSlot[8];
+    int material[8];
+};
+
 namespace SERVO {
     /// PJ 生命周期(贴近 E40 常见状态)
     enum class PJState : uint8_t {
@@ -215,6 +225,22 @@
 
         // 错误列表
         std::vector<ValidationIssue> m_issues;
+
+        // 新增
+        std::string m_strLotId;
+        std::string m_strProductId;
+        std::string m_strOperationId;
+        PJWarp m_pjWarp;
+
+    public:
+        void setLotId(std::string strLotId);
+        std::string& getLotId();
+        void setProductId(std::string strProductId);
+        std::string& getProductId();
+        void setOperationId(std::string strOperationId);
+        std::string& getOperationId();
+        void setPjWarp(PJWarp pjWarp);
+        PJWarp& getPjWarp();
     };
 }
 
diff --git a/SourceCode/Bond/x64/Debug/EqsGraph.ini b/SourceCode/Bond/x64/Debug/EqsGraph.ini
index 3cafc72..8a58491 100644
--- a/SourceCode/Bond/x64/Debug/EqsGraph.ini
+++ b/SourceCode/Bond/x64/Debug/EqsGraph.ini
@@ -1,6 +1,6 @@
 [LoadPort 1]
 Left=23
-Top=88
+Top=87
 [LoadPort 2]
 Left=23
 Top=437

--
Gitblit v1.9.3