From bc7f1c4e028e69be51079b59dae4ae5c4d43f5bb Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 31 一月 2026 21:54:56 +0800
Subject: [PATCH] 1.状态指示图,目前灰色表示掉线,绿色表示在线。增加Slot的小点表示有没有料,及加工状态 。 2.增加图示
---
SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp | 339 ++++++++++++++++++++++++++++---------------------------
1 files changed, 173 insertions(+), 166 deletions(-)
diff --git a/SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp b/SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp
index 22d0386..cd10a8b 100644
--- a/SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp
+++ b/SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp
@@ -14,12 +14,12 @@
// 缁戝畾鐣岄潰闇�瑕佹樉绀虹殑璁惧
static const std::vector<DeviceMetaInfo> g_vecBindDevices = {
- { EQ_ID_VACUUMBAKE, EQ_NAME_VACUUMBAKE },
- { EQ_ID_Bonder1, EQ_NAME_BONDER1 },
- { EQ_ID_Bonder2, EQ_NAME_BONDER2 },
- { EQ_ID_BAKE_COOLING, EQ_NAME_BAKE_COOLING },
- { EQ_ID_MEASUREMENT, EQ_NAME_MEASUREMENT },
- { EQ_ID_EFEM, EQ_NAME_EFEM }
+ { EQ_ID_VACUUMBAKE, EQ_NAME_VACUUMBAKE },
+ { EQ_ID_Bonder1, EQ_NAME_BONDER1 },
+ { EQ_ID_Bonder2, EQ_NAME_BONDER2 },
+ { EQ_ID_BAKE_COOLING, EQ_NAME_BAKE_COOLING },
+ { EQ_ID_MEASUREMENT, EQ_NAME_MEASUREMENT },
+ { EQ_ID_EFEM, EQ_NAME_EFEM }
};
// CRecipeDeviceBindDlg 瀵硅瘽妗�
@@ -28,8 +28,8 @@
CRecipeDeviceBindDlg::CRecipeDeviceBindDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_DIALOG_RECIPE_DEVICE_BIND, pParent)
- , m_strPPID(_T(""))
- , m_strDesc(_T(""))
+ , m_strPPID(_T(""))
+ , m_strDesc(_T(""))
{
}
@@ -39,122 +39,129 @@
}
const RecipeInfo& CRecipeDeviceBindDlg::GetRecipeInfo() const {
- return m_recipe;
+ return m_recipe;
}
void CRecipeDeviceBindDlg::SetRecipeInfo(const RecipeInfo& info)
{
- m_recipe = info;
+ m_recipe = info;
}
void CRecipeDeviceBindDlg::ReleaseDeviceControls()
{
- for (auto& ctrl : m_vecDevices) {
- delete ctrl.editDeviceID; ctrl.editDeviceID = nullptr;
- delete ctrl.editDeviceName; ctrl.editDeviceName = nullptr;
- delete ctrl.comboRecipeID; ctrl.comboRecipeID = nullptr;
- }
- m_vecDevices.clear();
+ for (auto& ctrl : m_vecDevices) {
+ delete ctrl.editDeviceID; ctrl.editDeviceID = nullptr;
+ delete ctrl.editDeviceName; ctrl.editDeviceName = nullptr;
+ delete ctrl.comboRecipeID; ctrl.comboRecipeID = nullptr;
+ }
+ m_vecDevices.clear();
}
void CRecipeDeviceBindDlg::CreateDeviceControls(int nXStart, int nYStart, int nTotalControlWidth, int nRowHeight)
{
- for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
- int y = nYStart + static_cast<int>(i) * nRowHeight;
- auto* pEditID = new CEdit;
- pEditID->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart, y, nXStart + 100, y + 25), this, (UINT)(IDC_EDIT_DEVICEID_BASE + i));
- pEditID->SetFont(&m_font);
+ for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
+ int y = nYStart + static_cast<int>(i) * nRowHeight;
+ auto* pEditID = new CEdit;
+ pEditID->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart, y, nXStart + 100, y + 25), this, (UINT)(IDC_EDIT_DEVICEID_BASE + i));
+ pEditID->SetFont(&m_font);
- auto* pEditName = new CEdit;
- pEditName->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart + 110, y, nXStart + 210, y + 25), this, (UINT)(IDC_EDIT_DEVICENAME_BASE + i));
- pEditName->SetFont(&m_font);
+ auto* pEditName = new CEdit;
+ pEditName->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart + 110, y, nXStart + 210, y + 25), this, (UINT)(IDC_EDIT_DEVICENAME_BASE + i));
+ pEditName->SetFont(&m_font);
- auto* pCombo = new CComboBox;
- pCombo->Create(WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, CRect(nXStart + 220, y, nXStart + nTotalControlWidth, y + 25), this, (UINT)(IDC_COMBO_RECIPEID_BASE + i));
- pCombo->SetFont(&m_font);
+ auto* pCombo = new CComboBox;
+ pCombo->Create(WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, CRect(nXStart + 220, y, nXStart + nTotalControlWidth, y + 25), this, (UINT)(IDC_COMBO_RECIPEID_BASE + i));
+ pCombo->SetFont(&m_font);
- m_vecDevices.push_back({ pEditID, pEditName, pCombo });
- }
+ m_vecDevices.push_back({ pEditID, pEditName, pCombo });
+ }
}
bool CRecipeDeviceBindDlg::FillComboRecipeList(CComboBox* pCombo, int nDeviceID, int nSelectedRecipeID)
{
- auto& master = theApp.m_model.getMaster();
- auto* pEq = master.getEquipment(nDeviceID);
- if (!pEq) {
- return false;
- }
+ auto& master = theApp.m_model.getMaster();
+ auto* pEq = master.getEquipment(nDeviceID);
+ if (!pEq) {
+ return false;
+ }
- auto* pRecipeList = pEq->getRecipeList(0);
- if (!pRecipeList) {
- return false;
- }
+ auto* pRecipeList = pEq->getRecipeList(0);
+ if (!pRecipeList) {
+ return false;
+ }
- auto& mapRecipeIds = pRecipeList->getIds();
- bool bFound = false;
- pCombo->ResetContent();
- for (const auto& pair : mapRecipeIds) {
- int nRecipeID = pair.second;
+ auto& mapRecipeIds = pRecipeList->getIds();
+ bool bFound = false;
+ pCombo->ResetContent();
+ for (const auto& pair : mapRecipeIds) {
+ int nRecipeID = pair.second;
- std::string strRecipeName = RecipeManager::getInstance().getDeviceRecipeName(pEq->getName(), nRecipeID);
- if (strRecipeName.empty()) {
- strRecipeName = std::to_string(nRecipeID);
- }
+ std::string strDeviceName;
+ for (const auto& dev : g_vecBindDevices) {
+ if (dev.nDeviceID == pEq->getID()) {
+ strDeviceName = dev.strDeviceName;
+ }
+ }
- CString str;
- str.Format(_T("%s"), strRecipeName.c_str());
- int idx = pCombo->AddString(str);
- pCombo->SetItemData(idx, nRecipeID);
- if (nSelectedRecipeID == nRecipeID) {
- pCombo->SetCurSel(idx);
- bFound = true;
- }
- }
+ std::string strRecipeName = RecipeManager::getInstance().getDeviceRecipeName(strDeviceName, nRecipeID);
+ if (strRecipeName.empty()) {
+ strRecipeName = std::to_string(nRecipeID);
+ }
- if (nSelectedRecipeID != -1 && !bFound) {
- pCombo->SetCurSel(CB_ERR);
- }
- else if (pCombo->GetCount() > 0 && nSelectedRecipeID == -1) {
- pCombo->SetCurSel(0);
- }
+ CString str;
+ str.Format(_T("%s"), strRecipeName.c_str());
+ int idx = pCombo->AddString(str);
+ pCombo->SetItemData(idx, nRecipeID);
+ if (nSelectedRecipeID == nRecipeID) {
+ pCombo->SetCurSel(idx);
+ bFound = true;
+ }
+ }
- return true;
+ if (nSelectedRecipeID != -1 && !bFound) {
+ pCombo->SetCurSel(CB_ERR);
+ }
+ else if (pCombo->GetCount() > 0 && nSelectedRecipeID == -1) {
+ pCombo->SetCurSel(0);
+ }
+
+ return true;
}
bool CRecipeDeviceBindDlg::FillDeviceInfo(int idx, int nDeviceID, const CString& strDeviceName, int nSelectedRecipeID)
{
- if (idx < 0 || idx >= (int)m_vecDevices.size()) {
- return false;
- }
+ if (idx < 0 || idx >= (int)m_vecDevices.size()) {
+ return false;
+ }
- auto& ctrl = m_vecDevices[idx];
- CString strID;
- strID.Format(_T("%d"), nDeviceID);
- ctrl.editDeviceID->SetWindowText(strID);
- ctrl.editDeviceID->SetReadOnly(TRUE);
- ctrl.editDeviceName->SetWindowText(strDeviceName);
- ctrl.editDeviceName->SetReadOnly(TRUE);
+ auto& ctrl = m_vecDevices[idx];
+ CString strID;
+ strID.Format(_T("%d"), nDeviceID);
+ ctrl.editDeviceID->SetWindowText(strID);
+ ctrl.editDeviceID->SetReadOnly(TRUE);
+ ctrl.editDeviceName->SetWindowText(strDeviceName);
+ ctrl.editDeviceName->SetReadOnly(TRUE);
- if (!FillComboRecipeList(ctrl.comboRecipeID, nDeviceID, nSelectedRecipeID)) {
- CString str;
- str.Format(_T("璁惧 [%s] 鎴栧叾閰嶆柟鍒楄〃鏈壘鍒帮紝璇锋鏌ヨ澶囬厤缃�"), strDeviceName.GetString());
- AfxMessageBox(str);
- return false;
- }
- return true;
+ if (!FillComboRecipeList(ctrl.comboRecipeID, nDeviceID, nSelectedRecipeID)) {
+ CString str;
+ str.Format(_T("璁惧 [%s] 鎴栧叾閰嶆柟鍒楄〃鏈壘鍒帮紝璇锋鏌ヨ澶囬厤缃�"), strDeviceName.GetString());
+ AfxMessageBox(str);
+ return false;
+ }
+ return true;
}
void CRecipeDeviceBindDlg::DoDataExchange(CDataExchange* pDX)
{
- CDialogEx::DoDataExchange(pDX);
- DDX_Text(pDX, IDC_EDIT_PPID, m_strPPID);
- DDX_Text(pDX, IDC_EDIT_DESC, m_strDesc);
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT_PPID, m_strPPID);
+ DDX_Text(pDX, IDC_EDIT_DESC, m_strDesc);
}
BEGIN_MESSAGE_MAP(CRecipeDeviceBindDlg, CDialogEx)
- ON_WM_CLOSE()
- ON_WM_SIZE()
- ON_BN_CLICKED(IDOK, &CRecipeDeviceBindDlg::OnBnClickedOk)
+ ON_WM_CLOSE()
+ ON_WM_SIZE()
+ ON_BN_CLICKED(IDOK, &CRecipeDeviceBindDlg::OnBnClickedOk)
END_MESSAGE_MAP()
@@ -165,62 +172,62 @@
CDialogEx::OnInitDialog();
// 璁剧疆瀵硅瘽妗嗘爣棰�
- SetWindowText(m_recipe.vecDeviceList.empty() ? _T("鏂板缓閰嶆柟") : _T("缂栬緫閰嶆柟"));
+ SetWindowText(m_recipe.vecDeviceList.empty() ? _T("鏂板缓閰嶆柟") : _T("缂栬緫閰嶆柟"));
// 鍒涘缓鍔ㄦ�佹帶浠跺瓧浣�
- if (!m_font.m_hObject) {
- CFont* pDlgFont = GetFont();
- LOGFONT lf;
- if (pDlgFont && pDlgFont->GetLogFont(&lf)) {
- lf.lfHeight = -16;
- m_font.CreateFontIndirect(&lf);
- }
- }
+ if (!m_font.m_hObject) {
+ CFont* pDlgFont = GetFont();
+ LOGFONT lf;
+ if (pDlgFont && pDlgFont->GetLogFont(&lf)) {
+ lf.lfHeight = -16;
+ m_font.CreateFontIndirect(&lf);
+ }
+ }
- // 璁$畻鍧愭爣
- CRect rDesc;
- int nXStart = 30, nYStart = 30, nTotalControlWidth = 340;
- if (auto* pWndDesc = GetDlgItem(IDC_STATIC_DESC)) {
- pWndDesc->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
- nXStart = rDesc.left;
- }
- if (auto* pWndEdit = GetDlgItem(IDC_EDIT_DESC)) {
- pWndEdit->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
- nYStart = rDesc.bottom + 20;
- }
- CRect rClient; GetClientRect(&rClient);
- nTotalControlWidth = rClient.Width() - nXStart * 2;
- const int nRowHeight = 30;
+ // 璁$畻鍧愭爣
+ CRect rDesc;
+ int nXStart = 30, nYStart = 30, nTotalControlWidth = 340;
+ if (auto* pWndDesc = GetDlgItem(IDC_STATIC_DESC)) {
+ pWndDesc->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
+ nXStart = rDesc.left;
+ }
+ if (auto* pWndEdit = GetDlgItem(IDC_EDIT_DESC)) {
+ pWndEdit->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
+ nYStart = rDesc.bottom + 20;
+ }
+ CRect rClient; GetClientRect(&rClient);
+ nTotalControlWidth = rClient.Width() - nXStart * 2;
+ const int nRowHeight = 30;
- // 娓呯┖鏃ф帶浠�
- ReleaseDeviceControls();
+ // 娓呯┖鏃ф帶浠�
+ ReleaseDeviceControls();
- // 鍒涘缓鏂版帶浠�
- CreateDeviceControls(nXStart, nYStart, nTotalControlWidth, nRowHeight);
+ // 鍒涘缓鏂版帶浠�
+ CreateDeviceControls(nXStart, nYStart, nTotalControlWidth, nRowHeight);
- auto& master = theApp.m_model.getMaster();
+ auto& master = theApp.m_model.getMaster();
- // 濉厖鍐呭
- if (m_recipe.vecDeviceList.empty()) {
- // 鏂板缓
- for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
- const auto& meta = g_vecBindDevices[i];
- FillDeviceInfo((int)i, meta.nDeviceID, meta.strDeviceName);
- }
- }
- else {
- // 缂栬緫
- m_strPPID = CA2T(m_recipe.strPPID.c_str());
- m_strDesc = CA2T(m_recipe.strDescription.c_str());
- UpdateData(FALSE);
+ // 濉厖鍐呭
+ if (m_recipe.vecDeviceList.empty()) {
+ // 鏂板缓
+ for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
+ const auto& meta = g_vecBindDevices[i];
+ FillDeviceInfo((int)i, meta.nDeviceID, meta.strDeviceName);
+ }
+ }
+ else {
+ // 缂栬緫
+ m_strPPID = CA2T(m_recipe.strPPID.c_str());
+ m_strDesc = CA2T(m_recipe.strDescription.c_str());
+ UpdateData(FALSE);
- for (size_t i = 0; i < m_recipe.vecDeviceList.size() && i < m_vecDevices.size(); ++i) {
- const auto& d = m_recipe.vecDeviceList[i];
- FillDeviceInfo((int)i, d.nDeviceID, d.strDeviceName.c_str(), d.nRecipeID);
- }
- }
+ for (size_t i = 0; i < m_recipe.vecDeviceList.size() && i < m_vecDevices.size(); ++i) {
+ const auto& d = m_recipe.vecDeviceList[i];
+ FillDeviceInfo((int)i, d.nDeviceID, d.strDeviceName.c_str(), d.nRecipeID);
+ }
+ }
- CenterWindow();
+ CenterWindow();
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
@@ -228,53 +235,53 @@
void CRecipeDeviceBindDlg::OnClose()
{
- // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
- CDialogEx::OnClose();
+ // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
+ CDialogEx::OnClose();
- // 娓呯悊鎺т欢
- ReleaseDeviceControls();
+ // 娓呯悊鎺т欢
+ ReleaseDeviceControls();
}
void CRecipeDeviceBindDlg::OnSize(UINT nType, int cx, int cy)
{
- CDialogEx::OnSize(nType, cx, cy);
+ CDialogEx::OnSize(nType, cx, cy);
- // TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+ // TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
}
void CRecipeDeviceBindDlg::OnBnClickedOk()
{
- // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
- UpdateData(TRUE);
+ // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+ UpdateData(TRUE);
- // 鏀堕泦鎵�鏈夎澶囨槧灏�
- m_recipe.vecDeviceList.clear();
- for (const auto& dev : m_vecDevices) {
- DeviceRecipe info;
- CString strID, strName;
- dev.editDeviceID->GetWindowText(strID);
- dev.editDeviceName->GetWindowText(strName);
+ // 鏀堕泦鎵�鏈夎澶囨槧灏�
+ m_recipe.vecDeviceList.clear();
+ for (const auto& dev : m_vecDevices) {
+ DeviceRecipe info;
+ CString strID, strName;
+ dev.editDeviceID->GetWindowText(strID);
+ dev.editDeviceName->GetWindowText(strName);
- int sel = dev.comboRecipeID->GetCurSel();
- info.nRecipeID = -1;
- if (sel != CB_ERR) {
- info.nRecipeID = (int)dev.comboRecipeID->GetItemData(sel);
- }
- info.nDeviceID = _ttoi(strID);
- info.strDeviceName = CT2A(strName);
+ int sel = dev.comboRecipeID->GetCurSel();
+ info.nRecipeID = -1;
+ if (sel != CB_ERR) {
+ info.nRecipeID = (int)dev.comboRecipeID->GetItemData(sel);
+ }
+ info.nDeviceID = _ttoi(strID);
+ info.strDeviceName = CT2A(strName);
- m_recipe.vecDeviceList.push_back(info);
- }
+ m_recipe.vecDeviceList.push_back(info);
+ }
- // 妫�鏌� PPID 鏄惁涓虹┖
- if (m_strPPID.IsEmpty()) {
- AfxMessageBox(_T("閰嶆柟 PPID 涓嶈兘涓虹┖"));
- return;
- }
+ // 妫�鏌� PPID 鏄惁涓虹┖
+ if (m_strPPID.IsEmpty()) {
+ AfxMessageBox(_T("閰嶆柟 PPID 涓嶈兘涓虹┖"));
+ return;
+ }
- // PPID鍜屾弿杩�
- m_recipe.strPPID = CT2A(m_strPPID);
- m_recipe.strDescription = CT2A(m_strDesc);
+ // PPID鍜屾弿杩�
+ m_recipe.strPPID = CT2A(m_strPPID);
+ m_recipe.strDescription = CT2A(m_strDesc);
- CDialogEx::OnOK();
+ CDialogEx::OnOK();
}
--
Gitblit v1.9.3