shanji 3 years ago
parent
commit
9ecc928926
  1. 20
      BBWY.Client/Models/Order/OrderDropShipping.cs
  2. 5
      BBWY.Client/Models/Order/RelationPurchaseOrderSku.cs
  3. 45
      BBWY.Client/ViewModels/Order/OrderListViewModel.cs
  4. 25
      BBWY.Client/Views/Order/OrderList.xaml
  5. 82
      BBWY.Client/Views/Order/RelationPurchaseOrder.xaml
  6. 66
      BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs
  7. 8
      BBWY.Client/Views/SelectShop.xaml.cs
  8. 23
      BBWY.Controls/BWindow.cs
  9. 11
      BBWY.Server.Business/Order/OrderBusiness.cs
  10. 2
      BBWY.Server.Model/Dto/Request/Order/OrderDropShippingRequest.cs

20
BBWY.Client/Models/Order/OrderDropShipping.cs

@ -1,11 +1,15 @@
namespace BBWY.Client.Models using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace BBWY.Client.Models
{ {
public class OrderDropShipping : NotifyObject public class OrderDropShipping : NotifyObject, ICloneable
{ {
public OrderDropShipping() public OrderDropShipping()
{ {
if (PurchaseFreight != 0M)
PurchaseFreightStr = PurchaseFreight.ToString(); PurchaseFreightStr = PurchaseFreight.ToString();
RelationPurchaseOrderSkuList = new ObservableCollection<RelationPurchaseOrderSku>();
} }
public long Id { get; set; } public long Id { get; set; }
public string OrderId { get; set; } public string OrderId { get; set; }
@ -60,6 +64,16 @@
private void OnAmountChanged() private void OnAmountChanged()
{ {
PurchaseAmount = SkuAmount + PurchaseFreight; PurchaseAmount = SkuAmount + PurchaseFreight;
OnPurchaseAmountChanged?.Invoke();
}
public Action OnPurchaseAmountChanged { get; set; }
public object Clone()
{
return this.MemberwiseClone();
} }
public IList<RelationPurchaseOrderSku> RelationPurchaseOrderSkuList { get; set; }
} }
} }

5
BBWY.Client/Models/Order/RelationPurchaseOrderSku.cs

@ -57,6 +57,11 @@ namespace BBWY.Client.Models
} }
} }
/// <summary>
/// 代发信息Id
/// </summary>
public long? OrderDropShippingId { get; set; }
[JsonIgnore] [JsonIgnore]
public Action OnSkuAmountChanged { get; set; } public Action OnSkuAmountChanged { get; set; }

45
BBWY.Client/ViewModels/Order/OrderListViewModel.cs

