feat: 重构项目结构,添加 WPF 应用
- 将核心功能提取到 WCTDataMiner.Core 类库 - 添加 WCTDataMiner.Wpf 桌面应用 - 支持数据解析、导出、统计等功能 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
7
WCTDataMiner.slnx
Normal file
7
WCTDataMiner.slnx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Solution>
|
||||||
|
<Folder Name="/src/">
|
||||||
|
<Project Path="src/WCTDataMiner.Core/WCTDataMiner.Core.csproj" />
|
||||||
|
<Project Path="src/WCTDataMiner.Wpf/WCTDataMiner.Wpf.csproj" />
|
||||||
|
<Project Path="src/WCTDataMiner/WCTDataMiner.csproj" />
|
||||||
|
</Folder>
|
||||||
|
</Solution>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Configuration;
|
namespace WCTDataMiner.Core.Configuration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用配置
|
/// 应用配置
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class PlossRecordConfiguration : IEntityTypeConfiguration<PlossRecord>
|
public class PlossRecordConfiguration : IEntityTypeConfiguration<PlossRecord>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class QfodRecordConfiguration : IEntityTypeConfiguration<QfodRecord>
|
public class QfodRecordConfiguration : IEntityTypeConfiguration<QfodRecord>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class RxTypeConfiguration : IEntityTypeConfiguration<RxType>
|
public class RxTypeConfiguration : IEntityTypeConfiguration<RxType>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class TestScenarioConfiguration : IEntityTypeConfiguration<TestScenario>
|
public class TestScenarioConfiguration : IEntityTypeConfiguration<TestScenario>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class TxHardwareConfiguration : IEntityTypeConfiguration<TxHardware>
|
public class TxHardwareConfiguration : IEntityTypeConfiguration<TxHardware>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class TxPanelConfiguration : IEntityTypeConfiguration<TxPanel>
|
public class TxPanelConfiguration : IEntityTypeConfiguration<TxPanel>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data.Configurations;
|
namespace WCTDataMiner.Core.Data.Configurations;
|
||||||
|
|
||||||
public class TxSoftwareConfiguration : IEntityTypeConfiguration<TxSoftware>
|
public class TxSoftwareConfiguration : IEntityTypeConfiguration<TxSoftware>
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data;
|
namespace WCTDataMiner.Core.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库上下文工厂实现 - 支持SQLite和PostgreSQL切换
|
/// 数据库上下文工厂实现 - 支持SQLite和PostgreSQL切换
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Data;
|
namespace WCTDataMiner.Core.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库上下文工厂接口
|
/// 数据库上下文工厂接口
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data;
|
namespace WCTDataMiner.Core.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始数据种子
|
/// 初始数据种子
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Data;
|
namespace WCTDataMiner.Core.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WCT数据采集数据库上下文
|
/// WCT数据采集数据库上下文
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Parsers;
|
using WCTDataMiner.Core.Parsers;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner.Extensions;
|
namespace WCTDataMiner.Core.Extensions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务注册扩展
|
/// 服务注册扩展
|
||||||
@@ -51,4 +51,4 @@ public static class ServiceCollectionExtensions
|
|||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ploss记录实体 - 存储Ploss FOD格式解析数据
|
/// Ploss记录实体 - 存储Ploss FOD格式解析数据
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Qfod记录实体 - 存储Qfod格式解析数据
|
/// Qfod记录实体 - 存储Qfod格式解析数据
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RX类型维度表
|
/// RX类型维度表
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试场景实体 - 通过外键关联各维度表
|
/// 测试场景实体 - 通过外键关联各维度表
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TX硬件版本维度表
|
/// TX硬件版本维度表
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TX面板类型维度表
|
/// TX面板类型维度表
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Models;
|
namespace WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TX软件版本维度表
|
/// TX软件版本维度表
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace WCTDataMiner.Parsers;
|
namespace WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件名解析器 - 从文件名提取场景信息
|
/// 文件名解析器 - 从文件名提取场景信息
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Parsers;
|
namespace WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通用解析器接口
|
/// 通用解析器接口
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Parsers;
|
namespace WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ploss FOD日志解析器
|
/// Ploss FOD日志解析器
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Parsers;
|
namespace WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Qfod日志解析器
|
/// Qfod日志解析器
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据清理服务 - 支持软删除
|
/// 数据清理服务 - 支持软删除
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 维度表管理服务 - 负责维度表的CRUD操作
|
/// 维度表管理服务 - 负责维度表的CRUD操作
|
||||||
@@ -2,10 +2,10 @@ using System.Globalization;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据导出服务
|
/// 数据导出服务
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Serilog;
|
using Microsoft.Extensions.Logging;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
using WCTDataMiner.Parsers;
|
using WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析流程协调服务 - 协调文件名解析、行解析、批量写入
|
/// 解析流程协调服务 - 协调文件名解析、行解析、批量写入
|
||||||
@@ -17,6 +17,7 @@ public class ParseService
|
|||||||
private readonly QfodParser _qfodParser;
|
private readonly QfodParser _qfodParser;
|
||||||
private readonly PlossParser _plossParser;
|
private readonly PlossParser _plossParser;
|
||||||
private readonly FileNameParser _fileNameParser;
|
private readonly FileNameParser _fileNameParser;
|
||||||
|
private readonly ILogger<ParseService> _logger;
|
||||||
private readonly int _batchSize;
|
private readonly int _batchSize;
|
||||||
|
|
||||||
public ParseService(
|
public ParseService(
|
||||||
@@ -25,13 +26,15 @@ public class ParseService
|
|||||||
QfodParser qfodParser,
|
QfodParser qfodParser,
|
||||||
PlossParser plossParser,
|
PlossParser plossParser,
|
||||||
FileNameParser fileNameParser,
|
FileNameParser fileNameParser,
|
||||||
IConfiguration config)
|
IConfiguration config,
|
||||||
|
ILogger<ParseService> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_scenarioService = scenarioService;
|
_scenarioService = scenarioService;
|
||||||
_qfodParser = qfodParser;
|
_qfodParser = qfodParser;
|
||||||
_plossParser = plossParser;
|
_plossParser = plossParser;
|
||||||
_fileNameParser = fileNameParser;
|
_fileNameParser = fileNameParser;
|
||||||
|
_logger = logger;
|
||||||
_batchSize = config.GetValue("Parser:BatchSize", 1000);
|
_batchSize = config.GetValue("Parser:BatchSize", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +47,7 @@ public class ParseService
|
|||||||
|
|
||||||
if (!fileInfo.Exists)
|
if (!fileInfo.Exists)
|
||||||
{
|
{
|
||||||
Log.Error("文件不存在: {FilePath}", filePath);
|
_logger.LogError("文件不存在: {FilePath}", filePath);
|
||||||
return new ParseReport(fileInfo.Name, 0, 0, 0, "文件不存在");
|
return new ParseReport(fileInfo.Name, 0, 0, 0, "文件不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +55,11 @@ public class ParseService
|
|||||||
var scenarioInfo = _fileNameParser.Parse(fileInfo.Name);
|
var scenarioInfo = _fileNameParser.Parse(fileInfo.Name);
|
||||||
if (scenarioInfo == null)
|
if (scenarioInfo == null)
|
||||||
{
|
{
|
||||||
Log.Error("无法解析文件名: {FileName}", fileInfo.Name);
|
_logger.LogError("无法解析文件名: {FileName}", fileInfo.Name);
|
||||||
return new ParseReport(fileInfo.Name, 0, 0, 1, "文件名格式不匹配");
|
return new ParseReport(fileInfo.Name, 0, 0, 1, "文件名格式不匹配");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Information("解析文件: {FileName} => 场景: {TxPanel}/{TxHardware}/{TxSoftware}/{RxType}/{TestDate}",
|
_logger.LogInformation("解析文件: {FileName} => 场景: {TxPanel}/{TxHardware}/{TxSoftware}/{RxType}/{TestDate}",
|
||||||
fileInfo.Name, scenarioInfo.TxPanel, scenarioInfo.TxHardware,
|
fileInfo.Name, scenarioInfo.TxPanel, scenarioInfo.TxHardware,
|
||||||
scenarioInfo.TxSoftware, scenarioInfo.RxType, scenarioInfo.TestDate);
|
scenarioInfo.TxSoftware, scenarioInfo.RxType, scenarioInfo.TestDate);
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ public class ParseService
|
|||||||
qfodRecords.Add(result.Record!);
|
qfodRecords.Add(result.Record!);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("Qfod解析失败 [{Line}] {Error}: {Message}",
|
_logger.LogError("Qfod解析失败 [{Line}] {Error}: {Message}",
|
||||||
lineNumber, result.ErrorType, result.ErrorMessage);
|
lineNumber, result.ErrorType, result.ErrorMessage);
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
@@ -94,7 +97,7 @@ public class ParseService
|
|||||||
plossRecords.Add(result.Record!);
|
plossRecords.Add(result.Record!);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("Ploss解析失败 [{Line}] {Error}: {Message}",
|
_logger.LogError("Ploss解析失败 [{Line}] {Error}: {Message}",
|
||||||
lineNumber, result.ErrorType, result.ErrorMessage);
|
lineNumber, result.ErrorType, result.ErrorMessage);
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
@@ -107,7 +110,7 @@ public class ParseService
|
|||||||
// 更新场景统计
|
// 更新场景统计
|
||||||
await UpdateScenarioStatsAsync(scenario.Id, qfodRecords.Count, plossRecords.Count);
|
await UpdateScenarioStatsAsync(scenario.Id, qfodRecords.Count, plossRecords.Count);
|
||||||
|
|
||||||
Log.Information("解析完成: {FileName} => Qfod: {QfodCount}, Ploss: {PlossCount}, Errors: {ErrorCount}",
|
_logger.LogInformation("解析完成: {FileName} => Qfod: {QfodCount}, Ploss: {PlossCount}, Errors: {ErrorCount}",
|
||||||
fileInfo.Name, qfodRecords.Count, plossRecords.Count, errorCount);
|
fileInfo.Name, qfodRecords.Count, plossRecords.Count, errorCount);
|
||||||
|
|
||||||
return new ParseReport(fileInfo.Name, qfodRecords.Count, plossRecords.Count, errorCount, null);
|
return new ParseReport(fileInfo.Name, qfodRecords.Count, plossRecords.Count, errorCount, null);
|
||||||
@@ -121,14 +124,14 @@ public class ParseService
|
|||||||
var dirInfo = new DirectoryInfo(dirPath);
|
var dirInfo = new DirectoryInfo(dirPath);
|
||||||
if (!dirInfo.Exists)
|
if (!dirInfo.Exists)
|
||||||
{
|
{
|
||||||
Log.Error("目录不存在: {DirPath}", dirPath);
|
_logger.LogError("目录不存在: {DirPath}", dirPath);
|
||||||
return [new ParseReport(dirPath, 0, 0, 0, "目录不存在")];
|
return [new ParseReport(dirPath, 0, 0, 0, "目录不存在")];
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||||
var logFiles = dirInfo.GetFiles("*.log", searchOption);
|
var logFiles = dirInfo.GetFiles("*.log", searchOption);
|
||||||
|
|
||||||
Log.Information("发现 {FileCount} 个日志文件", logFiles.Length);
|
_logger.LogInformation("发现 {FileCount} 个日志文件", logFiles.Length);
|
||||||
|
|
||||||
var reports = new List<ParseReport>();
|
var reports = new List<ParseReport>();
|
||||||
foreach (var file in logFiles)
|
foreach (var file in logFiles)
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
using WCTDataMiner.Parsers;
|
using WCTDataMiner.Core.Parsers;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试场景服务 - 负责测试场景的创建和查询
|
/// 测试场景服务 - 负责测试场景的创建和查询
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Models;
|
using WCTDataMiner.Core.Models;
|
||||||
|
|
||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 统计查询服务
|
/// 统计查询服务
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace WCTDataMiner.Services;
|
namespace WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阈值计算器 - 根据接收功率查表获取动态阈值
|
/// 阈值计算器 - 根据接收功率查表获取动态阈值
|
||||||
23
src/WCTDataMiner.Core/WCTDataMiner.Core.csproj
Normal file
23
src/WCTDataMiner.Core/WCTDataMiner.Core.csproj
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>12.0</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- ORM -->
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||||
|
|
||||||
|
<!-- Configuration -->
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
8
src/WCTDataMiner.Wpf/App.xaml
Normal file
8
src/WCTDataMiner.Wpf/App.xaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<Application x:Class="WCTDataMiner.Wpf.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:WCTDataMiner.Wpf">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
52
src/WCTDataMiner.Wpf/App.xaml.cs
Normal file
52
src/WCTDataMiner.Wpf/App.xaml.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using WCTDataMiner.Core.Extensions;
|
||||||
|
using WCTDataMiner.Core.Services;
|
||||||
|
using WCTDataMiner.Wpf.ViewModels;
|
||||||
|
using WCTDataMiner.Wpf.Views;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
private IHost? _host;
|
||||||
|
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
_host = Host.CreateDefaultBuilder()
|
||||||
|
.ConfigureServices((context, services) =>
|
||||||
|
{
|
||||||
|
// 注册 Core 层服务
|
||||||
|
services.AddDatabaseServices(context.Configuration);
|
||||||
|
services.AddApplicationServices();
|
||||||
|
|
||||||
|
// 注册 ViewModels
|
||||||
|
services.AddTransient<MainViewModel>();
|
||||||
|
services.AddTransient<ScenarioListViewModel>();
|
||||||
|
services.AddTransient<PlossChartViewModel>();
|
||||||
|
services.AddTransient<QfodChartViewModel>();
|
||||||
|
|
||||||
|
// 注册 Views
|
||||||
|
services.AddTransient<MainWindow>();
|
||||||
|
services.AddTransient<ScenarioListView>();
|
||||||
|
services.AddTransient<PlossChartView>();
|
||||||
|
services.AddTransient<QfodChartView>();
|
||||||
|
})
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var mainWindow = _host.Services.GetRequiredService<MainWindow>();
|
||||||
|
mainWindow.Show();
|
||||||
|
|
||||||
|
base.OnStartup(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExit(ExitEventArgs e)
|
||||||
|
{
|
||||||
|
_host?.Dispose();
|
||||||
|
base.OnExit(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/WCTDataMiner.Wpf/AssemblyInfo.cs
Normal file
10
src/WCTDataMiner.Wpf/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly:ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
66
src/WCTDataMiner.Wpf/MainWindow.xaml
Normal file
66
src/WCTDataMiner.Wpf/MainWindow.xaml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<Window x:Class="WCTDataMiner.Wpf.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:WCTDataMiner.Wpf"
|
||||||
|
xmlns:views="clr-namespace:WCTDataMiner.Wpf.Views"
|
||||||
|
xmlns:viewmodels="clr-namespace:WCTDataMiner.Wpf.ViewModels"
|
||||||
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="WCTDataMiner - FOD 数据分析工具" Height="600" Width="900"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
|
<Window.DataContext>
|
||||||
|
<viewmodels:MainViewModel/>
|
||||||
|
</Window.DataContext>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左侧导航栏 -->
|
||||||
|
<Border Grid.Column="0" Background="#F5F5F5" BorderBrush="#DDD" BorderThickness="0,0,1,0">
|
||||||
|
<StackPanel Margin="10">
|
||||||
|
<TextBlock Text="导航" FontSize="16" FontWeight="Bold" Margin="0,0,0,15"/>
|
||||||
|
|
||||||
|
<Button Content="场景列表" Command="{Binding NavigateToScenariosCommand}"
|
||||||
|
Margin="0,5" Padding="10,5" HorizontalAlignment="Stretch"/>
|
||||||
|
|
||||||
|
<TextBlock Text="筛选条件" FontSize="14" FontWeight="Bold" Margin="0,20,0,10"/>
|
||||||
|
|
||||||
|
<TextBlock Text="TX 面板:" Margin="0,5"/>
|
||||||
|
<ComboBox ItemsSource="{Binding TxPanels}" SelectedItem="{Binding SelectedTxPanel}"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<TextBlock Text="TX 硬件:" Margin="0,5"/>
|
||||||
|
<ComboBox ItemsSource="{Binding TxHardwares}" SelectedItem="{Binding SelectedTxHardware}"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<TextBlock Text="TX 软件:" Margin="0,5"/>
|
||||||
|
<ComboBox ItemsSource="{Binding TxSoftwares}" SelectedItem="{Binding SelectedTxSoftware}"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<TextBlock Text="RX 类型:" Margin="0,5"/>
|
||||||
|
<ComboBox ItemsSource="{Binding RxTypes}" SelectedItem="{Binding SelectedRxType}"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 右侧内容区域 -->
|
||||||
|
<ContentControl Grid.Column="1" Content="{Binding CurrentView}">
|
||||||
|
<ContentControl.Resources>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodels:ScenarioListViewModel}">
|
||||||
|
<views:ScenarioListView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodels:PlossChartViewModel}">
|
||||||
|
<views:PlossChartView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodels:QfodChartViewModel}">
|
||||||
|
<views:QfodChartView/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ContentControl.Resources>
|
||||||
|
</ContentControl>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
23
src/WCTDataMiner.Wpf/MainWindow.xaml.cs
Normal file
23
src/WCTDataMiner.Wpf/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
54
src/WCTDataMiner.Wpf/ViewModels/MainViewModel.cs
Normal file
54
src/WCTDataMiner.Wpf/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主窗口 ViewModel - 导航控制
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableObject _currentView = null!;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _selectedTxPanel;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _selectedTxHardware;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _selectedTxSoftware;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _selectedRxType;
|
||||||
|
|
||||||
|
// 筛选选项列表
|
||||||
|
public List<string> TxPanels { get; } = new() { "全部", "singleMold", "dualMold" };
|
||||||
|
public List<string> TxHardwares { get; } = new() { "全部", "v1.0", "v2.0" };
|
||||||
|
public List<string> TxSoftwares { get; } = new() { "全部", "hex2_1", "hex2_2" };
|
||||||
|
public List<string> RxTypes { get; } = new() { "全部", "iPhone15", "iPhone16", "Android" };
|
||||||
|
|
||||||
|
public MainViewModel()
|
||||||
|
{
|
||||||
|
_currentView = new ScenarioListViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void NavigateToScenarios()
|
||||||
|
{
|
||||||
|
CurrentView = new ScenarioListViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void NavigateToPlossChart(int scenarioId)
|
||||||
|
{
|
||||||
|
CurrentView = new PlossChartViewModel { ScenarioId = scenarioId };
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void NavigateToQfodChart(int scenarioId)
|
||||||
|
{
|
||||||
|
CurrentView = new QfodChartViewModel { ScenarioId = scenarioId };
|
||||||
|
}
|
||||||
|
}
|
||||||
49
src/WCTDataMiner.Wpf/ViewModels/PlossChartViewModel.cs
Normal file
49
src/WCTDataMiner.Wpf/ViewModels/PlossChartViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using LiveChartsCore;
|
||||||
|
using LiveChartsCore.SkiaSharpView;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ploss 折线图 ViewModel
|
||||||
|
/// </summary>
|
||||||
|
public partial class PlossChartViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _scenarioId;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ISeries[] _series;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Axis[] _xAxes;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Axis[] _yAxes;
|
||||||
|
|
||||||
|
public PlossChartViewModel()
|
||||||
|
{
|
||||||
|
// 初始化图表配置
|
||||||
|
Series = Array.Empty<ISeries>();
|
||||||
|
XAxes = new Axis[] { new Axis { Name = "Trigger Count" } };
|
||||||
|
YAxes = new Axis[] { new Axis { Name = "Power Loss (mW)" } };
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
// TODO: 从数据库加载 Ploss 数据并构建图表
|
||||||
|
Series = new ISeries[]
|
||||||
|
{
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = "Ploss",
|
||||||
|
Values = new double[] { -2882, -3500, -4200, -3800, -4500 }
|
||||||
|
},
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = "Threshold",
|
||||||
|
Values = new double[] { -3000, -3000, -3000, -3000, -3000 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
49
src/WCTDataMiner.Wpf/ViewModels/QfodChartViewModel.cs
Normal file
49
src/WCTDataMiner.Wpf/ViewModels/QfodChartViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using LiveChartsCore;
|
||||||
|
using LiveChartsCore.SkiaSharpView;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Qfod 折线图 ViewModel
|
||||||
|
/// </summary>
|
||||||
|
public partial class QfodChartViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _scenarioId;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ISeries[] _series;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Axis[] _xAxes;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Axis[] _yAxes;
|
||||||
|
|
||||||
|
public QfodChartViewModel()
|
||||||
|
{
|
||||||
|
// 初始化图表配置
|
||||||
|
Series = Array.Empty<ISeries>();
|
||||||
|
XAxes = new Axis[] { new Axis { Name = "Coil Index" } };
|
||||||
|
YAxes = new Axis[] { new Axis { Name = "Q Value" } };
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
// TODO: 从数据库加载 Qfod 数据并构建图表
|
||||||
|
Series = new ISeries[]
|
||||||
|
{
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = "DeltaQ",
|
||||||
|
Values = new double[] { 25, 30, 28 }
|
||||||
|
},
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = "CurrentQ",
|
||||||
|
Values = new double[] { 45.5, 50.2, 48.8 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
36
src/WCTDataMiner.Wpf/ViewModels/ScenarioListViewModel.cs
Normal file
36
src/WCTDataMiner.Wpf/ViewModels/ScenarioListViewModel.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 场景列表 ViewModel
|
||||||
|
/// </summary>
|
||||||
|
public partial class ScenarioListViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private List<ScenarioItem> _scenarios;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ScenarioItem? _selectedScenario;
|
||||||
|
|
||||||
|
public ScenarioListViewModel()
|
||||||
|
{
|
||||||
|
// TODO: 从数据库加载场景列表
|
||||||
|
_scenarios = new List<ScenarioItem>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 场景项数据模型
|
||||||
|
/// </summary>
|
||||||
|
public class ScenarioItem
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string TxPanel { get; set; } = "";
|
||||||
|
public string TxHardware { get; set; } = "";
|
||||||
|
public string TxSoftware { get; set; } = "";
|
||||||
|
public string RxType { get; set; } = "";
|
||||||
|
public string TestDate { get; set; } = "";
|
||||||
|
public int QfodCount { get; set; }
|
||||||
|
public int PlossCount { get; set; }
|
||||||
|
}
|
||||||
28
src/WCTDataMiner.Wpf/Views/PlossChartView.xaml
Normal file
28
src/WCTDataMiner.Wpf/Views/PlossChartView.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<UserControl x:Class="WCTDataMiner.Wpf.Views.PlossChartView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||||
|
xmlns:local="clr-namespace:WCTDataMiner.Wpf.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="400" d:DesignWidth="600">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="Ploss 功率损耗趋势图" FontSize="18" FontWeight="Bold"/>
|
||||||
|
<TextBlock Text="{Binding ScenarioId, StringFormat=' - 场景 {0}'}" FontSize="18" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<lvc:CartesianChart Grid.Row="1"
|
||||||
|
Series="{Binding Series}"
|
||||||
|
XAxes="{Binding XAxes}"
|
||||||
|
YAxes="{Binding YAxes}"
|
||||||
|
LegendPosition="Bottom"
|
||||||
|
Background="White"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
18
src/WCTDataMiner.Wpf/Views/PlossChartView.xaml.cs
Normal file
18
src/WCTDataMiner.Wpf/Views/PlossChartView.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.Views;
|
||||||
|
|
||||||
|
public partial class PlossChartView : UserControl
|
||||||
|
{
|
||||||
|
public PlossChartView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += async (s, e) =>
|
||||||
|
{
|
||||||
|
if (DataContext is ViewModels.PlossChartViewModel vm)
|
||||||
|
{
|
||||||
|
await vm.LoadDataAsync();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/WCTDataMiner.Wpf/Views/QfodChartView.xaml
Normal file
28
src/WCTDataMiner.Wpf/Views/QfodChartView.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<UserControl x:Class="WCTDataMiner.Wpf.Views.QfodChartView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||||
|
xmlns:local="clr-namespace:WCTDataMiner.Wpf.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="400" d:DesignWidth="600">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="Qfod Q值变化图" FontSize="18" FontWeight="Bold"/>
|
||||||
|
<TextBlock Text="{Binding ScenarioId, StringFormat=' - 场景 {0}'}" FontSize="18" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<lvc:CartesianChart Grid.Row="1"
|
||||||
|
Series="{Binding Series}"
|
||||||
|
XAxes="{Binding XAxes}"
|
||||||
|
YAxes="{Binding YAxes}"
|
||||||
|
LegendPosition="Bottom"
|
||||||
|
Background="White"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
18
src/WCTDataMiner.Wpf/Views/QfodChartView.xaml.cs
Normal file
18
src/WCTDataMiner.Wpf/Views/QfodChartView.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.Views;
|
||||||
|
|
||||||
|
public partial class QfodChartView : UserControl
|
||||||
|
{
|
||||||
|
public QfodChartView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += async (s, e) =>
|
||||||
|
{
|
||||||
|
if (DataContext is ViewModels.QfodChartViewModel vm)
|
||||||
|
{
|
||||||
|
await vm.LoadDataAsync();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/WCTDataMiner.Wpf/Views/ScenarioListView.xaml
Normal file
46
src/WCTDataMiner.Wpf/Views/ScenarioListView.xaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<UserControl x:Class="WCTDataMiner.Wpf.Views.ScenarioListView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:WCTDataMiner.Wpf.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="400" d:DesignWidth="600">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Text="测试场景列表" FontSize="18" FontWeight="Bold" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
<DataGrid Grid.Row="1" ItemsSource="{Binding Scenarios}"
|
||||||
|
SelectedItem="{Binding SelectedScenario}"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
AlternatingRowBackground="#F9F9F9">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="TX 面板" Binding="{Binding TxPanel}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="TX 硬件" Binding="{Binding TxHardware}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="TX 软件" Binding="{Binding TxSoftware}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="RX 类型" Binding="{Binding RxType}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="测试日期" Binding="{Binding TestDate}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="Qfod 数量" Binding="{Binding QfodCount}" Width="80"/>
|
||||||
|
<DataGridTextColumn Header="Ploss 数量" Binding="{Binding PlossCount}" Width="80"/>
|
||||||
|
<DataGridTemplateColumn Header="操作" Width="150">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Button Content="Ploss图" Margin="2" Padding="5,2"
|
||||||
|
Click="OnViewPlossChart"/>
|
||||||
|
<Button Content="Qfod图" Margin="2" Padding="5,2"
|
||||||
|
Click="OnViewQfodChart"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
30
src/WCTDataMiner.Wpf/Views/ScenarioListView.xaml.cs
Normal file
30
src/WCTDataMiner.Wpf/Views/ScenarioListView.xaml.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace WCTDataMiner.Wpf.Views;
|
||||||
|
|
||||||
|
public partial class ScenarioListView : UserControl
|
||||||
|
{
|
||||||
|
public ScenarioListView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnViewPlossChart(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// TODO: 导航到 Ploss 图表页面
|
||||||
|
if (DataContext is ViewModels.ScenarioListViewModel vm && vm.SelectedScenario != null)
|
||||||
|
{
|
||||||
|
// Navigation logic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnViewQfodChart(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// TODO: 导航到 Qfod 图表页面
|
||||||
|
if (DataContext is ViewModels.ScenarioListViewModel vm && vm.SelectedScenario != null)
|
||||||
|
{
|
||||||
|
// Navigation logic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/WCTDataMiner.Wpf/WCTDataMiner.Wpf.csproj
Normal file
29
src/WCTDataMiner.Wpf/WCTDataMiner.Wpf.csproj
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<LangVersion>12.0</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- LiveCharts2 -->
|
||||||
|
<PackageReference Include="LiveChartsCore" Version="2.0.0-rc2" />
|
||||||
|
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc2" />
|
||||||
|
|
||||||
|
<!-- MVVM -->
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||||
|
|
||||||
|
<!-- DI -->
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WCTDataMiner.Core\WCTDataMiner.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner.Commands;
|
namespace WCTDataMiner.Commands;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner.Commands;
|
namespace WCTDataMiner.Commands;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner.Commands;
|
namespace WCTDataMiner.Commands;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner.Commands;
|
namespace WCTDataMiner.Commands;
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using WCTDataMiner.Commands;
|
using WCTDataMiner.Commands;
|
||||||
using WCTDataMiner.Data;
|
using WCTDataMiner.Core.Data;
|
||||||
using WCTDataMiner.Extensions;
|
using WCTDataMiner.Core.Extensions;
|
||||||
using WCTDataMiner.Services;
|
using WCTDataMiner.Core.Services;
|
||||||
|
|
||||||
namespace WCTDataMiner;
|
namespace WCTDataMiner;
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- ORM -->
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
|
|
||||||
<!-- CLI -->
|
<!-- CLI -->
|
||||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||||
|
|
||||||
@@ -34,10 +25,14 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WCTDataMiner.Core\WCTDataMiner.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="appsettings.json">
|
<None Update="appsettings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user