From edb402ff80990eca94d2e87568c69ded621ee618 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 5 May 2023 17:11:40 +0800 Subject: [PATCH 1/7] 1 --- BBWY.Client/BBWYAppSettings.json | 4 +- .../Models/BatchPurchase/BatchPublishTask.cs | 384 ++++++++++++++++++ BBWY.Client/Models/Enums.cs | 6 + .../BatchPublishTaskViewModel.cs | 71 ++++ .../BatchPurchaseOrderListViewModel.cs | 27 ++ .../PackTask/CreatePackTaskViewModel.cs | 35 +- BBWY.Client/ViewModels/ViewModelLocator.cs | 9 + .../BatchPurchase/BatchPublishTaskWindow.xaml | 279 +++++++++++++ .../BatchPublishTaskWindow.xaml.cs | 26 ++ .../BatchPurchase/BatchPurchaseOrderList.xaml | 108 +++-- .../Views/PackTask/CreatePackTask.xaml | 32 +- 11 files changed, 898 insertions(+), 83 deletions(-) create mode 100644 BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs create mode 100644 BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs create mode 100644 BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml create mode 100644 BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml.cs diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index e1b3dcff..9622efaf 100644 --- a/BBWY.Client/BBWYAppSettings.json +++ b/BBWY.Client/BBWYAppSettings.json @@ -4,6 +4,6 @@ "MDSApiHost": "http://mdsapi.qiyue666.com", "JOSApiHost": "", "1688ApiHost": "", - "QKApiHost": "http://localhost:8080" - //"QKApiHost": "http://qiku.qiyue666.com" + //"QKApiHost": "http://localhost:8080" + "QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file diff --git a/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs new file mode 100644 index 00000000..bc1787db --- /dev/null +++ b/BBWY.Client/Models/BatchPurchase/BatchPublishTask.cs @@ -0,0 +1,384 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace BBWY.Client.Models +{ + public class BatchPublishTask : NotifyObject + { + + #region 属性 + + + private int skuCount; + /// + /// Sku任务数 + /// + public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } } + + private string skuId; + /// + /// Sku + /// + public string SkuId { get => skuId; set { Set(ref skuId, value); } } + + private string logo; + /// + /// 店铺Sku图链接 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + + private string skuName; + /// + /// 采购Sku名称 + /// + public string SkuName { get => skuName; set { Set(ref skuName, value); } } + + private string brand; + /// + /// 品牌 + /// + public string Brand { get => brand; set { Set(ref brand, value); } } + + + private string productNo; + /// + /// 货号 + /// + public string ProductNo { get => productNo; set { Set(ref productNo, value); } } + + private string brandName; + /// + /// 品名(手写上传) + /// + public string BrandName { get => brandName; set { Set(ref brandName, value); } } + + + private int goodsNumber; + /// + /// 配件数 + /// + public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + private Worry isWorry; + /// + /// 是否加急 + /// + public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } } + + private TaskState availability; + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public TaskState Availability { get => availability; set { Set(ref availability, value); } } + + private PackType packType; + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get => packType; set { Set(ref packType, value); } } + + private BasicPack basicPack; + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get => basicPack; set { Set(ref basicPack, value); } } + + private PositionType positionType; + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + + private string skuTitle; + /// + /// sku配件商品名称 + /// + public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } } + + private Need isNeedBarCode; + /// + /// 是否需要合格证 + /// + public Need IsNeedBarCode { get => isNeedBarCode; set { Set(ref isNeedBarCode, value); } } + + + private Need isNeedCertificateModel; + /// + /// 是否需要条形码 + /// + public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { Set(ref isNeedCertificateModel, value); } } + + + private BarCodeModel barCodeModel; + /// + /// 条形码 + /// + public BarCodeModel BarCodeModel { get => barCodeModel; set { Set(ref barCodeModel, value); } } + + + private bool isSetBarCode; + /// + /// 设置显示(条形码) + /// + public bool IsSetBarCode + { + get => isSetBarCode; set + { + + Set(ref isSetBarCode, value); + IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; + } + } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + private string setSpuCerStatus; + + public string SetSpuCerStatus { get => setSpuCerStatus; set { Set(ref setSpuCerStatus, value); } } + private bool isSetSpuCertificate = true; + + + /// + /// 设置spu显示(合格证) + /// + public bool IsSetSpuCertificate + { + get => isSetSpuCertificate; set + { + + Set(ref isSetSpuCertificate, value); + SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板"; + } + } + + + private string saveTask; + + /// + /// 设置显示(合格证) + /// + public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } } + + + private string spuId; + /// + /// 合格证 + /// + public string SpuId { get => spuId; set { Set(ref spuId, value); } } + + private CertificateModel spuCertificateModel; + /// + /// spu合格证 + /// + public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { Set(ref spuCertificateModel, value); } } + + + + private CertificateModel certificateModel; + /// + /// 合格证 + /// + public CertificateModel CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + private CertificatePosition certificatePosition; + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get => certificatePosition; set { Set(ref certificatePosition, value); } } + + /// + /// 注意事项(对接备注) + /// + private string markMessage; + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } } + + + private ObservableCollection increateList; + /// + /// 增量耗材查询关键字 + /// + public ObservableCollection IncreateList { get => increateList; set { Set(ref increateList, value); } } + #endregion + string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; + public PackTaskService packTaskService; + public ProductService productService; + public BatchPublishTask() + { + } + #region 方法 + /// + /// 搜索 skuId + /// + public void SearchSku(string skuid) + { + if (string.IsNullOrEmpty(skuid)) + return; + + ApiResponse productApiResponse = null; + var skuResponse = productService.GetProductSkuList(string.Empty, skuid); + if (skuResponse.Success) + { + if (skuResponse.Data.Count == 0) + { + return; + } + Logo = skuResponse.Data[0].Logo; + SkuName = skuResponse.Data[0].Title; + + + SpuId = skuResponse.Data[0].ProductId; + + productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, 1); + + if (productApiResponse.Success) + { + if (productApiResponse.Data.Count == 0) + { + + return; + } + + ProductNo = productApiResponse.Data.Items[0].ProductItemNum; + Brand = productApiResponse.Data.Items[0].BrandName; + + } + var productSku = packTaskService.GetProductSku(skuid); + if (productSku == null || !productSku.Success) + { + + return; + } + + if (productSku.Data.PackConfig != null) + { + var config = productSku.Data.PackConfig; + SkuTitle = config.SkuGoodsTitle; + GoodsNumber = config.GoodsNumber; + PackType = (PackType)config.PackType; + BasicPack = (BasicPack)config.BasicPack; + Availability = (TaskState)config.Availability; + MarkMessage = config.MarkMessage; + CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无 : (CertificatePosition)config.CertificatePosition.Value; + // Increment1 = config.Increment1; + string[] increateDatas = config.Increment1.Split(','); + + bool isSelected = false; + foreach (var item in increates) + { + isSelected = false; + if (increateDatas.Contains(item)) + { + isSelected = true; + } + App.Current.Dispatcher.Invoke(() => + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = isSelected + }); + }); + } + + } + + BrandName = productSku.Data.BrandName; + + + CertificateModel = productSku.Data.Certificate; + IsSetCertificate = false; + if (CertificateModel == null) + { + CertificateModel = new CertificateModel(); + IsSetCertificate = true; + + } + CertificateModel.Brand = Brand; + CertificateModel.BrandName = BrandName; + CertificateModel.ProductNo = ProductNo; + CertificateModel.SkuId = skuid; + BarCodeModel = productSku.Data.BarCodeModel; + IsSetBarCode = false; + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + IsSetBarCode = true; + } + BarCodeModel.Brand = Brand; + BarCodeModel.BrandName = BrandName; + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.SkuId = skuid; + BarCodeModel.SkuName = SkuName; + } + else + { + + App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); + return; + } + //查看有木有存在 + } + + + public void InitData() + { + + IncreateList = new ObservableCollection(); + SpuId = string.Empty; + SaveTask = "发布"; + + Logo = string.Empty; + + SkuId = ""; + SkuCount = 0; + SkuName = string.Empty; + ProductNo = string.Empty; + Brand = string.Empty; + BrandName = string.Empty; + this.MarkMessage = ""; + IsSetBarCode = true; + IsSetCertificate = true; + BarCodeModel = null; + CertificateModel = null; + SkuTitle = string.Empty; + GoodsNumber = 0; + foreach (var item in increates) + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = false + }); + } + //SearchSku(SkuId); + + } + + #endregion + + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index a0b9eee3..15c93476 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -384,4 +384,10 @@ 未结算 = 0, 已结清 = 1 } + + public enum Need + { + 不需要=0, + 需要=1 + } } diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs new file mode 100644 index 00000000..030c2229 --- /dev/null +++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPublishTaskViewModel.cs @@ -0,0 +1,71 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using BBWY.Common.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Windows.Input; + +namespace BBWY.Client.ViewModels +{ + public class BatchPublishTaskViewModel : BaseVM, IDenpendency + { + + PackTaskService packTaskService; + ProductService productService; + private bool isLoading = false; + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + private ObservableCollection batchPublishTasks; + public ObservableCollection BatchPublishTasks { get => batchPublishTasks; set { Set(ref batchPublishTasks, value); } } + + + public ICommand CreateTaskCommand { get; set; } + public BatchPublishTaskViewModel(PackTaskService packTaskService, ProductService productService) + { + BatchPublishTasks = new ObservableCollection(); + this.packTaskService = packTaskService; + this.productService = productService; + CreateTaskCommand = new RelayCommand(CreateTask); + } + + private void CreateTask() + { + + } + + Platform platform; string orderId; string PurchaserId; + public void AddSkus(Platform platform, string orderId, string PurchaserId, List purchaseOrderSkus) + { + BatchPublishTasks = new ObservableCollection(); + this.platform = platform; this.orderId = orderId; + this.PurchaserId = PurchaserId; + BatchPublishTask model = null; + IsLoading = true; + foreach (var item in purchaseOrderSkus) + { + model = new BatchPublishTask(); + //model.InitData(); + model.productService = productService; + model.packTaskService = packTaskService; + model.SkuId = item.SkuId; + model.SkuCount = item.Quantity.Value; + model.Logo = item.Logo; + model.SpuId = item.ProductId; + model.SkuName = item.SkuTitle; + model.SearchSku(item.SkuId); + App.Current.Dispatcher.Invoke(() => + { + BatchPublishTasks.Add(model); + }); + + } + + IsLoading = false; + } + + + } +} diff --git a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs index 463d9ea4..f8df4406 100644 --- a/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs +++ b/BBWY.Client/ViewModels/BatchPurchase/BatchPurchaseOrderListViewModel.cs @@ -1,5 +1,6 @@ using BBWY.Client.APIServices; using BBWY.Client.Models; +using BBWY.Client.ViewModels; using BBWY.Client.Views.BatchPurchase; using BBWY.Common.Extensions; using BBWY.Common.Models; @@ -11,6 +12,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows; +using System.Windows.Data; using System.Windows.Input; namespace BBWY.Client.ViewModels @@ -44,6 +46,8 @@ namespace BBWY.Client.ViewModels public ICommand CancelPurchaseOrderCommand { get; set; } + public ICommand CreateQTTaskCommand { get; set; } + public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } public DateTime EndDate { get => endDate; set { Set(ref endDate, value); } } public string SearchPurchaseOrderId { get => searchPurchaseOrderId; set { Set(ref searchPurchaseOrderId, value); } } @@ -72,6 +76,8 @@ namespace BBWY.Client.ViewModels PayPurchaseOrderCommand = new RelayCommand(PayPurchaseOrder); CancelPurchaseOrderCommand = new RelayCommand(CancelPurchaseOrder); + + CreateQTTaskCommand = new RelayCommand(CreateQTTask); PageSize = 10; this.globalContext = globalContext; EndDate = DateTime.Now.Date; @@ -80,7 +86,28 @@ namespace BBWY.Client.ViewModels InitQueryPurchaseOrder(); } + private void CreateQTTask(object obj) + { + var parameters = (object[])obj; + var PurchasePlatform = (Platform)parameters[0];//采购平台 + var id = parameters[1].ToString();//订单id + var itemList = (List)parameters[2];//skuid 数量 + var PurchaserId = (string)parameters[3];//采购商id + + ViewModelLocator viewModelLocator = new ViewModelLocator(); + BatchPublishTaskViewModel batch = viewModelLocator.BatchPublishTask; + + batch.AddSkus(PurchasePlatform, id, PurchaserId, itemList); + BatchPublishTaskWindow window = new BatchPublishTaskWindow(); + + window.ShowDialog(); + + + + + + } private void CancelPurchaseOrder(object obj) { diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index 28106afe..3e3ad520 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -302,7 +302,7 @@ namespace BBWY.Client.ViewModels.PackTask private string spuId; /// - /// 合格证 + /// spu /// public string SpuId { get => spuId; set { Set(ref spuId, value); } } @@ -338,41 +338,10 @@ namespace BBWY.Client.ViewModels.PackTask /// public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } } - /// - /// 服务收费 (单个任务id 消耗的总费用) - /// - private decimal feesMoney; - /// - /// 服务收费 (单个任务id 消耗的总费用) - /// - public decimal FeesMoney { get => feesMoney; set { Set(ref feesMoney, value); } } - /// - /// 打包员 - /// - private string packUser; - /// - /// 打包员 - /// - public string PackUser { get => packUser; set { Set(ref packUser, value); } } - private string printName; - /// - /// 选中的打印机名称 - /// - public string PrintName { get => printName; set { Set(ref printName, value); } } - private List printNames; - /// - /// 选中的打印机名称 - /// - public List PrintNames { get => printNames; set { Set(ref printNames, value); } } - private int printNums; - /// - /// 打印数 - /// - public int PrintNums { get => printNums; set { Set(ref printNums, value); } } private readonly PackTaskService packTaskService; @@ -535,7 +504,7 @@ namespace BBWY.Client.ViewModels.PackTask LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); - PrintNames = new List(); + delayTrigger = new DelayTrigger(500); delayTrigger.OnExecute = OnSearchIncreateKeyWordChanged; BarLabelCheck(BarcodeLabelModel.精简模板);//默认精简模式 diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 5aad40e1..d14db460 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -277,5 +277,14 @@ namespace BBWY.Client.ViewModels return s.ServiceProvider.GetRequiredService(); } } + + public BatchPublishTaskViewModel BatchPublishTask + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } } } diff --git a/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml new file mode 100644 index 00000000..2da46ca3 --- /dev/null +++ b/BBWY.Client/Views/BatchPurchase/BatchPublishTaskWindow.xaml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +