更新 发票助手 按照时间正序
This commit is contained in:
1 parent
786697c5a6
commit
330ccf3983
3 files changed
+17
-11
No files matched your search
@@ -422,7 +422,7 @@
|
||||
Margin="0,2,0,-2"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
ItemsSource="{Binding Orders}">
|
||||
ItemsSource="{Binding OrdersView}">
|
||||
<ItemsControl.Template>
|
||||
<ControlTemplate TargetType="ItemsControl">
|
||||
<ScrollViewer
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
|
||||
public partial class PDDInvoiceViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单列表浏览器
|
||||
/// 霈W��𡑒”瘚讛��?
|
||||
/// </summary>
|
||||
public ChromiumWebBrowser Browser { get; private set; }
|
||||
/// <summary>
|
||||
/// 内容浏览器
|
||||
/// ��捆瘚讛��?
|
||||
/// 霈W�霂行�
|
||||
/// �𤑳巨霂行�
|
||||
/// �唾窈�𤑳巨
|
||||
@@ -98,9 +98,9 @@ public partial class PDDInvoiceViewModel
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注入发票填写脚本并执行。
|
||||
/// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的
|
||||
/// <c>window.__invoiceApplyResult</c>,完成后通过 <see cref="_currentInvoiceTcs"/> 回传结果。
|
||||
/// 瘜典��𤑳巨憛怠��𡁏𧋦撟嗆�銵䎚�?
|
||||
/// �訫��唾窈璅∪�靽脲����銵䔶蛹嚗𥟇鸌�誩�蟡冽芋撘譍�頧株砭�𡁏𧋦�坔��?
|
||||
/// <c>window.__invoiceApplyResult</c>嚗���𣂼��朞� <see cref="_currentInvoiceTcs"/> �硺�蝏𤘪��?
|
||||
/// </summary>
|
||||
private async Task ExecuteInvoiceApplyScriptAsync(ChromiumWebBrowser b)
|
||||
{
|
||||
@@ -111,10 +111,10 @@ public partial class PDDInvoiceViewModel
|
||||
|
||||
await b.EvaluateScriptAsync(content);
|
||||
|
||||
if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行为
|
||||
if (_currentInvoiceTcs == null) return; // �訫��唾窈璅∪�嚗帋�����㕑�銝?
|
||||
|
||||
// 批量模式:等待异步脚本执行完成
|
||||
// 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果
|
||||
// �寥�璅∪�嚗𡁶�敺��甇亥��祆�銵���?
|
||||
// �閗繮敶枏� TCS嚗屸��齿鸌�誩儐�航��嗉��乩�銝�銝芾恥�訫�嚗諹��啁�頧株砭霂航圻�烐鰵霈W�����?
|
||||
var tcs = _currentInvoiceTcs;
|
||||
for (int i = 0; i < 120; i++)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ public partial class PDDInvoiceViewModel
|
||||
var jsStr = @"window.scroll({
|
||||
top: " + top + @",
|
||||
left: 0,
|
||||
behavior: 'smooth' // 可选,使滚动平滑
|
||||
behavior: 'smooth' // �舫�㚁�雿踵��典像皛?
|
||||
});";
|
||||
|
||||
var client = Browser.GetDevToolsClient();
|
||||
|
||||
@@ -13,6 +13,7 @@ using CefSharp.Wpf;
|
||||
using MAX.Core.Helpers;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -27,6 +28,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Work._29Tools.CefTools;
|
||||
@@ -54,9 +56,13 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
||||
private InvoiceConfig Config { get; }
|
||||
public PDDInvoiceViewModel()
|
||||
{
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig<InvoiceConfig>(ConfigPath);
|
||||
Orders = new ObservableCollection<PddBrowserOrderInvoiceViewModel>();
|
||||
Orders.CollectionChanged += Orders_CollectionChanged;
|
||||
OrdersView =CollectionViewSource.GetDefaultView(Orders);
|
||||
OrdersView.SortDescriptions.Add(
|
||||
new SortDescription(nameof(PddBrowserOrderInvoiceViewModel.order_time), ListSortDirection.Ascending));
|
||||
|
||||
BuyerLoginList = GlobalConfig.PDDBuyerLoginList;
|
||||
//Orders = new ObservableCollection<PDDInvoiceOrderModel>(_allOrders);
|
||||
@@ -138,7 +144,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
||||
|
||||
/// <summary> 订单列表 </summary>
|
||||
public ObservableCollection<PddBrowserOrderInvoiceViewModel> Orders { get; }
|
||||
|
||||
public ICollectionView OrdersView { get; }
|
||||
/// <summary> 搜索关键字:订单号 / 商品名称 / 买家 </summary>
|
||||
public string SearchText
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user