@ -221,7 +221,7 @@ namespace BBWY.Client.ViewModels
private void LoadOrder(int pageIndex) private void LoadOrder(int pageIndex)
{ {
IsLoading = true; IsLoading = true;
Thread.Sleep(random.Next(500, 2000)); Thread.Sleep(random.Next(0, 1000));
var response = orderService.GetOrderList(SearchOrderId, var response = orderService.GetOrderList(SearchOrderId,
StartDate, StartDate,
EndDate, EndDate,
@ -347,25 +347,25 @@ namespace BBWY.Client.ViewModels
private void RelationPurchaseOrder_Closed(object sender, EventArgs e) private void RelationPurchaseOrder_Closed(object sender, EventArgs e)
{ {
var relationPurchaseOrder = sender as RelationPurchaseOrder; //var relationPurchaseOrder = sender as RelationPurchaseOrder;
if (relationPurchaseOrder.DialogResult != true) //if (relationPurchaseOrder.DialogResult != true)
return; // return;
var orderDropShipping = relationPurchaseOrder.OrderDropShipping; //var orderDropShipping = relationPurchaseOrder.OrderDropShipping;
var relationPurchaseOrderSkuList = relationPurchaseOrder.RelationPurchaseOrderSkuList; //var relationPurchaseOrderSkuList = relationPurchaseOrder.RelationPurchaseOrderSkuList;
IsLoading = true; //IsLoading = true;
Task.Factory.StartNew(() => orderService.RelationPurchaseOrder(orderDropShipping, relationPurchaseOrderSkuList, globalContext.User.Shop.PlatformCommissionRatio ?? 0.05M)) //Task.Factory.StartNew(() => orderService.RelationPurchaseOrder(orderDropShipping, relationPurchaseOrderSkuList, globalContext.User.Shop.PlatformCommissionRatio ?? 0.05M))
.ContinueWith(r => // .ContinueWith(r =>
{ // {
var response = r.Result; // var response = r.Result;
if (!response.Success) // if (!response.Success)
{ // {
IsLoading = false; // IsLoading = false;
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "关联采购订单")); // App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "关联采购订单"));
return; // return;
} // }
//LoadOrder(PageIndex); //关联订单刷新订单列表 // //LoadOrder(PageIndex); //关联订单刷新订单列表
RefreshOrder(orderDropShipping.OrderId); // RefreshOrder(orderDropShipping.OrderId);
}); // });
} }
private void Sd_Closed(object sender, EventArgs e) private void Sd_Closed(object sender, EventArgs e)
@ -417,7 +417,7 @@ namespace BBWY.Client.ViewModels
return; return;
if (order.StorageType == StorageType.) if (order.StorageType == StorageType.)
{ {
var relationPurchaseOrder = new RelationPurchaseOrder(order.Id, globalContext.User.Shop.PurchaseAccountList, order.OrderDropShippingList[0], order.ItemList.Select(osku => new RelationPurchaseOrderSku() var relationPurchaseOrder = new RelationPurchaseOrder(order.Id, globalContext.User.Shop.PurchaseAccountList, order.OrderDropShippingList, order.ItemList.Select(osku => new RelationPurchaseOrderSku()
{ {
Logo = osku.Logo, Logo = osku.Logo,
ProductId = osku.ProductId, ProductId = osku.ProductId,
@ -425,7 +425,8 @@ namespace BBWY.Client.ViewModels
Quantity = osku.ItemTotal, Quantity = osku.ItemTotal,
Title = osku.Title, Title = osku.Title,
SingleSkuAmount = (order.OrderCostDetailList.FirstOrDefault(ocd => ocd.SkuId == osku.Id)?.SkuAmount / osku.ItemTotal) ?? 0, SingleSkuAmount = (order.OrderCostDetailList.FirstOrDefault(ocd => ocd.SkuId == osku.Id)?.SkuAmount / osku.ItemTotal) ?? 0,
SingleSkuAmountStr = ((order.OrderCostDetailList.FirstOrDefault(ocd => ocd.SkuId == osku.Id)?.SkuAmount / osku.ItemTotal) ?? 0).ToString() SingleSkuAmountStr = ((order.OrderCostDetailList.FirstOrDefault(ocd => ocd.SkuId == osku.Id)?.SkuAmount / osku.ItemTotal) ?? 0).ToString(),
OrderDropShippingId = osku.OrderDropShippingId
}).ToList()); }).ToList());
relationPurchaseOrder.Closed += RelationPurchaseOrder_Closed; relationPurchaseOrder.Closed += RelationPurchaseOrder_Closed;
relationPurchaseOrder.ShowDialog(); relationPurchaseOrder.ShowDialog();

25
BBWY.Client/Views/Order/OrderList.xaml

@ -291,13 +291,10 @@
<Grid Background="#F2F2F2" Grid.ColumnSpan="2"> <Grid Background="#F2F2F2" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding OrderStartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" Margin="5,0,0,0"/> <TextBlock Text="{Binding OrderStartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" Margin="5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> <TextBlock VerticalAlignment="Center" Text="订单号:" Margin="5,0,0,0" />
<Run Text="订单号:"/> <c:BButton Content="{Binding Id}" Style="{StaticResource LinkButton}"
<Run Text="{Binding Id}"/>
</TextBlock>
<c:BButton Content="复制" Style="{StaticResource LinkButton}" Margin="5,0,0,0"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}"
CommandParameter="{Binding Id}"/> CommandParameter="{Binding Id}" Margin="5,0,0,0"/>
<Border Width="1" Margin="5,5,0,5" Background="{StaticResource Border.Brush}"/> <Border Width="1" Margin="5,5,0,5" Background="{StaticResource Border.Brush}"/>
<c:BButton x:Name="btn_decodeCommand" Content="解密收货信息" Style="{StaticResource LinkButton}" Margin="5,0,0,0" <c:BButton x:Name="btn_decodeCommand" Content="解密收货信息" Style="{StaticResource LinkButton}" Margin="5,0,0,0"
Command="{Binding DataContext.DecodeConsigneeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" Command="{Binding DataContext.DecodeConsigneeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}"
@ -306,7 +303,7 @@
<TextBlock Text="收货人:"/> <TextBlock Text="收货人:"/>
<TextBox Text="{Binding Consignee.ContactName}" Foreground="{StaticResource Text.Color}" <TextBox Text="{Binding Consignee.ContactName}" Foreground="{StaticResource Text.Color}"
IsReadOnly="True" Background="Transparent" BorderThickness="0"/> IsReadOnly="True" Background="Transparent" BorderThickness="0"/>
<TextBlock Text="联系电话:"/> <TextBlock Text="联系电话:" Margin="5,0,0,0"/>
<TextBox Text="{Binding Consignee.Mobile}" Foreground="{StaticResource Text.Color}" <TextBox Text="{Binding Consignee.Mobile}" Foreground="{StaticResource Text.Color}"
IsReadOnly="True" Background="Transparent" BorderThickness="0"/> IsReadOnly="True" Background="Transparent" BorderThickness="0"/>
</StackPanel> </StackPanel>
@ -356,21 +353,15 @@
<Run Text="{Binding ItemTotal}"/> <Run Text="{Binding ItemTotal}"/>
</TextBlock> </TextBlock>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock> <TextBlock Text="SPU:"/>
<Run Text="SPU:" /> <c:BButton Content="{Binding ProductId}" Style="{StaticResource LinkButton}"
<Run Text="{Binding ProductId}"/>
</TextBlock>
<c:BButton Content="复制" Style="{StaticResource LinkButton}"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding ProductId}" CommandParameter="{Binding ProductId}"
Margin=" 5,0,0,0"/> Margin=" 5,0,0,0"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock> <TextBlock Text="SKU:"/>
<Run Text="SKU:" /> <c:BButton Content="{Binding Id}" Style="{StaticResource LinkButton}"
<Run Text="{Binding Id}"/>
</TextBlock>
<c:BButton Content="复制" Style="{StaticResource LinkButton}"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding Id}" CommandParameter="{Binding Id}"
Margin=" 5,0,0,0"/> Margin=" 5,0,0,0"/>

82
BBWY.Client/Views/Order/RelationPurchaseOrder.xaml

@ -23,15 +23,33 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="130"/> <!--<RowDefinition Height="130"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>-->
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/> <RowDefinition Height="40"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" <Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"
Background="{StaticResource Border.Background}"> Background="{StaticResource Border.Background}">
<TextBlock Text="关联采购单" HorizontalAlignment="Center" VerticalAlignment="Center"/> <TextBlock Text="{Binding OrderId,StringFormat=关联采购单({0})}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border> </Border>
<Grid Grid.Row="1" Margin="5,0">
<ListBox x:Name="listbox_orderDropShipping" Grid.Row="1" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
ItemsSource="{Binding OrderDropShippingList}">
<ListBox.ItemTemplate>
<DataTemplate>
<Border Width="{Binding ActualWidth,ElementName=listbox_orderDropShipping,Converter={StaticResource widthConverter},ConverterParameter=10}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1"
Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="130"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid Margin="5,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="0.12*"/> <ColumnDefinition Width="0.12*"/>
<ColumnDefinition Width="0.35*"/> <ColumnDefinition Width="0.35*"/>
@ -44,36 +62,37 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="订单编号" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Text="{Binding OrderDropShipping.OrderId}" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,0,0"/>
<TextBlock Text="采购平台" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/> <TextBlock Text="采购平台" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Source={StaticResource PlatformProvider}}" <ComboBox ItemsSource="{Binding Source={StaticResource PlatformProvider}}"
Grid.Row="1" Grid.Column="1" Grid.Column="1"
SelectedItem="{Binding OrderDropShipping.PurchasePlatform}" SelectedItem="{Binding PurchasePlatform}"
DisplayMemberPath="." DisplayMemberPath="."
Height="25" Height="25"
Margin="5,0,0,0" Margin="5,0,0,0"
VerticalContentAlignment="Center"/> VerticalContentAlignment="Center"/>
<TextBlock Text="采购订单号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"/> <TextBlock Text="采购订单号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.PurchaseOrderId}" Grid.Row="1" Grid.Column="3" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding PurchaseOrderId}" Grid.Column="3" Height="25" Margin="5,0,0,0"/>
<TextBlock Text="买家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2"/> <TextBlock Text="买家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/>
<c:BTextBox Text="{Binding OrderDropShipping.BuyerAccount}" Grid.Row="2" Grid.Column="1" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding BuyerAccount}" Grid.Row="1" Grid.Column="1" Height="25" Margin="5,0,0,0"/>
<TextBlock Text="卖家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2"/> <TextBlock Text="卖家账号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.SellerAccount}" Grid.Row="2" Grid.Column="3" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding SellerAccount}" Grid.Row="1" Grid.Column="3" Height="25" Margin="5,0,0,0"/>
<TextBlock Text="货款金额" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/> <TextBlock Text="货款金额" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.SkuAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="1" Height="25" Margin="5,0,0,0" IsEnabled="false" DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> <c:BTextBox Text="{Binding SkuAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="1" Height="25" Margin="5,0,0,0" IsEnabled="false" DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/>
<TextBlock Text="采购运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2"/> <TextBlock Text="采购运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2"/>
<c:BTextBox Text="{Binding OrderDropShipping.PurchaseFreightStr,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="3" Height="25" Margin="5,0,0,0"/> <c:BTextBox Text="{Binding PurchaseFreightStr,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="3" Height="25" Margin="5,0,0,0"/>
<TextBlock Text="商户单号" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/>
<c:BTextBox Text="{Binding MerchantOrderId}" Grid.Row="3" Grid.Column="1" Height="25" Margin="5,0,0,0"/>
</Grid> </Grid>
<Grid Grid.Row="2" Margin="5,0">
<Grid Grid.Row="1" Margin="5,3,5,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition/> <RowDefinition/>
@ -101,7 +120,7 @@
ItemsSource="{Binding RelationPurchaseOrderSkuList}" ItemsSource="{Binding RelationPurchaseOrderSkuList}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}" BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,0,1,1"> BorderThickness="1,0,1,0">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Height="90" Width="{Binding ActualWidth,ElementName=listbox_ordersku}"> <Grid Height="90" Width="{Binding ActualWidth,ElementName=listbox_ordersku}">
@ -135,10 +154,29 @@
</ListBox> </ListBox>
</Grid> </Grid>
<c:BButton Grid.Row="2" Style="{StaticResource LinkButton}">
<StackPanel>
<Path Style="{StaticResource path_add}" Fill="{StaticResource Text.Link.Color}" Width="16"/>
<TextBlock Text="添加采购单"/>
</StackPanel>
</c:BButton>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<c:BButton Grid.Row="2" Style="{StaticResource LinkButton}">
<StackPanel>
<Path Style="{StaticResource path_add}" Fill="{StaticResource Text.Link.Color}" Width="16"/>
<TextBlock Text="添加采购单"/>
</StackPanel>
</c:BButton>
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right">
<TextBlock VerticalAlignment="Center" Margin="0,0,8,0"> <TextBlock VerticalAlignment="Center" Margin="0,0,8,0">
<Run Text="总计"/> <Run Text="总计"/>
<Run Text="{Binding OrderDropShipping.PurchaseAmount}" Foreground="#EC808D"/> <Run Text="{Binding TotalCost}" Foreground="#EC808D"/>
<Run Text="元"/> <Run Text="元"/>
</TextBlock> </TextBlock>
<c:BButton x:Name="btn_Save" Content="保存" Width="60" Margin="0,0,8,0" <c:BButton x:Name="btn_Save" Content="保存" Width="60" Margin="0,0,8,0"

66
BBWY.Client/Views/Order/RelationPurchaseOrder.xaml.cs

@ -1,6 +1,7 @@
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Controls; using BBWY.Controls;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
@ -11,47 +12,68 @@ namespace BBWY.Client.Views.Order
/// </summary> /// </summary>
public partial class RelationPurchaseOrder : BWindow public partial class RelationPurchaseOrder : BWindow
{ {
public OrderDropShipping OrderDropShipping { get; set; } public IList<OrderDropShipping> OrderDropShippingList { get; set; }
public IList<RelationPurchaseOrderSku> RelationPurchaseOrderSkuList { get; set; } public IList<RelationPurchaseOrderSku> RelationPurchaseOrderSkuList { get; set; }
public RelationPurchaseOrder(string orderId, IList<PurchaseAccount> purchaseAccountList, OrderDropShipping orderDropShipping, IList<RelationPurchaseOrderSku> relationPurchaseOrderSkuList) public IList<PurchaseAccount> PurchaseAccountList { get; set; }
public string OrderId { get; set; }
public decimal TotalCost { get => totalCost; set { Set(ref totalCost, value); } }
private decimal totalCost;
public RelationPurchaseOrder(string orderId, IList<PurchaseAccount> purchaseAccountList, IList<OrderDropShipping> orderDropShippingList, IList<RelationPurchaseOrderSku> relationPurchaseOrderSkuList)
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = this; this.DataContext = this;
OrderDropShipping = new OrderDropShipping() { OrderId = orderId, BuyerAccount = purchaseAccountList?.FirstOrDefault()?.AccountName }; this.PurchaseAccountList = purchaseAccountList;
if (orderDropShipping != null) this.OrderId = orderId;
OrderDropShippingList = new ObservableCollection<OrderDropShipping>();
if (orderDropShippingList != null)
{ {
OrderDropShipping.BuyerAccount = orderDropShipping.BuyerAccount; foreach (var ods in orderDropShippingList)
OrderDropShipping.PurchaseAmount = orderDropShipping.PurchaseAmount; {
OrderDropShipping.PurchaseOrderId = orderDropShipping.PurchaseOrderId; var ods1 = ods.Clone() as OrderDropShipping;
OrderDropShipping.DeliveryFreight = orderDropShipping.DeliveryFreight; ods1.PurchaseFreightStr = ods1.PurchaseFreight.ToString();
OrderDropShipping.PurchasePlatform = orderDropShipping.PurchasePlatform; var currentOdsSkuList = relationPurchaseOrderSkuList.Where(rsku => rsku.OrderDropShippingId == ods1.Id);
OrderDropShipping.SellerAccount = orderDropShipping.SellerAccount; foreach (var rsku in currentOdsSkuList)
OrderDropShipping.SkuAmount = orderDropShipping.SkuAmount; ods.RelationPurchaseOrderSkuList.Add(rsku);
OrderDropShipping.PurchaseFreight = orderDropShipping.PurchaseFreight; OrderDropShippingList.Add(ods1);
OrderDropShipping.PurchaseFreightStr = orderDropShipping.PurchaseFreight.ToString();
ods1.OnPurchaseAmountChanged = OnPurchaseAmountChanged;
}
} }
this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList; this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList;
foreach (var sku in RelationPurchaseOrderSkuList) foreach (var sku in RelationPurchaseOrderSkuList)
sku.OnSkuAmountChanged = OnSkuAmountChanged; sku.OnSkuAmountChanged = OnSkuAmountChanged;
OnPurchaseAmountChanged();
} }
private void OnSkuAmountChanged() private void OnSkuAmountChanged()
{ {
OrderDropShipping.SkuAmount = RelationPurchaseOrderSkuList.Sum(sku => sku.SkuAmount); foreach (var ods in OrderDropShippingList)
ods.SkuAmount = ods.RelationPurchaseOrderSkuList.Sum(sku => sku.SkuAmount);
} }
private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e) private void OnPurchaseAmountChanged()
{
if (string.IsNullOrEmpty(OrderDropShipping.PurchaseOrderId) ||
string.IsNullOrEmpty(OrderDropShipping.SellerAccount) ||
string.IsNullOrEmpty(OrderDropShipping.BuyerAccount) ||
OrderDropShipping.PurchaseAmount == 0)
{ {
MessageBox.Show("关联订单信息不全", "提示"); TotalCost = OrderDropShippingList.Sum(ods => ods.PurchaseAmount);
return;
} }
private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e)
{
//if (string.IsNullOrEmpty(OrderDropShipping.PurchaseOrderId) ||
// string.IsNullOrEmpty(OrderDropShipping.SellerAccount) ||
// string.IsNullOrEmpty(OrderDropShipping.BuyerAccount) ||
// OrderDropShipping.PurchaseAmount == 0)
//{
// MessageBox.Show("关联订单信息不全", "提示");
// return;
//}
this.DialogResult = true; this.DialogResult = true;
this.Close(); this.Close();
} }

