diff --git a/BBWY.Client/APIServices/QiKu/PackTaskService.cs b/BBWY.Client/APIServices/QiKu/PackTaskService.cs index 80a670c9..a404013c 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,44 @@ 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", 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 @@ -400,15 +414,12 @@ namespace BBWY.Client.APIServices } - public class AddConsumableRequest { public long TaskId { get; set; } public long[] ConsumableIds { get; set; } } - - public class PackTaskDetailRequest { /// /// 任务id @@ -549,22 +560,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 +582,6 @@ namespace BBWY.Client.APIServices public ServiceType ServiceType { get; set; } } - - public class ConsumableTaskModel { public decimal Price { get; set; } @@ -601,7 +595,6 @@ namespace BBWY.Client.APIServices public int? ConsumableCount { get; set; } } - public class PackServiceMemberModel { public decimal Price { get; set; } @@ -620,7 +613,4 @@ namespace BBWY.Client.APIServices } - - - } diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index e1b3dcff..34888905 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -5,5 +5,5 @@ "JOSApiHost": "", "1688ApiHost": "", "QKApiHost": "http://localhost:8080" - //"QKApiHost": "http://qiku.qiyue666.com" + // "QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 6e29ed6d..484ab05e 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10164"; + ClientVersion = "10165"; } private User user; 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/BatchPurchase/BatchPublishTask.cs b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs index 6f572728..c4576a9b 100644 --- a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs +++ b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs @@ -60,10 +60,10 @@ namespace BBWY.Client.Models }; public ObservableCollection CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } } - private ObservableCollection availabilityList = new ObservableCollection { - "已到货","部分到货","未到货" - }; - public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + //private ObservableCollection availabilityList = new ObservableCollection { + // "已到货","部分到货","未到货" + // }; + //public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } private int skuCount; /// @@ -120,11 +120,11 @@ namespace BBWY.Client.Models ///// //public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } } - private Availability availability; - /// - /// 到货情况(待收货=0,部分收货=1,已到货=2) - /// - public Availability Availability { get => availability; set { Set(ref availability, value); } } + //private Availability availability; + ///// + ///// 到货情况(待收货=0,部分收货=1,已到货=2) + ///// + //public Availability Availability { get => availability; set { Set(ref availability, value); } } private PackType packType; /// 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/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/Models/Product/ProductSku.cs b/BBWY.Client/Models/Product/ProductSku.cs index ab10cce1..c1015cea 100644 --- a/BBWY.Client/Models/Product/ProductSku.cs +++ b/BBWY.Client/Models/Product/ProductSku.cs @@ -26,7 +26,6 @@ namespace BBWY.Client.Models /// 采购方案 /// public IList PurchaseSchemeList { get; set; } - /// /// 采购订单 /// 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/BatchPurchase/BatchPublishTaskViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs index fdfd6fd1..53f61bbb 100644 --- a/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs @@ -83,14 +83,14 @@ namespace BBWY.Client.ViewModels Logo = task.Logo, SkuName = task.SkuName, BrandName = task.BrandName, - Availability = (int)task.Availability, + //Availability = (int)task.Availability, BasicPack = (int)task.BasicPack, SkuId = task.SkuId, CreateTime = DateTime.Now, Increment1 = increateStr, CertificatePosition = (int)task.CertificatePosition, PackType = (int)task.PackType, - MarkMessage = task.MarkMessage, + //MarkMessage = task.MarkMessage, PositionType = (int)task.PositionType, GoodsNumber = task.GoodsNumber, SkuGoodsTitle = task.SkuTitle, 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("信息不完整,打包人设置有误"); 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 2385464a..7f02373f 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,10 @@ 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; +using System.Diagnostics.Eventing.Reader; +using BBWY.Client.Models.SealBox; namespace BBWY.Client.ViewModels.PackTask { @@ -331,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; /// @@ -346,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 { @@ -633,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) @@ -856,17 +883,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 +920,8 @@ namespace BBWY.Client.ViewModels.PackTask System.Windows.MessageBox.Show(res.Msg, "错误信息"); return; } + sorePickProductWindow.Close(); + Task.Factory.StartNew(() => SearchTaskList()); } @@ -999,6 +1045,7 @@ namespace BBWY.Client.ViewModels.PackTask #region 事件绑定 + /// /// 推送sku配置状态 /// @@ -1100,6 +1147,13 @@ namespace BBWY.Client.ViewModels.PackTask /// 商家自取 /// public ICommand StoreGetBySelfCommand { get; set; } + + + /// + /// 加载事件 + /// + public ICommand LoadSkuDataCommand { get; set; } + /// /// 完成封箱 /// @@ -1211,13 +1265,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; @@ -1233,6 +1287,7 @@ namespace BBWY.Client.ViewModels.PackTask private Thread sealboxOverTimeThread = null; private Thread fallwareOverTimeThread = null; private Thread waitTransportOverTimeThread = null; + /// /// 搜索任务列表 /// @@ -1284,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.已超时) @@ -1310,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.待转运) @@ -1376,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.待落仓) { @@ -1419,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.待封箱) { @@ -1510,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 @@ -1540,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 @@ -1550,7 +1632,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; @@ -1798,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() @@ -1824,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(); + })); + } } @@ -1834,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/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/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index d71620b0..0aa86d5c 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -376,6 +376,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 @@ /> - + - - - -