From a79fcf6a937e1bfe57014d2c99f1bb9f98bfa892 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 10 二月 2026 10:20:17 +0800
Subject: [PATCH] 1.完善日志; 2.背景图表配置 3.更改EAP通讯端口和设备名;

---
 SourceCode/Bond/Servo/PortConfigurationDlg.cpp |    3 +
 SourceCode/Bond/Servo/CMaster.cpp              |    3 +
 SourceCode/Bond/Servo/Model.cpp                |    4 +-
 SourceCode/Bond/Servo/CLoadPort.cpp            |   10 ++++-
 SourceCode/Bond/Servo/CPageGraph1.cpp          |   44 ++++++++++++++++-----
 SourceCode/Bond/Servo/CPortStatusReport.cpp    |   13 +++---
 6 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 4b86cf7..5f232b4 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -458,6 +458,11 @@
 
 		memcpy(&szBuffer[26], &slotProcess, sizeof(short));
 		memcpy(&szBuffer[36], &jopCount, sizeof(short));
+		LOGI("<CLoadPort-%d>sendCassetteCtrlCmd cmd=%d, jobExistence0=%d, jobExistence1=%d, slotProcess=%d, jobCount=%d",
+			m_nIndex, (int)cmd,
+			(jobExistence != nullptr && jobExistenceSize >= 1) ? (int)jobExistence[0] : -1,
+			(jobExistence != nullptr && jobExistenceSize >= 2) ? (int)jobExistence[1] : -1,
+			(int)slotProcess, (int)jopCount);
 		if (pJobDataA != nullptr) {
 			pJobDataA->serialize(&szBuffer[38], 1024 - 38);
 		}
@@ -968,8 +973,9 @@
 			m_portStatusReport.getPortStatus(), m_portStatusReport.getCassetteSequenceNo(), 
 			m_portStatusReport.getCassetteId().c_str());
 		if (m_portStatusReport.getPortStatus() == 3) {
-			LOGI("<CCassetteTranserStateStep>InUse<JobExistenceSlot:%d>",
-				m_portStatusReport.getJobExistenceSlot());
+			LOGI("<CCassetteTranserStateStep>InUse<JobExistenceSlot:%d, mapW1:%d>",
+				m_portStatusReport.getJobExistenceSlot(),
+				(int)portStatusReport.getJobExistenceSlot());
 		}
 
 
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 492e813..7ab8e30 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -3068,6 +3068,9 @@
 		if (portStatus != PORT_INUSE) {
 			LOGW("ProcessStart warning (ProceedWithCarrier): port status is %d (expected INUSE).", portStatus);
 		}
+		LOGI("ProcessStart payload (ProceedWithCarrier): port=%u, cassetteId=%s, scanMap=%d, jobExistence0=%d, jobExistence1=%d, slotProcess=%d, anyScheduled=%d",
+			port + 1, pPort->getCassetteId().c_str(), scanMap,
+			(int)jobExistence[0], (int)jobExistence[1], (int)slotProcess, anyScheduled ? 1 : 0);
 
 		pPort->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, jobCount, nullptr, nullptr);
 		return 0;
diff --git a/SourceCode/Bond/Servo/CPageGraph1.cpp b/SourceCode/Bond/Servo/CPageGraph1.cpp
index d34fd63..100771d 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph1.cpp
@@ -229,9 +229,7 @@
 		m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
 		m_slotTable.SetLineColor(lineColor);
 		m_slotTable.SetHeaderBgColor(headerBgColor);
