diff --git a/BBWY.Client/APIServices/QiKu/PackTaskExpressService.cs b/BBWY.Client/APIServices/QiKu/PackTaskExpressService.cs new file mode 100644 index 00000000..d9502a90 --- /dev/null +++ b/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> GetExpressNameList() + { + return SendRequest>(globalContext.QKApiHost, $"api/PackTaskExpress/GetExpressNameList", + null + , null, HttpMethod.Get); + } + + + /// + /// 订阅快递100 + /// + /// + /// + /// + public ApiResponse SubscribeKuaiDi100(string waybillNo, string sourceExpressName) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTaskExpress/SubscribeKuaiDi100", + new + { + waybillNo, + sourceExpressName + } + , null, HttpMethod.Post); + } + } +} diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 1ba284d0..c2cd725d 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -407,6 +407,35 @@ namespace BBWY.Client.APIServices UserId = globalContext.User.Id.ToString() }, null, HttpMethod.Post); } + + + + /// + /// 创建任务 新版 + /// + /// + /// + public ApiResponse CreatePackTaskV2(CreatePackTaskV2Request createTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/CreatePackTaskV2", + createTaskRequest + , null, HttpMethod.Post); + } + + + /// + /// 创建任务 新版 + /// + /// + /// + public ApiResponse UpdatePackTaskV2(UpdatePackTaskV2Request createTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/UpdatePackTaskV2", + createTaskRequest + , null, HttpMethod.Post); + } + + } public class CompeteSealBox diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 9f2db2d1..4e92cf4c 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -30,6 +30,11 @@ namespace BBWY.Client public string ClientVersion { get; set; } + /// + /// 物流公司列表 + /// + public List ExpressNameList { get; set; } + /// /// JD客户端 /// diff --git a/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs b/BBWY.Client/Models/APIModel/Request/CreatePackTaskV2Request.cs new file mode 100644 index 00000000..6955a210 --- /dev/null +++ b/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 + { + /// + /// 店铺Id + /// + public string ShopId { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public PositionType PositionType { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 注意事项 + /// + public string MarkMessage { get; set; } + + /// + /// 对接人(发布任务人) + /// + public string UserId { get; set; } + + /// + ///条形码Id + /// + public long? BarCodeId { get; set; } + + /// + /// 合格证Id + /// + public string CerId { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 合格证位置 + /// + public int? CertificatePosition { get; set; } + + + #region 更新数据 + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// 图 + /// + public string Logo { get; set; } + + /// + /// 名称 + /// + public string SkuName { get; set; } + /// + /// 品牌 + /// + public string Brand { get; set; } + + #endregion + + /// + /// 配送方式 + /// + public DistributionMode? DistributionMode { get; set; } + + /// + /// 绑定快递单号 + /// + public List WayBillNoList { get; set; } + + } + + +} diff --git a/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs b/BBWY.Client/Models/APIModel/Request/UpdatePackTaskV2Request.cs new file mode 100644 index 00000000..3e9d4374 --- /dev/null +++ b/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 + {/// + /// 任务id(修改使用) + /// + public long TaskId { get; set; } + + public string SkuId { get; set; } + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public PositionType PositionType { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 注意事项 + /// + public string MarkMessage { get; set; } + + /// + ///条形码Id + /// + public long? BarCodeId { get; set; } + + /// + /// 合格证Id + /// + public string CerId { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 合格证位置 + /// + public int? CertificatePosition { get; set; } + + #region 更新数据 + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// 图 + /// + public string Logo { get; set; } + + /// + /// 名称 + /// + public string SkuName { get; set; } + /// + /// 品牌 + /// + public string Brand { get; set; } + + + + #endregion + /// + /// 配送方式 + /// + public DistributionMode? DistributionMode { get; set; } + + /// + /// 绑定快递单号 + /// + public List WayBillNoList { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs index 9d2a3140..15b8eaea 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -219,6 +219,12 @@ namespace BBWY.Client.Models.APIModel /// 发送信息不全时间 /// public DateTime? SendToSetSkuConfigureTime { get; set; } + + + /// + /// 物流状态 + /// + public List ExpressOrderResponses { get; set; } } public class ExpressOrderResponse { diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index e1dc1816..db4dbfc3 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -560,5 +560,12 @@ } + /// + /// 配送方式(自送=1,快递配送=2) + /// + public enum DistributionMode + { + 自送 = 1, 快递配送 = 2 + } } diff --git a/BBWY.Client/Models/PackTask/PackTaskExpress.cs b/BBWY.Client/Models/PackTask/PackTaskExpress.cs new file mode 100644 index 00000000..91b86c82 --- /dev/null +++ b/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; + /// + /// 快递单号 + /// + public string WaybillNo { get=> waybillNo; set { Set(ref waybillNo, value); } } + /// + /// 原快递公司 + /// + public string SourceExpressName { get => sourceExpressName; set { Set(ref sourceExpressName, value); } } + + + public string NewGuid { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index c5e20b2d..cd127a99 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/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() { "董事办", "财务部", "技术部", "总经办" }; @@ -116,6 +119,7 @@ namespace BBWY.Client.ViewModels Task.Factory.StartNew(DownloadWebview2Runtime); } dongdongHelper.StartInJection(); + this.packTaskExpressService = packTaskExpressService; } /// @@ -310,7 +314,19 @@ namespace BBWY.Client.ViewModels CreateMenu(); + try + { + var res = packTaskExpressService.GetExpressNameList(); + if (res.Success) + { + GlobalContext.ExpressNameList= res.Data; + } + } + catch (Exception ex) + { + + } @@ -334,7 +350,7 @@ namespace BBWY.Client.ViewModels managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { ShowShopChoosePanel = true; - + //} } else diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 24d15111..68727025 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/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 packTaskExpressList; + public ObservableCollection PackTaskExpressList { get => packTaskExpressList; set { Set(ref packTaskExpressList, value); } } + + + public DistributionMode? distributionMode = Models.DistributionMode.快递配送; + /// + /// 配送方式 + /// + public DistributionMode? DistributionMode { get => distributionMode; set { Set(ref distributionMode, value); } } + + + private ObservableCollection distributionModeList = new ObservableCollection { + Models.DistributionMode.自送, Models.DistributionMode.快递配送}; + public ObservableCollection 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 /// public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + + + + private string skuTitle; /// /// 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(); 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(UpdateExpress); + + DeletedExpressCommand = new RelayCommand(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() @@ -357,7 +454,7 @@ namespace BBWY.Client.ViewModels.PackTask MarkMessage = string.Empty; - var resShow = markMessageService.ShowTaskMarkMessage(TaskId); + var resShow = markMessageService.ShowTaskMarkMessage(TaskId); if (resShow != null && resShow.Success && resShow.Data != null) { ShowMarkMessage = string.Join("\r\n", resShow.Data.Select(d => d.ToString())); @@ -384,7 +481,7 @@ namespace BBWY.Client.ViewModels.PackTask BarCodeModel.Brand = Brand; BarCodeModel.SkuId = SkuId; BarCodeModel.SkuName = SkuName; - + } BarCodeModel.ShopName = globalContext.User.Shop.ShopName; if (!string.IsNullOrEmpty(BrandName)) @@ -582,7 +679,7 @@ namespace BBWY.Client.ViewModels.PackTask public void SearSpuCer() { - if (string.IsNullOrEmpty(SpuId)&&globalContext.User.Shop!=null) + if (string.IsNullOrEmpty(SpuId) && globalContext.User.Shop != null) { SearchSku(SkuId); return; @@ -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();//多个仓库异常 todo: @@ -689,8 +806,8 @@ namespace BBWY.Client.ViewModels.PackTask CertificatePosition = model.CertificatePosition; TaskId = model.TaskId; - var res = markMessageService.ShowTaskMarkMessage(TaskId); - if (res!=null&&res.Success&&res.Data!=null) + var res = markMessageService.ShowTaskMarkMessage(TaskId); + if (res != null && res.Success && res.Data != null) { ShowMarkMessage = string.Join("\r\n", res.Data.Select(d => d.ToString())); } @@ -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 res = null; if (TaskId > 0)//修改界面 { - res = packTaskService.UpdateTask(createTaskModel); + var updateTaskModel = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(createTaskModel)); + + updateTaskModel.TaskId = TaskId; + res = packTaskService.UpdatePackTaskV2(updateTaskModel); } else { - res = packTaskService.CreateTask(createTaskModel); + res = packTaskService.CreatePackTaskV2(createTaskModel); } if (res == null) diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index d993bb05..d0e2e983 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/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())//加载物流信息 diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index e2f575ea..9560af0d 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/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) { diff --git a/BBWY.Client/Views/PackTask/AddExpressWindow.xaml b/BBWY.Client/Views/PackTask/AddExpressWindow.xaml new file mode 100644 index 00000000..7a5fb89a --- /dev/null +++ b/BBWY.Client/Views/PackTask/AddExpressWindow.xaml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/PackTask/AddExpressWindow.xaml.cs b/BBWY.Client/Views/PackTask/AddExpressWindow.xaml.cs new file mode 100644 index 00000000..8ecbcaee --- /dev/null +++ b/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 +{ + /// + /// AddExpressWindow.xaml 的交互逻辑 + /// + public partial class AddExpressWindow : BWindow + { + public AddExpressWindow(Action addExpressData, List 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 ExpressNameList { get; set; } + + public Action AddExpressData { get; set; } + + /// + /// 取消 + /// + /// + /// + private void BButton_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + /// + /// 确定 + /// + /// + /// + 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) + { + + + } + } + } +} diff --git a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml index de352923..5dbba0e8 100644 --- a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml +++ b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml @@ -121,33 +121,116 @@ - + - - - - - - - - - - - + + + + + + + + + + + + + + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +