diff --git a/BBWY.Client/APIServices/BatchPurchaseService.cs b/BBWY.Client/APIServices/BatchPurchaseService.cs index e3ff0f0f..b51eadb0 100644 --- a/BBWY.Client/APIServices/BatchPurchaseService.cs +++ b/BBWY.Client/APIServices/BatchPurchaseService.cs @@ -144,13 +144,10 @@ namespace BBWY.Client.APIServices return SendRequest(globalContext.BBYWApiHost, "api/BatchPurchase/PayPurchaseOrder", new { orderId, - PurchasePlatform, - purchaseAccount, - globalContext.User.Shop.ShopId, - globalContext.User.Shop.ShopName, - globalContext.User.Shop.AppKey, - globalContext.User.Shop.AppSecret, - globalContext.User.Shop.AppToken + Platform = purchaseAccount.PurchasePlatformId, + purchaseAccount.AppKey, + purchaseAccount.AppSecret, + purchaseAccount.AppToken, }, null, HttpMethod.Post); } diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index 9622efaf..726de360 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -1,5 +1,5 @@ { - //"BBWYApiHost": "http://localhost:5000", + // "BBWYApiHost": "http://localhost:5000", "BBWYApiHost": "http://bbwytest.qiyue666.com", "MDSApiHost": "http://mdsapi.qiyue666.com", "JOSApiHost": "", diff --git a/BBWY.Client/Converters/EnumToColorConverter.cs b/BBWY.Client/Converters/EnumToColorConverter.cs index a5c50883..dc4d8eb4 100644 --- a/BBWY.Client/Converters/EnumToColorConverter.cs +++ b/BBWY.Client/Converters/EnumToColorConverter.cs @@ -20,16 +20,20 @@ namespace BBWY.Client.Converters if (value == null) return DependencyProperty.UnsetValue; Assembly assem = Assembly.GetExecutingAssembly(); Type type = assem.GetType(parameter.ToString()); + + var enumName = Enum.Parse(type, value.ToString()); - if (value.ToString() == TaskState.已到货.GetName()) + if (enumName == null) return DependencyProperty.UnsetValue; + int enumIndex = (int)enumName; + if ((enumIndex == 0)) { return "#C1FFC1"; } - if (value.ToString() == "部分到货") + if (enumIndex == 1) { return "#FFDEAD"; } - if (value.ToString() == "未到货") + if(enumIndex==2) { return "#FFDAB9"; diff --git a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs index 5c098e61..8f0029a1 100644 --- a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs +++ b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs @@ -24,33 +24,41 @@ namespace BBWY.Client.Models { #region 属性 + private bool isSelected; + public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } - private ObservableCollection positionTypeList = new ObservableCollection { - new ComboBoxItem{IsSelected = false,Content = "本地仓"}, new ComboBoxItem{IsSelected = false,Content = "齐越仓"}, new ComboBoxItem{IsSelected = false,Content = "京东仓"} - - }; - public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } - private ObservableCollection packTypeList = new ObservableCollection { - new ComboBoxItem{ Content="单件",IsSelected=false }, new ComboBoxItem{ Content="多件",IsSelected=false } + private ObservableCollection worryList = new ObservableCollection { + "否","是" }; - public ObservableCollection PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } } - - private ObservableCollection basicPackList = new ObservableCollection { - new ComboBoxItem{ Content="快递袋",IsSelected=false }, new ComboBoxItem{ Content="纸箱",IsSelected=false }, new ComboBoxItem{ Content="麻袋",IsSelected=false } + public ObservableCollection WorryList { get => worryList; set { Set(ref worryList, value); } } + + private ObservableCollection positionTypeList = new ObservableCollection { + "本地仓","齐越仓", "京东仓"}; + public ObservableCollection PositionTypeList { get => positionTypeList; set { Set(ref positionTypeList, value); } } + + private ObservableCollection packTypeList = new ObservableCollection { + "单件","多件" }; - public ObservableCollection BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } } - private ObservableCollection isNeedBarCodeList = new ObservableCollection { - new ComboBoxItem{IsSelected = false,Content = "需要"}, new ComboBoxItem{IsSelected = false,Content = "不需要"}}; - public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } } + public ObservableCollection PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } } - private ObservableCollection certificatePositionList = new ObservableCollection { - new ComboBoxItem{ Content="无",IsSelected=false }, new ComboBoxItem{ Content="外部包装",IsSelected=false }, new ComboBoxItem{ Content="产品包装",IsSelected=false } + private ObservableCollection basicPackList = new ObservableCollection { + "快递袋","纸箱","麻袋" + }; + public ObservableCollection BasicPackList { get => basicPackList; set { Set(ref basicPackList, value); } } + + private ObservableCollection isNeedBarCodeList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } } + + private ObservableCollection certificatePositionList = new ObservableCollection { + "无","外部包装","产品包装" }; - public ObservableCollection CertificatePositionList { get => certificatePositionList; set { Set(ref certificatePositionList, value); } } - private ObservableCollection availabilityList = new ObservableCollection { - new ComboBoxItem{ Content="已到货",IsSelected=false }, new ComboBoxItem{ Content="部分到货",IsSelected=false }, new ComboBoxItem{ Content="未到货",IsSelected=false } + 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); } } + public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } private int skuCount; /// diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 9a2f2a89..21679a23 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -27,10 +27,8 @@ namespace BBWY.Client.Models private long id; public long Id { get => id; set { Set(ref id, value); } } - private readonly PackTaskService packTaskService; - readonly WorkProcessService workProcessService; - readonly IncreateServiceService increateServiceService; - public ICommand SetTaskStatusCommand { get; set; } + + public ICommand PrintBarcodeCommand { get; set; } public ICommand PrintCerCommand { get; set; } @@ -38,31 +36,17 @@ namespace BBWY.Client.Models public ICommand LookBarCommand { get; set; } public ICommand SetServiceCommand { get; set; } - public ConsumableService consumableService; - /// /// 修改任务 /// public ICommand UpdateTaskCommand { get; set; } - /// - /// 删除任务 - /// - public ICommand DeletedTaskCommand { get; set; } + public Action ReflashTask { get; set; } - private void DeletedTask() - { - MessageBoxResult result = MessageBox.Show("确定删除?", "提示", - MessageBoxButton.YesNo, - MessageBoxImage.Warning); - if (result != MessageBoxResult.Yes) return; - packTaskService.DeletedTask(TaskId); - if (ReflashTask != null) - ReflashTask();//刷新界面 - } + private void UpdateTask() { @@ -83,21 +67,14 @@ namespace BBWY.Client.Models - public PackTaskModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService) + public PackTaskModel() { - - SetTaskStatusCommand = new RelayCommand(SetTaskStatus); PrintBarcodeCommand = new RelayCommand(PrintBarcode); PrintCerCommand = new RelayCommand(PrintCer); LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); SetServiceCommand = new RelayCommand(SetService); UpdateTaskCommand = new RelayCommand(UpdateTask); - DeletedTaskCommand = new RelayCommand(DeletedTask); - this.packTaskService = packTaskService; - this.consumableService = consumableService; - this.workProcessService = workProcessService; - this.increateServiceService = increateServiceService; } private void SetService() @@ -200,26 +177,7 @@ namespace BBWY.Client.Models //printWindow.Datas = LoadBarLabelModels(); printWindow.Show(); } - - public void SetTaskStatus(long taskId) - { - - if (this.TaskStatus == TaskStateType.已完成) - { - return; - - } - ///修改完成 - var model = packTaskService.UpdateTaskStatus(taskId, 1,""); - if (model != null && model.Success) - { - //var res = batchPurchaseService.UpdatePurchaseOrderState(id, Models.PurchaseOrderState.已完成 ); - - - this.TaskStatus = TaskStateType.已完成; - new TipsWindow("修改成功").Show(); - } - } + /* public Dictionary LoadBarLabelModels() { diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs index d025c1e2..d6fce42d 100644 --- a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs +++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs @@ -139,7 +139,13 @@ namespace BBWY.Client.ViewModels var res = batchPurchaseService.CancelOrder(parameters[1].ToString(), purchaseAccount, ""); if (res.Success) { - Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); + if (res.Data.Success) + { + Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); + return; + } + + MessageBox.Show(res.Data.Msg); return; } if (res.Data != null) @@ -162,7 +168,12 @@ namespace BBWY.Client.ViewModels var res = batchPurchaseService.PayOrder(parameters[1].ToString(), PurchasePlatform, purchaseAccount); if (res.Success) { - Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); + if (res.Data.Success) + { + Task.Factory.StartNew(() => QueryPurchaseOrder(PageIndex)); + return; + } + MessageBox.Show(res.Data.Msg); return; } if (res.Data != null) diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index cfdd3f44..16867f10 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -24,6 +24,9 @@ namespace BBWY.Client.ViewModels.PackTask public class CreatePackTaskViewModel : BaseVM, IDenpendency { + #region 属性 + private bool isSelected; + public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } private bool isLoading = false; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } @@ -82,12 +85,6 @@ namespace BBWY.Client.ViewModels.PackTask public string SkuName { get => skuName; set { Set(ref skuName, value); } } - //private long barCodeId; - ///// - ///// 条形码id - ///// - //public long BarCodeId { get => barCodeId; set { Set(ref barCodeId, value); } } - private string brand; /// /// 品牌 @@ -131,12 +128,6 @@ namespace BBWY.Client.ViewModels.PackTask /// public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } - private DateTime endTime; - /// - /// 提交时间 - /// - public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } } - private long taskId; /// @@ -173,14 +164,6 @@ namespace BBWY.Client.ViewModels.PackTask public TaskState Availability { get => availability; set { Set(ref availability, value); } } - - private int taskStatus; - /// - /// 任务状态(已完成=0,未完成=1) - /// - public int TaskStatus { get => taskStatus; set { Set(ref taskStatus, value); } } - - private PackType packType; /// /// 打包类型(单件=0,多件=1) @@ -295,7 +278,7 @@ namespace BBWY.Client.ViewModels.PackTask private string saveTask; /// - /// 设置显示(合格证) + /// 发布按钮(发布/保存) /// public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } } @@ -337,6 +320,8 @@ namespace BBWY.Client.ViewModels.PackTask /// 注意事项(对接备注) /// public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } } + #endregion + @@ -491,16 +476,16 @@ namespace BBWY.Client.ViewModels.PackTask this.globalContext = globalContext; SetBarCodeCommand = new RelayCommand(SetBarCode); SetCertificateCommand = new RelayCommand(SetCertificate); - SaveBarCodeCommand = new RelayCommand(SaveBarCode); + //SaveBarCodeCommand = new RelayCommand(SaveBarCode); - SetSpuCerCommand = new RelayCommand(SetSpuCer); - SaveSpuCerCommand = new RelayCommand(SaveSpuCer); - InseartCerCommand = new RelayCommand(InseartCer); + //SetSpuCerCommand = new RelayCommand(SetSpuCer); + //SaveSpuCerCommand = new RelayCommand(SaveSpuCer); + //InseartCerCommand = new RelayCommand(InseartCer); - SaveCerCommand = new RelayCommand(SaveCer); + //SaveCerCommand = new RelayCommand(SaveCer); BarLabelCheckCommand = new RelayCommand(BarLabelCheck); - CerLabelCheckCommand = new RelayCommand(CerLabelCheck); - SpuCerLabelCheckCommand = new RelayCommand(SpuCerLabelCheck); + //CerLabelCheckCommand = new RelayCommand(CerLabelCheck); + //SpuCerLabelCheckCommand = new RelayCommand(SpuCerLabelCheck); LookBarCommand = new RelayCommand(LookBar); @@ -511,84 +496,84 @@ namespace BBWY.Client.ViewModels.PackTask BarLabelCheck(BarcodeLabelModel.精简模板);//默认精简模式 } - private void InseartCer() - { - if (IsSetSpuCertificate) - { - new TipsWindow("无可用模板").Show(); - return; - } - CertificateModel = new CertificateModel() - { - //SpuId = SpuCertificateModel.SpuId, - SkuId = SkuId, - Brand = SpuCertificateModel.Brand, - BrandName = SpuCertificateModel.BrandName, - ExcuteStander = SpuCertificateModel.ExcuteStander, - FactoryNumber = SpuCertificateModel.FactoryNumber, - IsLogo = SpuCertificateModel.IsLogo, - LabelModel = SpuCertificateModel.LabelModel, - ProductAdress = SpuCertificateModel.ProductAdress, - ProductNo = SpuCertificateModel.ProductNo, - Shader = SpuCertificateModel.Shader, - ProductShop = SpuCertificateModel.ProductShop, - ApplyAge = SpuCertificateModel.ApplyAge, - }; - } - - private void SetSpuCer() - { - - if (SpuCertificateModel == null) - { - SpuCertificateModel = new CertificateModel(); - SpuCertificateModel.ProductNo = ProductNo; - SpuCertificateModel.Brand = Brand; - SpuCertificateModel.SkuId = SkuId; - } - if (!string.IsNullOrEmpty(BrandName)) - SpuCertificateModel.BrandName = BrandName; - setSpuCerWindow = new SetSpuCerWindow(); - setSpuCerWindow.Show(); - } - - private void SaveSpuCer() - { - if (string.IsNullOrEmpty(SpuCertificateModel.ExcuteStander) - || string.IsNullOrEmpty(SpuCertificateModel.BrandName) - || string.IsNullOrEmpty(SpuCertificateModel.Brand) || string.IsNullOrEmpty(SpuCertificateModel.ProductShop) - || string.IsNullOrEmpty(SpuCertificateModel.ProductAdress)) - { - new TipsWindow("参数出错!请重新填写!").Show(); - return; - } - var resData = packTaskService.SaveSpuCer(new CerRequest - { - Brand = SpuCertificateModel.Brand, - BrandName = SpuCertificateModel.BrandName, - ProductNo = SpuCertificateModel.ProductNo, - SpuId = SpuCertificateModel.SpuId, - ExcuteStander = SpuCertificateModel.ExcuteStander, - LabelModel = (int)SpuCertificateModel.LabelModel, - FactoryNumber = SpuCertificateModel.FactoryNumber, - IsLogo = SpuCertificateModel.IsLogo, - ProductAdress = SpuCertificateModel.ProductAdress, - ProductShop = SpuCertificateModel.ProductShop, - Shader = SpuCertificateModel.Shader, - SkuId = SpuCertificateModel.SkuId, - ApplyAge = SpuCertificateModel.ApplyAge, - - - - }); - if (resData == null || !resData.Success) - { - IsSetSpuCertificate = false; - return; - } - IsSetSpuCertificate = false; - setSpuCerWindow.Close(); - } + //private void InseartCer() + //{ + // if (IsSetSpuCertificate) + // { + // new TipsWindow("无可用模板").Show(); + // return; + // } + // CertificateModel = new CertificateModel() + // { + // //SpuId = SpuCertificateModel.SpuId, + // SkuId = SkuId, + // Brand = SpuCertificateModel.Brand, + // BrandName = SpuCertificateModel.BrandName, + // ExcuteStander = SpuCertificateModel.ExcuteStander, + // FactoryNumber = SpuCertificateModel.FactoryNumber, + // IsLogo = SpuCertificateModel.IsLogo, + // LabelModel = SpuCertificateModel.LabelModel, + // ProductAdress = SpuCertificateModel.ProductAdress, + // ProductNo = SpuCertificateModel.ProductNo, + // Shader = SpuCertificateModel.Shader, + // ProductShop = SpuCertificateModel.ProductShop, + // ApplyAge = SpuCertificateModel.ApplyAge, + // }; + //} + + //private void SetSpuCer() + //{ + + // if (SpuCertificateModel == null) + // { + // SpuCertificateModel = new CertificateModel(); + // SpuCertificateModel.ProductNo = ProductNo; + // SpuCertificateModel.Brand = Brand; + // SpuCertificateModel.SkuId = SkuId; + // } + // if (!string.IsNullOrEmpty(BrandName)) + // SpuCertificateModel.BrandName = BrandName; + // setSpuCerWindow = new SetSpuCerWindow(); + // setSpuCerWindow.Show(); + //} + + //private void SaveSpuCer() + //{ + // if (string.IsNullOrEmpty(SpuCertificateModel.ExcuteStander) + // || string.IsNullOrEmpty(SpuCertificateModel.BrandName) + // || string.IsNullOrEmpty(SpuCertificateModel.Brand) || string.IsNullOrEmpty(SpuCertificateModel.ProductShop) + // || string.IsNullOrEmpty(SpuCertificateModel.ProductAdress)) + // { + // new TipsWindow("参数出错!请重新填写!").Show(); + // return; + // } + // var resData = packTaskService.SaveSpuCer(new CerRequest + // { + // Brand = SpuCertificateModel.Brand, + // BrandName = SpuCertificateModel.BrandName, + // ProductNo = SpuCertificateModel.ProductNo, + // SpuId = SpuCertificateModel.SpuId, + // ExcuteStander = SpuCertificateModel.ExcuteStander, + // LabelModel = (int)SpuCertificateModel.LabelModel, + // FactoryNumber = SpuCertificateModel.FactoryNumber, + // IsLogo = SpuCertificateModel.IsLogo, + // ProductAdress = SpuCertificateModel.ProductAdress, + // ProductShop = SpuCertificateModel.ProductShop, + // Shader = SpuCertificateModel.Shader, + // SkuId = SpuCertificateModel.SkuId, + // ApplyAge = SpuCertificateModel.ApplyAge, + + + + // }); + // if (resData == null || !resData.Success) + // { + // IsSetSpuCertificate = false; + // return; + // } + // IsSetSpuCertificate = false; + // setSpuCerWindow.Close(); + //} private void OnSearchIncreateKeyWordChanged(string key) { @@ -649,16 +634,7 @@ namespace BBWY.Client.ViewModels.PackTask }); look.Show(); } - private void SpuCerLabelCheck(CertificateLabelModel cer) - { - SpuCertificateModel.LabelModel = cer; - SpuCertificateModel.IsLogo = cer == CertificateLabelModel.标准有3c ? 1 : 0; - } - private void CerLabelCheck(CertificateLabelModel cer) - { - CertificateModel.LabelModel = cer; - CertificateModel.IsLogo = cer == CertificateLabelModel.标准有3c ? 1 : 0; - } + /// /// /// diff --git a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs index 35909122..5cd3bc6b 100644 --- a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs @@ -5,6 +5,7 @@ using BBWY.Client.Models; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.Order; using BBWY.Client.Views.PackTask; +using BBWY.Common.Extensions; using BBWY.Common.Models; using BBWY.Controls; using GalaSoft.MvvmLight.Command; @@ -72,16 +73,19 @@ namespace BBWY.Client.ViewModels.PackTask public ICommand BatchCheckedCommand { get; set; } - - + //public IList departmentList; + //ShopService shopService; public PackTaskTotalViewModel(PackTaskService packTaskService) { this.packTaskService = packTaskService; - - SearchTaskTotalCommand = new RelayCommand(SearchTaskTotal); + //this.shopService = shopService; + SearchTaskTotalCommand = new RelayCommand(() => + { + SearchTask(1); + }); StartDate = DateTime.Now; - EndDate = DateTime.Now; + EndDate = DateTime.Now; SetSearchDateCommand = new RelayCommand(d => { @@ -102,6 +106,24 @@ namespace BBWY.Client.ViewModels.PackTask ExportCommand = new RelayCommand(Export); SearchTaskTotal(); + + //LoadShopList(); + } + + private void LoadShopList() + { + + //departmentList=new List(); + //var response = shopService.GetDepartmentList(); + //if (!response.Success) + // throw new Exception(response.Msg); + //departmentList = response.Data.Map>(); + + + //var shopList = new List(); + //foreach (var d in departmentList) + // shopList.AddRange(d.ShopList); + } private void Export() diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 95e90778..da3edc92 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -127,6 +127,11 @@ namespace BBWY.Client.ViewModels.PackTask public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService) { + this.globalContext = globalContext; + this.productService = productService; + this.consumableService = consumableService; + this.workProcessService = workProcessService; + this.increateServiceService = increateServiceService; this.packTaskService = packTaskService; //TaskState = BBWY.Client.Models. TaskState.全部; PackTaskList = new ObservableCollection();//初始化数据 @@ -144,35 +149,28 @@ namespace BBWY.Client.ViewModels.PackTask }); OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); - CopyTextCommand = new RelayCommand(s => - { - try - { - Clipboard.SetText(s.ToString()); - } - catch (Exception ex) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine(ex); - Console.ResetColor(); - } - }); + DeletedTaskCommand = new RelayCommand(DeletedTask); StartTime = DateTime.Now.Date; EndTime = DateTime.Now.Date; IsLoading = false; - - //加载数据 SetTaskState(Models.TaskState.全部); - this.globalContext = globalContext; - this.productService = productService; - this.consumableService = consumableService; - this.workProcessService = workProcessService; - this.increateServiceService = increateServiceService; + } - + + private void DeletedTask(object obj) + { + + MessageBoxResult result = MessageBox.Show("确定删除?", "提示", + MessageBoxButton.YesNo, + MessageBoxImage.Warning); + long taskId = (long)obj; + if (result != MessageBoxResult.Yes) return; + packTaskService.DeletedTask(taskId); + Task.Factory.StartNew(() => SearchTaskList()); + } private void IsLoadCount() @@ -227,11 +225,11 @@ namespace BBWY.Client.ViewModels.PackTask /// public ICommand OpenSkuDetailCommand { get; set; } + /// - /// 复制 + /// 删除任务 /// - public ICommand CopyTextCommand { get; set; } - + public ICommand DeletedTaskCommand { get; set; } public void SetTaskState(TaskState? taskState) { @@ -293,7 +291,7 @@ namespace BBWY.Client.ViewModels.PackTask foreach (var item in dataModel.Items) { - var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService) + var data = new PackTaskModel() { Brand = item.Brand, SkuId = item.SkuId, @@ -322,10 +320,7 @@ namespace BBWY.Client.ViewModels.PackTask TaskId = item.TaskId, TaskStatus = (TaskStateType)item.TaskStatus, EndTime = item.CreateTime, - IsWorry = (Worry)item.IsWorry - - - + IsWorry = (Worry)item.IsWorry, }; if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 343b6380..05ef70d4 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -190,14 +190,6 @@ namespace BBWY.Client.ViewModels.PackTask this.productService = productService; this.batchPurchaseService = batchPurchaseService; } - - - - - - - - #region 事件绑定 public ICommand SetTaskStatusCommand { get; set; } @@ -241,7 +233,7 @@ namespace BBWY.Client.ViewModels.PackTask string orderId=(string)objList[1]; ///修改完成 var model = packTaskService.UpdateTaskStatus(taskId, 1,orderId); - if (model != null && model.Success&&!string.IsNullOrEmpty(orderId)) + if (model != null && model.Success) SearchTaskList(); } @@ -297,7 +289,7 @@ namespace BBWY.Client.ViewModels.PackTask OrderCount = dataModel.TotalCount; foreach (var item in dataModel.Items) { - var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService) + var data = new PackTaskModel() { AcceptName = item.UserName, Availability = (TaskState)item.Availability, @@ -326,9 +318,8 @@ namespace BBWY.Client.ViewModels.PackTask EndTime = item.CreateTime, OrderId= item.OrderId, SkuId = item.SkuId, + SkuName = item.SkuName, - - }; if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { @@ -420,14 +411,5 @@ namespace BBWY.Client.ViewModels.PackTask #endregion - - - - - - - - - } } diff --git a/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml index cd19b6c0..5b87d01b 100644 --- a/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml +++ b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml @@ -128,9 +128,8 @@ - - - + + @@ -189,7 +188,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index f42e6ae6..ad9ac1aa 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -24,6 +24,12 @@ + + + + + + @@ -31,7 +37,6 @@ - @@ -52,11 +57,11 @@ - + - + - + >(data); + //创建一个ListBoxIem + if (res.Success) + { + if (res.Data != null && res.Data.Length > 0) + { + foreach (var department in res.Data) + { + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } + + + + } + } + } + + } + public string QKApiHost { get; set; } + public void SelectionChangeCommand(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; + tbDepartment.Text = content.Content.ToString(); + tipBoxDepartment.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + + } + + + List departments = new List(); + + private void tb_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + var textBoxt = (System.Windows.Controls.TextBox)sender; + //创建一个ListBox + + if (tipBoxDepartment != null && tipBoxDepartment.Items.Count > 0) + { + tipBoxDepartment.Items.Clear(); + + } + + if (departments.Count <= 0) + return; + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBoxDepartment.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in departments) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBoxDepartment.Items.Add(item); + } + + } + + tipBoxDepartment.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + } } } diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml b/BBWY.Client/Views/PackTask/PrintWindow.xaml index a4186f45..ca1e0a6a 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml @@ -229,8 +229,6 @@ Height="44" Text="{Binding ProductAdress}" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,241,0,0"/> - - diff --git a/BBWY.Client/Views/PackTask/SetBarCode.xaml b/BBWY.Client/Views/PackTask/SetBarCode.xaml index c37d61c0..f797d050 100644 --- a/BBWY.Client/Views/PackTask/SetBarCode.xaml +++ b/BBWY.Client/Views/PackTask/SetBarCode.xaml @@ -137,6 +137,6 @@ + Click="BButton_Click" /> diff --git a/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs b/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs index 1a00bf89..32397bc1 100644 --- a/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs @@ -2,6 +2,7 @@ using BBWY.Client.Models; using BBWY.Client.Models.APIModel.Request; using BBWY.Controls; +using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; using System.Text; @@ -19,14 +20,14 @@ namespace BBWY.Client.Views.PackTask /// /// SetBarCode.xaml 的交互逻辑 /// - public partial class SetBarCodeWindow : BWindow + public partial class SetBarCodeWindow : BWindow { public SetBarCodeWindow() { InitializeComponent(); - + BarLabelCheckCommand = new RelayCommand(BarLabelCheck); } - public void LoadData(BarCodeModel barCodeModel,PackTaskService PackTaskService) + public void LoadData(BarCodeModel barCodeModel, PackTaskService PackTaskService) { BarCodeModel = barCodeModel; packTaskService = PackTaskService; this.DataContext = this; @@ -36,6 +37,9 @@ namespace BBWY.Client.Views.PackTask public PackTaskService packTaskService { get; set; } public Action SaveResult { get; set; } + + + private void BButton_Click(object sender, RoutedEventArgs e) { if (BarCodeModel.LabelModel == BarcodeLabelModel.标准模板)//标准版 判断数据是否异常 @@ -68,13 +72,26 @@ namespace BBWY.Client.Views.PackTask BarCodeModel.Id = resData.Data; if (SaveResult != null) SaveResult(BarCodeModel); - // IsNeedBarCode = "需要"; - //IsSetBarCode = false; - // setBarCodeWindow.Close(); + // IsNeedBarCode = "需要"; + //IsSetBarCode = false; + // setBarCodeWindow.Close(); this.Close(); } + public ICommand BarLabelCheckCommand { get; set; } + public void BarLabelCheck(BarcodeLabelModel labelModel) + { + if (labelModel == BarcodeLabelModel.标准模板)//标准版 判断数据是否异常 + { + if (string.IsNullOrEmpty(BarCodeModel.ProductNo) || BarCodeModel.ProductNo == "待填写") + { + TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型"); + tips.ShowDialog(); + } + } + + } } } diff --git a/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs b/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs index de951363..f6229de0 100644 --- a/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetCerControl.xaml.cs @@ -28,8 +28,6 @@ namespace BBWY.Client.Views.PackTask InitializeComponent(); } - - //CertificateModel public CertificateModel model @@ -62,22 +60,12 @@ namespace BBWY.Client.Views.PackTask private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) { - - - var control = d as SetCerControl; - var newValue = e.NewValue as CertificateModel; if (control != null && newValue != null) { control.model = newValue; - //control.DataContext = newValue; - - //control.OnPropertyChanged(e); - } - - } private void RadioButton_Checked(object sender, RoutedEventArgs e) diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml b/BBWY.Client/Views/PackTask/SetCerWindow.xaml index 908fef8c..6f4415cc 100644 --- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml +++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml @@ -35,103 +35,15 @@ - + + Click="InseartCer_Click" /> - + Click="save_btn_Click" /> diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs index 287d62aa..193515bf 100644 --- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs @@ -37,7 +37,6 @@ namespace BBWY.Client.Views.PackTask this.IsSetSpuCertificate = IsSetSpuCertificate; SetSpuCer.Content = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板"; this.DataContext = this; - } public bool IsSetSpuCertificate { get; set; } public PackTaskService packTaskService { get; set; } diff --git a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml index e40559ee..34edc24d 100644 --- a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml +++ b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml @@ -17,7 +17,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0"> - + @@ -30,94 +30,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/TaskListControl.xaml b/BBWY.Client/Views/PackTask/TaskListControl.xaml index dd5a2ec2..84ee9353 100644 --- a/BBWY.Client/Views/PackTask/TaskListControl.xaml +++ b/BBWY.Client/Views/PackTask/TaskListControl.xaml @@ -120,7 +120,7 @@ - diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml b/BBWY.Client/Views/PackTask/WareHouseList.xaml index 1182b986..e4e4be88 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml @@ -59,8 +59,6 @@ - - diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs index 345bbc59..22385b47 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs @@ -32,14 +32,39 @@ namespace BBWY.Client.Views.PackTask public WareHouseList() { InitializeComponent(); - var applicationPath = System.IO. Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + this.Loaded += Load; + } + + private void Load(object sender, RoutedEventArgs e) + { + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); - var Configuration = builder.Build(); - + var Configuration = builder.Build(); + QKApiHost = Configuration.GetSection("QKApiHost").Value; + HttpClientHelper helper = new HttpClientHelper(QKApiHost); + + string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 + var data = helper.Get(url); + var res = JsonConvert.DeserializeObject>(data); + //创建一个ListBoxIem + if (res.Success) + { + if (res.Data != null && res.Data.Count() > 0) + { + foreach (var department in res.Data) + { + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } + } + } + } } - string QKApiHost = ""; + public string QKApiHost {get;set;} public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e) { try @@ -57,12 +82,12 @@ namespace BBWY.Client.Views.PackTask catch (Exception) { - + } - + } - - + + List departments = new List(); private void tb_TextChanged(object sender, TextChangedEventArgs e) @@ -78,7 +103,7 @@ namespace BBWY.Client.Views.PackTask } - if (departments.Count<=0) + if (departments.Count <= 0) { HttpClientHelper helper = new HttpClientHelper(QKApiHost); @@ -98,8 +123,6 @@ namespace BBWY.Client.Views.PackTask departments.Add(department.DePartmentName); } - - } } } @@ -120,7 +143,7 @@ namespace BBWY.Client.Views.PackTask item.Content = lb; tipBox.Items.Add(item); } - + } tipBox.Visibility = Visibility.Visible; @@ -128,9 +151,9 @@ namespace BBWY.Client.Views.PackTask catch (Exception) { - + } - + } } } diff --git a/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs b/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs index 091e6a23..8da169df 100644 --- a/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/QuanTanBusiness.cs @@ -23,12 +23,12 @@ namespace BBWY.Server.Business public override PayPurchaseOrderResponse PayPurchaseOrder(PayPurchaseOrderRequest payPurchaseOrderRequest) { - var data = payPurchaseOrderRequest.PurchaseAccount; + var qtResponse = quanTanOrderClient.PayOrder(new QuanTanPayOrderRequest { orderId = payPurchaseOrderRequest.OrderId, - userAccount = data.AccountName - }, payPurchaseOrderRequest.PurchaseAccount.AppKey, payPurchaseOrderRequest.PurchaseAccount.AppSecret); + userAccount = payPurchaseOrderRequest.AppToken + }, payPurchaseOrderRequest.AppKey, payPurchaseOrderRequest.AppSecret); if (qtResponse.Status == 200) return new PayPurchaseOrderResponse { Success = true, PurchaseOrderState= PurchaseOrderState.待发货 }; if (qtResponse.Message != null && qtResponse.Message.Contains("已支付")) @@ -36,8 +36,8 @@ namespace BBWY.Server.Business var res = quanTanOrderClient.GetOrderDetail(new QuanTanGetOrderDetailRequest { orderId = payPurchaseOrderRequest.OrderId, - userAccount = data.AccountName - }, payPurchaseOrderRequest.PurchaseAccount.AppKey, payPurchaseOrderRequest.PurchaseAccount.AppSecret); + userAccount = payPurchaseOrderRequest.AppToken + }, payPurchaseOrderRequest.AppKey, payPurchaseOrderRequest.AppSecret); if (res.Status == 200) { PurchaseOrderState purchaseOrder= PurchaseOrderState.待发货; diff --git a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs index b970581c..121490b9 100644 --- a/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs +++ b/BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs @@ -441,7 +441,7 @@ namespace BBWY.Server.Business public PayPurchaseOrderResponse PayPurchaseOrder(PayPurchaseOrderRequest request) { - var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.PurchasePlatform); + var platformSDKBusiness = platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform); var payOrderResponse = platformSDKBusiness.PayPurchaseOrder(request); if (payOrderResponse.Success) diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/CancelPurchaseOrderRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/CancelPurchaseOrderRequest.cs index e2c04047..8febce2c 100644 --- a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/CancelPurchaseOrderRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/CancelPurchaseOrderRequest.cs @@ -3,8 +3,6 @@ public class CancelPurchaseOrderRequest: PlatformRequest { public string OrderId { get; set; } - - public string Remark { get; set; } } } diff --git a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/PayPurchaseOrderRequest.cs b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/PayPurchaseOrderRequest.cs index 214041e0..0a6ab9b1 100644 --- a/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/PayPurchaseOrderRequest.cs +++ b/BBWY.Server.Model/Dto/Request/PurchaseOrderV2/BatchPurchase/PayPurchaseOrderRequest.cs @@ -8,13 +8,5 @@ namespace BBWY.Server.Model.Dto public class PayPurchaseOrderRequest : PlatformRequest { public string OrderId { get; set; } - - public PurchaseAccount PurchaseAccount { get; set; } - - - /// - /// 采购平台 - /// - public Enums.Platform PurchasePlatform { get; set; } } }