-		LOGI("[Graph1] SlotTable create ret=%d hwnd=%p err=%lu rc=(%d,%d)-(%d,%d)",
-			created, m_slotTable.GetSafeHwnd(), GetLastError(),
-			rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
+		(void)created;
 	}
 	else {
 		m_slotTable.MoveWindow(&rcTable);
@@ -241,20 +239,16 @@
 		m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
 		m_slotTable.SetLineColor(lineColor);
 		m_slotTable.SetHeaderBgColor(headerBgColor);
-		LOGI("[Graph1] SlotTable moved rc=(%d,%d)-(%d,%d)", rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
 	}
 
 	// 濡傛灉瓒呭嚭鍙鍖哄煙锛屽己鍒剁Щ鍒板乏涓婅浣滀负鍏滃簳
 	CRect rcWnd;
 	m_slotTable.GetWindowRect(&rcWnd);
 	ScreenToClient(&rcWnd);
-	LOGI("[Graph1] SlotTable wnd rc=(%d,%d)-(%d,%d) client=(%d,%d)",
-		rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, rcClient.right, rcClient.bottom);
 	if (rcWnd.right <= 0 || rcWnd.bottom <= 0 ||
 		rcWnd.left >= rcClient.right || rcWnd.top >= rcClient.bottom) {
 		CRect rcFallback(10, 10, 10 + cfgW, 10 + cfgH);
 		m_slotTable.MoveWindow(&rcFallback);
-		LOGI("[Graph1] SlotTable fallback rc=(%d,%d)-(%d,%d)", rcFallback.left, rcFallback.top, rcFallback.right, rcFallback.bottom);
 	}
 	m_slotTable.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
 
@@ -270,7 +264,6 @@
 
 	std::vector<CSlotTableCtrl::Row> rows;
 	if (pEquipment != nullptr) {
-		LOGI("[Graph1] UpdateSlotTable eq=%s(%p)", pEquipment->getName().c_str(), pEquipment);
 		for (int i = 0; i < SLOT_MAX && rows.size() < 8; ++i) {
 			SERVO::CSlot* pSlot = pEquipment->getSlot(i);
 			if (pSlot == nullptr || !pSlot->isEnable()) continue;
@@ -291,7 +284,6 @@
 			rows.push_back(row);
 		}
 	}
-	LOGI("[Graph1] SlotTable rows=%zu", rows.size());
 
 	m_slotTableRowCount = static_cast<int>(rows.size());
 	if (m_slotTableRowCount < 1) m_slotTableRowCount = 1;
@@ -394,8 +386,39 @@
 	if (auto* pGraphWnd = GetDlgItem(IDC_SERVO_GRAPH1)) {
 		pGraphWnd->ModifyStyle(0, WS_CLIPSIBLINGS);
 	}
+	std::string iniPath = GetConfigPath();
 	CString strPath;
-	strPath.Format(_T("%s\\res\\Servo001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+	auto resolveGraphImagePath = [&](const char* iniKey, const char* defaultName) -> CString {
+		char value[MAX_PATH] = { 0 };
+		GetPrivateProfileStringA("Graph1", iniKey, defaultName, value, (DWORD)sizeof(value), iniPath.c_str());
+		std::string file = value;
+		auto trim = [](std::string& s) {
+			while (!s.empty() && (s.front() == ' ' || s.front() == '\t' || s.front() == '\r' || s.front() == '\n')) s.erase(s.begin());
+			while (!s.empty() && (s.back() == ' ' || s.back() == '\t' || s.back() == '\r' || s.back() == '\n')) s.pop_back();
+		};
+		trim(file);
+		if (file.empty()) file = defaultName;
+
+		CString path;
+		const bool isAbs = (file.size() > 1 && file[1] == ':') || (!file.empty() && (file[0] == '\\' || file[0] == '/'));
+		if (isAbs) {
+			path = file.c_str();
+		}
+		else if (file.rfind("res\\", 0) == 0 || file.rfind("res/", 0) == 0) {
+			path.Format(_T("%s\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(file.c_str()));
+		}
+		else {
+			path.Format(_T("%s\\res\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(file.c_str()));
+		}
+
+		DWORD attr = GetFileAttributes(path);
+		if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
+			path.Format(_T("%s\\res\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(defaultName));
+		}
+		return path;
+	};
+
+	strPath = resolveGraphImagePath("BackgroundBmp", "Servo001.bmp");
 	m_pGraph->AddImage(1, (LPTSTR)(LPCTSTR)strPath, 0, 0);
 
 	strPath.Format(_T("%s\\res\\Robot001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
@@ -411,7 +434,6 @@
 	// 娣诲姞鎸囩ず鍣�
 	// Bonder
 	// size config
-	std::string iniPath = GetConfigPath();
 	int boxSize = GetPrivateProfileIntA("Graph1", "BoxSize", 56, iniPath.c_str());
 	if (boxSize < 40) boxSize = 40;
 	if (boxSize > 80) boxSize = 80;
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.cpp b/SourceCode/Bond/Servo/CPortStatusReport.cpp
index 0d6fa95..a3cafdd 100644
--- a/SourceCode/Bond/Servo/CPortStatusReport.cpp
+++ b/SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -10,6 +10,7 @@
 	{
 		m_nPortStatus = 0;
 		m_nCassetteSequenceNo = 0;
+		memset(m_nJobExistenceSlot, 0, sizeof(m_nJobExistenceSlot));
 		m_nLoadingCassetteType = 0;
 		m_nQTimeFlag = 0;
 		m_nCassetteMappingState = 0;
@@ -27,11 +28,9 @@
 		m_nCassetteSequenceNo = other.m_nCassetteSequenceNo;
 		m_strCassetteID = other.m_strCassetteID;
 
-		// Job Existence Slot
-		if (PORT_INUSE == m_nPortStatus) {
-			for (int i = 0; i < 12; i++) {
-				m_nJobExistenceSlot[i] = other.m_nJobExistenceSlot[i];
-			}
+		// Job Existence Slot: always copy to avoid stale/uninitialized map
+		for (int i = 0; i < 12; i++) {
+			m_nJobExistenceSlot[i] = other.m_nJobExistenceSlot[i];
 		}
 
 		if (!m_strCassetteID.empty()) {
@@ -101,7 +100,7 @@
 		memcpy(&pszBuffer[index], m_strCassetteID.c_str(), strLen);
 		index += 20;
 
-		memcpy(&pszBuffer[index], &m_nJobExistenceSlot[0], sizeof(short));
+		memcpy(&pszBuffer[index], &m_nJobExistenceSlot[0], sizeof(short) * 12);
 		index += 12 * sizeof(short);
 
 		memcpy(&pszBuffer[index], &m_nLoadingCassetteType, sizeof(short));
@@ -133,7 +132,7 @@
 		CToolUnits::convertString(&pszBuffer[index], 20, m_strCassetteID);
 		index += 20;
 
-		memcpy(&m_nJobExistenceSlot[0], &pszBuffer[index], sizeof(short));
+		memcpy(&m_nJobExistenceSlot[0], &pszBuffer[index], sizeof(short) * 12);
 		index += 12 * sizeof(short);
 
 		memcpy(&m_nLoadingCassetteType, &pszBuffer[index], sizeof(short));
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index ce8ee46..4493f04 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -305,7 +305,7 @@
 	m_configuration.getUnitId(strUnitId);
 
 	// 鏈哄櫒鍨嬪彿鍜岃蒋浠剁増鏈彿搴斾粠閰嶇疆涓鍙栵紝褰撳墠鍏堝浐瀹氬��
-	CString strModeType = _T("Master");
+	CString strModeType = _T("Panel Bonder");
 	CString strSoftRev = _T("1.0.2");
 
 
@@ -537,7 +537,7 @@
 	m_hsmsPassive.loadEquipmentConstants((LPTSTR)(LPCTSTR)strVarialbleFile);
 	setControlState(m_currentControlState);
 	refreshDerivedSVs();
-	m_hsmsPassive.init(this, "APP", 7000);
+	m_hsmsPassive.init(this, "APP", 5000);
 	strVarialbleFile.Format(_T("%s\\ReportList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
 	m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile);
 	strVarialbleFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
index 2de5acd..e8e197d 100644
--- a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
+++ b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -497,6 +497,9 @@
     if (portStatus != PORT_INUSE) {
         LOGW("ProcessStart warning: port status is %d (expected INUSE).", portStatus);
     }
+    LOGI("ProcessStart payload: port=%d, cassetteId=%s, scanMap=%d, jobExistence0=%d, jobExistence1=%d, slotProcess=%d, anyScheduled=%d",
+        selPort + 1, pPort->getCassetteId().c_str(), scanMap,
+        (int)jobExistence[0], (int)jobExistence[1], (int)slotProcess, anyScheduled ? 1 : 0);
 
     int ret = pPort->sendCassetteCtrlCmd(cmd, jobExistence, 12, slotProcess, jobCount, nullptr,
         [selPort](int code) -> int {

--
Gitblit v1.9.3