Browse Source

C端添加快递配送

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
c3fbbd99eb
  1. 44
      BBWY.Client/APIServices/QiKu/PackTaskExpressService.cs
  2. 29
      BBWY.Client/APIServices/QiKu/PackTaskService.cs
  3. 5
      BBWY.Client/GlobalContext.cs
  4. 121
      BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs
  5. 109
      BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs
  6. 6
      BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs
  7. 7
      BBWY.Client/Models/Enums.cs
  8. 23
      BBWY.Client/Models/PackTask/PackTaskExpress.cs
  9. 18
      BBWY.Client/ViewModels/MainViewModel.cs
  10. 147
      BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs
  11. 1
      BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs
  12. 2
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  13. 94
      BBWY.Client/Views/PackTask/AddExpressWindow.xaml
  14. 214
      BBWY.Client/Views/PackTask/AddExpressWindow.xaml.cs
  15. 101
      BBWY.Client/Views/PackTask/PublishTaskWindow.xaml

44
BBWY.Client/APIServices/QiKu/PackTaskExpressService.cs

@ -0,0 +1,44 @@
using BBWY.Client.Models.APIModel.Response.PackTask;
using BBWY.Common.Http;
using BBWY.Common.Models;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
namespace BBWY.Client.APIServices.QiKu
{
public class PackTaskExpressService : BaseApiService, IDenpendency
{
public PackTaskExpressService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
{
}
public ApiResponse<List<string>> GetExpressNameList()
{
return SendRequest<List<string>>(globalContext.QKApiHost, $"api/PackTaskExpress/GetExpressNameList",
null
, null, HttpMethod.Get);
}
/// <summary>
/// 订阅快递100
/// </summary>
/// <param name="waybillNo"></param>
/// <param name="sourceExpressName"></param>
/// <returns></returns>
public ApiResponse<object> SubscribeKuaiDi100(string waybillNo, string sourceExpressName)
{
return SendRequest<object>(globalContext.QKApiHost, $"api/PackTaskExpress/SubscribeKuaiDi100",
new
{
waybillNo,
sourceExpressName
}
, null, HttpMethod.Post);
}
}
}

29
BBWY.Client/APIServices/QiKu/PackTaskService.cs

@ -407,6 +407,35 @@ namespace BBWY.Client.APIServices
UserId = globalContext.User.Id.ToString()
}, null, HttpMethod.Post);
}
/// <summary>
/// 创建任务 新版
/// </summary>
/// <param name="createTaskRequest"></param>
/// <returns></returns>
public ApiResponse<object> CreatePackTaskV2(CreatePackTaskV2Request createTaskRequest)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/CreatePackTaskV2",
createTaskRequest
, null, HttpMethod.Post);
}
/// <summary>
/// 创建任务 新版
/// </summary>
/// <param name="createTaskRequest"></param>
/// <returns></returns>
public ApiResponse<object> UpdatePackTaskV2(UpdatePackTaskV2Request createTaskRequest)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UpdatePackTaskV2",
createTaskRequest
, null, HttpMethod.Post);
}
}
public class CompeteSealBox

5
BBWY.Client/GlobalContext.cs

@ -30,6 +30,11 @@ namespace BBWY.Client
public string ClientVersion { get; set; }
/// <summary>
/// 物流公司列表
/// </summary>
public List<string> ExpressNameList { get; set; }
/// <summary>
/// JD客户端
/// </summary>

