1显示最新一条物流信息和展示完整物流轨迹 2优化订单48小时或72小时过滤逻辑

This commit is contained in:
wule committed 2026-09-18 12:21:17 +08:00
1 parent f3fa093709
commit db6774dbda
12 files changed
+749 -33

No files matched your search

@@ -46,6 +46,7 @@ using System.Xml;
using System.Xml.Linq;
using Work;
using Work._29Tools.BLL;
using Work.BaseForms;
using Work.BuyUsers;
using Work.KJDServer.API.Models;
using WPFCommon.Helpers;
@@ -306,8 +307,12 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 读取关联拍单商品
var buyMapList = GetBuyProdMap(orderItems);
// 读取关联拍单的所有sku
var buyMapSkusList = GetBuyProdMapSkus(orderItems);
// 读取物流轨迹
var ewaybillLst = GetEWaybillPath(order_ids);
// 装载订单
foreach (JObject jObj in jArr)
{
@@ -366,6 +371,15 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 装载订单售后详情
order.refundItems = new ObservableCollection<oms_wei_refund_info>(refunds.Where(of => of.order_id == order.order_id));
if (order.order_id.Contains("3738794693820307200"))
{
}
// 装载订单物流最后一条信息
order.latestEWaybills = [.. ewaybillLst.Where(ew => ew.order_id == order.order_id.ParseToLong())];
// 读取订单后立即赋值,防止滚动时实时赋值造成卡顿
InitOrderObservableProp(order);
@@ -684,6 +698,37 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
return new List<order_pdd_buyer_after_sale>();
}
public static List<oms_wei_ewaybill_path> GetEWaybillPath(string order_ids)
{
List<oms_wei_ewaybill_path> oms_wei_ewaybill_path_list = null;
if (!string.IsNullOrEmpty(order_ids))
{
try
{
var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_latest_list");
var data = UserLogin.GetSignaturex();
data += "&erp_order_id_in=" + order_ids;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
BaseMsgWindow.ShowAnimateMessage("物流查询失败 " + BaseRegex.GetStringJson(ref html, "msg"), "Error", 6);
}
else
{
oms_wei_ewaybill_path_list = JsonHelper.DeserializeJsonToList<oms_wei_ewaybill_path>(JObject.Parse(html)["data"].ParseToString()).OrderByDescending(p => p.update_time).ToList();
}
}
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;
}
public static List<WXBuyMapInfo> GetBuyProdMap(List<oms_wei_order_item_info> orderItems)
{
//foreach (var item in orderItems.ToList())
@@ -1563,7 +1608,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else if (order.orderItems.Any(oi => oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
// 直发没有单号正常发货才判断中转仓总店是否超时发货
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else
@@ -1575,7 +1622,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
else if (order.orderItems.Any(oi => oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
// 直发没有单号才判断中转仓总店是否超时发货
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
@@ -1613,10 +1662,16 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
if (chk72HourNoWaybill.IsChecked == true)
{
if (order.order_id == "3739190405314033408")
{
}
// 直发没有单号才判断中转仓总店是否超时发货
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else if (order.orderItems.Any(oi => oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
else if (order.orderItems.Any(oi => (oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && bOrder?.order_time <= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72))))
{ }
else
@@ -1624,11 +1679,13 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}
else if (chk48HourNoWaybill.IsChecked == true)
{
// 直发没有单号才判断中转仓总店是否超时发货
if (order.orderItems.Any(oi => oi.DirectPddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }
else if (order.orderItems.Any(oi => oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
else if (order.orderItems.Any(oi =>(oi.DirectPddBuyerOrders?.Count).IsNullOrZero() &&
oi.PddBuyerOrders.OrderByDescending(bo => bo.order_time).FirstOrDefault() is order_pdd_buyer_order bOrder &&
(bOrder?.tracking_number).IsNullOrEmpty() && (bOrder?.order_time < BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-48)) &&
bOrder.order_time >= BaseClass.DateTimeToTimestampSeconds(DateTime.Now.AddHours(-72)))))
{ }