LAPTOP-SNT8I5JK\Boounion
2025-09-11 71766e0946eaaf4473377a7943d6bc61da94a604
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// CPageCassetteCtrlCmd.cpp: 实现文件
//
 
#include "stdafx.h"
#include "Servo.h"
#include "CPageCassetteCtrlCmd.h"
#include "afxdialogex.h"
 
 
// CPageCassetteCtrlCmd 对话框
 
IMPLEMENT_DYNAMIC(CPageCassetteCtrlCmd, CHMPropertyPage)
 
CPageCassetteCtrlCmd::CPageCassetteCtrlCmd(CWnd* pParent /*=nullptr*/)
    : CHMPropertyPage(IDD_PAGE_CASSETTE_CTRL_CMD, pParent)
{
    m_pEquipment = nullptr;
}
 
CPageCassetteCtrlCmd::~CPageCassetteCtrlCmd()
{
}
 
void CPageCassetteCtrlCmd::DoDataExchange(CDataExchange* pDX)
{
    CHMPropertyPage::DoDataExchange(pDX);
}
 
 
BEGIN_MESSAGE_MAP(CPageCassetteCtrlCmd, CHMPropertyPage)
    ON_WM_CTLCOLOR()
    ON_WM_DESTROY()
    ON_WM_SIZE()
    ON_BN_CLICKED(IDC_BUTTON_SEND_CMD, &CPageCassetteCtrlCmd::OnBnClickedButtonSendCmd)
END_MESSAGE_MAP()
 
 
// CPageCassetteCtrlCmd 消息处理程序
void CPageCassetteCtrlCmd::OnApply()
{
    __super::OnApply();
}
 
void CPageCassetteCtrlCmd::setEquipment(SERVO::CEquipment* pEquipment)
{
    m_pEquipment = pEquipment;
}
 
BOOL CPageCassetteCtrlCmd::OnInitDialog()
{
    CHMPropertyPage::OnInitDialog();
 
    const char* pszText[] = {"Cassette Map Download", "Clamp", "Unclamp",
        "Reclamp", "Cassette Process Start", "Cassette Process Start By Count",
        "Cassette Process Pause", "Cassette Process Resume", "Cassette Process Abort",
        "Cassette Process Cancel", "Cassette Process End"};
 
    CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_CTRL_CMD);
    for (int i = 0; i < 11; i++) {
        pComboBox->InsertString(i, pszText[i]);
    }
    pComboBox->SetCurSel(0);
 
 
    return TRUE;  // return TRUE unless you set the focus to a control
                  // 异常: OCX 属性页应返回 FALSE
}
 
HBRUSH CPageCassetteCtrlCmd::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
 
    // TODO:  在此更改 DC 的任何特性
 
    // TODO:  如果默认的不是所需画笔,则返回另一个画笔
    return hbr;
}
 
void CPageCassetteCtrlCmd::OnDestroy()
{
    CHMPropertyPage::OnDestroy();
}
 
void CPageCassetteCtrlCmd::OnSize(UINT nType, int cx, int cy)
{
    CHMPropertyPage::OnSize(nType, cx, cy);
}
 
void CPageCassetteCtrlCmd::OnBnClickedButtonSendCmd()
{
    ASSERT(m_pEquipment != nullptr);
    ASSERT(m_pEquipment->getID() == EQ_ID_LOADPORT1
        || m_pEquipment->getID() == EQ_ID_LOADPORT2
        || m_pEquipment->getID() == EQ_ID_LOADPORT3
        || m_pEquipment->getID() == EQ_ID_LOADPORT4);
    SERVO::CLoadPort* pLoadPort = (SERVO::CLoadPort*)m_pEquipment;
 
    short cmd = 0;
    short jobExistence[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    int jobExistenceSize = 12;
    short slotProcess = 0;
    short jobCount = 0;
    SERVO::CJobDataA* pJobDataA = new SERVO::CJobDataA();
 
 
    CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_CTRL_CMD);
    cmd = pComboBox->GetCurSel() + 1;
    for (int i = 0; i < 12; i++) {
        jobExistence[i] = (short)GetDlgItemInt(IDC_EDIT_EXISTENCE1 + i);
    }
 
    slotProcess = (short)GetDlgItemInt(IDC_EDIT_SLOT_TO_PROCESS);
    jobCount = (short)GetDlgItemInt(IDC_EDIT_JOB_COUNT);
 
 
    pLoadPort->sendCassetteCtrlCmd(cmd, &jobExistence[0], jobExistenceSize, slotProcess,
        jobCount, pJobDataA, [&](int code) -> int {
            if (code == WOK) {
                LOGI("sendCassetteCtrlCmd 成功.");
            }
            else {
                LOGE("sendCassetteCtrlCmd 失败.");
            }
 
            return 0;
        });
}