121
BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Client.Models.APIModel.Request
{
public class CreatePackTaskV2Request
{
/// <summary>
/// 店铺Id
/// </summary>
public string ShopId { get; set; }
/// <summary>
/// skuid
/// </summary>
public string SkuId { get; set; }
/// <summary>
/// 品名
/// </summary>
public string BrandName { get; set; }
/// <summary>
/// sku数量
/// </summary>
public int SkuCount { get; set; }
/// <summary>
/// 落仓(本地仓=0,齐越仓=1,京东仓=2)
/// </summary>
public PositionType PositionType { get; set; }
/// <summary>
/// 打包类型(单件=0,多件=1)
/// </summary>
public int PackType { get; set; }
/// <summary>
/// 配件数量
/// </summary>
public int GoodsNumber { get; set; }
/// <summary>
/// sku配件名称
/// </summary>
public string SkuGoodsTitle { get; set; }
/// <summary>
/// 基础包装(快递袋=0,纸箱=1,麻袋=2)
/// </summary>
public int BasicPack { get; set; }
/// <summary>
/// 增量耗材
/// </summary>
public string Increment1 { get; set; }
/// <summary>
/// 注意事项
/// </summary>
public string MarkMessage { get; set; }
/// <summary>
/// 对接人(发布任务人)
/// </summary>
public string UserId { get; set; }
/// <summary>
///条形码Id
/// </summary>
public long? BarCodeId { get; set; }
/// <summary>
/// 合格证Id
/// </summary>
public string CerId { get; set; }
/// <summary>
/// 是否需要条形码
/// </summary>
public bool? NeedBar { get; set; }
/// <summary>
/// 是否需要合格证
/// </summary>
public bool? NeedCer { get; set; }
/// <summary>
/// 合格证位置
/// </summary>
public int? CertificatePosition { get; set; }
#region 更新数据
/// <summary>
/// 货号
/// </summary>
public string ProductNo { get; set; }
/// <summary>
/// 图
/// </summary>
public string Logo { get; set; }
/// <summary>
/// 名称
/// </summary>
public string SkuName { get; set; }
/// <summary>
/// 品牌
/// </summary>
public string Brand { get; set; }
#endregion
/// <summary>
/// 配送方式
/// </summary>
public DistributionMode? DistributionMode { get; set; }
/// <summary>
/// 绑定快递单号
/// </summary>
public List<string> WayBillNoList { get; set; }
}
}

109
BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Client.Models.APIModel.Request
{
public class UpdatePackTaskV2Request
{/// <summary>
/// 任务id(修改使用)
/// </summary>
public long TaskId { get; set; }
public string SkuId { get; set; }
/// <summary>
/// 品名
/// </summary>
public string BrandName { get; set; }
/// <summary>
/// sku数量
/// </summary>
public int SkuCount { get; set; }
/// <summary>
/// 落仓(本地仓=0,齐越仓=1,京东仓=2)
/// </summary>
public PositionType PositionType { get; set; }
/// <summary>
/// 打包类型(单件=0,多件=1)
/// </summary>
public int PackType { get; set; }
/// <summary>
/// 配件数量
/// </summary>
public int GoodsNumber { get; set; }
/// <summary>
/// sku配件名称
/// </summary>
public string SkuGoodsTitle { get; set; }
/// <summary>
/// 基础包装(快递袋=0,纸箱=1,麻袋=2)
/// </summary>
public int BasicPack { get; set; }
/// <summary>
/// 增量耗材
/// </summary>
public string Increment1 { get; set; }
/// <summary>
/// 注意事项
/// </summary>
public string MarkMessage { get; set; }
/// <summary>
///条形码Id
/// </summary>
public long? BarCodeId { get; set; }
/// <summary>
/// 合格证Id
/// </summary>
public string CerId { get; set; }
/// <summary>
/// 是否需要条形码
/// </summary>
public bool? NeedBar { get; set; }
/// <summary>
/// 是否需要合格证
/// </summary>
public bool? NeedCer { get; set; }
/// <summary>
/// 合格证位置
/// </summary>
public int? CertificatePosition { get; set; }
#region 更新数据
/// <summary>
/// 货号
/// </summary>
public string ProductNo { get; set; }
/// <summary>
/// 图
/// </summary>
public string Logo { get; set; }
/// <summary>
/// 名称
/// </summary>
public string SkuName { get; set; }
/// <summary>
/// 品牌
/// </summary>
public string Brand { get; set; }
#endregion
/// <summary>
/// 配送方式
/// </summary>
public DistributionMode? DistributionMode { get; set; }
/// <summary>
/// 绑定快递单号
/// </summary>
public List<string> WayBillNoList { get; set; }
}
}

6
BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs

@ -219,6 +219,12 @@ namespace BBWY.Client.Models.APIModel
/// 发送信息不全时间
/// </summary>
public DateTime? SendToSetSkuConfigureTime { get; set; }
/// <summary>
/// 物流状态
/// </summary>
public List<ExpressOrderResponse> ExpressOrderResponses { get; set; }
}
public class ExpressOrderResponse
{

7
BBWY.Client/Models/Enums.cs

@ -560,5 +560,12 @@
}
/// <summary>
/// 配送方式(自送=1,快递配送=2)
/// </summary>
public enum DistributionMode
{
= 1, = 2
}
}

