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)
{
}
}
}
@@ -0,0 +1,134 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.Forms.ShopForms;
using Work.BaseForms;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 更改运单号ViewModel
/// </summary>
public class EWaybillPathViewModel : PropertyNotifyObject
{
public oms_wei_order_info Order
{
get { return this.GetValue(x => x.Order); }
set { this.SetValue(x => x.Order, value); }
}
public string OrderId
{
get { return this.GetValue(x => x.OrderId); }
set { this.SetValue(x => x.OrderId, value); }
}
public string ExpressName
{
get { return this.GetValue(x => x.ExpressName); }
set { this.SetValue(x => x.ExpressName, value); }
}
public string WaybillId
{
get { return this.GetValue(x => x.WaybillId); }
set { this.SetValue(x => x.WaybillId, value); }
}
public bool IsGetWaybillPath
{
get { return this.GetValue(x => x.IsGetWaybillPath); }
set { this.SetValue(x => x.IsGetWaybillPath, value); }
}
public ObservableCollection<oms_wei_ewaybill_path> WaybillPathInfos
{
get { return this.GetValue(x => x.WaybillPathInfos); }
set { this.SetValue(x => x.WaybillPathInfos, value); }
}
/// <summary>
/// 请求关闭窗口
/// </summary>
public event Action RequestClose;
#region 命令
public ICommand GetEWaybillPathCommand { get; }
#endregion
private volatile bool _isWindowLoaded = false;
public EWaybillPathViewModel(oms_wei_order_info _order, string _waybillId, string _expressName)
{
Order = _order;
OrderId = Order?.order_id;
ExpressName = _expressName;
WaybillId = _waybillId;
IsGetWaybillPath = false;
GetEWaybillPathCommand = new DelegateCommand(GetEWaybillPath);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
_isWindowLoaded = true;
GetEWaybillPath();
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
public void GetEWaybillPath()
{
string orderId = Order.order_id;
ShopLoginInfo shop = Order.Shop;
Task.Run(async () =>
{
IsGetWaybillPath = true;
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=" + order_id;
data += "&waybill_id_in=" + WaybillId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
BaseMsgWindow.ShowError("查询失败请重试");
return;
}
this.WaybillPathInfos = new ObservableCollection<oms_wei_ewaybill_path>(
JsonHelper.DeserializeJsonToList<oms_wei_ewaybill_path>(JObject.Parse(html)["data"].ParseToString()).OrderByDescending(p => p.update_time).ToList());
IsGetWaybillPath = false;
});
}
}
}
@@ -0,0 +1,115 @@
<UserControl
x:Class="_29WxOrderWpf.Views.EWaybillPathListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="auto"
d:DesignHeight="80"
d:DesignWidth="600"
mc:Ignorable="d">
<Grid>
<Border
Margin="4"
BorderBrush="LightGray"
BorderThickness="0,0,0,1"
CornerRadius="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
x:Name="imgSku"
Grid.Row="0"
Grid.Column="0"
Width="20"
Height="20"
Margin="8"
Cursor="Hand"
MouseDown="imgSku_MouseDown"
MouseEnter="imgSku_MouseEnter"
MouseLeave="imgSku_MouseLeave" />
<Grid
Grid.Column="1"
Margin="0,8"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Visibility="{Binding node_desc, Converter={StaticResource HasTextVisibility}}">
<TextBox
VerticalAlignment="Top"
d:Opacity="0.5"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
IsReadOnly="True"
Text="物流信息:"
TextWrapping="Wrap"
Visibility="Collapsed" />
<TextBox
Grid.Row="0"
VerticalAlignment="Top"
d:Opacity="0.5"
d:Text="已送达"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
IsReadOnly="True"
Text="{Binding node_desc}"
TextWrapping="Wrap" />
</WrapPanel>
<WrapPanel Grid.Row="1" Visibility="{Binding UpdateTimeStr, Converter={StaticResource HasTextVisibility}}" Margin="4">
<TextBox
VerticalAlignment="Top"
d:Opacity="0.5"
d:Visibility="Visible"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="更新时间:"
TextWrapping="Wrap"
Visibility="Collapsed" />
<TextBox
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
d:Opacity="0.5"
d:Text="2000/1/1 0:0:0"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding UpdateTimeStr}"
TextWrapping="Wrap" />
</WrapPanel>
</Grid>
<Button
x:Name="btnAdd"
Grid.Column="100"
MinWidth="18"
MinHeight="28"
Margin="8"
Padding="4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content=""
Style="{StaticResource BasePageButtonStyle}"
Visibility="Hidden" />
</Grid>
</Border>
</Grid>
</UserControl>
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Views;
/// <summary>
/// EWaybillPathListView.xaml 的交互逻辑
/// </summary>
public partial class EWaybillPathListView : UserControl
{
public EWaybillPathListView()
{
InitializeComponent();
}
private void imgSku_MouseDown(object sender, MouseButtonEventArgs e)
{
}
private void imgSku_MouseEnter(object sender, MouseEventArgs e)
{
}
private void imgSku_MouseLeave(object sender, MouseEventArgs e)
{
}
}
+138
View File
@@ -0,0 +1,138 @@
<UserControl
x:Class="_29WxOrderWpf.Views.EWaybillPathView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:_29WxOrderWpf.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="EWaybillPathCtrl"
d:DesignHeight="450"
d:DesignWidth="800" Loaded="EWaybillPathCtrl_Loaded"
Background="White"
mc:Ignorable="d">
<Grid Margin="24,24,24,24">
<WrapPanel
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="top">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="15"
Foreground="#333333"
Text="订单 " />
<TextBox
x:Name="txtOrderId"
VerticalContentAlignment="Center"
d:Text="1111111"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding OrderId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="15"
Foreground="#333333"
Text=" 物流明细" />
</WrapPanel>
<Grid Margin="24,24,24,24">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Margin="24,24,24,24">
<Grid>
<WrapPanel>
<TextBlock FontSize="14" Text="物流公司:" />
<TextBox
x:Name="txtExpressName"
VerticalContentAlignment="Center"
d:Text="物流公司:"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding ExpressName, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
</WrapPanel>
<Image
x:Name="imgLoading"
Width="20"
Height="20"
HorizontalAlignment="Right"
IsEnabled="False"
Source="{StaticResource imgLoadingPic}"
Visibility="{Binding IsGetWaybillPath, Converter={StaticResource visibleToVisibilityConverter}}">
<Image.RenderTransform>
<RotateTransform Angle="45" CenterX="10" CenterY="10" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
RepeatBehavior="Forever"
Storyboard.TargetName="imgLoading"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0"
To="360"
Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</Grid>
<WrapPanel>
<TextBlock FontSize="14" Text="物流编码:" />
<TextBox
x:Name="txtWaybillId"
VerticalContentAlignment="Center"
d:Text="物流编码:"
BorderBrush="#D0D0D0"
BorderThickness="0"
FontSize="14"
Text="{Binding WaybillId, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
</WrapPanel>
</StackPanel>
<ListBox
x:Name="lbxSku"
Grid.Row="1"
Grid.Column="1"
Margin="7,0,7,0"
HorizontalContentAlignment="Stretch"
BorderThickness="0"
ItemsSource="{Binding WaybillPathInfos}"
ScrollViewer.CanContentScroll="True"
VirtualizingPanel.ScrollUnit="Pixel">
<!-- 使用自定义属性模板去除ListBox高亮显示框 -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!-- 此处绑定将数据源传递给子自定义控件OrderListRowCtrl -->
<local:EWaybillPathListView
VerticalAlignment="Center"
VerticalContentAlignment="Center"
DataContext="{Binding}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,42 @@
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Views;
/// <summary>
/// EWaybillPathView.xaml 的交互逻辑
/// </summary>
public partial class EWaybillPathView : UserControl
{
/// <summary>
/// 视图模型
/// </summary>
public EWaybillPathViewModel ViewModel { get; }
public EWaybillPathView(oms_wei_order_info _order, string _waybillId, string _expressName)
{
InitializeComponent();
ViewModel = new EWaybillPathViewModel(_order, _waybillId, _expressName);
DataContext = ViewModel;
}
private void EWaybillPathCtrl_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
}
@@ -102,17 +102,31 @@ namespace _29WxOrderWpf.Windows.OrderWindows
{
// 回填库内信息
btnAdd.Content = "创 建";
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
if (OrderItem.DistribReturnOrderInfo != null)
{
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
}
}
if (OrderItem.AddEditTransitWarehouseReturnOrderStr == "已创建未到仓" || OrderItem.AddEditTransitWarehouseReturnOrderStr == "已到仓" ||
OrderItem.AddEditTransitWarehouseReturnOrderStr == "已发回")
btnAdd.IsEnabled = false;
{
btnAdd.IsEnabled = btnAddressAnalysis.IsEnabled = false;
if (OrderItem.DistribReturnOrderInfo != null)
{
txtProvince.Text = OrderItem.DistribReturnOrderInfo.receiver_province;
txtCity.Text = OrderItem.DistribReturnOrderInfo.receiver_city;
txtCounty.Text = OrderItem.DistribReturnOrderInfo.receiver_area;
txtDetailAddress.Text = OrderItem.DistribReturnOrderInfo.receiver_address;
txtUser.Text = OrderItem.DistribReturnOrderInfo.receiver_name;
txtMobile.Text = OrderItem.DistribReturnOrderInfo.receiver_phone;
}
}
}
}
@@ -134,6 +148,11 @@ namespace _29WxOrderWpf.Windows.OrderWindows
BaseMsgWindow.ShowError("缺少收货人信息!");
return;
}
if (txtUser.Text.Trim().Length > 15)
{
BaseMsgWindow.ShowError("收货人姓名长度不能超过15!");
return;
}
JObject jObj = new JObject();
@@ -0,0 +1,75 @@
using AllBase.Model.MvvmBaseClasses;
using NaiBa.Util.Extension;
using NaiBa.Util.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.DBModel
{
public class oms_wei_ewaybill_path : PropertyNotifyObject
{
public long id { get; set; }
public long? shop_id { get; set; }
public long? order_id { get; set; }
public string ewaybill_order_id { get; set; }
public string waybill_id { get; set; }
public long update_time
{
get { return this.GetValue(x => x.update_time); }
set
{
this.SetValue(x => x.update_time, value);
this.UpdateTimeStr = BaseClass.StampToDateTime(value.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss");
}
}
public string UpdateTimeStr
{
get { return this.GetValue(x => x.UpdateTimeStr); }
set { this.SetValue(x => x.UpdateTimeStr, value); }
}
//0待揽件 1揽收 2运输中 3派件 4入柜 5签收 6退回 7转寄 8异常 9出柜 99其他未知
public int status
{
get { return this.GetValue(x => x.status); }
set
{
this.SetValue(x => x.status, value);
try
{
StatusStr = ((oms_wei_ewaybill_path_status_emum)value).ParseToString();
}
catch
{
StatusStr = "其他未知";
}
}
}
public string StatusStr
{
get { return this.GetValue(x => x.StatusStr); }
set { this.SetValue(x => x.StatusStr, value); }
}
public string node_desc { get; set; }
public DateTime create_time { get; set; }
}
public enum oms_wei_ewaybill_path_status_emum
{
待揽件 = 0,
揽收 = 1,
运输中 = 2,
派件 = 3,
入柜 = 4,
签收 = 5,
退回 = 6,
转寄 = 7,
异常 = 8,
出柜 = 9,
其他未知 = 99
}
}
+7 -4
View File
@@ -1,5 +1,6 @@
using AllBase.Helper;
using AllBase.Model.MvvmBaseClasses;
using NaiBa.Util;
using NaiBa.Util.Extension;
using NPOI.OpenXmlFormats.Dml.Diagram;
using NPOI.OpenXmlFormats.Spreadsheet;
@@ -43,10 +44,12 @@ namespace AllBase.Model.DBModel
public ObservableCollection<oms_wei_refund_info> refundItems { get; set; } = new ObservableCollection<oms_wei_refund_info>();
/// <summary>
/// 待采购
/// </summary>
public bool IsWaitBuy
public ConcurrentList<oms_wei_ewaybill_path> latestEWaybills { get; set; } = new ConcurrentList<oms_wei_ewaybill_path>();
/// <summary>
/// 待采购
/// </summary>
public bool IsWaitBuy
{
get { return this.GetValue(x => x.IsWaitBuy); }
set { this.SetValue(x => x.IsWaitBuy, value); }
@@ -938,10 +938,24 @@ namespace AllBase.Model.DBModel
DirectOrderBuyTimeStr = DirectPddBuyerOrder != null ? DirectPddBuyerOrder.add_time.ToString("yyyy-MM-dd HH:mm:ss") : "";
}
/// <summary>
/// 订单中所有商品加起来的总售价文本
/// </summary>
public string RealPriceStr
/// <summary> 直发最后一条物流信息 </summary>
public oms_wei_ewaybill_path LatestDirectEWaybill
{
get { return this.GetValue(x => x.LatestDirectEWaybill); }
set { this.SetValue(x => x.LatestDirectEWaybill, value); }
}
/// <summary> 中转仓最后一条物流信息 </summary>
public oms_wei_ewaybill_path LatestTransitEWaybill
{
get { return this.GetValue(x => x.LatestTransitEWaybill); }
set { this.SetValue(x => x.LatestTransitEWaybill, value); }
}
/// <summary>
/// 订单中所有商品加起来的总售价文本
/// </summary>
public string RealPriceStr
{
//get { return "¥" + (order_items.Sum(oi => oi.real_price) * 0.01m).ParseToDecimal().ToString("0.00"); }
get { return "¥" + (real_price * 0.01m).ParseToDecimal().ToString("0.00"); }
@@ -1384,7 +1398,27 @@ namespace AllBase.Model.DBModel
// 拍单、代发等信息判断并控制拍单按钮
this.UpdateOrderItemBuyButton();
this.SetAbnormalAndDirectBtnVisibility();
}
SetEWaybillInfo();
}
/// <summary> 初始化物流明细信息 </summary>
public void SetEWaybillInfo()
{
if(order_id == "3738794693820307200")
{
}
if (this.ItemOrder?.latestEWaybills?.Count > 0 && !string.IsNullOrEmpty(ItemTransitOrderWithVoid?.express_2_waybill))
LatestTransitEWaybill = ItemOrder.latestEWaybills.FirstOrDefault(ew => ew.waybill_id == ItemTransitOrderWithVoid.express_2_waybill);
else
LatestTransitEWaybill = null;
if (this.ItemOrder?.latestEWaybills?.Count > 0 && !string.IsNullOrEmpty(this.ItemOrder?.out_express_no))
LatestDirectEWaybill = ItemOrder.latestEWaybills.FirstOrDefault(ew => ew.waybill_id == this.ItemOrder?.out_express_no);
else
LatestDirectEWaybill = null;
}
public void UpdateOrderItemBuyButton()
{