feat(产品管理): 增加标签来源和打印状态的查询条件
在FinishedProductDto中新增LabelFrom和LabelPrintStatus字段 修改查询服务支持按标签来源和打印状态过滤 调整视图模型默认选中配置的标签来源 移除视图模型中手动过滤逻辑,改为服务层处理
This commit is contained in:
parent
9881883856
commit
539abee410
BIN
Label/成品入库单.btw
BIN
Label/成品入库单.btw
Binary file not shown.
@ -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;
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,8 @@ namespace RIZO_Application.Modules.ModuleName.Services
|
||||
int pageSize = 20;
|
||||
var result = Context
|
||||
.Queryable<ProFinishedProductReceipt>()
|
||||
.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
|
||||
|
||||
@ -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<string> { "全部", "GP12", "后道", "产线" };
|
||||
StatusList = new ObservableCollection<string> { "全部", "已打印", "未打印" };
|
||||
Categories = new ObservableCollection<string> { "全部", "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<ProFinishedProductReceipt>)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<ProFinishedProductReceipt>)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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user