From b31770cfb61272f0bcf148198d1b95ef445fe079 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 21 八月 2025 10:56:53 +0800
Subject: [PATCH] 1.完善可折叠ListCtrl; 2.l加载Job时,根据ProcessID设置ControlJob的PJ列表 3.ControlJob对话框完善;
---
SourceCode/Bond/Servo/CControlJobDlg.cpp | 125 ++++++++++++++++++++++++++----
SourceCode/Bond/Servo/CControlJobDlg.h | 15 +++
SourceCode/Bond/Servo/ProcessJob.h | 1
SourceCode/Bond/Servo/ProcessJob.cpp | 38 +++++++++
SourceCode/Bond/Servo/resource.h | 0
SourceCode/Bond/Servo/CControlJob.cpp | 32 ++++++++
SourceCode/Bond/Servo/CControlJob.h | 2
SourceCode/Bond/Servo/Servo.rc | 0
SourceCode/Bond/Servo/CMaster.cpp | 18 ++++
SourceCode/Bond/Servo/CMaster.h | 1
SourceCode/Bond/Servo/ServoDlg.cpp | 1
11 files changed, 214 insertions(+), 19 deletions(-)
diff --git a/SourceCode/Bond/Servo/CControlJob.cpp b/SourceCode/Bond/Servo/CControlJob.cpp
index e88f816..8dc2b18 100644
--- a/SourceCode/Bond/Servo/CControlJob.cpp
+++ b/SourceCode/Bond/Servo/CControlJob.cpp
@@ -301,4 +301,36 @@
return true;
}
+
+ std::string CControlJob::getStateText()
+ {
+ switch (m_state)
+ {
+ case SERVO::CJState::NoState:
+ return "NoState";
+ break;
+ case SERVO::CJState::Queued:
+ return "Queued";
+ break;
+ case SERVO::CJState::Executing:
+ return "Executing";
+ break;
+ case SERVO::CJState::Paused:
+ return "Paused";
+ break;
+ case SERVO::CJState::Completed:
+ return "Completed";
+ break;
+ case SERVO::CJState::Aborted:
+ return "Aborted";
+ break;
+ case SERVO::CJState::Failed:
+ return "Failed";
+ break;
+ default:
+ break;
+ }
+
+ return "";
+ }
}
diff --git a/SourceCode/Bond/Servo/CControlJob.h b/SourceCode/Bond/Servo/CControlJob.h
index c5fdf60..8533018 100644
--- a/SourceCode/Bond/Servo/CControlJob.h
+++ b/SourceCode/Bond/Servo/CControlJob.h
@@ -45,6 +45,7 @@
CJState state() const noexcept { return m_state; }
uint8_t priority() const noexcept { return m_priority; }
void setPriority(uint8_t p) noexcept { m_priority = p; }
+ std::string getStateText();
// —— PJ 列表维护(去重)—— //
bool addPJ(const std::string& pjId); // 已存在则不重复添加
@@ -54,6 +55,7 @@
const std::vector<std::string>& pjIds() const noexcept { return m_pjIds; }
bool setPJs(const std::vector<CProcessJob*>& pjs);
void clearPJs() { m_pjIds.clear(); }
+ const std::vector<CProcessJob*>& getPjs() { return m_pjs; };
// —— 校验 —— //
struct ValidationIssue { uint32_t code; std::string text; };
diff --git a/SourceCode/Bond/Servo/CControlJobDlg.cpp b/SourceCode/Bond/Servo/CControlJobDlg.cpp
index 77311e8..a372529 100644
--- a/SourceCode/Bond/Servo/CControlJobDlg.cpp
+++ b/SourceCode/Bond/Servo/CControlJobDlg.cpp
@@ -14,7 +14,7 @@
CControlJobDlg::CControlJobDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_DIALOG_CONTROL_JOB, pParent)
{
-
+ m_pControlJob = nullptr;
}
CControlJobDlg::~CControlJobDlg()
@@ -29,40 +29,127 @@
BEGIN_MESSAGE_MAP(CControlJobDlg, CDialogEx)
+ ON_WM_SIZE()
END_MESSAGE_MAP()
+void CControlJobDlg::SetControlJob(SERVO::CControlJob* pControlJob)
+{
+ m_pControlJob = pControlJob;
+}
+
// CControlJobDlg 娑堟伅澶勭悊绋嬪簭
-
-
BOOL CControlJobDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
+
+ // label瀛椾綋
+ LOGFONT lf{};
+ GetFont()->GetLogFont(&lf);
+ lf.lfHeight = -20;
+ lf.lfWeight = FW_BOLD;
+ _tcscpy_s(lf.lfFaceName, _T("Arial"));
+ m_fontNoJob.CreateFontIndirect(&lf);
+ GetDlgItem(IDC_LABEL_NO_JOB)->SetFont(&m_fontNoJob);
+
+
+ // 鍒楄〃鎺т欢
HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1);
ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL);
-
- // m_list 宸茬粡鏄璇濇涓婄殑 CExpandableListCtrl 鎴愬憳锛堟嫋鎺т欢鏀圭被锛�
m_listCtrl.ModifyStyle(0, LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS);
- m_listCtrl.InsertColumn(0, _T("鍚嶇О"), LVCFMT_LEFT, 260);
+ m_listCtrl.InsertColumn(0, _T("鍚嶇О"), LVCFMT_LEFT, 180);
m_listCtrl.InsertColumn(1, _T("鐘舵��"), LVCFMT_LEFT, 120);
m_listCtrl.InsertColumn(2, _T("鎻忚堪"), LVCFMT_LEFT, 260);
+ m_listCtrl.InsertColumn(3, _T("閰嶆柟"), LVCFMT_LEFT, 180);
- auto* root1 = m_listCtrl.InsertRoot({ _T("EFEM"), _T("Ready"), _T("Front End Module") });
- m_listCtrl.InsertChild(root1, { _T("Slot #1"), _T("OK"), _T("150mm wafer") });
- m_listCtrl.InsertChild(root1, { _T("Slot #2"), _T("Empty"), _T("") });
- auto* root2 = m_listCtrl.InsertRoot({ _T("Bonder"), _T("Run"), _T("G1+G2 Process") });
- auto* ch21 = m_listCtrl.InsertChild(root2, { _T("Job A"), _T("Proc"), _T("Step 1") });
- m_listCtrl.InsertChild(ch21, { _T("SubStep A1"), _T("Done"), _T("Align") });
- m_listCtrl.InsertChild(ch21, { _T("SubStep A2"), _T("Run"), _T("Bond") });
-
- // 鍒濆璁╅《灞傚睍寮�
- root1->expanded = true;
- root2->expanded = true;
-
- m_listCtrl.RebuildVisible();
+ // 鎺т欢鐘舵��
+ Resize();
+ ShowGroup1(m_pControlJob == nullptr);
+ ShowGroup2(m_pControlJob != nullptr);
+ LoadData();
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
+
+void CControlJobDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogEx::OnSize(nType, cx, cy);
+ if (GetDlgItem(IDC_LIST1) == nullptr) return;
+ Resize();
+}
+
+void CControlJobDlg::Resize()
+{
+ CRect rcClient, rcItem;
+ CWnd* pItem;
+
+ GetClientRect(rcClient);
+
+
+ // 鍏抽棴鎸夐挳
+ int y = rcClient.bottom - 12;
+ pItem = GetDlgItem(IDCANCEL);
+ pItem->GetClientRect(&rcItem);
+ pItem->MoveWindow(rcClient.right - 12 - rcItem.Width(),
+ y - rcItem.Height(),
+ rcItem.Width(), rcItem.Height());
+ y -= rcItem.Height();
+ y -= 12;
+
+
+ // 绾�
+ pItem = GetDlgItem(IDC_LINE1);
+ pItem->MoveWindow(12, y, rcClient.Width() - 24, 2);
+ y -= 2;
+
+
+ // Label
+ pItem = GetDlgItem(IDC_LABEL_NO_JOB);
+ pItem->GetClientRect(&rcItem);
+ pItem->MoveWindow((rcClient.Width() - rcItem.Width()) / 2,
+ (y - rcItem.Height()) / 2,
+ rcItem.Width(), rcItem.Height());
+
+
+ // ListCtrl
+ pItem = GetDlgItem(IDC_LIST1);
+ pItem->MoveWindow(12, 12, rcClient.Width() - 24, y - 12);
+}
+
+void CControlJobDlg::ShowGroup1(BOOL bShow)
+{
+ GetDlgItem(IDC_LABEL_NO_JOB)->ShowWindow(bShow ? SW_SHOW : SW_HIDE);
+ GetDlgItem(IDC_LINE1)->ShowWindow(bShow ? SW_SHOW : SW_HIDE);
+}
+
+void CControlJobDlg::ShowGroup2(BOOL bShow)
+{
+ GetDlgItem(IDC_LIST1)->ShowWindow(bShow ? SW_SHOW : SW_HIDE);
+}
+
+void CControlJobDlg::LoadData()
+{
+ m_listCtrl.DeleteAllItems();
+
+ if (m_pControlJob != nullptr) {
+ auto* root1 = m_listCtrl.InsertRoot({ m_pControlJob->id().c_str(),
+ m_pControlJob->getStateText().c_str(), _T("") });
+ auto pjs = m_pControlJob->getPjs();
+ for (auto pj : pjs) {
+ auto* root2 = m_listCtrl.InsertChild(root1, {pj->id().c_str(),
+ pj->getStateText().c_str(), _T(""), pj->recipeSpec().c_str()});
+ auto cs = pj->carriers();
+ for (auto c : cs) {
+ m_listCtrl.InsertChild(root2, {c.carrierId.c_str(), _T(""), _T("") });
+ }
+ root2->expanded = true;
+ }
+ root1->expanded = true;
+
+
+ m_listCtrl.RebuildVisible();
+ }
+}
diff --git a/SourceCode/Bond/Servo/CControlJobDlg.h b/SourceCode/Bond/Servo/CControlJobDlg.h
index 83763f0..410f3ec 100644
--- a/SourceCode/Bond/Servo/CControlJobDlg.h
+++ b/SourceCode/Bond/Servo/CControlJobDlg.h
@@ -1,5 +1,6 @@
锘�#pragma once
#include "CExpandableListCtrl.h"
+#include "CControlJob.h"
// CControlJobDlg 瀵硅瘽妗�
@@ -11,6 +12,19 @@
public:
CControlJobDlg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁�
virtual ~CControlJobDlg();
+
+public:
+ void SetControlJob(SERVO::CControlJob* pControlJob);
+
+private:
+ void Resize();
+ void ShowGroup1(BOOL bShow);
+ void ShowGroup2(BOOL bShow);
+ void LoadData();
+
+private:
+ SERVO::CControlJob* m_pControlJob;
+ CFont m_fontNoJob;
protected:
CExpandableListCtrl m_listCtrl;
@@ -27,4 +41,5 @@
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
};
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 77b3a37..1f38e9f 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -1929,6 +1929,11 @@
return 0;
}
+ CControlJob* CMaster::getControlJob()
+ {
+ return m_pControlJob;
+ }
+
CLoadPort* CMaster::getPortWithCarrierId(const std::string& carrierId) const
{
CLoadPort* pPort;
@@ -2047,6 +2052,19 @@
m_processJobs.push_back(pProcessJob);
}
+
+ // 找到CProcessJob指针加入列表中
+ std::vector<CProcessJob*> tempPjs;
+ auto ids = m_pControlJob->pjIds();
+ for (auto id : ids) {
+ auto pj = getProcessJob(id);
+ if (pj != nullptr) {
+ tempPjs.push_back(pj);
+ }
+ }
+ m_pControlJob->setPJs(tempPjs);
+
+
// 如果版本升级,可在这里判断 version 来加载新字段
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index 097c2d6..e8c7236 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -110,6 +110,7 @@
std::vector<CProcessJob*>& getProcessJobs();
CProcessJob* getProcessJob(const std::string& id);
int setControlJob(CControlJob& controlJob);
+ CControlJob* getControlJob();
CLoadPort* getPortWithCarrierId(const std::string& carrierId) const;
bool saveState() const;
bool loadState(const std::string& path);
diff --git a/SourceCode/Bond/Servo/ProcessJob.cpp b/SourceCode/Bond/Servo/ProcessJob.cpp
index 77dea9a..801d9d2 100644
--- a/SourceCode/Bond/Servo/ProcessJob.cpp
+++ b/SourceCode/Bond/Servo/ProcessJob.cpp
@@ -381,4 +381,42 @@
return true;
}
+
+ std::string CProcessJob::getStateText()
+ {
+ switch (m_state)
+ {
+ case SERVO::PJState::NoState:
+ return "NoState";
+ break;
+ case SERVO::PJState::Queued:
+ return "Queued";
+ break;
+ case SERVO::PJState::SettingUp:
+ return "SettingUp";
+ break;
+ case SERVO::PJState::InProcess:
+ return "InProcess";
+ break;
+ case SERVO::PJState::Paused:
+ return "Queued";
+ break;
+ case SERVO::PJState::Aborting:
+ return "Aborting";
+ break;
+ case SERVO::PJState::Completed:
+ return "Queued";
+ break;
+ case SERVO::PJState::Aborted:
+ return "Aborted";
+ break;
+ case SERVO::PJState::Failed:
+ return "Failed";
+ break;
+ default:
+ break;
+ }
+
+ return "";
+ }
}
diff --git a/SourceCode/Bond/Servo/ProcessJob.h b/SourceCode/Bond/Servo/ProcessJob.h
index 062bd8b..7c78b26 100644
--- a/SourceCode/Bond/Servo/ProcessJob.h
+++ b/SourceCode/Bond/Servo/ProcessJob.h
@@ -94,6 +94,7 @@
StartPolicy startPolicy() const noexcept { return m_startPolicy; }
RecipeMethod recipeMethod() const noexcept { return m_recipeMethod; }
const std::string& recipeSpec() const noexcept { return m_recipeSpec; } // PPID 或 Spec
+ std::string getStateText();
// 绑定父 CJ
void setParentCjId(std::string cjId);
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index a327080..228d83e 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 91dc9ec..400712c 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -981,6 +981,7 @@
}
else if (id == IDC_BUTTON_JOBS) {
CControlJobDlg dlg;
+ dlg.SetControlJob(theApp.m_model.m_master.getControlJob());
dlg.DoModal();
}
else if (id == IDC_BUTTON_PORT_CONFIG) {
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
index 87072ee..c911fc0 100644
--- a/SourceCode/Bond/Servo/resource.h
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ
--
Gitblit v1.9.3