From da96e6da0b677c6a4e96308aaecd3d619a8e4db2 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 26 六月 2025 08:46:11 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/ServoDlg.cpp |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index b8c863c..dde6456 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -21,6 +21,7 @@
 #include "SystemLogManagerDlg.h"
 #include "UserManager.h"
 #include "SystemLogManager.h"
+#include "PortConfigurationDlg.h"
 
 
 #ifdef _DEBUG
@@ -190,6 +191,18 @@
 					GetRuntimeFormatText(strText, "");
 					m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
 				}
+				else if (state == SERVO::MASTERSTATE::STARTING) {
+					m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_STARTING);
+					m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0));
+					m_pMyStatusbar->setRunTimeText("正在启动...");
+				}
+				else if (state == SERVO::MASTERSTATE::MSERROR) {
+					m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE);
+					m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
+					m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_ALARM);
+					m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0));
+					m_pMyStatusbar->setRunTimeText("启动失败.");
+				}
 				else if (state == SERVO::MASTERSTATE::RUNNING) {
 					m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
 					m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE);
@@ -221,6 +234,9 @@
 						m_pMyStatusbar->setCurTaskBtnText("无");
 					}
 					else if (exCode == ROBOT_EVENT_ABORT) {
+						m_pMyStatusbar->setCurTaskBtnText("无");
+					}
+					else if (exCode == ROBOT_EVENT_RESTORE) {
 						m_pMyStatusbar->setCurTaskBtnText("无");
 					}
 				}
@@ -349,6 +365,7 @@
 
 	// 相当于延时调用master的初始化
 	theApp.m_model.m_master.init();
+	theApp.m_model.loadPortParams();
 
 
 	// 初始化master以后需要控件绑定数据
@@ -855,19 +872,39 @@
 {
 	int id = (int)lParam;
 	if (id == IDC_BUTTON_RUN) {
-		theApp.m_model.getMaster().start();
-		m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
+		if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) {
+			AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!");
+		}
+		else {
+			if (theApp.m_model.getMaster().start() == 0) {
+				m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
+			}
+		}
 	}
 	else if (id == IDC_BUTTON_STOP) {
-		theApp.m_model.getMaster().stop();
-		m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
+		if (theApp.m_model.getMaster().stop() == 0) {
+			m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
+		}
+	}
+	else if (id == IDC_BUTTON_PORT_CONFIG) {
+		CPortConfigurationDlg dlg;
+		dlg.DoModal();
 	}
 	else if (id == IDC_BUTTON_ROBOT) {
+		theApp.m_model.getMaster().clearError();
 		SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM);
 		CRobotCmdTestDlg dlg;
 		dlg.SetEFEM(pEFEM);
 		dlg.DoModal();
 	}
+	else if (id == IDC_BUTTON_SETTINGS) {
+		SERVO::CEquipment* pEq = theApp.m_model.m_master.getEquipment(EQ_ID_EFEM);
+		pEq->printDebugString001();
+		pEq = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder1);
+		pEq->printDebugString001();
+		pEq = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder2);
+		pEq->printDebugString001();
+	}
 	else if (id == IDC_BUTTON_OPERATOR) {
 		int menuId = (int)wParam;
 		SystemLogManager& logManager = SystemLogManager::getInstance();

--
Gitblit v1.9.3