CAN的更改

This commit is contained in:
2025-05-09 16:13:11 +08:00
parent df4b481bbb
commit 03fd92ac86
8 changed files with 176 additions and 131 deletions

View File

@@ -175,40 +175,48 @@ namespace CapMachine.Wpf.Services
{
while (await CycleChannelInfo.Reader.WaitToReadAsync())
{
if (CycleChannelInfo.Reader.TryRead(out var CycleChannelData))
try
{
////第一次计时
//stopwatch.Start(); //启动Stopwatch
//新增数据
CacheHighFragMsg.AddRange(CycleChannelData);
MaxCacheCellCount++;
if (MaxCacheCellCount >= 600)
if (CycleChannelInfo.Reader.TryRead(out var CycleChannelData))
{
//CSV文件保存
SaveToCsv(CacheHighFragMsg);
CacheHighFragMsg.Clear();
MaxCacheCellCount = 0;
////第一次计时
//stopwatch.Start(); //启动Stopwatch
//新增数据
CacheHighFragMsg.AddRange(CycleChannelData);
MaxCacheCellCount++;
if (MaxCacheCellCount >= 600)
{
//CSV文件保存
SaveToCsv(CacheHighFragMsg);
CacheHighFragMsg.Clear();
MaxCacheCellCount = 0;
}
//}
//CacheRecordData.Clear();
//Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss:fff")}-{LineName}-保存成功!");
//}
//stopwatch.Stop(); //停止Stopwatch
//Console.WriteLine("保存数据耗时::{0}", stopwatch.Elapsed.TotalSeconds.ToString());
//stopwatch.Reset();
}
//}
//CacheRecordData.Clear();
//Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss:fff")}-{LineName}-保存成功!");
//}
//stopwatch.Stop(); //停止Stopwatch
//Console.WriteLine("保存数据耗时::{0}", stopwatch.Elapsed.TotalSeconds.ToString());
//stopwatch.Reset();
}
catch (Exception ex)
{
LogService.Error($"时间:{DateTime.Now.ToString()}-【ListenCycleChannelAction】-{ex.Message}");
}
}
}
#endregion
#region CSV Helper CSV