23
BBWY.Client/Models/PackTask/PackTaskExpress.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Client.Models.PackTask
{
public class PackTaskExpress : NotifyObject
{
private string sourceExpressName;
private string waybillNo;
/// <summary>
/// 快递单号
/// </summary>
public string WaybillNo { get=> waybillNo; set { Set(ref waybillNo, value); } }
/// <summary>
/// 原快递公司
/// </summary>
public string SourceExpressName { get => sourceExpressName; set { Set(ref sourceExpressName, value); } }
public string NewGuid { get; set; }
}
}

18
BBWY.Client/ViewModels/MainViewModel.cs

@ -1,4 +1,5 @@
using BBWY.Client.APIServices;
using BBWY.Client.APIServices.QiKu;
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Client.Views;
@ -23,6 +24,7 @@ namespace BBWY.Client.ViewModels
{
#region Properties
private IHttpClientFactory httpClientFactory;
private PackTaskExpressService packTaskExpressService;
private MdsApiService mdsApiService;
private LogisticsService logisticsService;
private ShopService shopService;
@ -88,7 +90,8 @@ namespace BBWY.Client.ViewModels
ShopService shopService,
IHttpClientFactory httpClientFactory,
WebView2Manager w2m,
DongDongHelper dongdongHelper)
DongDongHelper dongdongHelper,
PackTaskExpressService packTaskExpressService)
{
this.w2m = w2m;
this.managerDepartment = new List<string>() { "董事办", "财务部", "技术部", "总经办" };
@ -116,6 +119,7 @@ namespace BBWY.Client.ViewModels
Task.Factory.StartNew(DownloadWebview2Runtime);
}
dongdongHelper.StartInJection();
this.packTaskExpressService = packTaskExpressService;
}
/// <summary>
@ -310,8 +314,20 @@ namespace BBWY.Client.ViewModels
CreateMenu();
try
{
var res = packTaskExpressService.GetExpressNameList();
if (res.Success)
{
GlobalContext.ExpressNameList= res.Data;
}
}
catch (Exception ex)
{
}
IList<Department> departmentList = null;

147
BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs

