1.ControlJob和ProcessJob的中断操作,强制结批增加字符串描述原因,方便生产跟踪。
| | |
| | | m_grid.SetPortInfo(3, _T("Port 4"), _T("")); |
| | | |
| | | |
| | | // 测试数据 |
| | | char szBuffer[256]; |
| | | for (int port = 0; port < 4; port++) { |
| | | for (int slot = 0; slot < 8; slot++) { |
| | | sprintf_s(szBuffer, 256, "Gls%04d%04d", port + 1, slot + 1); |
| | | m_grid.SetSlotGlass(port, slot, TRUE, szBuffer, CCarrierSlotGrid::MAT_G1); |
| | | } |
| | | } |
| | | |
| | | UpdatePjData(); |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // 读取出真实数据 |
| | | 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]); |
| | | m_grid.SetPortInfo(p, |
| | | (std::string("Port ") + std::to_string(p+1)).c_str(), |
| | | pPort->getCassetteId().c_str() |
| | | ); |
| | | for (int i = 0; i < SLOT_MAX; ++i) { |
| | | SERVO::CSlot* pSlot = pPort->getSlot(i); |
| | | if (!pSlot) { |
| | | continue; |
| | | } |
| | | |
| | | // 设置 Panel ID |
| | | SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext()); |
| | | SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS(); |
| | | if (pGlass != nullptr && pJobDataS != nullptr) { |
| | | m_grid.SetSlotGlass(p, i, TRUE, |
| | | pGlass->getID().c_str(), |
| | | m_pjWarps[p].material[i]); |
| | | } |
| | | else { |
| | | m_grid.SetSlotGlass(p, i, FALSE, nullptr, CCarrierSlotGrid::MAT_G1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 设置勾选数据 |
| | | if (portIndex != -1) { |
| | | for (int i = 0; i < 8; i++) { |
| | | m_grid.SetSlotChecked(portIndex, i, ((PJWarp*)m_pContext)->checkSlot[i]); |
| | | m_grid.SetSlotMaterialType(portIndex, i, ((PJWarp*)m_pContext)->material[i]); |
| | | // m_grid.SetSlotMaterialType(portIndex, i, ((PJWarp*)m_pContext)->material[i]); |
| | | } |
| | | } |
| | | |
| | |
| | | return m_issues; |
| | | } |
| | | |
| | | void CControlJob::clearIssues() |
| | | { |
| | | m_issues.clear(); |
| | | } |
| | | |
| | | bool CControlJob::validateForCreate( |
| | | const std::function<bool(uint32_t& code, std::string& msg)>& canCreateCjFn, |
| | | const std::function<bool(const std::string&)>& getPjExistsFn, |
| | |
| | | return true; |
| | | } |
| | | |
| | | bool CControlJob::abort() { |
| | | bool CControlJob::abort(std::string reason) { |
| | | if (m_state == CJState::Completed || m_state == CJState::Aborted || m_state == CJState::Failed) |
| | | return false; |
| | | m_failReason = trimCopy(reason); |
| | | clampString(m_failReason, 128); |
| | | m_state = CJState::Aborted; |
| | | markEnd(); |
| | | return true; |
| | |
| | | const std::function<bool(const std::string&)>& canJoinFn |
| | | ); |
| | | const std::vector<ValidationIssue>& CControlJob::issues(); |
| | | void clearIssues(); |
| | | |
| | | // —— S14F9 → S14F10 的“应用结果”模型 —— // |
| | | struct CreateRequest { |
| | |
| | | bool pause(); // Executing -> Paused |
| | | bool resume(); // Paused -> Executing |
| | | bool complete(); // Executing/Paused -> Completed |
| | | bool abort(); // 非终态 -> Aborted |
| | | bool abort(std::string reason); // 非终态 -> Aborted |
| | | bool fail(std::string reason); // 任意 -> Failed |
| | | |
| | | const std::string& failReason() const noexcept { return m_failReason; } |
| | |
| | | |
| | | BEGIN_MESSAGE_MAP(CControlJobDlg, CDialogEx) |
| | | ON_WM_SIZE() |
| | | ON_BN_CLICKED(IDC_BUTTON_COMPLETION_BATH, &CControlJobDlg::OnBnClickedButtonCompletionBath) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | |
| | | // 控件状态 |
| | | Resize(); |
| | | ShowGroup1(m_pControlJob == nullptr); |
| | | ShowGroup2(m_pControlJob != nullptr); |
| | | LoadData(); |
| | | |
| | | // 如果m_pControlJob为空,取master的 |
| | | auto* cj = m_pControlJob; |
| | | if (cj == nullptr) { |
| | | cj = theApp.m_model.getMaster().getControlJob(); |
| | | } |
| | | |
| | | ShowGroup1(cj == nullptr); |
| | | ShowGroup2(cj != nullptr); |
| | | GetDlgItem(IDC_BUTTON_COMPLETION_BATH)->EnableWindow(cj != nullptr); |
| | | LoadData(cj); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 异常: OCX 属性页应返回 FALSE |
| | |
| | | GetDlgItem(IDC_LIST1)->ShowWindow(bShow ? SW_SHOW : SW_HIDE); |
| | | } |
| | | |
| | | void CControlJobDlg::LoadData() |
| | | void CControlJobDlg::LoadData(SERVO::CControlJob* pControlJob) |
| | | { |
| | | m_listCtrl.DeleteAllItems(); |
| | | m_listCtrl.ClearTree(); |
| | | if (pControlJob == nullptr) return; |
| | | |
| | | if (m_pControlJob != nullptr) { |
| | | auto* root1 = m_listCtrl.InsertRoot({ m_pControlJob->id().c_str(), _T("ControlJob"), |
| | | m_pControlJob->getStateText().c_str(), _T("") }); |
| | | auto pjs = m_pControlJob->getPjs(); |
| | | for (auto pj : pjs) { |
| | | auto* root2 = m_listCtrl.InsertChild(root1, {pj->id().c_str(), _T("ProcessJob"), |
| | | pj->getStateText().c_str(), pj->recipeSpec().c_str(), _T(""), _T(""), _T("") }); |
| | | auto cs = pj->carriers(); |
| | | for (auto c : cs) { |
| | | for (auto g : c.contexts) { |
| | | SERVO::CGlass* pGlass = (SERVO::CGlass*)g; |
| | | if (pGlass != nullptr) { |
| | | int port, slot; |
| | | pGlass->getOrginPort(port, slot); |
| | | std::string carrier = c.carrierId + " / Port" + std::to_string(port + 1) + " / Slot" + std::to_string(slot + 1); |
| | | m_listCtrl.InsertChild(root2, { pGlass->getID().c_str(), _T("Glass"), |
| | | pGlass->getStateText().c_str(), _T(""), carrier.c_str(), _T("") }); |
| | | } |
| | | else { |
| | | m_listCtrl.InsertChild(root2, { "Null", _T("Glass"), _T(""), _T(""), c.carrierId.c_str(), _T("") }); |
| | | } |
| | | auto* root1 = m_listCtrl.InsertRoot({ pControlJob->id().c_str(), _T("ControlJob"), |
| | | pControlJob->getStateText().c_str(), _T(""), _T(""), pControlJob->failReason().c_str()}); |
| | | auto pjs = pControlJob->getPjs(); |
| | | for (auto pj : pjs) { |
| | | auto* root2 = m_listCtrl.InsertChild(root1, {pj->id().c_str(), _T("ProcessJob"), |
| | | pj->getStateText().c_str(), pj->recipeSpec().c_str(), _T(""), pj->failReason().c_str()}); |
| | | auto cs = pj->carriers(); |
| | | for (auto c : cs) { |
| | | for (auto g : c.contexts) { |
| | | SERVO::CGlass* pGlass = (SERVO::CGlass*)g; |
| | | if (pGlass != nullptr) { |
| | | int port, slot; |
| | | pGlass->getOrginPort(port, slot); |
| | | std::string carrier = c.carrierId + " / Port" + std::to_string(port + 1) + " / Slot" + std::to_string(slot + 1); |
| | | m_listCtrl.InsertChild(root2, { pGlass->getID().c_str(), _T("Glass"), |
| | | pGlass->getStateText().c_str(), _T(""), carrier.c_str(), _T("") }); |
| | | } |
| | | else { |
| | | m_listCtrl.InsertChild(root2, { "Null", _T("Glass"), _T(""), _T(""), c.carrierId.c_str(), _T("") }); |
| | | } |
| | | } |
| | | root2->expanded = true; |
| | | } |
| | | root1->expanded = true; |
| | | |
| | | |
| | | m_listCtrl.RebuildVisible(); |
| | | root2->expanded = true; |
| | | } |
| | | root1->expanded = true; |
| | | m_listCtrl.RebuildVisible(); |
| | | } |
| | | |
| | | void CControlJobDlg::OnBnClickedButtonCompletionBath() |
| | | { |
| | | if (theApp.m_model.getMaster().completeControlJob("测试手动结批")) { |
| | | AfxMessageBox("结批完成"); |
| | | } |
| | | |
| | | auto* cj = m_pControlJob; |
| | | if (cj == nullptr) { |
| | | cj = theApp.m_model.getMaster().getControlJob(); |
| | | } |
| | | |
| | | ShowGroup1(cj == nullptr); |
| | | ShowGroup2(cj != nullptr); |
| | | GetDlgItem(IDC_BUTTON_COMPLETION_BATH)->EnableWindow(cj != nullptr); |
| | | LoadData(cj); |
| | | } |
| | |
| | | void Resize(); |
| | | void ShowGroup1(BOOL bShow); |
| | | void ShowGroup2(BOOL bShow); |
| | | void LoadData(); |
| | | void LoadData(SERVO::CControlJob* pControlJob); |
| | | |
| | | private: |
| | | SERVO::CControlJob* m_pControlJob; |
| | |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | afx_msg void OnBnClickedButtonCompletionBath(); |
| | | }; |
| | |
| | | #include "CControlJobManagerDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "ToolUnits.h" |
| | | #include "RecipeManager.h" |
| | | |
| | | |
| | | bool CControlJobManagerDlg::m_bHasState = false; |
| | |
| | | |
| | | void CControlJobManagerDlg::OnBnClickedButtonBathCompletion() |
| | | { |
| | | // 先检查当前master |
| | | auto& master = theApp.m_model.getMaster(); |
| | | if (!master.canCreateControlJob()) { |
| | | AfxMessageBox("当前Master有未结批的Job, 请先结批处理"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 先应用 |
| | | for (int i = 0; i < 3; i++) { |
| | | if (m_pages[i]->IsWindowVisible()) { |
| | |
| | | |
| | | |
| | | |
| | | 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; |
| | |
| | | } |
| | | 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); |
| | |
| | | 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的glass中,类型等 |
| | | 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("断点检查一下数据"); |
| | | } |
| | |
| | | return nullptr; |
| | | } |
| | | |
| | | |
| | | bool CMaster::completeControlJob(std::string description) |
| | | { |
| | | if (m_pControlJob == nullptr || m_state != SERVO::MASTERSTATE::READY) { |
| | | return false; |
| | | } |
| | | for (auto item : m_processJobs) { |
| | | item->abort(description); |
| | | } |
| | | m_pControlJob->abort(description); |
| | | |
| | | |
| | | // 释放Job相关 |
| | | for (auto item : m_processJobs) { |
| | | delete item; |
| | | } |
| | | m_processJobs.clear(); |
| | | if (m_pControlJob != nullptr) { |
| | | delete m_pControlJob; |
| | | m_pControlJob = nullptr; |
| | | } |
| | | |
| | | saveState(); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CMaster::canCreateControlJob() |
| | | { |
| | | return m_pControlJob == nullptr; |
| | |
| | | bool checkAndUpdatePjComplete(CProcessJob* pJob); |
| | | bool checkAndUpdateCjComplete(CControlJob* pJob); |
| | | CProcessJob* getGlassProcessJob(CGlass* pGlass); |
| | | bool completeControlJob(std::string description); |
| | | bool canCreateControlJob(); |
| | | bool canCompleteControlJob(); |
| | | bool canDeleteControlJob(); |
| | |
| | | return true; |
| | | } |
| | | |
| | | bool CProcessJob::abort() { |
| | | bool CProcessJob::abort(std::string reason) { |
| | | if (m_state == PJState::Completed || m_state == PJState::Aborted || m_state == PJState::Failed) |
| | | return false; |
| | | m_failReason = trimCopy(reason); |
| | | clampString(m_failReason, 128); |
| | | m_state = PJState::Aborted; |
| | | markEnd(); |
| | | return true; |
| | |
| | | bool pause(); // InProcess -> Paused |
| | | bool resume(); // Paused -> InProcess |
| | | bool complete(); // InProcess -> Completed |
| | | bool abort(); // Any (未终态) -> Aborted |
| | | bool abort(std::string reason); // Any (未终态) -> Aborted |
| | | bool fail(std::string reason); // 任意态 -> Failed(记录失败原因) |
| | | |
| | | // —— 访问器(用于上报/查询)—— |
| | |
| | | <RemoteDebuggerCommand>\\DESKTOP-IODBVIQ\Servo\Debug\Servo.exe</RemoteDebuggerCommand> |
| | | <RemoteDebuggerWorkingDirectory>\\DESKTOP-IODBVIQ\Servo\Debug\</RemoteDebuggerWorkingDirectory> |
| | | <RemoteDebuggerServerName>DESKTOP-IODBVIQ</RemoteDebuggerServerName> |
| | | <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> |
| | | <DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | } |
| | | else { |
| | | CControlJobDlg dlg; |
| | | dlg.SetControlJob(theApp.m_model.m_master.getControlJob()); |
| | | dlg.DoModal(); |
| | | } |
| | | } |