From bea6407b376a4e426f0b120bae569fba6ab867db Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 08 十一月 2025 17:55:47 +0800
Subject: [PATCH] 1.CMaster.cpp 第 1644/1667/1691 行在记录 SV 曲线时通过 getGlassFromSlot(0) 取玻璃,而各设备的 initSlots() 都是从 1 开始编号(例如 CBonder.cpp (line 408)、CVacuumBake.cpp (line 415) 等)。槽位 0 永远不存在,所以 pGlass 始终是 nullptr,pGlass->addSVData(...) 的分支从未执行。结果 SERVO::CGlass::m_svDatas 里没有任何曲线数据,GlassJson::ToPrettyString 生成的 pretty 字符串也就没有 sv_datas,导出 CSV 时自然读不到曲线。 同一段代码还有一个潜在 Bug:虽然判断了 channel - 1 < bonderTypes.size(),但真正索引却用的是 bonderTypes[channel]。索引偏移会导致数据类型错位,最后一个通道甚至可能越界。即使修正了槽位,这里也需要同步改成 bonderTypes[channel - 1](另外两处 vacuumbakeTypes、coolingTypes 也一样)。

---
 SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h
index 3b8748c..a1d8aae 100644
--- a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h
+++ b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h
@@ -3,6 +3,11 @@
 //
 
 #pragma once
+
+#include "PLCSignalListener.h"
+#include "ProductResultStorage.h"
+
+#include <map>
 #include <vector>
 #include <numeric>
 #include <algorithm>
@@ -145,14 +150,25 @@
 	 * @param fJumpThreshold 璺冲彉闃堝�硷紝鐢ㄤ簬妫�娴嬫暟鎹殑鏄庢樉鏂偣銆�
 	 * @param nWindow 璺冲彉鍒ゆ柇鐨勫墠鍚庣獥鍙e搴︺��
 	 * @param nValleyMargin valley 鐐逛箣鍚庡灏戜釜鐐逛綔涓哄疄闄呭垏鍓茬偣銆�
-	 * @param nMinGlass1Count 绗竴娈垫渶灏戞湁鏁堢偣鏁伴檺鍒躲��
+	 * @param nMinGlass1Count 鏈�灏戞湁鏁堢偣鏁伴檺鍒躲��
 	 *
 	 * @return true 琛ㄧず鍒囧壊鎴愬姛锛宖alse 琛ㄧず澶辫触锛堜緥濡傛暟鎹笉瓒虫垨鏃犳槑鏄捐烦鍙橈級銆�
 	 */
 	bool SplitGlassSegments(int nOutNo, const std::vector<float>& validData,
 		std::vector<float>& vecGlass1, std::vector<float>& vecGlass2,
-		float fJumpThreshold = 1.0f, int nWindow = 3, int nValleyMargin = 0,
-		int nMinGlass1Count = 10);
+		float fJumpThreshold = 0.2f, int nWindow = 3, int nValleyMargin = 0,
+		int nMinGlassCount = 10);
+
+	/**
+	 * @brief 瀵规暟鎹寜鏁存暟閮ㄥ垎杩涜鍒嗙粍锛屼繚鐣欐暟鎹噺鏈�澶氱殑涓�缁勶紙鎺掗櫎寮傚父/骞叉壈锛夈��
+	 *
+	 * @param nOutNo 杈撳嚭閫氶亾缂栧彿锛岀敤浜庢棩蹇楄褰曘��
+	 * @param vecInput 鍘熷娴偣鏁版嵁锛堝凡瑁佸壀鏃犳晥鍊硷級銆�
+	 * @param vecOutput 杈撳嚭琚繚鐣欑殑涓昏鍒嗙粍鏁版嵁锛堟渶澶氱殑閭g粍锛夈��
+	 *
+	 * @return true 琛ㄧず鎴愬姛杩囨护鍑轰富鍒嗙粍锛宖alse 琛ㄧず鎵�鏈夋暟鎹兘琚繃婊ゆ垨涓虹┖銆�
+	 */
+	bool FilterDominantGroup(int nOutNo, const std::vector<float>& vecInput, std::vector<float>& vecOutput);
 
 	/**
 	 * @brief 浠庤緭鍏ユ暟鎹腑鎻愬彇涓�涓浐瀹氶暱搴︾殑绋冲畾鍖洪棿銆�
@@ -318,4 +334,18 @@
 	 * @brief 鏍囪绋嬪簭鏄惁閫氳繃鎵樼洏鍥炬爣閫�鍑�
 	 */
 	BOOL m_bExitingFromTray;
+
+	// === PLC 淇″彿鐩戝惉鍣� ===
+
+	/**
+	 * @brief PLC 淇″彿鐩戝惉鍣ㄥ疄渚嬶紝鐢ㄤ簬澶勭悊 PLC 淇″彿浜嬩欢
+	 */
+	CPLCSignalListener m_plcListener;
+
+	// === 浜у搧缁撴灉瀛樺偍 ===
+
+	/**
+	 * @brief 浜у搧缁撴灉瀛樺偍瀹炰緥锛岀敤浜庝繚瀛樺拰绠$悊娴嬮噺缁撴灉
+	 */
+	CProductResultStorage m_resultStorage;
 };

--
Gitblit v1.9.3