From e873b2dc6f9ab599ace6a550e91b4f82ecd1a94a Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Tue, 8 Aug 2023 17:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=B0=81=E7=AE=B1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../APIServices/QiKu/PackTaskService.cs | 12 ++- .../ViewModels/PackTask/TaskListViewModel.cs | 15 ++- .../Views/SealBox/AddProductWindow.xaml | 101 ++++++++++++++++++ .../Views/SealBox/AddProductWindow.xaml.cs | 94 ++++++++++++++++ .../SealBox/SealBoxWaitConfigureControl.xaml | 5 +- .../Views/SealBox/ShopSealBoxListControl.xaml | 7 +- 6 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 BBWY.Client/Views/SealBox/AddProductWindow.xaml create mode 100644 BBWY.Client/Views/SealBox/AddProductWindow.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index a404013c..1ba284d0 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -396,7 +396,17 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - + public ApiResponse AddSealBoxProduct(string skuId, PositionType positionType, int count) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/AddSealBoxProduct", new + { + skuId, + positionType, + SkuCount = count, + ShopId = globalContext.User.Shop.ShopId.ToString(), + UserId = globalContext.User.Id.ToString() + }, null, HttpMethod.Post); + } } public class CompeteSealBox diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 5d18077f..a8371bd4 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -245,7 +245,7 @@ namespace BBWY.Client.ViewModels.PackTask - public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService) { this.globalContext = globalContext; @@ -288,6 +288,15 @@ namespace BBWY.Client.ViewModels.PackTask SetFallWareConfiguredCommand = new RelayCommand(SetFallWareConfigured); SubmitOverTimeMarkMsgCommand = new RelayCommand(SubmitOverTimeMarkMsg); + + AddSealBoxProductCommand = new RelayCommand(AddSealBoxProduct); + this.productService = productService; + } + ProductService productService; + private void AddSealBoxProduct() + { + AddProductWindow addProductWindow = new AddProductWindow(packTaskService, productService); + addProductWindow.ShowDialog(); } private void SubmitOverTimeMarkMsg(object param) @@ -439,6 +448,10 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// + /// 添加封箱商品 + /// + public ICommand AddSealBoxProductCommand { get; set; } /// /// 提交过期时间数据 /// diff --git a/BBWY.Client/Views/SealBox/AddProductWindow.xaml b/BBWY.Client/Views/SealBox/AddProductWindow.xaml new file mode 100644 index 00000000..4b0a2c90 --- /dev/null +++ b/BBWY.Client/Views/SealBox/AddProductWindow.xaml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/AddProductWindow.xaml.cs b/BBWY.Client/Views/SealBox/AddProductWindow.xaml.cs new file mode 100644 index 00000000..8fc1e654 --- /dev/null +++ b/BBWY.Client/Views/SealBox/AddProductWindow.xaml.cs @@ -0,0 +1,94 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +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.SealBox +{ + /// + /// AddProductWindow.xaml 的交互逻辑 + /// + public partial class AddProductWindow : BWindow + { + public AddProductWindow(PackTaskService packTaskService, ProductService productService) + { + this. packTaskService = packTaskService; + this. productService = productService; + InitializeComponent(); + this.DataContext = this; + } + ProductService productService; + PackTaskService packTaskService; + private int count; + public int Count { get => count; set { Set(ref count, value); } } + + private string skuId; + public string SkuId { get=>skuId; set { Set(ref skuId, value); } } + + private string logo; + public string Logo { get => logo; set { Set(ref logo, value); } } + + private string skuTitle; + public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } } + + + public ObservableCollection PositionTypes { get; set; }=new ObservableCollection() { + PositionType.商家仓, PositionType.云仓, PositionType.京仓, PositionType.聚水潭 + }; + + private PositionType positionType; + public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + if (Count<=0) + { + MessageBox.Show("请输入任务数"); return; + } + var res = packTaskService.AddSealBoxProduct(SkuId, PositionType, Count); + + if (res == null || !res.Success) + { + MessageBox.Show(res?.Msg); return; + } + + this.Close(); + } + + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + if (SkuId.IsNullOrEmpty()) + { + MessageBox.Show("请输入SkuId"); return; + } + SkuId = SkuId.Trim(); + var res = productService.GetProductSkuList(null, SkuId); + if (res==null||!res.Success) + { + MessageBox.Show(res?.Msg);return; + } + var productSku = res.Data.SingleOrDefault(d => d.Id == SkuId); + + if (productSku==null) + { + MessageBox.Show("不存在对应的sku商品数据."); return; + } + SkuTitle = productSku.Title; + Logo= productSku.Logo.Replace("80x80","150x150"); + + } + } +} diff --git a/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml b/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml index b7e7d690..ed03a801 100644 --- a/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml +++ b/BBWY.Client/Views/SealBox/SealBoxWaitConfigureControl.xaml @@ -154,7 +154,10 @@ - + + + + diff --git a/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml index 1d767697..e16874ff 100644 --- a/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml +++ b/BBWY.Client/Views/SealBox/ShopSealBoxListControl.xaml @@ -72,9 +72,14 @@ - +