From f43cd123ec78c608127a056489fc1d7a1aa8703e Mon Sep 17 00:00:00 2001 From: limingCai <1902058478@qq.com> Date: Wed, 16 Sep 2026 10:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=80=9A=E4=BF=A1=E7=BB=84?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JinYuan.Helper/ScanerHook.cs | 1 + LargeSquareOne/CommunicationEditForm.cs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/JinYuan.Helper/ScanerHook.cs b/JinYuan.Helper/ScanerHook.cs index d0bc6c4..d136444 100644 --- a/JinYuan.Helper/ScanerHook.cs +++ b/JinYuan.Helper/ScanerHook.cs @@ -84,6 +84,7 @@ namespace JinYuan.Helper { EventMsg msg = (EventMsg)Marshal.PtrToStructure(lParam, typeof(EventMsg)); codes.Add(msg); + Debug.WriteLine($"scanerEvent: {codes.Result}, msg.message: {msg.message}, msg.paramH: {msg.paramH}"); if (ScanerEvent != null && msg.message == 13 && msg.paramH > 0 && !string.IsNullOrEmpty(codes.Result)) { ScanerEvent(codes); diff --git a/LargeSquareOne/CommunicationEditForm.cs b/LargeSquareOne/CommunicationEditForm.cs index ebef2d6..6e6a425 100644 --- a/LargeSquareOne/CommunicationEditForm.cs +++ b/LargeSquareOne/CommunicationEditForm.cs @@ -177,7 +177,13 @@ namespace LargeSquareOne { if (e.RowIndex < 0) return; - editingConfig = TotalGroups[e.RowIndex]; + // 获取当前行显示的数据 + var currentRow = groupTable.Rows[e.RowIndex]; + var config = (PlcGroupConfig)currentRow.DataBoundItem; + editingConfig = TotalGroups.First(g => + g.PlcNum == config.PlcNum && + g.GroupName == config.GroupName && + g.Start == config.Start); // 禁止编辑PLC编号和组名列 if (groupTable.Columns[e.ColumnIndex].Name == "PlcNum") @@ -193,7 +199,13 @@ namespace LargeSquareOne { if (e.RowIndex < 0 || e.RowIndex >= TotalGroups.Count) return; - var config = TotalGroups[e.RowIndex]; + // 获取当前行显示的数据 + var currentRow = groupTable.Rows[e.RowIndex]; + var curConfig = (PlcGroupConfig)currentRow.DataBoundItem; + var config = TotalGroups.First(g => + g.PlcNum == curConfig.PlcNum && + g.GroupName == curConfig.GroupName && + g.Start == curConfig.Start); var value = groupTable[e.ColumnIndex, e.RowIndex].Value; try