优化读取订单的展示

This commit is contained in:
wule committed 2026-10-18 08:09:48 +08:00
1 parent b827c6e118
commit 06e45bf587
7 files changed
+127 -105

No files matched your search

@@ -14,8 +14,6 @@ namespace _29WxOrderWpf.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Visibility.Collapsed;
if (value == null)
return Visibility.Collapsed;
return !value.ParseToString().Trim().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
@@ -60,6 +60,8 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
/// </summary>
public partial class OrderListCtrl : UserControl, INotifyPropertyChanged
{
private static readonly object locker = new object();
public static bool IsAutoBuy { get; set; } = false;
public CheckBox chkSelectAll = null;
OrderFilterConfig _orderFilterConfig;
@@ -1019,15 +1021,14 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
else
{
oms_wei_ewaybill_path_list = JsonHelper.DeserializeJsonToList<oms_wei_ewaybill_path>(JObject.Parse(html)["data"].ParseToString()).OrderByDescending(p => p.update_time).ToList();
return oms_wei_ewaybill_path_list;
}
}
catch
{
}
}
if (oms_wei_ewaybill_path_list == null)
oms_wei_ewaybill_path_list = new List<oms_wei_ewaybill_path>();
return oms_wei_ewaybill_path_list;
return new List<oms_wei_ewaybill_path>();
}
public static List<WXBuyMapInfo> GetBuyProdMap(List<oms_wei_order_item_info> orderItems)
@@ -1075,6 +1076,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
catch
{
return new List<WXBuyMapInfo>();
}
}
return GlobalConfig.BuyMapList.Where(m => orderItems.Any(oi => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id)).ToList();
@@ -1544,71 +1546,46 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
TabItem tabItem = null;
List<TabItem> tabItems = this.tabOrderType.Items.Cast<TabItem>().ToList();
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("待采购")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsWaitBuy).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "待采购")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "待采购(" + lstCount + "|" + filteLstTmpCount + ")"; }));
WaitBuyTabTxt = "待采购(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("待发货")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsWaitSend).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "待发货")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "待发货(" + lstCount + "|" + filteLstTmpCount + ")"; }));
WaitSendTabTxt = "待发货(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("待收货")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsWaitReceive).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "待收货")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "待收货(" + lstCount + "|" + filteLstTmpCount + ")"; }));
WaitReceiveTabTxt = "待收货(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("售后完成单")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsRefund).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "售后完成单")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "售后完成单(" + lstCount + "|" + filteLstTmpCount + ")"; }));
RefundTabTxt = "售后完成单(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("需处理售后单")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsEmergencyManualReturnOrder).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "需处理售后单")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "需处理售后单(" + lstCount + "|" + filteLstTmpCount + ")"; }));
EmergencyManualReturnOrderTabTxt = "需处理售后单(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("退货仓自动售后单")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsEmergencyDistribReturnOrder).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "退货仓自动售后单")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "退货仓自动售后单(" + lstCount + "|" + filteLstTmpCount + ")"; }));
EmergencyDistribReturnOrderTabTxt = "退货仓自动售后单(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("异常需重拍")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Where(r => r.IsAbnormal).Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "异常需重拍")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "异常需重拍(" + lstCount + "|" + filteLstTmpCount + ")"; }));
AbnormalTabTxt = "异常需重拍(" + lstCount + "|" + filteLstTmpCount + ")";
}
//Dispatcher.Invoke(new Action(() => { tabItem = tabItems.FirstOrDefault(t => t.Header.ParseToString().StartsWith("全部订单")); }));
//if (tabItem != null)
{
var lstCount = userOrderLst.Count();
var filteLstTmpCount = userOrderLst.Where(o => !GetOrderIsFilter(o, "全部订单")).Count();
//Dispatcher.Invoke(new Action(() => { tabItem.Header = "全部订单(" + lstCount + "|" + filteLstTmpCount + ")"; }));\
AllOrderTabTxt = "全部订单(" + lstCount + "|" + filteLstTmpCount + ")";
}
//txtMsg.Text = "当前条件共计 " + GlobalConfig.lstFilterOrder.Count() + " 条订单记录";
}
CancellationTokenSource TokenSource = null;
@@ -1626,6 +1603,18 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (this.lbxOrder == null)
return;
if (token.IsCancellationRequested)
return;
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.lstFilterOrder.Clear();
//GlobalConfig.lstFilterOrder = new ObservableCollection<oms_wei_order_info>(orderLstTmp);
GlobalConfig.lstFilterOrder = new ObservableCollection<oms_wei_order_info>();
this.lbxOrder.ItemsSource = GlobalConfig.lstFilterOrder;
}));
if (token.IsCancellationRequested)
return;
var orderLstTmp = new List<oms_wei_order_info>();
if (GlobalConfig.OrderTabHeaderStr.StartsWith("需处理售后单") || GlobalConfig.OrderTabHeaderStr.StartsWith("退货仓自动售后单"))
orderLstTmp = GlobalConfig.lstOrder.Where(o => !GetOrderIsFilter(o)).OrderByDescending(o => o.RefundDatetime).ToList();
@@ -1634,23 +1623,23 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
else
orderLstTmp = GlobalConfig.lstOrder.Where(o => !GetOrderIsFilter(o)).OrderByDescending(o => o.create_time).ToList();
//Task.Run(() => {
if (token.IsCancellationRequested)
return;
disPlayOrderTabOrderCount();
//});
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.lstFilterOrder.Clear();
}));
int n = 0;
foreach (var order in orderLstTmp)
{
if (n++ % 100 == 0)
Thread.Sleep(1);
if (token.IsCancellationRequested)
break;
if (!GlobalConfig.lstFilterOrder.ToList().Any(o => o.order_id == order.order_id))
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.lstFilterOrder.Add(order);
}));
{
Dispatcher.Invoke(() => { GlobalConfig.lstFilterOrder.Add(order); });
}
}
}
catch (Exception ex)
@@ -1690,11 +1679,14 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
else
nextOrder = GlobalConfig.lstFilterOrder.ToList().FirstOrDefault(o => o.create_time < order.create_time);
var index = -1;
if (nextOrder != null)
index = GlobalConfig.lstFilterOrder.IndexOf(nextOrder);
Dispatcher.Invoke(() =>
{
if (nextOrder != null)
if (nextOrder != null && index >= 0 && GlobalConfig.lstFilterOrder.Count > index)
{
GlobalConfig.lstFilterOrder.Insert(GlobalConfig.lstFilterOrder.IndexOf(nextOrder), order);
GlobalConfig.lstFilterOrder.Insert(index, order);
}
else
{
@@ -466,7 +466,7 @@
Background="Transparent"
Foreground="#f56c6c"
Text="{Binding ItemRefund.ReasonTextStr}"
Visibility="{Binding ItemRefund.ReasonTextStrVisibility}" />
Visibility="{Binding RefundReasonTextStrVisibility}" />
<!-- 售后结果 -->
<TextBlock
@@ -536,7 +536,7 @@
IsReadOnly="True"
Text="{Binding ItemRefund.after_sale_order_id}"
TextWrapping="Wrap"
Visibility="{Binding ItemRefund.AfterSaleOrderIdVisibility}"
Visibility="{Binding RefundAfterSaleOrderIdVisibility}"
WaterMark="退款单号" />
<Border
Width="12"
@@ -722,7 +722,7 @@
Title="采购单号:"
Cursor="Hand"
Foreground="#0099ff"
Visibility="{Binding ElementName=txtTransitOrderNumStr, Path=Text, Converter={StaticResource HasTextVisibility}}">
Visibility="{Binding ItemTransitOrderWithVoid.OutOrderNumStr, Converter={StaticResource HasTextVisibility}}">
<WrapPanel Orientation="Horizontal">
<uc:UcWaterMarkTextBox1
x:Name="txtTransitOrderNumStr"