From ebf96874b6a994e3b09b69f272416cb482cf25bb Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 30 五月 2025 18:49:43 +0800
Subject: [PATCH] 1.Fliper(G2) -> Aligner    VacuumBake(G1) -> Aligner搬送逻辑和模拟测试; 2.在状态栏增加当前搬送状态显示(按钮,下一步用于实现点击按钮展开搬送任务详情,中断操作等)

---
 SourceCode/Bond/Servo/ServoDlg.cpp |   62 ++++++++++++++++++++++++++-----
 1 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 69a0d76..1921443 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -169,6 +169,38 @@
 					}
 				}
 			}
+			else if (RX_CODE_MASTER_STATE_CHANGED == code) {
+				SERVO::MASTERSTATE state = theApp.m_model.getMaster().getState();
+				if (state == SERVO::MASTERSTATE::READY) {
+					m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_NORMAL);
+					m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0));
+					KillTimer(TIMER_ID_UPDATE_RUMTIME);
+					CString strText;
+					GetRuntimeFormatText(strText, "");
+					m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
+				}
+				else if (state == SERVO::MASTERSTATE::RUNNING) {
+					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 (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);
+					}
+				}
+			}
 
 			pAny->release();
 		}, [&]() -> void {
@@ -704,12 +736,8 @@
 		if (index >= 4) index = 0;
 		static char* status[] = {"|", "/", "--", "\\"};
 
-		CTime time = CTime::GetCurrentTime();
 		CString strText;
-		strText.Format(_T("已运行:%d-%02d-%02d %02d:%02d:%02d   %s"),
-			time.GetYear(), time.GetMonth(), time.GetDay(),
-			time.GetHour(), time.GetMinute(), time.GetSecond(),
-			status[index]);
+		GetRuntimeFormatText(strText, status[index]);
 		m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
 	}
 
@@ -750,16 +778,11 @@
 		theApp.m_model.getMaster().start();
 		m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
 		m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE);
-		m_pMyStatusbar->setBkgnd(STATUSBAR_BK_RUNNING);
-		SetTimer(TIMER_ID_UPDATE_RUMTIME, 1000, nullptr);
-
 	}
 	else if (id == IDC_BUTTON_STOP) {
 		theApp.m_model.getMaster().stop();
 		m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE);
 		m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
-		m_pMyStatusbar->setBkgnd(STATUSBAR_BK_ALARM);
-		KillTimer(TIMER_ID_UPDATE_RUMTIME);
 	}
 	else if (id == IDC_BUTTON_ROBOT) {
 		SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM);
@@ -768,4 +791,23 @@
 		dlg.DoModal();
 	}
 	return 0;
+}
+
+CString& CServoDlg::GetRuntimeFormatText(CString& strText, const char* pszSuffix)
+{
+	ULONGLONG ullRunTime = (ULONGLONG)(theApp.m_model.getMaster().getRunTime() * 0.001);
+	int h, m, s;
+	h = int(ullRunTime / 3600);
+	m = int((ullRunTime % 3600) / 60);
+	s = int(ullRunTime % 60);
+
+	SERVO::MASTERSTATE state = theApp.m_model.getMaster().getState();
+	if (state == SERVO::MASTERSTATE::RUNNING) {
+		strText.Format(_T("正在运行:%02d:%02d:%02d   %s"), h, m, s, pszSuffix);
+	}
+	else {
+		strText.Format(_T("已运行:%02d:%02d:%02d   %s"), h, m, s, pszSuffix);
+	}
+
+	return strText;
 }
\ No newline at end of file

--
Gitblit v1.9.3