| | |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | return 0; |
| | |
| | | |
| | | CEquipment::CEquipment() : m_nID(0), m_strName(""), m_strDescription(""), m_station(0, 255) |
| | | { |
| | | m_bEnable = TRUE; |
| | | m_listener = { }; |
| | | m_alive = { FALSE, 0, FALSE }; |
| | | m_bCimState = FALSE; |
| | |
| | | m_outputPins.clear(); |
| | | |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | void CEquipment::SetEnable(BOOL bEnable) |
| | | { |
| | | m_bEnable = bEnable; |
| | | } |
| | | |
| | | BOOL CEquipment::IsEnabled() const |
| | | { |
| | | return m_bEnable; |
| | | } |
| | | |
| | | void CEquipment::setListener(EquipmentListener listener) |
| | |
| | | // EQ Job Event |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS1, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS2, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS3, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_RECIVE_JOB_UPS4, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_SENT_OUT_JOB_DOWNS1, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_SENT_OUT_JOB_DOWNS2, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_SENT_OUT_JOB_DOWNS3, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_SENT_OUT_JOB_DOWNS4, pszData, size); |
| | | |
| | | // Store Job Report #1~15 |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_STORE_JOB_REPORT1, pszData, size); |
| | |
| | | if (m_slot[i].isLock()) continue; |
| | | if (!m_slot[i].isEmpty()) continue; |
| | | |
| | | int lsPath = m_slot[i].getLinkSignalPath(); |
| | | if (!m_bLinkSignalToDownstream[lsPath][SIGNAL_UPSTREAM_INLINE] |
| | | || m_bLinkSignalToDownstream[lsPath][SIGNAL_UPSTREAM_TROUBLE] |
| | | || !m_bLinkSignalToDownstream[lsPath][SIGNAL_INTERLOCK] |
| | | || !m_bLinkSignalToDownstream[lsPath][SIGNAL_RECEIVE_ABLE]) continue; |
| | | |
| | | MaterialsType slotType = m_slot[i].getType(); |
| | | if (type == MaterialsType::G1 && slotType == MaterialsType::G2) continue; |
| | | if (type == MaterialsType::G2 && slotType == MaterialsType::G1) continue; |
| | |
| | | virtual ~CEquipment(); |
| | | |
| | | public: |
| | | void SetEnable(BOOL bEnable); |
| | | BOOL IsEnabled() const; |
| | | virtual const char* getClassName() = 0; |
| | | virtual void setListener(EquipmentListener listener); |
| | | void setCcLink(CCCLinkIEControl* pCcLink); |
| | |
| | | void setProcessState(PROCESS_STATE state); |
| | | |
| | | protected: |
| | | BOOL m_bEnable; |
| | | EquipmentListener m_listener; |
| | | int m_nID; |
| | | std::string m_strName; |
| | |
| | | MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/, |
| | | int armNo/* = 1*/) |
| | | { |
| | | if (!pSrcEq->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | | CSlot* pSrcSlot, * pTarSlot; |
| | | pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType); |
| | |
| | | |
| | | CRobotTask* CMaster::createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq) |
| | | { |
| | | if (!pSrcEq->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<int> slots = {1, 3}; |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | |
| | | |
| | | CRobotTask* CMaster::createTransferTask_bake_to_cooling(CEquipment* pSrcEq) |
| | | { |
| | | if (!pSrcEq->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<int> slotsTar = { 2, 4 }; |
| | | std::vector<int> slotsSrc = { 1, 3 }; |
| | | |
| | |
| | | |
| | | CRobotTask* CMaster::createTransferTask_bakecooling_to_measurement(CEquipment* pSrcEq, CEquipment* pTarEq) |
| | | { |
| | | if (!pSrcEq->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<int> slots = { 2, 4 }; |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | |
| | | |
| | | CRobotTask* CMaster::createTransferTask_restore(CEquipment* pEqSrc, CLoadPort** pPorts) |
| | | { |
| | | if (!pEqSrc->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | | CSlot* pSrcSlot, * pTarSlot = nullptr, * pTempSlot; |
| | | pSrcSlot = pEqSrc->getInspFailSlot(); |
| | |
| | | // 定时器 |
| | | #define TIMER_ID_DEVICE_STATUS 1 // 用于初始化设备状态 |
| | | #define TIMER_ID_ROBOT_STATUS 2 // 用于周期刷新机器人位置/臂状态 |
| | | #define TIMER_ID_ROBOT_ANIMATION 3 // |
| | | |
| | | // CPageGraph1 对话框 |
| | | |
| | |
| | | CPageGraph1::CPageGraph1(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_PAGE_GRAPH1, pParent) |
| | | { |
| | | m_pGraph = nullptr; |
| | | m_pObserver = nullptr; |
| | | m_bIsRobotMoving = FALSE; |
| | | m_crBkgnd = PAGE_GRPAH1_BACKGROUND_COLOR; |
| | | m_hbrBkgnd = nullptr; |
| | | m_lastRobotPosition = SERVO::ROBOT_POSITION::Port1; |
| | | m_lastArmState[0] = FALSE; |
| | | m_lastArmState[1] = FALSE; |
| | | // ===== 图形界面相关成员变量初始化 ===== |
| | | m_pGraph = nullptr; // 图形绘图对象 |
| | | m_pObserver = nullptr; // 观察者对象(可能是事件观察者) |
| | | m_crBkgnd = PAGE_GRPAH1_BACKGROUND_COLOR; // 背景颜色 |
| | | m_hbrBkgnd = nullptr; // 背景刷句柄 |
| | | |
| | | m_arm1Offset = LoadArmOffset("ARM1"); |
| | | m_arm2Offset = LoadArmOffset("ARM2"); |
| | | // ===== 机器人动画状态初始化 ===== |
| | | m_bIsRobotMoving = FALSE; // 当前是否正在动画移动 |
| | | m_nRobotMoveStartX = 0; // 动画起始 X 坐标 |
| | | m_nRobotMoveEndX = 0; // 动画目标 X 坐标 |
| | | m_nRobotMoveSteps = 30; // 动画总步数(动画速度控制) |
| | | m_nRobotMoveCurrentStep = 0; // 当前动画步数 |
| | | m_nRobotMoveStartAngle = 0.0f; // 动画起始角度 |
| | | m_nRobotMoveEndAngle = 0.0f; // 动画目标角度 |
| | | |
| | | // ===== 机器人上一次状态初始化 ===== |
| | | m_lastRobotPosition = SERVO::ROBOT_POSITION::Port1; // 上次机器人位置(默认 Port1) |
| | | m_lastArmState[0] = FALSE; // 上次机械臂1 状态(未占用) |
| | | m_lastArmState[1] = FALSE; // 上次机械臂2 状态(未占用) |
| | | |
| | | // ===== 机械臂相对偏移量初始化(从配置中加载) ===== |
| | | m_arm1Offset = LoadArmOffset("ARM1"); // 加载机械臂1偏移 |
| | | m_arm2Offset = LoadArmOffset("ARM2"); // 加载机械臂2偏移 |
| | | |
| | | //m_arm1Offset = { -30, -45 }; // ARM1 从中心向左47, 向上33 |
| | | //m_arm2Offset = { 27, -45 }; // ARM2 从中心向右10, 向上33 |
| | |
| | | m_lastRobotPosition = position; |
| | | } |
| | | |
| | | void CPageGraph1::StartRobotMoveToPosition(SERVO::ROBOT_POSITION position) |
| | | { |
| | | auto it = g_positionMap.find(position); |
| | | if (it == g_positionMap.end()) { |
| | | TRACE("Invalid robot position: %d\n", static_cast<int>(position)); |
| | | return; |
| | | } |
| | | |
| | | const RobotPositionMapping& mapping = it->second; |
| | | |
| | | auto* pImage = m_pGraph->GetImage(IMAGE_ROBOT); |
| | | if (!pImage) return; |
| | | |
| | | m_nRobotMoveStartX = pImage->x; |
| | | m_nRobotMoveEndX = static_cast<int>(170 + mapping.percentage * (700 - 170)); |
| | | |
| | | m_nRobotMoveStartAngle = pImage->angle; // 起始角度(当前角度) |
| | | m_nRobotMoveEndAngle = mapping.angle; // 目标角度 |
| | | |
| | | m_nRobotMoveCurrentStep = 0; |
| | | m_targetRobotPosition = position; |
| | | m_bIsRobotMoving = TRUE; |
| | | |
| | | SetTimer(TIMER_ID_ROBOT_ANIMATION, 16, nullptr); |
| | | } |
| | | |
| | | POINT CPageGraph1::LoadArmOffset(const std::string& armName) |
| | | { |
| | | std::string iniPath = GetConfigPath(); |
| | |
| | | |
| | | // 移动到指定位置 (测试使用) |
| | | if (pGraphNmhdr->dwData == INDICATE_LPORT1) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Port1); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Port1); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_LPORT2) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Port2); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Port2); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_LPORT3) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Port3); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Port3); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_LPORT4) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Port4); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Port4); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_ALIGNER) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Aligner); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Aligner); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_FLIPER) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Fliper); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Fliper); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_BONDER1) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Bonder1); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Bonder1); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_BONDER2) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Bonder2); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Bonder2); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_VACUUM_BAKE) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Bake); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Bake); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_BAKE_COOLING) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Cooling); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Cooling); |
| | | } |
| | | else if (pGraphNmhdr->dwData == INDICATE_MEASUREMENT) { |
| | | MoveRobotToPosition(SERVO::ROBOT_POSITION::Measurement); |
| | | StartRobotMoveToPosition(SERVO::ROBOT_POSITION::Measurement); |
| | | } |
| | | |
| | | *pResult = 0; |
| | |
| | | |
| | | // 位置信息状态显示 |
| | | if (robotData.position != m_lastRobotPosition) { |
| | | MoveRobotToPosition(robotData.position); |
| | | StartRobotMoveToPosition(robotData.position); |
| | | } |
| | | } |
| | | else if (nIDEvent == TIMER_ID_ROBOT_ANIMATION) { |
| | | if (!m_bIsRobotMoving) { |
| | | KillTimer(TIMER_ID_ROBOT_ANIMATION); |
| | | return; |
| | | } |
| | | |
| | | m_nRobotMoveCurrentStep++; |
| | | |
| | | float progress = static_cast<float>(m_nRobotMoveCurrentStep) / m_nRobotMoveSteps; |
| | | if (progress >= 1.0f) { |
| | | progress = 1.0f; |
| | | m_bIsRobotMoving = FALSE; |
| | | KillTimer(TIMER_ID_ROBOT_ANIMATION); |
| | | m_lastRobotPosition = m_targetRobotPosition; |
| | | } |
| | | |
| | | // 平滑计算位置 |
| | | int currentX = static_cast<int>(m_nRobotMoveStartX + progress * (m_nRobotMoveEndX - m_nRobotMoveStartX)); |
| | | auto* pImage = m_pGraph->GetImage(IMAGE_ROBOT); |
| | | if (!pImage) return; |
| | | |
| | | int cx = currentX + pImage->bmWidth / 2; |
| | | int y = 270; |
| | | int cy = y + pImage->bmHeight / 2; |
| | | |
| | | // 平滑计算角度 |
| | | float currentAngle = m_nRobotMoveStartAngle + progress * (m_nRobotMoveEndAngle - m_nRobotMoveStartAngle); |
| | | float radians = currentAngle * 3.1415926f / 180.0f; |
| | | |
| | | int rotatedX1 = static_cast<int>(cos(radians) * m_arm1Offset.x - sin(radians) * m_arm1Offset.y); |
| | | int rotatedY1 = static_cast<int>(sin(radians) * m_arm1Offset.x + cos(radians) * m_arm1Offset.y); |
| | | int rotatedX2 = static_cast<int>(cos(radians) * m_arm2Offset.x - sin(radians) * m_arm2Offset.y); |
| | | int rotatedY2 = static_cast<int>(sin(radians) * m_arm2Offset.x + cos(radians) * m_arm2Offset.y); |
| | | |
| | | m_pGraph->UpdateImageCoordinates(IMAGE_ROBOT, currentX, y); |
| | | m_pGraph->UpdateIndicateBoxCoordinates(INDICATE_ROBOT_ARM1, cx + rotatedX1, cy + rotatedY1); |
| | | m_pGraph->UpdateIndicateBoxCoordinates(INDICATE_ROBOT_ARM2, cx + rotatedX2, cy + rotatedY2); |
| | | m_pGraph->UpdateImageAngle(IMAGE_ROBOT, currentAngle); |
| | | |
| | | Invalidate(); |
| | | } |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | | } |
| | |
| | | void RotateRobot(float angleInDegrees); |
| | | void BindEquipmentToGraph(); |
| | | void MoveRobotToPosition(SERVO::ROBOT_POSITION position); |
| | | void StartRobotMoveToPosition(SERVO::ROBOT_POSITION position); |
| | | POINT LoadArmOffset(const std::string& armName); |
| | | void SaveArmOffset(const std::string& armName, const POINT& pt); |
| | | |
| | |
| | | BOOL m_bIsRobotMoving; |
| | | COLORREF m_crBkgnd; |
| | | HBRUSH m_hbrBkgnd; |
| | | |
| | | // ===== 机器人动画相关成员变量 ===== |
| | | |
| | | // 动画目标位置(机器人目标位置枚举) |
| | | SERVO::ROBOT_POSITION m_targetRobotPosition; |
| | | |
| | | // 动画起始和目标 X 坐标(水平位移) |
| | | int m_nRobotMoveStartX; |
| | | int m_nRobotMoveEndX; |
| | | |
| | | // 动画步数控制(总步数 & 当前步) |
| | | int m_nRobotMoveSteps; // 动画总步数(控制动画速度) |
| | | int m_nRobotMoveCurrentStep; // 当前动画步数进度 |
| | | |
| | | // 动画起始和目标角度(旋转角度,单位:度) |
| | | float m_nRobotMoveStartAngle; // 起始角度 |
| | | float m_nRobotMoveEndAngle; // 目标角度(旋转角度) |
| | | |
| | | // ===== 机器人状态相关成员变量 ===== |
| | | |
| | | // 上一次已完成的位置(用于判断是否需要移动) |
| | | SERVO::ROBOT_POSITION m_lastRobotPosition; |
| | | |
| | | // 上一次已更新的机器人 ARM 占用状态(两个机械臂) |
| | | BOOL m_lastArmState[2]; |
| | | POINT m_arm1Offset; // ARM1 从中心向左47, 向上33 |
| | | POINT m_arm2Offset; // ARM2 从中心向右10, 向上33 |
| | | |
| | | // 两个机械臂相对于机器人中心的偏移(像素坐标) |
| | | POINT m_arm1Offset; |
| | | POINT m_arm2Offset; |
| | | |
| | | |
| | | // 对话框数据 |
| | | #ifdef AFX_DESIGN_TIME |
| | |
| | | ASSERT(pItem); |
| | | SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData; |
| | | |
| | | CHMPropertyDlg dlg(pEquipment->getName().c_str(), 658, 788); |
| | | CHMPropertyDlg dlg(pEquipment->getName().c_str(), 1258, 788); |
| | | |
| | | CPageLinkSignal* pPage1 = new CPageLinkSignal(); |
| | | pPage1->setEquipment(pEquipment); |
| | |
| | | |
| | | CPageLinkSignal::CPageLinkSignal(CWnd* pParent /*=nullptr*/) |
| | | : CHMPropertyPage(IDD_PAGE_LINK_SIGNAL, pParent) |
| | | , m_bEnable(TRUE) |
| | | { |
| | | m_pEquipment = nullptr; |
| | | } |
| | |
| | | void CPageLinkSignal::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CHMPropertyPage::DoDataExchange(pDX); |
| | | DDX_Check(pDX, IDC_CHECK_ENABLE, m_bEnable); |
| | | } |
| | | |
| | | |
| | |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | ON_WM_TIMER() |
| | | ON_BN_CLICKED(IDC_CHECK_ENABLE, &CPageLinkSignal::OnClickedCheckEnable) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | |
| | | KillTimer(TIMER_ID_SIGNAL_UPDATE); |
| | | SetTimer(TIMER_ID_SIGNAL_UPDATE, TIMER_INTERVAL_MS, nullptr); |
| | | |
| | | |
| | | if (m_pEquipment) { |
| | | m_bEnable = m_pEquipment->IsEnabled(); |
| | | UpdateData(FALSE); |
| | | } |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 异常: OCX 属性页应返回 FALSE |
| | |
| | | // TODO: 在此处添加消息处理程序代码 |
| | | for (int i = 0; i < 8; i++) { |
| | | for (int j = 0; j < 8; j++) { |
| | | if (m_pBtn[i][j] != nullptr) { |
| | | m_pBtn[i][j]->DestroyWindow(); |
| | | delete m_pBtn[i][j]; |
| | | m_pBtn[i][j] = nullptr; |
| | | if (m_pBtnUpstream[i][j] != nullptr) { |
| | | m_pBtnUpstream[i][j]->DestroyWindow(); |
| | | delete m_pBtnUpstream[i][j]; |
| | | m_pBtnUpstream[i][j] = nullptr; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < 8; i++) { |
| | | for (int j = 0; j < 4; j++) { |
| | | if (m_pBtnDwonstream[i][j] != nullptr) { |
| | | m_pBtnDwonstream[i][j]->DestroyWindow(); |
| | | delete m_pBtnDwonstream[i][j]; |
| | | m_pBtnDwonstream[i][j] = nullptr; |
| | | } |
| | | } |
| | | } |
| | |
| | | y = BTN_Y + (BTN_WIDTH + marginy) * row; |
| | | for (int col = 0; col < 8; col++) { |
| | | x = BTN_X + (BTN_WIDTH + marginx) * col; |
| | | m_pBtn[row][col] = new CBlButton(); |
| | | m_pBtn[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000); |
| | | m_pBtn[row][col]->SetFaceColor(FACECOLOR_OFF); |
| | | m_pBtn[row][col]->SetFrameColor(RGB(28, 28, 28)); |
| | | m_pBtn[row][col]->SetTextColor(RGB(238, 238, 238)); |
| | | m_pBtnUpstream[row][col] = new CBlButton(); |
| | | m_pBtnUpstream[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000); |
| | | m_pBtnUpstream[row][col]->SetFaceColor(FACECOLOR_OFF); |
| | | m_pBtnUpstream[row][col]->SetFrameColor(RGB(28, 28, 28)); |
| | | m_pBtnUpstream[row][col]->SetTextColor(RGB(238, 238, 238)); |
| | | } |
| | | } |
| | | |
| | | CRect rcLine; |
| | | GetDlgItem(IDC_LINE1)->GetWindowRect(&rcLine); |
| | | GetDlgItem(IDC_LINE1)->MoveWindow(BTN_Y, BTN_X + (BTN_WIDTH + marginx) * 8, |
| | | rcLine.Width(), rcLine.Height()); |
| | | |
| | | for (int row = 0; row < 8; row++) { |
| | | y = BTN_Y + (BTN_WIDTH + marginy) * row; |
| | | for (int col = 0; col < 4; col++) { |
| | | x = BTN_X + (BTN_WIDTH + marginx) * (col + 8); |
| | | m_pBtnDwonstream[row][col] = new CBlButton(); |
| | | m_pBtnDwonstream[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000); |
| | | m_pBtnDwonstream[row][col]->SetFaceColor(FACECOLOR_OFF); |
| | | m_pBtnDwonstream[row][col]->SetFrameColor(RGB(28, 28, 28)); |
| | | m_pBtnDwonstream[row][col]->SetTextColor(RGB(238, 238, 238)); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | int idy[] = { IDC_LABEL_NAME1, IDC_LABEL_NAME2, IDC_LABEL_NAME3, IDC_LABEL_NAME4, IDC_LABEL_NAME5, |
| | | IDC_LABEL_NAME6, IDC_LABEL_NAME7, IDC_LABEL_NAME8 }; |
| | | for (int i = 0; i < 8; i++) { |
| | | IDC_LABEL_NAME6, IDC_LABEL_NAME7, IDC_LABEL_NAME8, IDC_LABEL_NAME9, IDC_LABEL_NAME10, |
| | | IDC_LABEL_NAME11, IDC_LABEL_NAME12}; |
| | | for (int i = 0; i < sizeof(idy) / sizeof(int); i++) { |
| | | pItem = GetDlgItem(idy[i]); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(BTN_X + (BTN_WIDTH + marginx) * i, |
| | | BTN_Y - 36, |
| | | rcItem.Width(), rcItem.Height()); |
| | | } |
| | | |
| | | pItem = GetDlgItem(IDC_CHECK_ENABLE); |
| | | if (pItem) { |
| | | int nCheckboxX = max(0, BTN_X - 50); |
| | | int nCheckboxY = max(0, BTN_Y - rcItem.Height() - 30); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(nCheckboxX, nCheckboxY, rcItem.Width(), rcItem.Height()); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (nIDEvent == TIMER_ID_SIGNAL_UPDATE) { |
| | | if (m_pEquipment) { |
| | | UpdateAllSignalStatesFromDevice(); |
| | | UpdateAllUpstreamSignalStatesFromDevice(); |
| | | UpdateAllDownstreamSignalStatesFromDevice(); |
| | | } |
| | | } |
| | | |
| | | CHMPropertyPage::OnTimer(nIDEvent); |
| | | } |
| | | |
| | | void CPageLinkSignal::UpdateAllSignalStatesFromDevice() |
| | | void CPageLinkSignal::UpdateAllUpstreamSignalStatesFromDevice() |
| | | { |
| | | ASSERT(m_pEquipment); |
| | | |
| | | for (int nRow = 0; nRow < 8; ++nRow) { |
| | | for (int nCol = 0; nCol < 8; ++nCol) { |
| | | BOOL bCurrentState = m_pEquipment->isLinkSignalUpstreamOn(nRow, nCol); |
| | | UpdateSignalState(nRow, nCol, bCurrentState); |
| | | BOOL bCurrentState = m_pEquipment->isLinkSignalUpstreamOn(nRow, nCol) && m_pEquipment->IsEnabled(); |
| | | UpdateUpstreamSignalState(nRow, nCol, bCurrentState); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CPageLinkSignal::UpdateSignalState(int nRow, int nCol, bool bNewState) |
| | | void CPageLinkSignal::UpdateAllDownstreamSignalStatesFromDevice() |
| | | { |
| | | if (!::IsWindow(m_pBtn[nRow][nCol]->GetSafeHwnd())) { |
| | | return; |
| | | } |
| | | ASSERT(m_pEquipment); |
| | | |
| | | bool bState = ::GetProp(m_pBtn[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1; |
| | | if (bState != bNewState) { |
| | | m_pBtn[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF); |
| | | ::SetProp(m_pBtn[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0); |
| | | for (int nRow = 0; nRow < 8; ++nRow) { |
| | | for (int nCol = 0; nCol < 4; ++nCol) { |
| | | BOOL bCurrentState = m_pEquipment->isLinkSignalDownstreamOn(nRow, nCol) && m_pEquipment->IsEnabled(); |
| | | UpdateDownstreamSignalState(nRow, nCol, bCurrentState); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CPageLinkSignal::UpdateUpstreamSignalState(int nRow, int nCol, bool bNewState) |
| | | { |
| | | if (!::IsWindow(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd())) { |
| | | return; |
| | | } |
| | | |
| | | bool bState = ::GetProp(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1; |
| | | if (bState != bNewState) { |
| | | m_pBtnUpstream[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF); |
| | | ::SetProp(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0); |
| | | } |
| | | } |
| | | |
| | | void CPageLinkSignal::UpdateDownstreamSignalState(int nRow, int nCol, bool bNewState) |
| | | { |
| | | if (!::IsWindow(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd())) { |
| | | return; |
| | | } |
| | | |
| | | bool bState = ::GetProp(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1; |
| | | if (bState != bNewState) { |
| | | m_pBtnDwonstream[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF); |
| | | ::SetProp(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0); |
| | | } |
| | | } |
| | | |
| | | void CPageLinkSignal::OnClickedCheckEnable() |
| | | { |
| | | // TODO: 在此添加控件通知处理程序代码 |
| | | UpdateData(TRUE); |
| | | m_pEquipment->SetEnable(m_bEnable); |
| | | } |
| | |
| | | virtual ~CPageLinkSignal(); |
| | | void setEquipment(SERVO::CEquipment* pEquipment); |
| | | void CreateSignalButtons(); |
| | | void UpdateAllSignalStatesFromDevice(); |
| | | void UpdateSignalState(int nRow, int nCol, bool bNewState); |
| | | void UpdateAllUpstreamSignalStatesFromDevice(); |
| | | void UpdateAllDownstreamSignalStatesFromDevice(); |
| | | void UpdateUpstreamSignalState(int nRow, int nCol, bool bNewState); |
| | | void UpdateDownstreamSignalState(int nRow, int nCol, bool bNewState); |
| | | |
| | | |
| | | private: |
| | | SERVO::CEquipment* m_pEquipment; |
| | | CBlButton* m_pBtn[8][8]; |
| | | CBlButton* m_pBtnUpstream[8][8]; |
| | | CBlButton* m_pBtnDwonstream[8][4]; |
| | | BOOL m_bEnable; |
| | | |
| | | // 对话框数据 |
| | | #ifdef AFX_DESIGN_TIME |
| | |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | afx_msg void OnTimer(UINT_PTR nIDEvent); |
| | | afx_msg void OnClickedCheckEnable(); |
| | | }; |
| | |
| | | |
| | | // 示例设备名称列表 |
| | | CStringList eqNameList; |
| | | eqNameList.AddTail(_T("Port1")); |
| | | eqNameList.AddTail(_T("Port2")); |
| | | eqNameList.AddTail(_T("Port3")); |
| | | eqNameList.AddTail(_T("Port4")); |
| | | eqNameList.AddTail(_T("RB1")); |
| | | eqNameList.AddTail(_T("RB2")); |
| | | eqNameList.AddTail(_T("AL")); |
| | | eqNameList.AddTail(_T("FLIP")); |
| | | eqNameList.AddTail(_T("Bonder1-上产品")); |
| | | eqNameList.AddTail(_T("Bonder1-下产品")); |
| | | eqNameList.AddTail(_T("Bonder2-上产品")); |
| | | eqNameList.AddTail(_T("Bonder2-下产品")); |
| | | eqNameList.AddTail(_T("VacBakeA腔")); |
| | | eqNameList.AddTail(_T("VacBakeB腔")); |
| | | eqNameList.AddTail(_T("BakecCoolingA烘烤")); |
| | | eqNameList.AddTail(_T("BakecCoolingA冷却")); |
| | | eqNameList.AddTail(_T("BakecCoolingB烘烤")); |
| | | eqNameList.AddTail(_T("BakecCoolingB冷却")); |
| | | eqNameList.AddTail(_T("Measurement")); |
| | | eqNameList.AddTail(_T("Port1")); // 1 |
| | | eqNameList.AddTail(_T("Port2")); // 2 |
| | | eqNameList.AddTail(_T("Port3")); // 3 |
| | | eqNameList.AddTail(_T("Port4")); // 4 |
| | | eqNameList.AddTail(_T("RB1")); // 5 |
| | | eqNameList.AddTail(_T("RB2")); // 6 |
| | | eqNameList.AddTail(_T("AL")); // 7 |
| | | eqNameList.AddTail(_T("FLIP")); // 8 |
| | | eqNameList.AddTail(_T("Bonder1-上产品")); // 9 |
| | | eqNameList.AddTail(_T("Bonder1-下产品")); // 10 |
| | | eqNameList.AddTail(_T("Bonder2-上产品")); // 11 |
| | | eqNameList.AddTail(_T("Bonder2-下产品")); // 12 |
| | | eqNameList.AddTail(_T("VacBakeA腔")); // 13 |
| | | eqNameList.AddTail(_T("VacBakeB腔")); // 14 |
| | | eqNameList.AddTail(_T("BakecCoolingA烘烤")); // 15 |
| | | eqNameList.AddTail(_T("BakecCoolingA冷却")); // 16 |
| | | eqNameList.AddTail(_T("BakecCoolingB烘烤")); // 17 |
| | | eqNameList.AddTail(_T("BakecCoolingB冷却")); // 18 |
| | | eqNameList.AddTail(_T("Measurement")); // 19 |
| | | |
| | | for (POSITION pos = eqNameList.GetHeadPosition(); pos != NULL;) { |
| | | CString item = eqNameList.GetNext(pos); |
| | |
| | | { |
| | | // Received Job Report Upstream #1~9 |
| | | char szBuffer[256]; |
| | | for (int i = 0; i < 1; i++) { |
| | | for (int i = 0; i < 2; i++) { |
| | | CEqReadStep* pStep = new CEqReadStep(0x14c90 + 320 * i, 320 * 2, |
| | | [&](void* pFrom, int code, const char* pszData, size_t size) -> int { |
| | | if (code == ROK && pszData != nullptr && size > 0) { |
| | |
| | | { |
| | | // Sent Out Job Report Downstream #1~9 |
| | | char szBuffer[256]; |
| | | for (int i = 0; i < 1; i++) { |
| | | for (int i = 0; i < 2; i++) { |
| | | CEqReadStep* pStep = new CEqReadStep(0x14000 + 320 * i, 320 * 2, |
| | | [&](void* pFrom, int code, const char* pszData, size_t size) -> int { |
| | | if (code == ROK && pszData != nullptr && size > 0) { |
| | |
| | | { |
| | | // Fetched Out Job Report #1~15 |
| | | char szBuffer[256]; |
| | | for (int i = 0; i < 1; i++) { |
| | | for (int i = 0; i < 2; i++) { |
| | | CEqReadStep* pStep = new CEqReadStep(0x15c31 + 18 * i, 18 * 2, |
| | | [&](void* pFrom, int code, const char* pszData, size_t size) -> int { |
| | | if (code == ROK && pszData != nullptr && size > 0) { |
| | |
| | | { |
| | | // Stored Job Report #1~15 |
| | | char szBuffer[256]; |
| | | for (int i = 0; i < 1; i++) { |
| | | for (int i = 0; i < 2; i++) { |
| | | CEqReadStep* pStep = new CEqReadStep(0x15b23 + 18 * i, 18 * 2, |
| | | [&](void* pFrom, int code, const char* pszData, size_t size) -> int { |
| | | if (code == ROK && pszData != nullptr && size > 0) { |
| | |
| | | delete pStep; |
| | | } |
| | | } |
| | | |
| | | { |
| | | CEqReadStep* pStep = new CEqReadStep(0x15D4C, 13 * 2, |
| | | [&](void* pFrom, int code, const char* pszData, size_t size) -> int { |
| | |
| | | delete pStep; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // 必须要实现的虚函数,在此初始化Slot信息 |
| | |
| | | m_slot[0].setNo(1); |
| | | m_slot[0].setName("Slot 1(G1)"); |
| | | m_slot[0].setType(MaterialsType::G1); |
| | | m_slot[0].setLinkSignalPath(0); |
| | | m_slot[1].enable(); |
| | | m_slot[1].setPosition(m_nID); |
| | | m_slot[1].setNo(2); |
| | | m_slot[1].setName("Slot 2(G1)"); |
| | | m_slot[1].setType(MaterialsType::G1); |
| | | m_slot[1].setLinkSignalPath(1); |
| | | } |
| | | |
| | | void CVacuumBake::onTimer(UINT nTimerid) |