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)))))
{ }
@@ -809,16 +809,26 @@
<!-- 仓库物流 -->
<wpf:TitleContent Title="仓库物流:" Visibility="{Binding TransitOrderWaybillFromWareHouseStr, Converter={StaticResource HasTextVisibility}}">
<uc:UcWaterMarkTextBox1
Margin="-2,0"
Padding="0"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding TransitOrderWaybillFromWareHouseStr}"
TextWrapping="Wrap"
WaterMark="仓库物流" />
<WrapPanel>
<uc:UcWaterMarkTextBox1
Margin="-2,0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding TransitOrderWaybillFromWareHouseStr}"
TextWrapping="Wrap"
WaterMark="仓库物流" />
<Button
x:Name="btnGetTransitWaybillDetail"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="查看"
Click="btnGetTransitWaybillDetail_Click"
Content="{Binding LatestTransitEWaybill.StatusStr}"
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
<!-- 外采买手 -->
@@ -922,7 +932,7 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
@@ -933,7 +943,7 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2"
Padding="0"
VerticalAlignment="Top"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
@@ -944,7 +954,7 @@
<uc:UcWaterMarkTextBox1
Margin="-2,2,4,2"
Padding="0"
VerticalAlignment="Top"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{Binding ItemOrder.OutExpressNoBrush}"
@@ -952,6 +962,15 @@
Text="{Binding ItemOrder.OutExpressNoStr}"
TextWrapping="Wrap"
WaterMark="外采物流" />
<Button
x:Name="btnGetDirectWaybillDetail"
Margin="4,0,0,0"
Padding="0,0,0,0"
d:Content="查看"
Click="btnGetDirectWaybillDetail_Click"
Content="{Binding LatestDirectEWaybill.StatusStr}"
Style="{StaticResource LinkButton}" />
</WrapPanel>
</wpf:TitleContent>
@@ -1587,6 +1587,44 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
}.ShowDialog();
}
}
private async void btnGetTransitWaybillDetail_Click(object sender, RoutedEventArgs e)
{
if (this.DataContext is oms_wei_order_item_info orderItem && GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == orderItem.shop_id.ParseToString()) is ShopLoginInfo shop)
{
//var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_list");
////var url = BaseClass.Build29WxObjString("order/wx_get_erp_ewaybill_path_latest_list");
//var data = UserLogin.GetSignaturex();
////data += "&erp_order_id_in=" + orderItem.order_id;
//data += "&waybill_id_in=" + orderItem.ItemTransitOrderWithVoid.express_2_waybill;
//var html = GetHtml.PostUtf8(url, data);
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
// html = GetHtml.PostUtf8(url, data);
//if (!html.Contains("\"code\":200"))
//{
// BaseMsgForm.ShowError("查询失败请重试");
// return;
//}
var order = orderItem.ItemOrder;
var waybillId = orderItem.ItemTransitOrderWithVoid.express_2_waybill;
var expressName = orderItem.ItemTransitOrderWithVoid.express_2_company;
EWaybillPathView WaybillPathView = new EWaybillPathView(order, waybillId, expressName);
new DialogWindow()
{
Title = "订单 " + orderItem.order_id + " 物流明细",
Content = WaybillPathView,
}.ShowDialog();
}
}
private void btnGetDirectWaybillDetail_Click(object sender, RoutedEventArgs e)
{
}
}
}