@ -2,11 +2,13 @@
using BBWY.Client.APIServices.QiKu;
using BBWY.Client.Extensions;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
using BBWY.Client.Models.PackTask;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using Newtonsoft.Json;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
@ -26,6 +28,22 @@ namespace BBWY.Client.ViewModels.PackTask
#region 属性
private ObservableCollection<PackTaskExpress> packTaskExpressList;
public ObservableCollection<PackTaskExpress> PackTaskExpressList { get => packTaskExpressList; set { Set(ref packTaskExpressList, value); } }
public DistributionMode? distributionMode = Models.DistributionMode.;
/// <summary>
/// 配送方式
/// </summary>
public DistributionMode? DistributionMode { get => distributionMode; set { Set(ref distributionMode, value); } }
private ObservableCollection<DistributionMode> distributionModeList = new ObservableCollection<DistributionMode> {
Models.DistributionMode., Models.DistributionMode.};
public ObservableCollection<DistributionMode> DistributionModeList { get => distributionModeList; set { Set(ref distributionModeList, value); } }
public SaveType SaveType { get; set; }
private string searchSkuId;
@ -149,6 +167,10 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
private string skuTitle;
/// <summary>
/// sku配件商品名称
@ -293,8 +315,9 @@ namespace BBWY.Client.ViewModels.PackTask
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
#endregion
public PublishTaskViewModel(PackTaskService packTaskService, ProductService productService, GlobalContext globalContext, MarkMessageService markMessageService)
public PublishTaskViewModel(PackTaskService packTaskService, ProductService productService, GlobalContext globalContext, MarkMessageService markMessageService, PackTaskExpressService packTaskExpressService)
{
PackTaskExpressList = new ObservableCollection<PackTaskExpress>();
this.packTaskService = packTaskService;
this.productService = productService;
this.globalContext = globalContext;
@ -323,6 +346,72 @@ namespace BBWY.Client.ViewModels.PackTask
AppendMarkMessageCommand = new RelayCommand(AppendMarkMessage);
this.markMessageService = markMessageService;
AddExpressCommand = new RelayCommand(AddExpress);
UpdateExpressCommand = new RelayCommand<PackTaskExpress>(UpdateExpress);
DeletedExpressCommand = new RelayCommand<PackTaskExpress>(DeletedExpress);
this.packTaskExpressService = packTaskExpressService;
}
private void DeletedExpress(PackTaskExpress express)
{
var expressdata = PackTaskExpressList.SingleOrDefault(e => e.NewGuid == express.NewGuid);
if (expressdata != null)
PackTaskExpressList.Remove(expressdata);
}
private void UpdateExpress(PackTaskExpress express)
{
AddExpressWindow addExpress = new AddExpressWindow((newGuid, waybillNo, ExpressName) =>
{
App.Current.Dispatcher.Invoke(() =>
{
var express = PackTaskExpressList.SingleOrDefault(e => e.NewGuid == newGuid);
if (express != null)
{
App.Current.Dispatcher.Invoke(() =>
{
express.WaybillNo = waybillNo;
express.SourceExpressName = ExpressName;
});
}
});
}, globalContext.ExpressNameList, packTaskExpressService, express);
addExpress.ShowDialog();
}
PackTaskExpressService packTaskExpressService;
private void AddExpress()
{
AddExpressWindow addExpress = new AddExpressWindow((newGuid, waybillNo, ExpressName) =>
{
App.Current.Dispatcher.Invoke(() =>
{
PackTaskExpressList.Add(new PackTaskExpress
{
SourceExpressName = ExpressName,
WaybillNo = waybillNo,
NewGuid = newGuid
});
});
}, globalContext.ExpressNameList, packTaskExpressService);
addExpress.ShowDialog();
}
@ -339,6 +428,14 @@ namespace BBWY.Client.ViewModels.PackTask
public ICommand AppendMarkMessageCommand { get; set; }
public ICommand AddExpressCommand { get; set; }
public ICommand UpdateExpressCommand { get; set; }
public ICommand DeletedExpressCommand { get; set; }
MarkMessageService markMessageService;
private void AppendMarkMessage()
@ -674,6 +771,26 @@ namespace BBWY.Client.ViewModels.PackTask
GoodsNumber = model.GoodsNumber;
Availability = model.Availability;
if (model.ExpressOrderList!=null&&model.ExpressOrderList.Any())
{
DistributionMode = Models.DistributionMode.;
model.ExpressOrderList.ForEach(s => {
PackTaskExpressList.Add(new PackTaskExpress { NewGuid=Guid.NewGuid().ToString(),
SourceExpressName=s.TargetExpressName,
WaybillNo =s.WaybillNo
});
});
}
else
{
distributionMode = Models.DistributionMode.;
}
try
{
PositionType = model.PositionType.ToEnum<PositionType>();//多个仓库异常 todo:
@ -754,31 +871,40 @@ namespace BBWY.Client.ViewModels.PackTask
{
increateStr = string.Join(",", increates);
}
var createTaskModel = new Models.APIModel.Request.CreateTaskRequest
if (DistributionMode == Models.DistributionMode. && (PackTaskExpressList == null || !PackTaskExpressList.Any()))
{
MessageBox.Show("请添加快递信息", "提示");
return;
}
var createTaskModel = new Models.APIModel.Request.CreatePackTaskV2Request
{
ProductNo = ProductNo,
Logo = Logo.Replace("200x200", "80x80"),
SkuName = SkuName,
TaskId = TaskId,
BrandName = BrandName,
Availability = (int)Availability,
BasicPack = (int)BasicPack,
SkuId = SkuId,
CreateTime = DateTime.Now,
Increment1 = increateStr,
CertificatePosition = (int)CertificatePosition,
PackType = (int)PackType,
MarkMessage = MarkMessage,
PositionType = (int)PositionType,
PositionType = PositionType,
GoodsNumber = GoodsNumber,
SkuGoodsTitle = SkuTitle,
SkuCount = SkuCount,
UserId = globalContext.User.Id.ToString(),
ShopId = globalContext.User.Shop.ShopId.ToString(),
NeedBar = IsNeedBarCode == Need.,
NeedCer = IsNeedCertificateModel == Need.
NeedCer = IsNeedCertificateModel == Need.,
DistributionMode = DistributionMode,
WayBillNoList = PackTaskExpressList?.Select(p => p.WaybillNo)?.ToList()
};
if (IsNeedBarCode == Need.)
{
if (BarCodeModel == null || IsSetBarCode || BarCodeModel.Id <= 0)
@ -801,11 +927,14 @@ namespace BBWY.Client.ViewModels.PackTask
ApiResponse<object> res = null;
if (TaskId > 0)//修改界面
{
res = packTaskService.UpdateTask(createTaskModel);
var updateTaskModel = JsonConvert.DeserializeObject<UpdatePackTaskV2Request>(JsonConvert.SerializeObject(createTaskModel));
updateTaskModel.TaskId = TaskId;
res = packTaskService.UpdatePackTaskV2(updateTaskModel);
}
else
{
res = packTaskService.CreateTask(createTaskModel);
res = packTaskService.CreatePackTaskV2(createTaskModel);
}
if (res == null)

1
BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs

@ -802,6 +802,7 @@ namespace BBWY.Client.ViewModels.PackTask
ScheduleOverTime = item.ScheduleOverTime,
PackProcessType = item.PackProcessType,
SendToSetSkuConfigureTime = item.SendToSetSkuConfigureTime,
ExpressOrderList =item.ExpressOrderResponses
};
if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty())//加载物流信息

