CAN的更改
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user