| | |
| | | #include "SystemLogManagerDlg.h" |
| | | #include "UserManager.h" |
| | | #include "SystemLogManager.h" |
| | | #include "PortConfigurationDlg.h" |
| | | #include "CHMPropertyDlg.h" |
| | | #include "CPageVarialbles.h" |
| | | #include "CPageReport.h" |
| | | #include "CPageCollectionEvent.h" |
| | | #include "CControlJobDlg.h" |
| | | #include "InputDialog.h" |
| | | #include "CControlJobManagerDlg.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | |
| | | /* 运行时间定时器 */ |
| | | #define TIMER_ID_UPDATE_RUMTIME 2 |
| | | |
| | | /* Test */ |
| | | #define TIMER_ID_TEST 3 |
| | | |
| | | |
| | | // 用于应用程序“关于”菜单项的 CAboutDlg 对话框 |
| | |
| | | m_pPanelAttributes = nullptr; |
| | | m_pPageGraph1 = nullptr; |
| | | m_pPageGraph2 = nullptr; |
| | | m_pPageGlassList = nullptr; |
| | | m_pPageAlarm = nullptr; |
| | | m_pPageLog = nullptr; |
| | | m_pPageTransferLog = nullptr; |
| | |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SETTINGS, &CServoDlg::OnUpdateMenuFileSettings) |
| | | ON_COMMAND(ID_MENU_FILE_SECSTEST, &CServoDlg::OnMenuFileSecsTest) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SECSTEST, &CServoDlg::OnUpdateMenuFileSecsTest) |
| | | ON_COMMAND(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnMenuProjectVarialbleList) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnUpdateMenuProjectVarialbleList) |
| | | ON_COMMAND(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnMenuTestMessageSet) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnUpdateMenuTestMessageSet) |
| | | ON_COMMAND(ID_MENU_TEST_MESSAGE_CLEAR, &CServoDlg::OnMenuTestMessageClear) |
| | |
| | | SERVO::MASTERSTATE state = theApp.m_model.getMaster().getState(); |
| | | if (state == SERVO::MASTERSTATE::READY) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_NORMAL); |
| | | m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0)); |
| | |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::MSERROR) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_ALARM); |
| | | m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0)); |
| | | m_pMyStatusbar->setRunTimeText("启动失败."); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(TRUE); |
| | | KillTimer(TIMER_ID_UPDATE_RUMTIME); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::RUNNING) { |
| | | else if (state == SERVO::MASTERSTATE::ATHERERROR) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_ALARM); |
| | | m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0)); |
| | | m_pMyStatusbar->setRunTimeText(theApp.m_model.getMaster().getLastErrorText().c_str()); |
| | | if (theApp.m_model.getMaster().getLastError() == ER_CODE_AOI_NG) { |
| | | AfxMessageBox(_T("AOI检测失败,请操作员介入解决问题!")); |
| | | } |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(TRUE); |
| | | KillTimer(TIMER_ID_UPDATE_RUMTIME); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::RUNNING || state == SERVO::MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER |
| | | || state == SERVO::MASTERSTATE::RUNNING_BATCH) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE); |
| | | m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_RUNNING); |
| | | m_pMyStatusbar->setForegroundColor(RGB(255, 255, 255)); |
| | |
| | | pEq2 = theApp.m_model.getMaster().getEquipment(pTask->getTarPosition()); |
| | | if (pEq1 != nullptr && pEq2 != nullptr) { |
| | | CString strText; |
| | | strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER) { |
| | | strText.Format(_T("[%d]%s --> %s"), |
| | | theApp.m_model.getMaster().getContinuousTransferCount(), |
| | | pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | } |
| | | else { |
| | | strText.Format(_T("%s --> %s"), |
| | | pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | } |
| | | m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (RX_CODE_LOADPORT_STATUS_CHANGED == code) { |
| | | SERVO::CLoadPort* pLoadPort = nullptr; |
| | | if (pAny->getPtrValue("ptr", (void*&)pLoadPort)) { |
| | | //CPortConfigurationDlg dlg; |
| | | //dlg.setCurSelPort(pLoadPort->getIndex()); |
| | | //dlg.DoModal(); |
| | | } |
| | | } |
| | | |
| | | if (RX_CODE_PASSIVE_STATUS_CHANGED == code) { |
| | | int state = 0; |
| | | pAny->getIntValue("exCode", state); |
| | | |
| | | if (STATE::NOT_CONNECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Disconnected"); |
| | | //m_labelPassiveState.setBackground(DISCONNECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(DISCONNECTED_FOREGROUND, TRUE); |
| | | } |
| | | else if (STATE::NOT_SELECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Not Selected"); |
| | | //m_labelPassiveState.setBackground(NOT_SELECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(NOT_SELECTED_FOREGROUND, TRUE); |
| | | } |
| | | else if (STATE::SELECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Selected"); |
| | | //m_labelPassiveState.setBackground(SELECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(SELECTED_FOREGROUND, TRUE); |
| | | } |
| | | } |
| | | pAny->release(); |
| | | }, [&]() -> void { |
| | | // onComplete |
| | |
| | | SetIcon(m_hIcon, FALSE); // 设置小图标 |
| | | |
| | | |
| | | // model init |
| | | theApp.m_model.init(); |
| | | SetTimer(TIMER_ID_TEST, 1000, nullptr); |
| | | |
| | | // 菜单 |
| | | CMenu menu; |
| | | menu.LoadMenu(IDR_MENU_APP); |
| | |
| | | HMENU hMenu = m_pTopToolbar->GetOperatorMenu(); |
| | | ASSERT(hMenu); |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_SWITCH, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_JOBS)->EnableWindow(TRUE); |
| | | |
| | | |
| | | // Tab |
| | | m_pPageGraph1 = new CPageGraph1(); |
| | | m_pPageGraph1->Create(IDD_PAGE_GRAPH1, this); |
| | | m_pPageGraph2 = new CPageGraph2(); |
| | | m_pPageGraph2->Create(IDD_PAGE_GRAPH2, this); |
| | | m_pPageGlassList = new CPageGlassList(); |
| | | m_pPageGlassList->Create(IDD_PAGE_GLASS_LIST, this); |
| | | m_pPageRecipe = new CPageRecipe(); |
| | | m_pPageRecipe->Create(IDD_PAGE_RECIPE, this); |
| | | m_pPageAlarm = new CPageAlarm(); |
| | |
| | | m_pTab->SetItemMarginLeft(18); |
| | | m_pTab->AddItem("״̬ͼ", FALSE); |
| | | m_pTab->AddItem("连接图", TRUE); |
| | | m_pTab->AddItem("Glass", TRUE); |
| | | m_pTab->AddItem("配方", TRUE); |
| | | m_pTab->AddItem("报警", TRUE); |
| | | m_pTab->AddItem("日志", TRUE); |
| | | m_pTab->AddItem("搬运", TRUE); |
| | | m_pTab->AddItem("搬运任务", TRUE); |
| | | m_pTab->SetCurSel(0); |
| | | m_pTab->SetBkgndColor(RGB(222, 222, 222)); |
| | | ShowChildPage(0); |
| | |
| | | int height = GetSystemMetrics(SM_CYSCREEN); |
| | | MoveWindow((width - rcWnd.Width()) / 2, 0, rcWnd.Width(), rcWnd.Height(), TRUE); |
| | | |
| | | |
| | | // model init |
| | | theApp.m_model.init(); |
| | | |
| | | |
| | | SetTimer(TIMER_ID_CREATE_TERMINAL, 3000, nullptr); |
| | |
| | | pCmdUI->Enable(TRUE); |
| | | } |
| | | |
| | | void CServoDlg::OnMenuProjectVarialbleList() |
| | | { |
| | | CHMPropertyDlg dlg(_T("Variable | Rreport | Collection Event"), 658, 788); |
| | | |
| | | CPageCollectionEvent* pPage1 = new CPageCollectionEvent(); |
| | | pPage1->Create(IDD_PAGE_COLLECTION_EVENT); |
| | | dlg.addPage(pPage1, "Event"); |
| | | |
| | | CPageReport* pPage2 = new CPageReport(); |
| | | pPage2->Create(IDD_PAGE_REPORT); |
| | | dlg.addPage(pPage2, "Report"); |
| | | |
| | | CPageVarialbles* pPage3 = new CPageVarialbles(); |
| | | pPage3->Create(IDD_PAGE_VARIABLE); |
| | | dlg.addPage(pPage3, "Variable"); |
| | | |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CServoDlg::OnUpdateMenuProjectVarialbleList(CCmdUI* pCmdUI) |
| | | { |
| | | pCmdUI->Enable(TRUE); |
| | | } |
| | | |
| | | void CServoDlg::OnMenuTestMessageSet() |
| | | { |
| | | SERVO::CEquipment* pEquipment = m_pPanelMaster->GetActiveEquipment(); |
| | |
| | | |
| | | void CServoDlg::OnMenuHelpAbout() |
| | | { |
| | | theApp.m_model.getMaster().test(); |
| | | CAboutDlg dlgAbout; |
| | | dlgAbout.DoModal(); |
| | | } |
| | |
| | | m_pPageGraph2 = nullptr; |
| | | } |
| | | |
| | | if (m_pPageGlassList != nullptr) { |
| | | m_pPageGlassList->DestroyWindow(); |
| | | delete m_pPageGlassList; |
| | | m_pPageGlassList = nullptr; |
| | | } |
| | | |
| | | if (m_pPageRecipe != nullptr) { |
| | | m_pPageRecipe->DestroyWindow(); |
| | | delete m_pPageRecipe; |
| | |
| | | if (GetDlgItem(IDC_TAB1) == nullptr) return; |
| | | if (m_pPageGraph1 == nullptr) return; |
| | | if (m_pPageGraph2 == nullptr) return; |
| | | if (m_pPageGlassList == nullptr) return; |
| | | if (m_pPageRecipe == nullptr) return; |
| | | if (m_pPageAlarm == nullptr) return; |
| | | if (m_pPageLog == nullptr) return; |
| | |
| | | |
| | | m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageGlassList->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | |
| | | m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | |
| | | else if(TIMER_ID_TEST == nIDEvent){ |
| | | static __int64 tttt = 0; |
| | | tttt++; |
| | | theApp.m_model.m_hsmsPassive.setVariableValue("CJobSpace", tttt % 10); |
| | | theApp.m_model.m_hsmsPassive.setVariableValue("PJobSpace", tttt % 5); |
| | | } |
| | | |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | | } |
| | |
| | | |
| | | void CServoDlg::ShowChildPage(int index) |
| | | { |
| | | ASSERT(0 <= index && index < 6); |
| | | static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageRecipe, m_pPageAlarm, m_pPageLog, m_pPageTransferLog }; |
| | | for (int i = 0; i < 6; i++) { |
| | | static CWnd* pPages[] = { m_pPageGraph1, m_pPageGraph2, m_pPageGlassList, |
| | | m_pPageRecipe, m_pPageAlarm, m_pPageLog, m_pPageTransferLog }; |
| | | ASSERT(0 <= index && index < sizeof(pPages) / sizeof(CWnd*)); |
| | | |
| | | for (int i = 0; i < sizeof(pPages) / sizeof(CWnd*); i++) { |
| | | pPages[i]->ShowWindow(i == index ? SW_SHOW : SW_HIDE); |
| | | } |
| | | } |
| | |
| | | LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam) |
| | | { |
| | | int id = (int)lParam; |
| | | if (id == IDC_BUTTON_RUN || id == IDC_BUTTON_STOP) { |
| | | UserRole emRole = UserManager::getInstance().getCurrentUserRole(); |
| | | if (emRole != UserRole::SuperAdmin) { |
| | | AfxMessageBox(_T("当前用户并非管理员!!!")); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | if (id == IDC_BUTTON_RUN) { |
| | | if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) { |
| | | AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!"); |
| | |
| | | else { |
| | | if (theApp.m_model.getMaster().start() == 0) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | } |
| | | else if (id == IDC_BUTTON_RUN_BATCH) { |
| | | if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) { |
| | | AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!"); |
| | | } |
| | | else { |
| | | if (theApp.m_model.getMaster().startBatch() == 0) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | } |
| | | else if (id == IDC_BUTTON_RUN_CT) { |
| | | if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) { |
| | | AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!"); |
| | | } |
| | | else { |
| | | if (theApp.m_model.getMaster().startContinuousTransfer() == 0) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_BATCH)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN_CT)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (theApp.m_model.getMaster().stop() == 0) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | } |
| | | } |
| | | else if (id == IDC_BUTTON_JOBS) { |
| | | CControlJobDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (id == IDC_BUTTON_PORT_CONFIG) { |
| | | CPortConfigurationDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (id == IDC_BUTTON_CASSETTE) { |
| | | CControlJobManagerDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (id == IDC_BUTTON_ROBOT) { |
| | | theApp.m_model.getMaster().clearError(); |
| | |
| | | dlg.DoModal(); |
| | | } |
| | | else if (id == IDC_BUTTON_SETTINGS) { |
| | | SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.m_master.getEquipment(EQ_ID_EFEM); |
| | | pEFEM->printDebugString001(); |
| | | SERVO::CEquipment* pEq = theApp.m_model.m_master.getEquipment(EQ_ID_EFEM); |
| | | ((SERVO::CEFEM*)pEq)->printDebugRobotState(); |
| | | pEq->printDebugString001(); |
| | | pEq = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder1); |
| | | pEq->printDebugString001(); |
| | | pEq = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder2); |
| | | pEq->printDebugString001(); |
| | | |
| | | } |
| | | else if (id == IDC_BUTTON_OPERATOR) { |
| | | int menuId = (int)wParam; |
| | |
| | | m_pRobotTaskDlg->MoveWindow(x, rcBar.top - h, w, h); |
| | | m_pRobotTaskDlg->ShowWindow(SW_SHOW); |
| | | } |
| | | else if (id == IDC_BUTTON_CIM) { |
| | | AfxMessageBox("IDC_BUTTON_CIM"); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | |
| | | if (state == SERVO::MASTERSTATE::RUNNING) { |
| | | strText.Format(_T("正在运行:%02d:%02d:%02d %s"), h, m, s, pszSuffix); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER) { |
| | | strText.Format(_T("千传模式:%02d:%02d:%02d %s"), h, m, s, pszSuffix); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::RUNNING_BATCH) { |
| | | strText.Format(_T("JOB模式:%02d:%02d:%02d %s"), h, m, s, pszSuffix); |
| | | } |
| | | else { |
| | | strText.Format(_T("已运行:%02d:%02d:%02d %s"), h, m, s, pszSuffix); |
| | | } |