8
BBWY.Client/Views/SelectShop.xaml.cs

@ -1,16 +1,8 @@
using BBWY.Client.Models; using BBWY.Client.Models;
using BBWY.Controls; using BBWY.Controls;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; 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.Shapes;
namespace BBWY.Client.Views namespace BBWY.Client.Views
{ {

23
BBWY.Controls/BWindow.cs

@ -1,4 +1,6 @@
using System.Reflection; using System.ComponentModel;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
@ -8,7 +10,7 @@ using System.Windows.Shell;
namespace BBWY.Controls namespace BBWY.Controls
{ {
[StyleTypedProperty(Property = "Style", StyleTargetType = typeof(BWindow))] [StyleTypedProperty(Property = "Style", StyleTargetType = typeof(BWindow))]
public class BWindow : Window public class BWindow : Window, INotifyPropertyChanged
{ {
public static readonly DependencyProperty CornerRadiusProperty = public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(BWindow), new PropertyMetadata(new CornerRadius(0))); DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(BWindow), new PropertyMetadata(new CornerRadius(0)));
@ -155,5 +157,22 @@ namespace BBWY.Controls
var filedInfo = typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic); var filedInfo = typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic);
return filedInfo != null && (bool)filedInfo.GetValue(this); return filedInfo != null && (bool)filedInfo.GetValue(this);
} }
#region PropertyNotify
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected bool Set<T>(ref T oldValue, T newValue, [CallerMemberName] string propertyName = "")
{
if (Equals(oldValue, newValue))
return false;
oldValue = newValue;
OnPropertyChanged(propertyName);
return true;
}
#endregion
} }
} }

