| | |
| | | ASSERT(m_pEquipment); |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | SERVO::CGlass* pGlass = m_pEquipment->getGlassFromSlot(i+1); |
| | | pGlass->addRef(); |
| | | |
| | | SERVO::CGlass* pBuddy = pGlass->getBuddy(); |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)pGlass); |
| | | m_listCtrl.SetItemText(index, 1, pGlass->getID().c_str()); |
| | | if (pBuddy != nullptr) { |
| | | m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str()); |
| | | if (pGlass != nullptr) { |
| | | pGlass->addRef(); |
| | | SERVO::CGlass* pBuddy = pGlass->getBuddy(); |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)pGlass); |
| | | m_listCtrl.SetItemText(index, 1, pGlass->getID().c_str()); |
| | | if (pBuddy != nullptr) { |
| | | m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | unsigned CMaster::DispatchProc() |
| | | { |
| | | // åç§æºå¨ |
| | | CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1); |
| | | CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2); |
| | | CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER); |
| | | CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE); |
| | | CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER); |
| | | |
| | | ASSERT(pLoadPort1); |
| | | ASSERT(pLoadPort2); |
| | | ASSERT(pFliper); |
| | | ASSERT(pVacuumBack); |
| | | ASSERT(pAligner); |
| | | |
| | | while (1) { |
| | | // å¾
éåºä¿¡å·ææ¶é´å° |
| | | HANDLE hEvents[] = { m_hEventDispatchThreadExit[0], m_hDispatchEvent }; |
| | |
| | | // è°åº¦é»è¾å¤ç |
| | | else if (m_state == MASTERSTATE::RUNNING) { |
| | | unlock(); |
| | | LOGI("è°åº¦å¤çä¸..."); |
| | | // LOGI("è°åº¦å¤çä¸..."); |
| | | |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | unlock(); |
| | | // æ£æµå°å½åææ£å¨ä¸åçä»»å¡ï¼ç¡®ä¿å½åä»»å¡å®ææä¸æ¢åç»§ç» |
| | | LOGI("æ£æµå°å½åææ£å¨ä¸åçä»»å¡ï¼ç¡®ä¿å½åä»»å¡å®ææä¸æ¢åç»§ç»..."); |
| | | // LOGI("æ£æµå°å½åææ£å¨ä¸åçä»»å¡ï¼ç¡®ä¿å½åä»»å¡å®ææä¸æ¢åç»§ç»..."); |
| | | continue; |
| | | } |
| | | |
| | | // LoadPort -> Fliper(G2) |
| | | CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1); |
| | | CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2); |
| | | CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER); |
| | | CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE); |
| | | ASSERT(pLoadPort1); |
| | | ASSERT(pLoadPort2); |
| | | ASSERT(pFliper); |
| | | ASSERT(pVacuumBack); |
| | | |
| | | m_pActiveRobotTask = createTransferTask(pLoadPort1, pFliper); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | LOGI("å建æ°ä»»å¡1<%s>...", strDescription.c_str()); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | LOGI("å建æ°ä»»å¡2<%s>...", strDescription.c_str()); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // Fliper(G2) -> Aligner |
| | | // VacuumBake(G1) -> Aligner |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pAligner); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBack, pAligner); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | |
| | | // Fliper(G2) -> Aligner |
| | | |
| | | |
| | | // VacuumBake(G1) -> Aligner |
| | | |
| | | |
| | | // Aligner -> Bonder |
| | |
| | | lock(); |
| | | delete m_pActiveRobotTask; |
| | | m_pActiveRobotTask = nullptr; |
| | | |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0); |
| | | } |
| | | } |
| | | unlock(); |
| | | } |
| | |
| | | typedef std::function<void(void* pMaster, CEquipment* pEquipment, int state, int alarmId, int unitId, int level)> ONEQALARM; |
| | | typedef std::function<void(void* pMaster, CEquipment* pEquipment, CVcrEventReport* pReport)> ONEQVCREVENTREPORT; |
| | | typedef std::function<void(void* pMaster, CEquipment* pEquipment, int code)> ONEQDATACHANGED; |
| | | typedef std::function<void(void* pMaster, CRobotTask* pTask, int code)> ONROBOTTASKEVENT; |
| | | typedef struct _MasterListener |
| | | { |
| | | ONMASTERSTATECHANGED onMasterStateChanged; |
| | |
| | | ONEQALARM onEqAlarm; |
| | | ONEQVCREVENTREPORT onEqVcrEventReport; |
| | | ONEQDATACHANGED onEqDataChanged; |
| | | ONROBOTTASKEVENT onRobotTaskEvent; |
| | | } MasterListener; |
| | | |
| | | class CMaster |
| | |
| | | m_brBkgnd.DeleteObject(); |
| | | } |
| | | |
| | | m_crBkgnd = color; |
| | | m_brBkgnd.CreateSolidBrush(color); |
| | | m_btnCurTask.SetFaceColor(m_crBkgnd); |
| | | m_btnCurTask.SetFrameColor(m_crBkgnd); |
| | | m_btnCurTask.SetFrameColor(BS_HOVER, CColorTransfer::ApproximateColor(m_crBkgnd, 0.05)); |
| | | m_btnCurTask.SetFrameColor(BS_PRESS, CColorTransfer::ApproximateColor(m_crBkgnd, 0.12)); |
| | | m_btnCurTask.SetBkgndColor(BS_HOVER, CColorTransfer::ApproximateColor(m_crBkgnd, 0.05)); |
| | | m_btnCurTask.SetBkgndColor(BS_PRESS, CColorTransfer::ApproximateColor(m_crBkgnd, 0.12)); |
| | | |
| | | Invalidate(); |
| | | UpdateWindow(); |
| | | } |
| | |
| | | void CMyStatusbar::setForegroundColor(COLORREF cr) |
| | | { |
| | | m_crForeground = cr; |
| | | m_btnCurTask.SetTextColor(m_crForeground); |
| | | |
| | | Invalidate(); |
| | | UpdateWindow(); |
| | | } |
| | |
| | | SetDlgItemText(IDC_LABEL_RUNTIME, pszText); |
| | | } |
| | | |
| | | void CMyStatusbar::setCurTaskBtnText(const char* pszText) |
| | | { |
| | | SetDlgItemText(IDC_BUTTON_ROBOTTASK, pszText); |
| | | } |
| | | |
| | | BOOL CMyStatusbar::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | |
| | | m_btnCurTask.SubclassDlgItem(IDC_BUTTON_ROBOTTASK, this); |
| | | // m_btnCurTask.SetIcon(hIcon1, hIcon1, 24); |
| | | m_btnCurTask.SetFaceColor(m_crBkgnd); |
| | | m_btnCurTask.SetFrameColor(m_crBkgnd); |
| | | m_btnCurTask.SetFrameColor(BS_HOVER, RGB(218, 218, 218)); |
| | | m_btnCurTask.SetFrameColor(BS_PRESS, RGB(168, 168, 168)); |
| | | |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | BOOL CMyStatusbar::OnCommand(WPARAM wParam, LPARAM lParam) |
| | | { |
| | | CWnd* pItem; |
| | | CRect rcItem; |
| | | |
| | | switch (LOWORD(wParam)) { |
| | | case IDC_BUTTON_ROBOTTASK: |
| | | pItem = GetDlgItem(IDC_BUTTON_ROBOTTASK); |
| | | pItem->GetWindowRect(rcItem); |
| | | GetParent()->SendMessage(ID_MSG_STATUSBAR_BTN_CLICKED, rcItem.left, LOWORD(wParam)); |
| | | break; |
| | | } |
| | | |
| | | return CDialogEx::OnCommand(wParam, lParam); |
| | | } |
| | | |
| | | void CMyStatusbar::OnSize(UINT nType, int cx, int cy) |
| | | { |
| | | CDialogEx::OnSize(nType, cx, cy); |
| | |
| | | int x; |
| | | GetClientRect(&rcClient); |
| | | |
| | | x = 120; |
| | | x = 20; |
| | | pItem = GetDlgItem(IDC_LABEL_RUNTIME); |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | } |
| | | x += rcItem.Width(); |
| | | |
| | | x += 8; |
| | | pItem = GetDlgItem(IDC_LABEL_CUR_TASK_L); |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | x += rcItem.Width(); |
| | | |
| | | x += 8; |
| | | pItem = GetDlgItem(IDC_BUTTON_ROBOTTASK); |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | x += rcItem.Width(); |
| | | } |
| | |
| | | #pragma once |
| | | #include "BlButton.h" |
| | | #include "ColorTransfer.h" |
| | | |
| | | |
| | | #define ID_MSG_STATUSBAR_BTN_CLICKED WM_USER + 20398 |
| | | |
| | | // CMyStatusbar å¯¹è¯æ¡ |
| | | |
| | |
| | | void setBackgroundColor(COLORREF color); |
| | | void setForegroundColor(COLORREF cr); |
| | | void setRunTimeText(const char* pszText); |
| | | void setCurTaskBtnText(const char* pszText); |
| | | |
| | | private: |
| | | void Resize(); |
| | |
| | | COLORREF m_crForeground; |
| | | COLORREF m_crBkgnd; |
| | | CBrush m_brBkgnd; |
| | | |
| | | CBlButton m_btnCurTask; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); |
| | | }; |
| | |
| | | return strOut; |
| | | } |
| | | |
| | | std::string CRobotTask::getSimpleDescription() const |
| | | { |
| | | std::string strOut = "CRobotTask<ID:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo); |
| | | strOut = strOut + ",Arm:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.armNo); |
| | | strOut = strOut + ",GetPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getPosition); |
| | | strOut = strOut + ",GetSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo); |
| | | strOut = strOut + ",PutPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putPosition); |
| | | strOut = strOut + ",PutSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo); |
| | | strOut = strOut + ">"; |
| | | |
| | | return strOut; |
| | | } |
| | | |
| | | void CRobotTask::setContext(CContext* pContext) |
| | | { |
| | | if (pContext != nullptr) { |
| | |
| | | public: |
| | | std::string& getId(); |
| | | std::string getDescription() const; |
| | | std::string getSimpleDescription() const; |
| | | void setContext(CContext* pContext); |
| | | CContext* getContext(); |
| | | void setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CRobotTaskDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "CRobotTaskDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CRobotTaskDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CRobotTaskDlg, CDialogEx) |
| | | |
| | | CRobotTaskDlg::CRobotTaskDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_ROBOT_TASK, pParent) |
| | | { |
| | | m_pRobotTask = nullptr; |
| | | } |
| | | |
| | | CRobotTaskDlg::~CRobotTaskDlg() |
| | | { |
| | | } |
| | | |
| | | void CRobotTaskDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CRobotTaskDlg, CDialogEx) |
| | | ON_WM_CTLCOLOR() |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | ON_WM_ACTIVATE() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CRobotTaskDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | void CRobotTaskDlg::SetRobotTask(SERVO::CRobotTask* pRobotTask) |
| | | { |
| | | m_pRobotTask = pRobotTask; |
| | | |
| | | |
| | | // åæ§ä»¶æ¯å¦æ¾ç¤º; |
| | | GetDlgItem(IDC_LABEL_NO_TASK)->ShowWindow(m_pRobotTask == nullptr ? SW_SHOW : SW_HIDE); |
| | | GetDlgItem(IDC_LABEL_GET_PUT)->ShowWindow(m_pRobotTask != nullptr ? SW_SHOW : SW_HIDE); |
| | | |
| | | |
| | | if (m_pRobotTask != nullptr) { |
| | | SERVO::CEquipment* pEq1, * pEq2; |
| | | pEq1 = theApp.m_model.getMaster().getEquipment(m_pRobotTask->getSrcPosition()); |
| | | pEq2 = theApp.m_model.getMaster().getEquipment(m_pRobotTask->getTarPosition()); |
| | | |
| | | CString strText; |
| | | strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | SetDlgItemText(IDC_LABEL_GET_PUT, strText); |
| | | } |
| | | } |
| | | |
| | | BOOL CRobotTaskDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | HBRUSH CRobotTaskDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | |
| | | // TODO: 卿¤æ´æ¹ DC çä»»ä½ç¹æ§ |
| | | |
| | | // TODO: 妿é»è®¤ç䏿¯æéç»ç¬ï¼åè¿åå¦ä¸ä¸ªç»ç¬ |
| | | return hbr; |
| | | } |
| | | |
| | | |
| | | void CRobotTaskDlg::OnDestroy() |
| | | { |
| | | CDialogEx::OnDestroy(); |
| | | |
| | | // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç |
| | | } |
| | | |
| | | void CRobotTaskDlg::OnSize(UINT nType, int cx, int cy) |
| | | { |
| | | CDialogEx::OnSize(nType, cx, cy); |
| | | if (GetDlgItem(IDC_LABEL_NO_TASK) == nullptr) return; |
| | | Resize(); |
| | | } |
| | | |
| | | void CRobotTaskDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) |
| | | { |
| | | CWnd::OnActivate(nState, pWndOther, bMinimized); |
| | | |
| | | if (nState == WA_INACTIVE) { |
| | | ShowWindow(SW_HIDE); |
| | | } |
| | | } |
| | | |
| | | void CRobotTaskDlg::Resize() |
| | | { |
| | | CRect rcClient, rcItem; |
| | | CWnd* pItem; |
| | | GetClientRect(&rcClient); |
| | | |
| | | pItem = GetDlgItem(IDC_LABEL_NO_TASK); |
| | | pItem->GetClientRect(&rcItem); |
| | | pItem->MoveWindow((rcClient.Width() - rcItem.Width()) / 2, |
| | | (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | |
| | | pItem = GetDlgItem(IDC_LABEL_GET_PUT); |
| | | pItem->GetClientRect(&rcItem); |
| | | pItem->MoveWindow(12, |
| | | 12, rcItem.Width(), rcItem.Height()); |
| | | } |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CRobotTask.h" |
| | | |
| | | |
| | | // CRobotTaskDlg å¯¹è¯æ¡ |
| | | |
| | | class CRobotTaskDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CRobotTaskDlg) |
| | | |
| | | public: |
| | | CRobotTaskDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CRobotTaskDlg(); |
| | | |
| | | public: |
| | | void SetRobotTask(SERVO::CRobotTask* pRobotTask); |
| | | |
| | | private: |
| | | void Resize(); |
| | | |
| | | |
| | | private: |
| | | SERVO::CRobotTask* m_pRobotTask; |
| | | |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_ROBOT_TASK }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); |
| | | }; |
| | |
| | | #define RX_CODE_ALARM_CLEAR 1009 |
| | | #define RX_CODE_EQ_DATA_CHANGED 1010 |
| | | #define RX_CODE_MASTER_STATE_CHANGED 1011 |
| | | #define RX_CODE_EQ_ROBOT_TASK 1012 |
| | | |
| | | |
| | | /* Channel Name */ |
| | |
| | | LOGE("<CModel>onEqDataChanged."); |
| | | notifyPtr(RX_CODE_EQ_DATA_CHANGED, pEquipment); |
| | | }; |
| | | masterListener.onRobotTaskEvent = [&](void* pMaster, SERVO::CRobotTask* pTask, int code) { |
| | | notifyPtr(RX_CODE_EQ_ROBOT_TASK, pTask); |
| | | }; |
| | | m_master.setListener(masterListener); |
| | | |
| | | |
| | |
| | | <ClInclude Include="CRobotCmdTestDlg.h" /> |
| | | <ClInclude Include="CPagePortStatus.h" /> |
| | | <ClInclude Include="CPortStatusReport.h" /> |
| | | <ClInclude Include="CRobotTaskDlg.h" /> |
| | | <ClInclude Include="GridControl\CellRange.h" /> |
| | | <ClInclude Include="GridControl\GridCell.h" /> |
| | | <ClInclude Include="GridControl\GridCellBase.h" /> |
| | |
| | | <ClCompile Include="CRobotCmdTestDlg.cpp" /> |
| | | <ClCompile Include="CPagePortStatus.cpp" /> |
| | | <ClCompile Include="CPortStatusReport.cpp" /> |
| | | <ClCompile Include="CRobotTaskDlg.cpp" /> |
| | | <ClCompile Include="GridControl\GridCell.cpp" /> |
| | | <ClCompile Include="GridControl\GridCellBase.cpp" /> |
| | | <ClCompile Include="GridControl\GridCellButton.cpp" /> |
| | |
| | | <ClCompile Include="CMyStatusbar.cpp" /> |
| | | <ClCompile Include="CRobotTask.cpp" /> |
| | | <ClCompile Include="CSlot.cpp" /> |
| | | <ClCompile Include="CRobotTaskDlg.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="AlarmManager.h" /> |
| | |
| | | <ClInclude Include="CMyStatusbar.h" /> |
| | | <ClInclude Include="CRobotTask.h" /> |
| | | <ClInclude Include="CSlot.h" /> |
| | | <ClInclude Include="CRobotTaskDlg.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="Servo.rc" /> |
| | |
| | | m_pPageRecipe = nullptr; |
| | | m_pTopToolbar = nullptr; |
| | | m_pMyStatusbar = nullptr; |
| | | m_pRobotTaskDlg = nullptr; |
| | | } |
| | | |
| | | void CServoDlg::DoDataExchange(CDataExchange* pDX) |
| | |
| | | ON_MESSAGE(ID_MSG_PANEL_RESIZE, OnPanelResize) |
| | | ON_NOTIFY(BYHMTAB_SEL_CHANGED, IDC_TAB1, &CServoDlg::OnTabSelChanged) |
| | | ON_MESSAGE(ID_MSG_TOOLBAR_BTN_CLICKED, &CServoDlg::OnToolbarBtnClicked) |
| | | ON_MESSAGE(ID_MSG_STATUSBAR_BTN_CLICKED, &CServoDlg::OnStatusbarBtnClicked) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_RUNNING); |
| | | m_pMyStatusbar->setForegroundColor(RGB(255, 255, 255)); |
| | | SetTimer(TIMER_ID_UPDATE_RUMTIME, 500, nullptr); |
| | | } |
| | | } |
| | | else if (RX_CODE_EQ_ROBOT_TASK == code) { |
| | | SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask(); |
| | | if (m_pRobotTaskDlg != nullptr) { |
| | | m_pRobotTaskDlg->SetRobotTask(pTask); |
| | | } |
| | | if (pTask == nullptr) { |
| | | m_pMyStatusbar->setCurTaskBtnText("æ "); |
| | | } |
| | | else { |
| | | SERVO::CEquipment* pEq1, * pEq2; |
| | | pEq1 = theApp.m_model.getMaster().getEquipment(pTask->getSrcPosition()); |
| | | 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()); |
| | | m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | m_pMyStatusbar = nullptr; |
| | | } |
| | | |
| | | if (m_pRobotTaskDlg != nullptr) { |
| | | m_pRobotTaskDlg->DestroyWindow(); |
| | | delete m_pRobotTaskDlg; |
| | | m_pRobotTaskDlg = nullptr; |
| | | } |
| | | |
| | | if (m_pTerminalDisplayDlg != nullptr) { |
| | | m_pTerminalDisplayDlg->DestroyWindow(); |
| | | delete m_pTerminalDisplayDlg; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | LRESULT CServoDlg::OnStatusbarBtnClicked(WPARAM wParam, LPARAM lParam) |
| | | { |
| | | int id = (int)lParam; |
| | | int x = (int)wParam; |
| | | if (id == IDC_BUTTON_ROBOTTASK) { |
| | | if (m_pRobotTaskDlg == nullptr) { |
| | | m_pRobotTaskDlg = new CRobotTaskDlg(); |
| | | m_pRobotTaskDlg->Create(IDD_DIALOG_ROBOT_TASK, this); |
| | | } |
| | | |
| | | CRect rcBar; |
| | | int h = 258; |
| | | int w = 388; |
| | | m_pRobotTaskDlg->SetRobotTask(theApp.m_model.getMaster().getActiveRobotTask()); |
| | | m_pMyStatusbar->GetWindowRect(rcBar); |
| | | m_pRobotTaskDlg->MoveWindow(x, rcBar.top - h, w, h); |
| | | m_pRobotTaskDlg->ShowWindow(SW_SHOW); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | CString& CServoDlg::GetRuntimeFormatText(CString& strText, const char* pszSuffix) |
| | | { |
| | | ULONGLONG ullRunTime = (ULONGLONG)(theApp.m_model.getMaster().getRunTime() * 0.001); |
| | |
| | | #include "CPageGraph2.h" |
| | | #include "TopToolbar.h" |
| | | #include "CMyStatusbar.h" |
| | | #include "CRobotTaskDlg.h" |
| | | |
| | | |
| | | // CServoDlg å¯¹è¯æ¡ |
| | |
| | | private: |
| | | IObserver* m_pObserver; |
| | | CTerminalDisplayDlg* m_pTerminalDisplayDlg; |
| | | CRobotTaskDlg* m_pRobotTaskDlg; |
| | | CPageGraph1* m_pPageGraph1; |
| | | CPageGraph2* m_pPageGraph2; |
| | | CPageRecipe* m_pPageRecipe; |
| | | CPageAlarm* m_pPageAlarm; |
| | | CPageLog* m_pPageLog; |
| | | |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | |
| | | afx_msg LRESULT OnPanelResize(WPARAM wParam, LPARAM lParam); |
| | | afx_msg void OnTabSelChanged(NMHDR* nmhdr, LRESULT* result); |
| | | LRESULT OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam); |
| | | LRESULT OnStatusbarBtnClicked(WPARAM wParam, LPARAM lParam); |
| | | }; |