From e5fb1e316cd9e1a85abd9c8e9a81f66990a82c6b Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期四, 12 二月 2026 14:36:05 +0800
Subject: [PATCH] 1.S1F11与S1F21对换;
---
SourceCode/Bond/Servo/CControlJobManagerDlg.cpp | 245 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 175 insertions(+), 70 deletions(-)
diff --git a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
index 2e2d92c..f5e911b 100644
--- a/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
+++ b/SourceCode/Bond/Servo/CControlJobManagerDlg.cpp
@@ -12,6 +12,65 @@
bool CControlJobManagerDlg::m_bHasState = false;
CControlJobManagerDlg::State CControlJobManagerDlg::m_state{};
+namespace {
+ constexpr int kPortCount = 4;
+ constexpr int kSlotCount = 8;
+ constexpr int kMatG1 = 1;
+ constexpr int kMatG2 = 2;
+
+ int NormalizeWarpMaterial(int material)
+ {
+ return (material == kMatG2) ? kMatG2 : kMatG1;
+ }
+
+ void EnsureWarpDefaults(PJWarp& warp)
+ {
+ bool hasSelectedPort = false;
+ for (int p = 0; p < kPortCount; ++p) {
+ if (warp.selectedPorts[p]) {
+ hasSelectedPort = true;
+ }
+ for (int s = 0; s < kSlotCount; ++s) {
+ warp.materialSlots[p][s] = NormalizeWarpMaterial(warp.materialSlots[p][s]);
+ }
+ }
+
+ for (int s = 0; s < kSlotCount; ++s) {
+ warp.material[s] = NormalizeWarpMaterial(warp.material[s]);
+ }
+
+ if (!hasSelectedPort && 0 <= warp.port && warp.port < kPortCount) {
+ warp.selectedPorts[warp.port] = TRUE;
+ for (int s = 0; s < kSlotCount; ++s) {
+ warp.checkSlots[warp.port][s] = warp.checkSlot[s];
+ warp.materialSlots[warp.port][s] = NormalizeWarpMaterial(warp.material[s]);
+ }
+ }
+
+ int firstSelectedPort = -1;
+ for (int p = 0; p < kPortCount; ++p) {
+ if (warp.selectedPorts[p]) {
+ firstSelectedPort = p;
+ break;
+ }
+ }
+ warp.port = firstSelectedPort;
+
+ if (firstSelectedPort >= 0) {
+ for (int s = 0; s < kSlotCount; ++s) {
+ warp.checkSlot[s] = warp.checkSlots[firstSelectedPort][s];
+ warp.material[s] = NormalizeWarpMaterial(warp.materialSlots[firstSelectedPort][s]);
+ }
+ }
+ else {
+ for (int s = 0; s < kSlotCount; ++s) {
+ warp.checkSlot[s] = FALSE;
+ warp.material[s] = kMatG1;
+ }
+ }
+ }
+}
+
// CControlJobManagerDlg 瀵硅瘽妗�
IMPLEMENT_DYNAMIC(CControlJobManagerDlg, CDialogEx)
@@ -373,6 +432,16 @@
PJWarp pjWarp = {};
pjWarp.pj = pj;
pjWarp.port = -1;
+ for (int s = 0; s < kSlotCount; ++s) {
+ pjWarp.material[s] = kMatG1;
+ }
+ for (int p = 0; p < kPortCount; ++p) {
+ pjWarp.selectedPorts[p] = FALSE;
+ for (int s = 0; s < kSlotCount; ++s) {
+ pjWarp.checkSlots[p][s] = FALSE;
+ pjWarp.materialSlots[p][s] = kMatG1;
+ }
+ }
m_pjWarps.push_back(pjWarp);
}
}
@@ -449,20 +518,19 @@
return;
}
-
// 鍏堝簲鐢�
for (int i = 0; i < 3; i++) {
if (m_pages[i]->IsWindowVisible()) {
int ret = m_pages[i]->OnApply();
- if (ret != 0) return ;
+ if (ret != 0) return;
}
}
GetDlgItem(IDC_BUTTON_APPLY)->EnableWindow(FALSE);
-
// 鍏堟鏌ユ暟鎹纭��
int checkCount = 0;
- for (auto item : m_pjWarps) {
+ for (auto& item : m_pjWarps) {
+ EnsureWarpDefaults(item);
if (!item.addToCj) continue;
checkCount++;
}
@@ -471,26 +539,30 @@
return;
}
-
SERVO::CLoadPort* pPorts[4];
pPorts[0] = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT1);
pPorts[1] = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT2);
pPorts[2] = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT3);
pPorts[3] = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT4);
- bool bProcessStart[] = {false, false, false, false};
+ bool bProcessStart[] = { false, false, false, false };
std::vector<SERVO::CProcessJob*> pjs;
- for (auto item : m_pjWarps) {
+ for (auto& item : m_pjWarps) {
+ EnsureWarpDefaults(item);
if (!item.addToCj) continue;
- if (item.port == -1) continue;
- BOOL bCheck = FALSE;
- for (int i = 0; i < 8; i++) {
- if (item.checkSlot[i]) {
- bCheck = TRUE;
- break;
+
+ bool hasAnyCheckedSlot = false;
+ for (int p = 0; p < kPortCount; ++p) {
+ if (!item.selectedPorts[p]) continue;
+ for (int s = 0; s < kSlotCount; ++s) {
+ if (item.checkSlots[p][s]) {
+ hasAnyCheckedSlot = true;
+ break;
+ }
}
+ if (hasAnyCheckedSlot) break;
}
- if (!bCheck) continue;
+ if (!hasAnyCheckedSlot) continue;
SERVO::CProcessJob* pScr = (SERVO::CProcessJob*)item.pj;
pScr->setPjWarp(item);
@@ -499,7 +571,7 @@
pScr->setOperationId("OperationId");
pScr->setRecipe(SERVO::RecipeMethod::NoTuning, pScr->recipeSpec());
- SERVO::CProcessJob * pj = new SERVO::CProcessJob(pScr->id());
+ SERVO::CProcessJob* pj = new SERVO::CProcessJob(pScr->id());
pj->setPjWarp(item);
pj->setLotId("LotID1");
pj->setProductId("ProductId1");
@@ -507,24 +579,35 @@
pj->setRecipe(SERVO::RecipeMethod::NoTuning, pScr->recipeSpec());
std::vector<SERVO::CarrierSlotInfo> carriers;
- SERVO::CarrierSlotInfo csi;
- csi.carrierId = pPorts[item.port]->getCassetteId();
- for (int i = 0; i < 8; i++) {
- if (item.checkSlot[i]) {
- SERVO::CGlass* pGlass = pPorts[item.port]->getGlassFromSlot(i+1);
+ for (int p = 0; p < kPortCount; ++p) {
+ if (!item.selectedPorts[p] || pPorts[p] == nullptr) {
+ continue;
+ }
+
+ SERVO::CarrierSlotInfo csi;
+ csi.carrierId = pPorts[p]->getCassetteId();
+ for (int s = 0; s < kSlotCount; ++s) {
+ if (!item.checkSlots[p][s]) continue;
+ SERVO::CGlass* pGlass = pPorts[p]->getGlassFromSlot(s + 1);
if (pGlass != nullptr) {
- csi.slots.push_back(i + 1);
+ csi.slots.push_back(s + 1);
}
}
+ if (!csi.slots.empty()) {
+ carriers.push_back(csi);
+ bProcessStart[p] = true;
+ }
}
- carriers.push_back(csi);
+
+ if (carriers.empty()) {
+ delete pj;
+ continue;
+ }
+
pj->setCarriers(carriers);
pjs.push_back(pj);
- bProcessStart[item.port] = true;
-
m_pControlJob->addPJ(pScr->id());
}
-
if (pjs.empty()) {
AfxMessageBox(_T("娌℃湁闇�瑕佽繘琛屽伐鑹哄鐞嗙殑Process Job!\n鍙兘鏈�夋嫨Port鎴栭�夋嫨浠讳綍鐗╂枡銆�"));
@@ -534,15 +617,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 +633,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) {
@@ -583,70 +666,92 @@
return;
}
+ // 鎴愬姛鍚庡悓姝ュ埌 slot 鐨� glass
+ for (auto& warp : m_pjWarps) {
+ EnsureWarpDefaults(warp);
+ if (!warp.addToCj) continue;
- // 鎴愬姛锛岃鍒ゆ柇锛屽悓姝ュ埌slot鐨刧lass涓紝绫诲瀷绛�
- 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::CProcessJob* pj = (SERVO::CProcessJob*)warp.pj;
+ int nRecipeID = RecipeManager::getInstance().getIdByPPID(pj->recipeSpec());
+ RecipeInfo stRecipeInfo = RecipeManager::getInstance().getRecipeByPPID(pj->recipeSpec());
+ std::vector<DeviceRecipe> vecRecipeInfo = stRecipeInfo.vecDeviceList;
- 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());
- 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]));
+ for (int p = 0; p < kPortCount; ++p) {
+ if (!warp.selectedPorts[p]) continue;
+ SERVO::CLoadPort* pLoadPort = pPorts[p];
+ if (pLoadPort == nullptr) continue;
+
+ for (int s = 0; s < SLOT_MAX; ++s) {
+ SERVO::CSlot* pSlot = pLoadPort->getSlot(s);
+ 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;
+
+ const BOOL checked = (s < kSlotCount) ? warp.checkSlots[p][s] : FALSE;
+ const int mat = (s < kSlotCount) ? NormalizeWarpMaterial(warp.materialSlots[p][s]) : kMatG1;
+ pGlass->setScheduledForProcessing(checked);
+ pGlass->setType(static_cast<SERVO::MaterialsType>(mat));
+
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->setMaterialsType(mat);
pJobDataS->setMasterRecipe(nRecipeID);
for (const auto& info : vecRecipeInfo) {
const std::string& name = info.strDeviceName;
- short nRecipeID = (short)info.nRecipeID;
-
+ short nDeviceRecipeID = (short)info.nRecipeID;
if (name == EQ_NAME_EFEM) {
- pJobDataS->setDeviceRecipeId(0, nRecipeID);
+ pJobDataS->setDeviceRecipeId(0, nDeviceRecipeID);
}
else if (name == EQ_NAME_BONDER1) {
- pJobDataS->setDeviceRecipeId(1, nRecipeID);
+ pJobDataS->setDeviceRecipeId(1, nDeviceRecipeID);
}
else if (name == EQ_NAME_BONDER2) {
- pJobDataS->setDeviceRecipeId(2, nRecipeID);
+ pJobDataS->setDeviceRecipeId(2, nDeviceRecipeID);
}
else if (name == EQ_NAME_BAKE_COOLING) {
- pJobDataS->setDeviceRecipeId(3, nRecipeID);
+ pJobDataS->setDeviceRecipeId(3, nDeviceRecipeID);
}
else if (name == EQ_NAME_VACUUMBAKE) {
- pJobDataS->setDeviceRecipeId(4, nRecipeID);
+ pJobDataS->setDeviceRecipeId(4, nDeviceRecipeID);
}
else if (name == EQ_NAME_MEASUREMENT) {
- pJobDataS->setDeviceRecipeId(5, nRecipeID);
+ pJobDataS->setDeviceRecipeId(5, nDeviceRecipeID);
}
}
}
}
}
-
// process start
- for (int p = 0; p < 4; p++) {
- if (bProcessStart[p]) {
- pPorts[p]->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr);
- Sleep(100);
+ for (int p = 0; p < kPortCount; p++) {
+ if (!bProcessStart[p]) continue;
+ if (pPorts[p] == nullptr) continue;
+
+ short jobExistence[12] = { 0 };
+ short slotProcess = 0;
+ const short scanMap = pPorts[p]->getScanCassetteMap();
+ if (scanMap != 0) {
+ jobExistence[0] = scanMap;
+ slotProcess = scanMap;
}
+
+ bool hasExistence = false;
+ for (short w : jobExistence) {
+ if (w != 0) { hasExistence = true; break; }
+ }
+ if (!hasExistence) {
+ LOGE("ProcessStart blocked (ControlJob): no JobExistence map (port=%d, portStatus=%d, scanMap=%d).",
+ p + 1, pPorts[p]->getPortStatus(), scanMap);
+ continue;
+ }
+ pPorts[p]->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, 0, nullptr, nullptr);
+ Sleep(100);
}
}
+
--
Gitblit v1.9.3