From 2465b38e6522802b673c514c2a2bbb2b3129e860 Mon Sep 17 00:00:00 2001 From: chfei Date: Fri, 16 Oct 2026 17:28:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=8F=91=E7=A5=A8=20?= =?UTF-8?q?=E5=85=A8=E9=80=89=20=E6=95=B0=E5=AD=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AFBug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/PDDInvoiceViewModel.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs index e3d61b5..7bc83ff 100644 --- a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs +++ b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs @@ -105,6 +105,16 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos if (order.OrderTime < StartTime || EndTime < order.OrderTime) return false; return true; } + /// + /// 获取筛选后的数据 + /// + /// + private IEnumerable GetFilterOrders() + { + return OrdersView.Cast(); + } + + partial void InitBrowser(); partial void InitBrowserDetail(); /// 列表增删时订阅/退订订单勾选状态,用于刷新表头全选状态 @@ -365,7 +375,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos if (_isUpdatingSelectAll) return; if (value == true) { - foreach (var order in Orders) + foreach (var order in GetFilterOrders()) { if (order.IsInvoiced == false) { @@ -441,7 +451,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos return; } - var targets = OrdersView.Cast().Where(o => o.IsSelected && !o.IsInvoiced).ToList(); + var targets = GetFilterOrders().Where(o => o.IsSelected && !o.IsInvoiced).ToList(); if (targets.Count == 0) { BaseMsgWindow.ShowError("请先勾选需要开票的订单"); @@ -522,7 +532,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}"; ProgressValue = i; SelectedOrder = order; - BatchInvoiceChanged?.Invoke(this, OrdersView.Cast().ToList().IndexOf(order)); + BatchInvoiceChanged?.Invoke(this, GetFilterOrders().ToList().IndexOf(order)); bool ok = false; if (EnvironmentHelper.IsTest) { @@ -586,8 +596,8 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos /// private void StatisticsInvoiceAmount() { - InvoicedAmountTotal = OrdersView.Cast().Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m; - UninvoicedAmountTotal = OrdersView.Cast().Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m; + InvoicedAmountTotal = GetFilterOrders().Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m; + UninvoicedAmountTotal = GetFilterOrders().Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m; } #endregion