diff --git a/ADP/App.xaml.cs b/ADP/App.xaml.cs index 1dee614..080d5e0 100644 --- a/ADP/App.xaml.cs +++ b/ADP/App.xaml.cs @@ -151,6 +151,7 @@ namespace ADP containerRegistry.RegisterScoped(typeof(SqlSugarRepository<>)); //注册服务 containerRegistry.Register(); + containerRegistry.Register(); } //指定模块加载方式(需要手动将模块生成的dll放入Modules文件夹中) protected override IModuleCatalog CreateModuleCatalog() diff --git a/ADP/ViewModels/ShellViewModel.cs b/ADP/ViewModels/ShellViewModel.cs index a514b55..b656b16 100644 --- a/ADP/ViewModels/ShellViewModel.cs +++ b/ADP/ViewModels/ShellViewModel.cs @@ -567,7 +567,7 @@ namespace ADP.ViewModels ScopedContext? targetContext = CurrentContext; if (runningScope == "default" || string.IsNullOrEmpty(runningScope) || targetContext == null) return; - + CurrentConfig.CurrentADPFile = "新建ADP文件"; // 💡 2. 严格对快照隔离的 Context 数据进行清理,不影响其他工位 targetContext.CurrentFilePath = null; targetContext.Program.Parameters.Clear(); @@ -631,7 +631,7 @@ namespace ADP.ViewModels LoggerHelper.WarnWithNotify(runningScope, $"文件格式不正确或为空: {filePath}"); return; } - + CurrentConfig.CurrentADPFile = filePath; // 💡 2. 严格赋值给快照锁定下的当前工位上下文,实现数据完全隔离 targetContext.Program.Parameters = program.Parameters; targetContext.Program.StepCollection = program.StepCollection; @@ -691,6 +691,7 @@ namespace ADP.ViewModels if (saveFileDialog.ShowDialog() == true) { // 💡 2. 将新路径安全写入快照工位 + CurrentConfig.CurrentADPFile = saveFileDialog.FileName; targetContext.CurrentFilePath = saveFileDialog.FileName; // 💡 3. 调用你的底层文件保存逻辑,传入快照工位的 Program 模型 @@ -850,7 +851,7 @@ namespace ADP.ViewModels break; case "测试报告导出界面": if (_globalInfo.CurrentScope != "default") return; - _regionManager.RequestNavigate("ShellViewManager", "CurveRecallView"); + _regionManager.RequestNavigate("ShellViewManager", "ExportView"); break; } } diff --git a/CurveModule/ViewModels/CurveRecallViewModel.cs b/CurveModule/ViewModels/CurveRecallViewModel.cs index 2d5ff4d..a2fe064 100644 --- a/CurveModule/ViewModels/CurveRecallViewModel.cs +++ b/CurveModule/ViewModels/CurveRecallViewModel.cs @@ -16,11 +16,14 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Windows.Threading; + using UIShare.GlobalVariable; using UIShare.UIViewModel; using UIShare.ViewModelBase; namespace CurveModule.ViewModels + + { public class CurveRecallViewModel : NavigateViewModelBase, IRegionMemberLifetime, IDisposable { diff --git a/ExportModule/ViewModels/ExportViewModel.cs b/ExportModule/ViewModels/ExportViewModel.cs index 8e77901..5885d49 100644 --- a/ExportModule/ViewModels/ExportViewModel.cs +++ b/ExportModule/ViewModels/ExportViewModel.cs @@ -1,5 +1,6 @@ using Logger; using MahApps.Metro.Controls; +using Model; using Model.Entity; using Model.Models; using NLog.Targets; @@ -26,24 +27,46 @@ namespace ExportModule.ViewModels { #region 属性 public bool KeepAlive => true; + + private ObservableCollection _testReportModelList = new(); + + public ObservableCollection TestReportModelList + { + get { return _testReportModelList; } + set { SetProperty(ref _testReportModelList, value); } + } + #endregion #region 命令 #endregion - + public ICommand LoadedCommand { get; set; } #region 私有字段 - + ITestReportService _testReportService { get; set; } #endregion public ExportViewModel(IContainerProvider containerProvider) : base(containerProvider) { - + _testReportService = containerProvider.Resolve(); + LoadedCommand = new AsyncDelegateCommand(OnLoad); } + + #region 命令处理 - - - + private async Task OnLoad() + { + var result=await _testReportService.GetFilterList(); + if (result.IsSuccess) + { + IList reportList = result.Data; + TestReportModelList = new ObservableCollection(reportList); + } + else + { + TestReportModelList = new(); + } + } #endregion #region 辅助方法 diff --git a/ExportModule/Views/ExportView.xaml b/ExportModule/Views/ExportView.xaml index f674c20..827caf2 100644 --- a/ExportModule/Views/ExportView.xaml +++ b/ExportModule/Views/ExportView.xaml @@ -3,11 +3,17 @@ 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:i="http://schemas.microsoft.com/xaml/behaviors" mc:Ignorable="d" xmlns:prism="http://prismlibrary.com/" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" prism:ViewModelLocator.AutoWireViewModel="True" d:DesignHeight="1080" d:DesignWidth="1920"> + + + + + diff --git a/MainModule/ViewModels/AutomatedTestingViewModel.cs b/MainModule/ViewModels/AutomatedTestingViewModel.cs index 4ce318c..ff7fa63 100644 --- a/MainModule/ViewModels/AutomatedTestingViewModel.cs +++ b/MainModule/ViewModels/AutomatedTestingViewModel.cs @@ -266,6 +266,7 @@ namespace MainModule.ViewModels if(_systemConfig.DefaultProgramFilePath != null&&File.Exists(_systemConfig.DefaultProgramFilePath)) { var filePath = _systemConfig.DefaultProgramFilePath; + _systemConfig.CurrentADPFile= _systemConfig.DefaultProgramFilePath; // 读取 JSON 文件 string json = File.ReadAllText(filePath); diff --git a/Model/Entity/TestReportEntity.cs b/Model/Entity/TestReportEntity.cs index 5bd126d..13bb325 100644 --- a/Model/Entity/TestReportEntity.cs +++ b/Model/Entity/TestReportEntity.cs @@ -16,6 +16,9 @@ namespace Model.Entity /// 作用域/台架名称 [SugarColumn(ColumnName = "Scope", ColumnDescription = "台架名称")] public string Scope { get; set; } = string.Empty; + /// 测试项名称(当前ADP文件路径) + [SugarColumn(ColumnName = "FileName", ColumnDescription = "测试项名称")] + public string FileName { get; set; } = string.Empty; /// 步骤序号 [SugarColumn(ColumnName = "StepIndex")] diff --git a/Model/Models/TestReportModel.cs b/Model/Models/TestReportModel.cs new file mode 100644 index 0000000..c332c10 --- /dev/null +++ b/Model/Models/TestReportModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Models +{ + public class TestReportModel + { + public Guid TestRoundId { get; set; } + public string Scope { get; set; } + public DateTime StartTime { get; set; } + public DateTime EndTime { get; set; } + public string FileName { get; set; } + } +} diff --git a/MonitorModule/ViewModels/RecordViewModel.cs b/MonitorModule/ViewModels/RecordViewModel.cs index 1b1d886..bfb575f 100644 --- a/MonitorModule/ViewModels/RecordViewModel.cs +++ b/MonitorModule/ViewModels/RecordViewModel.cs @@ -64,10 +64,15 @@ namespace MonitorModule.ViewModels } /// 查询日期(null = 全部日期) - public DateTime? SelectedDate + public DateTime? SelectedStartDate { - get => _selectedDate; - set => SetProperty(ref _selectedDate, value); + get => _selectedStartDate; + set => SetProperty(ref _selectedStartDate, value); + } + public DateTime? SelectedEndDate + { + get => _selectedEndDate; + set => SetProperty(ref _selectedEndDate, value); } public DataTable ResultTable @@ -142,7 +147,8 @@ namespace MonitorModule.ViewModels private string? _selectedMonitorName; private ObservableCollection _scopeNames = new(new[] { "全部", "TestCell1", "TestCell2", "TestCell3", "TestCell4", "TestCell5", "TestCell6", "TestCell7", "TestCell8" }); private string? _selectedScope = "全部"; - private DateTime? _selectedDate; + private DateTime? _selectedStartDate; + private DateTime? _selectedEndDate; private DataTable _resultTable = new(); private string _statusMessage = "未连接"; private int _pageIndex = 1; @@ -257,7 +263,8 @@ namespace MonitorModule.ViewModels { SelectedMonitorName = null; SelectedScope = "全部"; - SelectedDate = null; + SelectedStartDate = null; + SelectedEndDate = null; PageIndex = 1; Query(); } @@ -274,8 +281,8 @@ namespace MonitorModule.ViewModels var db = SqlSugarContext.DbContext; // 预计算日期范围,避免在表达式树中访问可空属性 - DateTime? dateStart = SelectedDate?.Date; - DateTime? dateEnd = dateStart?.AddDays(1); + DateTime? dateStart = SelectedStartDate?.Date; + DateTime? dateEnd = SelectedEndDate?.Date.AddDays(1); var query = db.Queryable() .WhereIF(!string.IsNullOrEmpty(SelectedMonitorName), x => x.MonitorName == SelectedMonitorName) @@ -317,8 +324,8 @@ namespace MonitorModule.ViewModels { var db = SqlSugarContext.DbContext; - DateTime? dateStart = SelectedDate?.Date; - DateTime? dateEnd = dateStart?.AddDays(1); + DateTime? dateStart = SelectedStartDate?.Date; + DateTime? dateEnd = SelectedEndDate?.Date.AddDays(1); var query = db.Queryable() .WhereIF(!string.IsNullOrEmpty(SelectedMonitorName), x => x.MonitorName == SelectedMonitorName) diff --git a/MonitorModule/Views/RecordView.xaml b/MonitorModule/Views/RecordView.xaml index 736b395..364ac27 100644 --- a/MonitorModule/Views/RecordView.xaml +++ b/MonitorModule/Views/RecordView.xaml @@ -52,6 +52,7 @@ + @@ -88,20 +89,25 @@ VerticalAlignment="Center" Margin="12,0,4,0"/> + -