From 7d4ae2695407d9e7d01759cbce4e22784d66f06d Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Wed, 2 Aug 2023 17:06:37 +0800 Subject: [PATCH 1/5] 1 --- .../APIServices/QiKu/PackTaskService.cs | 58 ++++--------- .../Models/PackTask/StoreGetSelfResponse.cs | 45 ++++++++++ .../PackTask/WareHouseListViewModel.cs | 49 ++++++----- .../ServiceOrder/ServiceOrderViewModel.cs | 3 - .../Views/PackTask/PrintWindow.xaml.cs | 16 ---- .../Views/PackTask/WareHouseListControl.xaml | 2 + .../Views/SealBox/SplitOtherWareWindow.xaml | 2 +- .../StorePickSelf/StorePickProductWindow.xaml | 83 +++++++++++++++++++ .../StorePickProductWindow.xaml.cs | 54 ++++++++++++ 9 files changed, 231 insertions(+), 81 deletions(-) create mode 100644 BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs create mode 100644 BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml create mode 100644 BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 80a670c9..2427bde4 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -19,8 +19,6 @@ namespace BBWY.Client.APIServices public class PackTaskService : BaseApiService, IDenpendency { - - public PackTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } @@ -286,11 +284,6 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - public ApiResponse StoreGetBySelf(long taskId) - { - - return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelf?TaskId={taskId}", null, null, HttpMethod.Post); - } public ApiResponse CompletedPackTask(long taskId) { @@ -366,23 +359,28 @@ namespace BBWY.Client.APIServices }, null, HttpMethod.Post); } - //public ApiResponse QikuPublishOrderSkuPackConfigState(string orderId, string skuId, PackConfigState packConfigState) - //{ - // return SendRequest("http://bbwyb.qiyue666.com", $"Api/Order/QikuPublishOrderSkuPackConfigState", new - // { - // orderId, - // skuId, - // packConfigState, - // }, null, HttpMethod.Post); - //} - public ApiResponse SendToSetSkuConfigure(long taskId) { return SendRequest(globalContext.QKApiHost, $"api/PackTask/SendToSetSkuConfigure?taskid={taskId}", null, null, HttpMethod.Post); } + public ApiResponse GetStoreGetSelfData(long taskId) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/GetStoreGetSelfData?taskid={taskId}", null, null, HttpMethod.Get); + } + + + public ApiResponse StoreGetBySelfV2(long taskId, int storeGetCount, string PickerUserName) + { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV2?TaskId={taskId}", new { + taskId, + storeGetCount, + PickerUserName, + OperatorUserName= globalContext.User.Name + }, null, HttpMethod.Post); + } } public class CompeteSealBox @@ -400,15 +398,12 @@ namespace BBWY.Client.APIServices } - public class AddConsumableRequest { public long TaskId { get; set; } public long[] ConsumableIds { get; set; } } - - public class PackTaskDetailRequest { /// /// 任务id @@ -549,22 +544,7 @@ namespace BBWY.Client.APIServices /// 服务数量 /// public int? ServiceCount { get; set; } - ///// - ///// 增值服务ids - ///// - //public string IncreateServiceIds { get; set; } - ///// - ///// 增值服务数量 - ///// - //public string IncreateServiceNos { get; set; } - ///// - ///// 工序ids - ///// - //public string WorkProcessIds { get; set; } - ///// - ///// 工序数量 - ///// - //public string WorkProcessNos { get; set; } + /// /// @@ -586,8 +566,6 @@ namespace BBWY.Client.APIServices public ServiceType ServiceType { get; set; } } - - public class ConsumableTaskModel { public decimal Price { get; set; } @@ -601,7 +579,6 @@ namespace BBWY.Client.APIServices public int? ConsumableCount { get; set; } } - public class PackServiceMemberModel { public decimal Price { get; set; } @@ -620,7 +597,4 @@ namespace BBWY.Client.APIServices } - - - } diff --git a/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs b/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs new file mode 100644 index 00000000..ad6336d7 --- /dev/null +++ b/BBWY.Client/Models/PackTask/StoreGetSelfResponse.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace BBWY.Client.Models.PackTask +{ + public class StoreGetSelfResponse:NotifyObject + { /// + /// 团队用户列表(取件人) + /// + private ObservableCollection departmentUsers; + + /// + /// 团队用户列表(取件人) + /// + public ObservableCollection DepartmentUsers { get=> departmentUsers; set { Set(ref departmentUsers, value); } } + + /// + /// 可取的最大数 + /// + public int PickMaxCount { get; set; } + + /// + /// 提示消息 + /// + public string ShowMessage { get; set; } + } + public class DepartmentUser:NotifyObject + { + /// + /// 用户id + /// + public string UserId { get; set; } + + + + + private string userName; + /// + /// 名称 + /// + public string UserName { get => userName; set { Set(ref userName, value); } } // + } +} diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 2385464a..a495b205 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -1,24 +1,16 @@ using BBWY.Client.APIServices; -using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models; -using BBWY.Client.Views.PackTask; using BBWY.Common.Models; using BBWY.Controls; using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Linq; -using System.Windows.Controls; -using System.ComponentModel; -using HandyControl.Controls; using System.Windows; -using System.Collections; -using NPOI.SS.Formula.Functions; -using GalaSoft.MvvmLight.Messaging; + using BBWY.Client.Models.APIModel; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.SealBox; @@ -27,8 +19,8 @@ using BBWY.Client.Models.FallWare; using WebSocketSharp; using System.Threading; using BBWY.Client.Helpers; -using System.Diagnostics.Eventing.Reader; using BBWY.Client.Views.TaskOverTime; +using BBWY.Client.Views.StorePickSelf; namespace BBWY.Client.ViewModels.PackTask { @@ -856,17 +848,34 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show(res.Msg); return; } + + Task.Factory.StartNew(() => SearchTaskList()); } private void StoreGetBySelf(long taskId) { - MessageBoxResult result = System.Windows.MessageBox.Show($"确定商家自取,任务id:{taskId}?", "提示", - MessageBoxButton.YesNo, - MessageBoxImage.Warning); - if (result != MessageBoxResult.Yes) return; - var res = packTaskService.StoreGetBySelf(taskId); + //MessageBoxResult result = System.Windows.MessageBox.Show($"确定商家自取,任务id:{taskId}?", "提示", + // MessageBoxButton.YesNo, + // MessageBoxImage.Warning); + //if (result != MessageBoxResult.Yes) return; + + var data = packTaskService.GetStoreGetSelfData(taskId); + if (!data.Success) + { + MessageBox.Show(data?.Msg); + return; + } + + StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data); + sorePickProductWindow.ShowDialog(); + if (sorePickProductWindow.DialogResult == null || !sorePickProductWindow.DialogResult.Value) + { + return; + } + + var res = packTaskService.StoreGetBySelfV2(taskId, sorePickProductWindow.Count, sorePickProductWindow.UserName); if (res == null) { return; @@ -876,6 +885,8 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show(res.Msg, "错误信息"); return; } + sorePickProductWindow.Close(); + Task.Factory.StartNew(() => SearchTaskList()); } @@ -1211,13 +1222,13 @@ namespace BBWY.Client.ViewModels.PackTask public void SetTaskState(TaskState? taskState) { - if (!(TaskState== Models.TaskState.未到货&&TaskState== Models.TaskState.待验收)) + if (!(TaskState == Models.TaskState.未到货 && TaskState == Models.TaskState.待验收)) { SearchSkuTitle = ""; SearchSpuTitle = ""; } - - + + TaskState = taskState; @@ -1550,7 +1561,7 @@ namespace BBWY.Client.ViewModels.PackTask PackTaskList = new ObservableCollection();//初始化数据 var datas = packTaskService.SearchTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, SearchShopName, - PageIndex, PageSize,SearchSkuTitle,SearchSpuTitle); + PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; diff --git a/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs index b286832e..f3f4e305 100644 --- a/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs +++ b/BBWY.Client/ViewModels/ServiceOrder/ServiceOrderViewModel.cs @@ -47,9 +47,6 @@ namespace BBWY.Client.ViewModels public ICommand SetServiceOrderStateCommand { get; set; } public ICommand SetReturnDirectionCommand { get; set; } public ICommand OnPageIndexChangedCommand { get; set; } - - public ICommand CopyTextCommand { get; set; } - public ICommand SetSearchDateCommand { get; set; } public ICommand SearchServiceOrderCommand { get; set; } diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index 7f91e2a0..0eb7a853 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -1,28 +1,12 @@ using BBWY.Client.Helpers; using BBWY.Client.Models; using BBWY.Controls; -using NPOI.SS.UserModel; using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Printing; -using System.IO; using System.Linq; -using System.Printing; -using System.Runtime.ConstrainedExecution; -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.Interop; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Media.Media3D; -using System.Windows.Shapes; -using System.Drawing.Printing; using System.Collections.ObjectModel; using BBWY.Client.Extensions; diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index d99b7c6e..ab4b54b1 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -275,8 +275,10 @@ > + + diff --git a/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml b/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml index bc3876e7..eba2ef4e 100644 --- a/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml +++ b/BBWY.Client/Views/SealBox/SplitOtherWareWindow.xaml @@ -6,7 +6,7 @@ xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" WindowStartupLocation="CenterScreen" CloseButtonVisibility="Visible" - xmlns:hc="https://handyorg.github.io/handycontrol" + xmlns:hc="https://handyorg.github.io/handycontrol" CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml new file mode 100644 index 00000000..183ce15a --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs new file mode 100644 index 00000000..a603a207 --- /dev/null +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs @@ -0,0 +1,54 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Controls; +using System; +using System.Collections.Generic; +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.Shapes; + +namespace BBWY.Client.Views.StorePickSelf +{ + /// + /// StorePickProductWindow.xaml 的交互逻辑 + /// + public partial class StorePickProductWindow : BWindow + { + public StorePickProductWindow(StoreGetSelfResponse model) + { + StoreGetSelfResponse=model; + InitializeComponent(); + this.DataContext = this; + } + private string userName; + /// + /// 用户名 + /// + public string UserName { get => userName; set { Set(ref userName, value); } } + + private int count; + + public int Count { get => count; set { Set(ref count, value); } } + + private StoreGetSelfResponse storeGetSelfResponse; + + public StoreGetSelfResponse StoreGetSelfResponse { get=> storeGetSelfResponse; set {Set(ref storeGetSelfResponse,value); } } + private void BButton_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + + } + + private void BButton_Click_1(object sender, RoutedEventArgs e) + { + Count = StoreGetSelfResponse.PickMaxCount; + } + } +} From 0f3fbdf4b6756b79beb163da764106942fb4f2f5 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Wed, 2 Aug 2023 17:34:03 +0800 Subject: [PATCH 2/5] 1 --- BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs index a8603c9f..9406456e 100644 --- a/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackDetailViewModel.cs @@ -906,12 +906,6 @@ namespace BBWY.Client.ViewModels.PackTask /// private void UpLoadPack(object obj) { - //if (ProcessTaskCount > TaskCount) - //{ - // System.Windows.MessageBox.Show($"工序任务数:{ProcessTaskCount}不能超过打包总任务数:{TaskCount}"); - // return; - //} - if (PackUserModelList==null|| PackUserModelList.Count<=0) { System.Windows.MessageBox.Show("信息不完整,打包人设置有误"); From 8658ae91c0fe9ebd1909ffda2603c0a764e16bbb Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 7 Aug 2023 17:00:29 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=88=E6=A0=BC?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../APIServices/QiKu/PackTaskService.cs | 18 +- .../PackTask/SearchStoreGetSelfResponse.cs | 83 +++++ .../Models/PackTask/CertificateModel.cs | 4 +- .../Models/SealBox/WareNoSealBoxModel.cs | 7 +- .../PackTask/StorePickSelfViewModel.cs | 11 + .../ViewModels/PackTask/TaskListViewModel.cs | 56 ++- .../PackTask/UpdatePurchaseTaskViewModel.cs | 173 ++++----- .../PackTask/WareHouseListViewModel.cs | 166 +++++++-- BBWY.Client/ViewModels/ViewModelLocator.cs | 10 + .../Views/PackTask/PackDetailWindow.xaml | 9 +- BBWY.Client/Views/PackTask/PackTaskTotal.xaml | 14 +- .../Views/PackTask/SetCerWindow.xaml.cs | 2 +- BBWY.Client/Views/PackTask/TaskList.xaml | 20 +- BBWY.Client/Views/PackTask/WareHouseList.xaml | 6 +- .../Views/PackTask/WareHouseListControl.xaml | 1 - .../SealBox/SealBoxConfiguredControl.xaml | 2 +- .../SealBox/SealBoxNoConfigureControl.xaml | 68 ++-- .../SealBox/SealBoxNoConfigureControl.xaml.cs | 28 +- .../Views/SealBox/WaitSealBoxControl.xaml | 2 +- .../ShopStorePickSelfControl.xaml | 347 ++++++++++++++++++ .../ShopStorePickSelfControl.xaml.cs | 26 ++ .../StorePickSelf/StorePickSelfControl.xaml | 347 ++++++++++++++++++ .../StorePickSelfControl.xaml.cs | 253 +++++++++++++ .../TotalPackTask/ShopPackTaskTotal.xaml | 4 +- 24 files changed, 1456 insertions(+), 201 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs create mode 100644 BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs create mode 100644 BBWY.Client/Views/StorePickSelf/ShopStorePickSelfControl.xaml create mode 100644 BBWY.Client/Views/StorePickSelf/ShopStorePickSelfControl.xaml.cs create mode 100644 BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml create mode 100644 BBWY.Client/Views/StorePickSelf/StorePickSelfControl.xaml.cs diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 2427bde4..a404013c 100644 --- a/BBWY.Client/APIServices/QiKu/PackTaskService.cs +++ b/BBWY.Client/APIServices/QiKu/PackTaskService.cs @@ -374,13 +374,29 @@ namespace BBWY.Client.APIServices public ApiResponse StoreGetBySelfV2(long taskId, int storeGetCount, string PickerUserName) { - return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV2?TaskId={taskId}", new { + return SendRequest(globalContext.QKApiHost, $"api/PackTask/StoreGetBySelfV2", new { taskId, storeGetCount, PickerUserName, OperatorUserName= globalContext.User.Name }, null, HttpMethod.Post); } + + public ApiResponse SearchStoreGetSelfList(string taskId, string OrderSn, string SpuId, string SkuId,string DepartmentName, string ShopName, int? pageIndex, int pageSize, string ShopId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchStoreGetSelfList", new + { + taskId, + OrderSn, + SpuId, + SkuId, + DepartmentName, ShopName, + ShopId , pageIndex, pageSize, + }, null, HttpMethod.Post); + } + + } public class CompeteSealBox diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs new file mode 100644 index 00000000..eaad8a64 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchStoreGetSelfResponse.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchStoreGetSelfResponse + { + /// + /// 总条数 + /// + public int TotalCount { get; set; } + + /// + /// 商家自取记录列表 + /// + public List StoreGetSelfResponseList { get; set; } + + } + + /// + /// 单挑自取记录数据 + /// + public class StoreGetSelfData:NotifyObject + { + /// + /// 打包任务id + /// + public long TaskId { get; set; } + ///// + ///// 取货时间 + ///// + //public DateTime OperatorTime { get; set; } + + /// + /// 取货人 + /// + public string PickerUserName { get; set; } + + /// + /// 自取数量 + /// + public int StoreGetCount { get; set; } + + #region 任务信息 + + /// + /// 任务创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 店铺 + /// + public string ShopName { get; set; } + + /// + /// 团队 + /// + public string DepartmentName { get; set; } + /// + /// 商品sku + /// + public string SkuId { get; set; } + + /// + /// 图片 + /// + public string Logo { get; set; } + + /// + /// 商品sku标题名称 + /// + public string SkuName { get; set; } + + /// + /// 商品品名 + /// + public string BrandName { get; set; } + + #endregion + } +} diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index 90fe2664..30981c69 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -134,11 +134,11 @@ namespace BBWY.Client.Models - private long goodsNumber = 1; + private long? goodsNumber = 1; /// /// 配件序号 /// - public long GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + public long? GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } diff --git a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs index 94e1dab4..2f1deee5 100644 --- a/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs +++ b/BBWY.Client/Models/SealBox/WareNoSealBoxModel.cs @@ -31,6 +31,11 @@ namespace BBWY.Client.Models /// /// 封箱sku列表 /// - public List SealBoxSkus { get; set; } + private List sealBoxSkus; + + /// + /// 封箱sku列表 + /// + public List SealBoxSkus { get=> sealBoxSkus; set {Set(ref sealBoxSkus, value); } } } } diff --git a/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs b/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs new file mode 100644 index 00000000..0ce4ca24 --- /dev/null +++ b/BBWY.Client/ViewModels/PackTask/StorePickSelfViewModel.cs @@ -0,0 +1,11 @@ +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.ViewModels.PackTask +{ + public class StorePickSelfViewModel:BaseVM,IDenpendency + { + } +} diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index ea9b28cc..5d18077f 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -237,6 +237,12 @@ namespace BBWY.Client.ViewModels.PackTask public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } } #endregion + private ObservableCollection storeGetSelfDataList; + /// + /// 商家自取记录任务列表 + /// + public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } } + public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService) @@ -373,11 +379,17 @@ namespace BBWY.Client.ViewModels.PackTask //SealBoxConfigureWindow sealBoxConfigureWindow = new SealBoxConfigureWindow(updateSealBoxConfig.Data.UpdateSealBoxConfiguredTaskDatas, ReflashTask, 0); //sealBoxConfigureWindow.ShowDialog(); - var data = waitSealBoxRes.Data.SealBoxWaitConfigureModels.Select(x => new SealBoxConfigureModel { - Logo = x.Logo, - WareType = x.WareType, SkuCount = x.SkuCount , SkuId = x.SkuId, SkuName = x.SkuName, TaskId = x.TaskId, TaskState =x.TaskState, - WaitConfigureCount= x.SkuCount, - } ).ToList(); + var data = waitSealBoxRes.Data.SealBoxWaitConfigureModels.Select(x => new SealBoxConfigureModel + { + Logo = x.Logo, + WareType = x.WareType, + SkuCount = x.SkuCount, + SkuId = x.SkuId, + SkuName = x.SkuName, + TaskId = x.TaskId, + TaskState = x.TaskState, + WaitConfigureCount = x.SkuCount, + }).ToList(); SetSealBoxPolicyWindow setSealBoxPolicyWindow = new SetSealBoxPolicyWindow(data, ReflashTask, 0); setSealBoxPolicyWindow.ShowDialog(); @@ -494,7 +506,7 @@ namespace BBWY.Client.ViewModels.PackTask } private List waitSealBoxTaskStates = new List { - Models.TaskState.待落仓, Models.TaskState.待封箱, Models.TaskState.待出库 + Models.TaskState.待落仓, Models.TaskState.待封箱, Models.TaskState.待出库, Models.TaskState.商家自取 };//配置封箱的任务状态范围 @@ -1045,6 +1057,38 @@ namespace BBWY.Client.ViewModels.PackTask IsLoading = false; }); } + if (TaskState == Models.TaskState.商家自取) + { + Task.Factory.StartNew(() => + { + StoreGetSelfDataList = new ObservableCollection(); + var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, null, null, PageIndex, PageSize, globalContext.User.Shop.ShopId.ToString()); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.StoreGetSelfResponseList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreGetSelfDataList.Add(item); + })); + + } + + } + else + { + App.Current.Dispatcher.Invoke(new Action(() => + { + MessageBox.Show(datas?.Msg); + })); + + } + IsLoading = false; + }); + + } } diff --git a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs index 305ab8bb..c85ef211 100644 --- a/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/UpdatePurchaseTaskViewModel.cs @@ -525,108 +525,111 @@ namespace BBWY.Client.ViewModels.PackTask Brand = productApiResponse.Data.Items[0].BrandName; } - var productSku = packPurchaseTaskService.GetConfigPack(SkuId, "", OrderId); + } + else + { - if (productSku == null || !productSku.Success || productSku.Data == null) - { - MessageBox.Show(productSku.Msg); - return false; - } + App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku失败")); + } + var productSku = packPurchaseTaskService.GetConfigPack(SkuId, "", OrderId); - SkuPurchaseSchemeId = productSku.Data.SkuPurchaseSchemeId; - BarCodeModel = productSku.Data.BarCode; - if (BarCodeModel == null) - { - BarCodeModel = new BarCodeModel(); + if (productSku == null || !productSku.Success || productSku.Data == null) + { + MessageBox.Show(productSku.Msg); + return false; + } + + + SkuPurchaseSchemeId = productSku.Data.SkuPurchaseSchemeId; + BarCodeModel = productSku.Data.BarCode; + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + } + if (!string.IsNullOrEmpty(Brand)) + BarCodeModel.Brand = Brand; + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + PurchaseSkuList = new ObservableCollection(); + foreach (var item in productSku.Data.PurchaseSkus) + { + var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); + if (list == null || !list.Success || list.Data == null) + continue; + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + if (skuItem == null) + { + MessageBox.Show($"{item.PurchaseProductId}采购商品列表不存在skuid:{item.PurchaseSkuId},sku商品可能被下架了."); + //return false; } - if (!string.IsNullOrEmpty(Brand)) - BarCodeModel.Brand = Brand; - if (!string.IsNullOrEmpty(BrandName)) - BarCodeModel.BrandName = BrandName; - BarCodeModel.ProductNo = ProductNo; - BarCodeModel.SkuId = SkuId; - BarCodeModel.SkuName = SkuName; - PurchaseSkuList = new ObservableCollection(); - foreach (var item in productSku.Data.PurchaseSkus) + App.Current.Dispatcher.Invoke(new Action(() => { - var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); - if (list == null ||!list.Success|| list.Data == null) - continue; - var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); - if (skuItem == null) + PurchaseSkuList.Add(new PurchaseSku { - MessageBox.Show($"{item.PurchaseProductId}采购商品列表不存在skuid:{item.PurchaseSkuId},sku商品可能被下架了."); - //return false; + Logo = skuItem?.Logo, + Title = skuItem?.Title, + IsNeedCer = item.IsNeedCer, + PurchaseSkuId = item.PurchaseSkuId, + CerDTO = item.CerDTO, + IsSetCertificate = item.CerDTO == null ? true : false, + }); + })); + } + + IsNeedBarCode = Need.需要; + IsSetBarCode = true; + IsSetCertificate = true; + if (productSku.Data.PackConfig != null) + { + var config = productSku.Data.PackConfig; + SkuTitle = config.SkuGoodsTitle; + BrandName = config.BrandName; + GoodsNumber = config.GoodsNumber; + PackType = (PackType)config.PackType; + BasicPack = (BasicPack)config.BasicPack; + //MarkMessage = config.MarkMessage; + CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无需合格证 : (CertificatePosition)config.CertificatePosition.Value; + // Increment1 = config.Increment1; + + IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; + IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; + + IsSetBarCode = !config.NeedBar; + IsSetCertificate = !config.NeedCer; + + string[] increateDatas = config.Increment1?.Split(','); + bool isSelected = false; + + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + isSelected = false; + if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item)) + { + isSelected = true; } - App.Current.Dispatcher.Invoke(new Action(() => + App.Current.Dispatcher.Invoke(() => { - PurchaseSkuList.Add(new PurchaseSku + IncreateList.Add(new IncreateModel { - Logo = skuItem?.Logo, - Title = skuItem?.Title, - IsNeedCer = item.IsNeedCer, - PurchaseSkuId = item.PurchaseSkuId, - CerDTO = item.CerDTO, - IsSetCertificate = item.CerDTO == null ? true : false, + IncreateName = item, + IsSelected = isSelected }); - })); + }); } - IsNeedBarCode = Need.需要; - IsSetBarCode = true; - IsSetCertificate = true; - if (productSku.Data.PackConfig != null) - { - var config = productSku.Data.PackConfig; - SkuTitle = config.SkuGoodsTitle; - BrandName = config.BrandName; - GoodsNumber = config.GoodsNumber; - PackType = (PackType)config.PackType; - BasicPack = (BasicPack)config.BasicPack; - //MarkMessage = config.MarkMessage; - CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无需合格证 : (CertificatePosition)config.CertificatePosition.Value; - // Increment1 = config.Increment1; - - IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; - IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; - - IsSetBarCode = !config.NeedBar; - IsSetCertificate = !config.NeedCer; - - string[] increateDatas = config.Increment1?.Split(','); - bool isSelected = false; - - IncreateList = new ObservableCollection(); - foreach (var item in increates) - { - isSelected = false; - if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item)) - { - isSelected = true; - } - App.Current.Dispatcher.Invoke(() => - { - IncreateList.Add(new IncreateModel - { - IncreateName = item, - IsSelected = isSelected - }); - }); - } + } + + - } - return true; - } - else - { - App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); - return false; - } return true; //加载配置文件 } diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index a495b205..7f02373f 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -21,6 +21,8 @@ using System.Threading; using BBWY.Client.Helpers; using BBWY.Client.Views.TaskOverTime; using BBWY.Client.Views.StorePickSelf; +using System.Diagnostics.Eventing.Reader; +using BBWY.Client.Models.SealBox; namespace BBWY.Client.ViewModels.PackTask { @@ -323,6 +325,15 @@ namespace BBWY.Client.ViewModels.PackTask /// public ObservableCollection WareNoSealBoxModels { get => wareNoSealBoxModels; set { Set(ref wareNoSealBoxModels, value); } } + /// + /// 分箱列表 + /// + public List WaitSealBoxModelList { get; set; } + + + + + private ObservableCollection waitSealBoxModels; /// @@ -338,6 +349,12 @@ namespace BBWY.Client.ViewModels.PackTask + private ObservableCollection storeGetSelfDataList; + /// + /// 商家自取记录任务列表 + /// + public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } } + private string searchShopName; public string SearchShopName { @@ -625,6 +642,24 @@ namespace BBWY.Client.ViewModels.PackTask SendToSetSkuConfigureCommand = new RelayCommand(SendToSetSkuConfigure); SelectSku = "SKU"; SelectExpress = "物流单号"; + LoadSkuDataCommand = new RelayCommand(LoadSkuData); + } + + private void LoadSkuData(WareNoSealBoxModel model) + { + + if (model.SealBoxSkus==null|| model.SealBoxSkus.Count<=0) + { + var skuDatas =WaitSealBoxModelList.SingleOrDefault(w => w.ShopId == model.ShopId); + WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = skuDatas.SealBoxSkus; + } + else + { + WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = new List(); + } + + + } private void SendToSetSkuConfigure(PackTaskModel model) @@ -849,7 +884,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } - + Task.Factory.StartNew(() => SearchTaskList()); } @@ -1010,6 +1045,7 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// /// 推送sku配置状态 /// @@ -1111,6 +1147,13 @@ namespace BBWY.Client.ViewModels.PackTask /// 商家自取 /// public ICommand StoreGetBySelfCommand { get; set; } + + + /// + /// 加载事件 + /// + public ICommand LoadSkuDataCommand { get; set; } + /// /// 完成封箱 /// @@ -1244,6 +1287,7 @@ namespace BBWY.Client.ViewModels.PackTask private Thread sealboxOverTimeThread = null; private Thread fallwareOverTimeThread = null; private Thread waitTransportOverTimeThread = null; + /// /// 搜索任务列表 /// @@ -1295,8 +1339,6 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoading = false; } else if (TaskState == Models.TaskState.已超时) @@ -1321,8 +1363,7 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoading = false; + } else if (TaskState == Models.TaskState.待转运) @@ -1387,10 +1428,12 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoadWaitTransportCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadWaitTransportCount(); + }); } else if (TaskState == Models.TaskState.待落仓) { @@ -1430,10 +1473,12 @@ namespace BBWY.Client.ViewModels.PackTask { if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } - IsLoadCount(); - IsLoadFallWareCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadFallWareCount(); + }); } else if (TaskState == Models.TaskState.待封箱) { @@ -1521,29 +1566,29 @@ namespace BBWY.Client.ViewModels.PackTask } if (SealBoxConfigureType == SealBoxConfigureType.待配置) { - WareNoSealBoxModels = new ObservableCollection(); + WareNoSealBoxModels = new ObservableCollection(); var datas = sealBoxService.GetWareSealBoxWaitConfigureList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { var dataModel = datas.Data; OrderCount = dataModel.TotalCount; - foreach (var item in dataModel.WaitSealBoxModels) - { + WaitSealBoxModelList = dataModel.WaitSealBoxModels; - App.Current.Dispatcher.Invoke(new Action(() => + foreach (var item in WaitSealBoxModelList) + { + App.Current.Dispatcher.Invoke(new Action(() => { + WareNoSealBoxModels.Add(new WareNoSealBoxModel { - WareNoSealBoxModels.Add(new WareNoSealBoxModel - { - AcceptUserName = string.Join("|", item.AcceptUserNames), - DepartmentName = item.DepartmentName, - SealBoxSkus = item.SealBoxSkus, - ShopId = item.ShopId, - ShopName = item.ShopName, + AcceptUserName = string.Join("|", item.AcceptUserNames), + DepartmentName = item.DepartmentName, + SealBoxSkus = new List(), + // SealBoxSkus = item.SealBoxSkus, + ShopId = item.ShopId, + ShopName = item.ShopName, - }); + }); })); - } } else @@ -1551,9 +1596,35 @@ namespace BBWY.Client.ViewModels.PackTask if (datas != null) System.Windows.MessageBox.Show(datas.Msg); } } - IsLoadSealBoxCount(); - IsLoadCount(); - IsLoading = false; + + Task.Factory.StartNew(() => + { + IsLoadSealBoxCount(); + }); + + } + else if (taskState == Models.TaskState.商家自取) + { + StoreGetSelfDataList = new ObservableCollection(); + var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null); + if (datas != null && datas.Data != null && datas.Success) + { + var dataModel = datas.Data; + OrderCount = dataModel.TotalCount; + foreach (var item in dataModel.StoreGetSelfResponseList) + { + App.Current.Dispatcher.Invoke(new Action(() => + { + StoreGetSelfDataList.Add(item); + })); + + } + + } + else + { + MessageBox.Show(datas?.Msg); + } } else @@ -1809,25 +1880,38 @@ namespace BBWY.Client.ViewModels.PackTask else { } - IsLoadCount(); - IsLoading = false; } + + Task.Factory.StartNew(() => + { + IsLoadCount(); + }); + + IsLoading = false; + }); } + + + private void IsLoadWaitTransportCount() { var res = sealBoxService.GetWareTransportCounts(); if (res != null && res.Success && res.Data != null) { - WaitTransportCloudWareCount = res.Data.WaitTransportCloudWareCount; - WaitTransportJuShuiTanCount = res.Data.WaitTransportJuShuiTanCount; - WaitTransportStoreWareCount = res.Data.WaitTransportStoreWareCount; - WaitTransportJDWareCount = res.Data.WaitTransportJDWareCount; + App.Current.Dispatcher.Invoke(new Action(() => + { + WaitTransportCloudWareCount = res.Data.WaitTransportCloudWareCount; + WaitTransportJuShuiTanCount = res.Data.WaitTransportJuShuiTanCount; + WaitTransportStoreWareCount = res.Data.WaitTransportStoreWareCount; + WaitTransportJDWareCount = res.Data.WaitTransportJDWareCount; + })); } + } private void IsLoadSealBoxCount() @@ -1835,8 +1919,12 @@ namespace BBWY.Client.ViewModels.PackTask var res = sealBoxService.GetWareSealBoxConfigureCounts(); if (res != null && res.Success && res.Data != null) { - FallWareWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString(); - FallWareConfiguredCount = res.Data.SealBoxConfiguredCount.ToString(); + App.Current.Dispatcher.Invoke(new Action(() => + { + FallWareWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString(); + FallWareConfiguredCount = res.Data.SealBoxConfiguredCount.ToString(); + })); + } } @@ -1845,8 +1933,12 @@ namespace BBWY.Client.ViewModels.PackTask var res = sealBoxService.GetFallWareConfigureCounts(null); if (res != null && res.Success && res.Data != null) { - FallWareWaitConfigureCount = res.Data.FallWareWaitConfigureCount.ToString(); - FallWareConfiguredCount = res.Data.FallWareConfiguredCount.ToString(); + App.Current.Dispatcher.Invoke(new Action(() => + { + FallWareWaitConfigureCount = res.Data.FallWareWaitConfigureCount.ToString(); + FallWareConfiguredCount = res.Data.FallWareConfiguredCount.ToString(); + })); + } } private void IsLoadCount() diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 73bd50ee..f3ec012a 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -367,6 +367,16 @@ namespace BBWY.Client.ViewModels } } + public StorePickSelfViewModel StorePickSelfVM + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } + + //public ShopSealBoxListViewModel ShopSealBoxListVM //{ // get diff --git a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml index bd67e769..e6e0e354 100644 --- a/BBWY.Client/Views/PackTask/PackDetailWindow.xaml +++ b/BBWY.Client/Views/PackTask/PackDetailWindow.xaml @@ -96,14 +96,7 @@ - - - - - - - - + diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index ad9cd1b4..baec44bc 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -38,7 +38,7 @@ - + @@ -87,23 +87,19 @@ /> - + - - - -