diff --git a/Label/成品入库单.btw b/Label/成品入库单.btw index 1d42421..c145000 100644 Binary files a/Label/成品入库单.btw and b/Label/成品入库单.btw differ diff --git a/RIZO_Application.Models/Model/FinishedProductDto.cs b/RIZO_Application.Models/Model/FinishedProductDto.cs index 69031af..54e7155 100644 --- a/RIZO_Application.Models/Model/FinishedProductDto.cs +++ b/RIZO_Application.Models/Model/FinishedProductDto.cs @@ -197,5 +197,7 @@ namespace RIZO_Application.Models.Model { public DateTime? StartTime { get; set; } public DateTime? EndTime { get; set; } + public string LabelFrom { get; set; } = string.Empty; + public string LabelPrintStatus { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/Services/FinishedProductService.cs b/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/Services/FinishedProductService.cs index 7ba1176..15bd993 100644 --- a/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/Services/FinishedProductService.cs +++ b/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/Services/FinishedProductService.cs @@ -121,7 +121,8 @@ namespace RIZO_Application.Modules.ModuleName.Services int pageSize = 20; var result = Context .Queryable() - .Where(it => it.LabelFrom == _labelFrom) + .WhereIF(!string.IsNullOrEmpty(query.LabelFrom)&& query.LabelFrom != "全部", it => it.LabelFrom == query.LabelFrom) + .WhereIF(!string.IsNullOrEmpty(query.LabelPrintStatus) && query.LabelPrintStatus != "全部", it => it.LabelPrintStatus == query.LabelPrintStatus) .WhereIF( query.StartTime.Value > DateTime.MinValue, it => it.CreatedTime >= query.StartTime.Value diff --git a/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/ViewModels/MainControlViewModel.cs b/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/ViewModels/MainControlViewModel.cs index b419a42..15a0af4 100644 --- a/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/ViewModels/MainControlViewModel.cs +++ b/RIZO_Application/Modules/RIZO_Application.Modules.ModuleName/ViewModels/MainControlViewModel.cs @@ -8,6 +8,7 @@ using Prism.Events; using Prism.Regions; using Prism.Services.Dialogs; using RIZO_Application.Core.Mvvm; +using RIZO_Application.Infrastructure.Model; using RIZO_Application.Models.Model; using RIZO_Application.Modules.ModuleName.Services.IServices; using RIZO_Application.Services.Interfaces; @@ -20,7 +21,7 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels private readonly IFinishedProductService _finishedProductService; private readonly IEventAggregator _eventAggregator; private readonly IDialogService _dialogService; - + private readonly string _labelFrom = PrintConfigs.Current.LabelFrom; private string _message; public string Message { @@ -110,10 +111,10 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels Message = messageService.GetMessage(); // 初始化搜索条件 - Categories = new ObservableCollection { "全部", "GP12", "后道", "产线" }; StatusList = new ObservableCollection { "全部", "已打印", "未打印" }; + Categories = new ObservableCollection { "全部", "GP12", "后道", "产线" }; SelectedStatus = "全部"; // 默认选中全部 - SelectedCategory = "全部"; // 默认选中全部 + SelectedCategory = _labelFrom; // 默认选中配置 // 初始化命令 LoadFinishedProductsCommand = new DelegateCommand(async () => await LoadFinishedProductsAsync()); @@ -136,6 +137,8 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels { StartTime = _startDate, EndTime = _endDate, + LabelFrom = SelectedCategory, + LabelPrintStatus = SelectedStatus }; FinishedProducts = (List)await _finishedProductService.GetFinishedProductsAsync(query); } @@ -146,6 +149,8 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels { StartTime = _startDate, EndTime = _endDate, + LabelFrom = SelectedCategory, + LabelPrintStatus = SelectedStatus }; // 获取所有产品 var allProducts = (List)await _finishedProductService.GetFinishedProductsAsync(query); @@ -154,10 +159,10 @@ namespace RIZO_Application.Modules.ModuleName.ViewModels var filteredProducts = allProducts.AsEnumerable(); // 状态过滤 - if (!string.IsNullOrEmpty(SelectedStatus) && SelectedStatus != "全部") - { - filteredProducts = filteredProducts.Where(p => p.LabelPrintStatus == SelectedStatus); - } + //if (!string.IsNullOrEmpty(SelectedStatus) && SelectedStatus != "全部") + //{ + //filteredProducts = filteredProducts.Where(p => p.LabelPrintStatus == SelectedStatus); + //} FinishedProducts = filteredProducts.ToList(); }