11
BBWY.Server.Business/Order/OrderBusiness.cs

@ -947,7 +947,8 @@ namespace BBWY.Server.Business
foreach (var relationOrderSku in orderDropShipping.RelationPurchaseOrderSkuList) foreach (var relationOrderSku in orderDropShipping.RelationPurchaseOrderSkuList)
{ {
#region OrderSku #region OrderSku
var updateOrderSku = fsql.Update<OrderSku>(relationOrderSku.Id).Set(osku => osku.OrderDropShippingId, orderDropShipping.Id); var updateOrderSku = fsql.Update<OrderSku>().Set(osku => osku.OrderDropShippingId, orderDropShipping.Id)
.Where(osku => osku.SkuId == relationOrderSku.SkuId && osku.OrderId == dbOrder.Id);
updateOrderSkuList.Add(updateOrderSku); updateOrderSkuList.Add(updateOrderSku);
#endregion #endregion
@ -1059,6 +1060,14 @@ namespace BBWY.Server.Business
fsql.Insert(insertOrderCostDetailList).ExecuteAffrows(); fsql.Insert(insertOrderCostDetailList).ExecuteAffrows();
insertOrderCost?.ExecuteAffrows(); insertOrderCost?.ExecuteAffrows();
updateOrderCost?.ExecuteAffrows(); updateOrderCost?.ExecuteAffrows();
if (dbOrder.StorageType != Enums.StorageType.)
{
fsql.Update<Order>(dbOrder.Id)
.Set(o => o.StorageType, Enums.StorageType.)
.SetIf(dbOrder.OrderState == Enums.OrderState., o => o.OrderState, Enums.OrderState.)
.ExecuteAffrows();
}
}); });
} }

2
BBWY.Server.Model/Dto/Request/Order/OrderDropShippingRequest.cs

@ -11,8 +11,6 @@ namespace BBWY.Server.Model.Dto
public class RelationPurchaseOrderSkuRequestV2 public class RelationPurchaseOrderSkuRequestV2
{ {
public long Id { get; set; }
public string ProductId { get; set; } public string ProductId { get; set; }
public string SkuId { get; set; } public string SkuId { get; set; }

Loading…
Cancel
Save