2
BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs

@ -1815,7 +1815,7 @@ namespace BBWY.Client.ViewModels.PackTask
PackProcessType = item.PackProcessType,
ShopId = item.ShopId,
SendToSetSkuConfigureTime = item.SendToSetSkuConfigureTime,
ExpressOrderList = item.ExpressOrderResponses
};
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
{

94
BBWY.Client/Views/PackTask/AddExpressWindow.xaml

@ -0,0 +1,94 @@
<c:BWindow x:Class="BBWY.Client.Views.PackTask.AddExpressWindow"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BBWY.Client.Views.PackTask"
mc:Ignorable="d"
Style="{StaticResource bwstyle}"
Height="245" Width="320"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:ctr="clr-namespace:BBWY.Client.Converters"
xmlns:cmodel="clr-namespace:BBWY.Client.Models"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
CloseButtonVisibility="Visible"
WindowStyle="None"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"
CloseButtonColor="White"
Title="添加物流">
<Window.Resources>
<ResourceDictionary >
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid >
<TextBlock Text="警告:填写错误的物流信息将导致打包任务无法更新任务状态" FontSize="12" TextWrapping="Wrap" Margin="30 45 30 0" VerticalAlignment="Top" HorizontalAlignment="Left" Foreground=" #ec808d"/>
<StackPanel Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="88,82,0,0"
Visibility="{Binding SelectShop,Mode=OneWay,Converter={StaticResource objConverter},ConverterParameter=店铺:Visible:Collapsed}"
>
<c:BTextBox x:Name="tbShop" Width="200" Height="25" TextChanged="tbShop_TextChanged" HorizontalAlignment="Left" Text="{Binding ExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="快递公司"
BorderThickness="0 0 0 0" Margin="0 0 0 1"
/>
<ListBox MaxHeight="300" x:Name="tipBoxShop" SelectionChanged="tipBoxShop_SelectionChanged" Background="{StaticResource Border.Background}">
</ListBox>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" Background="#8080ff" BorderBrush="{StaticResource MainMenu.BorderBrush}"
>
<TextBlock Text="添加物流" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Margin="20 0 0 0"/>
</Border>
<StackPanel Grid.Row="1" Orientation="Vertical" >
<StackPanel Orientation="Horizontal" Margin=" 0 50 0 0" HorizontalAlignment="Center">
<TextBlock Margin="0 0 5 0" VerticalAlignment="Center" Text="快递公司:"/>
<Border BorderBrush="{StaticResource Border.Brush}" VerticalAlignment="Center" BorderThickness="1" Height="30" >
<c:BTextBox WaterRemark="快递公司" Visibility="Hidden" Text="{Binding ExpressName}" BorderThickness="0" Height="25" Width="200" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center">
<TextBlock Margin="0 0 5 0" VerticalAlignment="Center" Text="快递单号:"/>
<Border BorderBrush="{StaticResource Border.Brush}" VerticalAlignment="Center" BorderThickness="1" Height="30" >
<c:BTextBox WaterRemark="快递单号" Text="{Binding WaybillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Height="25" Width="200" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Border>
</StackPanel>
</StackPanel>
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/>
<DockPanel Grid.Row="2">
<c:BButton Background="{StaticResource Button.Background}" DockPanel.Dock="Right" Content="确定" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click_1" />
<c:BButton Foreground="{StaticResource Button.Background}" Grid.Row="2" Style="{StaticResource LinkButton}" Content="取消" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click" />
</DockPanel>
</Grid>
</Grid>
</c:BWindow>

214
BBWY.Client/Views/PackTask/AddExpressWindow.xaml.cs

@ -0,0 +1,214 @@
using BBWY.Client.APIServices.QiKu;
using BBWY.Client.Models.PackTask;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Text;
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.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.PackTask
{
/// <summary>
/// AddExpressWindow.xaml 的交互逻辑
/// </summary>
public partial class AddExpressWindow : BWindow
{
public AddExpressWindow(Action<string, string, string> addExpressData, List<string> expressNameList, PackTaskExpressService packTaskExpressService, PackTaskExpress updateData=null)
{
InitializeComponent();
AddExpressData = addExpressData;
ExpressNameList = expressNameList;
this.packTaskExpressService = packTaskExpressService;
this.DataContext = this;
if (updateData!=null)
{
WaybillNo=updateData.WaybillNo;
ExpressName = updateData.SourceExpressName;
NewGuid = updateData.NewGuid;
}
}
PackTaskExpressService packTaskExpressService;
private string waybillNo;
public string WaybillNo { get => waybillNo; set { Set(ref waybillNo, value); } }
public string expressName;
public string ExpressName { get => expressName; set { Set(ref expressName, value); } }
public string NewGuid { get; set; }
public List<string> ExpressNameList { get; set; }
public Action<string, string, string> AddExpressData { get; set; }
/// <summary>
/// 取消
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
/// <summary>
/// 确定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BButton_Click_1(object sender, RoutedEventArgs e)
{
if (WaybillNo.IsNullOrEmpty())
{
MessageBox.Show("快递单号不能为空");
return;
}
if (ExpressName.IsNullOrEmpty())
{
MessageBox.Show("快递公司不能为空不能为空");
return;
}
var res = packTaskExpressService.SubscribeKuaiDi100(WaybillNo, ExpressName);
if (res.Success)
{
if (NewGuid.IsNullOrEmpty())
{
AddExpressData?.Invoke(Guid.NewGuid().ToString(), WaybillNo, ExpressName);
}
else
{
AddExpressData?.Invoke(NewGuid, WaybillNo, ExpressName);
}
this.Close();
return;
}
MessageBox.Show(res.Msg);
}
private void tbShop_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
var textBoxt = (TextBox)sender;
//创建一个ListBox
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
if (string.IsNullOrEmpty(textBoxt.Text))
{
tipBoxShop.Visibility = Visibility.Collapsed;
return;
}
if (ExpressNameList == null || ExpressNameList.Count < 0)
{
try
{
var res = packTaskExpressService.GetExpressNameList();
if (res.Success)
{
ExpressNameList = res.Data;
}
}
catch (Exception ex)
{
}
}
foreach (var department in ExpressNameList)
{
if (department.Contains(textBoxt.Text))
{
ListBoxItem item = new ListBoxItem();
Label lb = new Label();
lb.BorderThickness = new Thickness(0);
lb.HorizontalAlignment = HorizontalAlignment.Left;
lb.VerticalAlignment = VerticalAlignment.Center;
lb.Background = Brushes.Transparent;
lb.Margin = (new Thickness(0));
lb.Content = department;
item.Content = lb;
tipBoxShop.Items.Add(item);
}
}
if (tipBoxShop != null)
tipBoxShop.Visibility = Visibility.Visible;
}
catch (Exception)
{
}
}
private void tipBoxShop_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
var list = (ListBox)sender;
if (list.Items.Count <= 0)
{
return;
}
var value = (ListBoxItem)list.SelectedValue;
var content = (Label)value.Content;
tbShop.Text = content.Content.ToString();
tipBoxShop.Visibility = Visibility.Collapsed;
}
catch (Exception)
{
}
}
private void tbShop_LostFocus(object sender, RoutedEventArgs e)
{
try
{
if (tipBoxShop != null && tipBoxShop.Items.Count > 0)
{
tipBoxShop.Items.Clear();
}
}
catch (Exception)
{
}
}
}
}

101
BBWY.Client/Views/PackTask/PublishTaskWindow.xaml

@ -121,33 +121,116 @@
</StackPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="200"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="350"/>
<ColumnDefinition Width="180"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<TextBlock Text="任务信息" FontWeight="Bold" Margin="19 23 0 0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<StackPanel Height="30" VerticalAlignment="Top" Margin="19 23 0 0" Orientation="Horizontal" HorizontalAlignment="Left" >
<TextBlock Text="数量:" VerticalAlignment="Center"/>
<c:BTextBox WaterRemark="包装数量" Height="25" Width="90" Text="{Binding SkuCount}" />
<!--<TextBlock Margin="30 0 0 0" Text="到货情况:" VerticalAlignment="Center"/>
<TextBlock Text="落仓去向:" VerticalAlignment="Center" Margin="30 0 0 0" />
<Border CornerRadius="0" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}">
<ComboBox BorderThickness="0" VerticalContentAlignment="Center" ItemsSource="{Binding AvailabilityList}" Text="{Binding Availability}" >
<ComboBox VerticalContentAlignment="Center" BorderThickness="0" ItemsSource="{Binding PositionTypeList}" Text="{Binding PositionType}" >
</ComboBox>
</Border>-->
<TextBlock Text="落仓去向:" VerticalAlignment="Center" Margin="30 0 0 0" />
</Border>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1">
<TextBlock Text="配送信息" FontWeight="Bold" Margin="19 23 0 0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<StackPanel Height="30" VerticalAlignment="Top" Margin="19 23 0 0" Orientation="Horizontal" HorizontalAlignment="Left" >
<TextBlock Text="配送方式:" VerticalAlignment="Center" Margin="0 0 0 0" />
<Border CornerRadius="0" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}">
<ComboBox VerticalContentAlignment="Center" BorderThickness="0" ItemsSource="{Binding PositionTypeList}" Text="{Binding PositionType}" >
<ComboBox VerticalContentAlignment="Center" BorderThickness="0" ItemsSource="{Binding DistributionModeList}" Text="{Binding DistributionMode}" >
</ComboBox>
</Border>
</StackPanel>
</StackPanel>
<Grid Grid.Column="2" Visibility="{Binding DistributionMode,Converter={StaticResource objConverter},ConverterParameter=自送:Collapsed:Visible}">
<Grid Margin="20" VerticalAlignment="Top" >
<TextBlock Text="警告:填写错误的物流信息将导致打包任务无法更新任务状态" FontSize="14" Foreground=" #ec808d"/>
</Grid>
<Grid Margin="20 60 20 0">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Background="#f5f7fa" >
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="80"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<Border VerticalAlignment="Top" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" Grid.Row="0" />
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="0" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="1" />
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="2"/>
<Border HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="3"/>
<Border HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Width="1" Grid.Column="3"/>
<TextBlock Grid.Column="0" Text="快递公司" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="1" Text="快递单号" Style="{StaticResource middleTextBlock}"/>
<TextBlock Grid.Column="2" Text="操作" Style="{StaticResource middleTextBlock}"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Vertical" Background="Transparent">
<ListBox Name="basic_Listbox"
ItemsSource="{Binding PackTaskExpressList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,0,1,0"
Foreground="{StaticResource Text.Color}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
>
<ListBox.ItemTemplate >
<DataTemplate>
<Grid Width="{Binding ActualWidth,ElementName=basic_Listbox,Converter={StaticResource widthConverter},ConverterParameter=-0}"
>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="80"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<!--<TextBlock Margin="30 0 0 0" Text="加急:" VerticalAlignment="Center"/>
<ComboBox VerticalContentAlignment="Center" ItemsSource="{Binding WorryList}" Text="{Binding IsWorry}" >
</ComboBox>-->
<TextBlock Style="{StaticResource middleTextBlock}" Grid.Column="0" Text="{Binding SourceExpressName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Style="{StaticResource middleTextBlock}" Grid.Column="1" Text="{Binding WaybillNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
<c:BButton Foreground="#8080ff" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DataContext.UpdateExpressCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type c:BWindow}}}" CommandParameter="{Binding }" Content="修改" />
<c:BButton Foreground=" #ec808d" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DataContext.DeletedExpressCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type c:BWindow}}}" CommandParameter="{Binding }" Content="删除" Margin="10 0 0 0"/>
</StackPanel>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="1" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="2" Width="1" Background="{StaticResource Border.Brush}"/>
<Border HorizontalAlignment="Left" Margin="-1 0 0 0" Grid.Column="3" Width="1" Background="{StaticResource Border.Brush}"/>
<Border VerticalAlignment="Bottom" Grid.ColumnSpan="4" Height="1" Background="{StaticResource Border.Brush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<c:BButton Content="添加物流单号" Foreground="#8080ff" BorderThickness="1 0 1 1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding AddExpressCommand}"
/>
</StackPanel>
</Grid>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>

Loading…
Cancel
Save