From 301965d3cee51ceb0e7b4612bf823a27b4d2dd6c Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 12 May 2023 21:02:22 +0800 Subject: [PATCH] 1 --- .../APIModel/Request/ConsumableRequest.cs | 4 + .../APIModel/Request/CreateTaskRequest.cs | 4 + .../Response/PackTask/ProductSkuResponse.cs | 3 + BBWY.Client/Models/Enums.cs | 7 ++ .../Models/PackTask/ConsumableModel.cs | 43 ++++++-- BBWY.Client/Models/PackTask/ShopTotal.cs | 27 +++++ .../PackTask/ConsumableViewModel.cs | 3 +- .../PackTask/PublishTaskViewModel.cs | 102 ++++++++++-------- BBWY.Client/Views/PackTask/Consumable.xaml | 42 +++++--- .../Views/PackTask/EditConsumable.xaml | 64 +++++++---- .../Views/PackTask/PublishTaskWindow.xaml | 4 +- 11 files changed, 209 insertions(+), 94 deletions(-) diff --git a/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs b/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs index 533bc27a..5693a793 100644 --- a/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/ConsumableRequest.cs @@ -64,5 +64,9 @@ namespace BBWY.Client.Models.APIModel.Request /// 备注 /// public string Remark { get; set; } + /// + /// 耗材归属 + /// + public ConsumableType? ConsumableType { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs index 739c31ff..7dc26ce4 100644 --- a/BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs @@ -109,5 +109,9 @@ namespace BBWY.Client.Models.APIModel.Request public Worry IsWorry { get; set; } public string OrderId { get; set; } public Platform Platform { get; set; } + + public bool NeedBar { get;set; } + + public bool NeedCer { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs index 95416932..a27a9d28 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs @@ -126,6 +126,9 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask public int Availability { get; set; } + public bool NeedBar { get; set; } + + public bool NeedCer { get; set; } } diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index e3f49d11..3c353aee 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -395,4 +395,11 @@ { 待发布 = 0, 打包中 = 1, 已完成 = 2 } + public enum ConsumableType + { + 箱子 = 0, + 气泡纸 = 1, + 胶带 = 2, + 其他 = 3 + } } diff --git a/BBWY.Client/Models/PackTask/ConsumableModel.cs b/BBWY.Client/Models/PackTask/ConsumableModel.cs index 3125d821..6a7b4977 100644 --- a/BBWY.Client/Models/PackTask/ConsumableModel.cs +++ b/BBWY.Client/Models/PackTask/ConsumableModel.cs @@ -5,6 +5,7 @@ using BBWY.Client.Views.PackTask; using BBWY.Common.Models; using GalaSoft.MvvmLight.Command; using HandyControl.Controls; +using NPOI.Util; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -18,6 +19,18 @@ namespace BBWY.Client.Models.PackTask { public class ConsumableModel : BaseVM, IDenpendency { + public ObservableCollection consumableTypeList = new ObservableCollection() + { + "箱子", "气泡纸", "胶带", "其他" + }; + public ObservableCollection ConsumableTypeList { get => consumableTypeList; set { Set(ref consumableTypeList, value); } } + + private ConsumableType? consumableType; + public ConsumableType? ConsumableType + { get => consumableType; set { Set(ref consumableType, value); } } + + + public ConsumableService consumableService; public ICommand EditConsumableCommand { get; set; } public ICommand DeletedConsumableCommand { get; set; } @@ -59,7 +72,8 @@ namespace BBWY.Client.Models.PackTask Price = Price.Value, Remark = Remark, Weigth = Weigth, - Width = Width + Width = Width, + ConsumableType= ConsumableType, }); } @@ -74,7 +88,8 @@ namespace BBWY.Client.Models.PackTask Price = Price.Value, Remark = Remark, Weigth = Weigth, - Width = Width + Width = Width, + ConsumableType = ConsumableType, }); } @@ -91,13 +106,14 @@ namespace BBWY.Client.Models.PackTask } else { + if(res!=null) new TipsWindow(res.Msg).Show(); } } public void DeletedConsumable(ObservableCollection list) { - MessageBoxResult result =System.Windows. MessageBox.Show("是否删除?", "提示", + MessageBoxResult result = System.Windows.MessageBox.Show("是否删除?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result != MessageBoxResult.Yes) return; @@ -116,15 +132,20 @@ namespace BBWY.Client.Models.PackTask public void EditConsumable() { - EditConsumable add = new EditConsumable(new ConsumableModel(consumableService) { - Heigth=this.Heigth, Length=this.Length, - Id=this.Id, Name=this.Name, Weigth=this.Weigth, - Remark = this.Remark, - Width = this.Width , - Price = this.Price - + EditConsumable add = new EditConsumable(new ConsumableModel(consumableService) + { + Heigth = this.Heigth, + Length = this.Length, + Id = this.Id, + Name = this.Name, + Weigth = this.Weigth, + Remark = this.Remark, + Width = this.Width, + Price = this.Price, + ConsumableType = this.ConsumableType, + }); - + add.Show(); } diff --git a/BBWY.Client/Models/PackTask/ShopTotal.cs b/BBWY.Client/Models/PackTask/ShopTotal.cs index a680f351..b58e27b3 100644 --- a/BBWY.Client/Models/PackTask/ShopTotal.cs +++ b/BBWY.Client/Models/PackTask/ShopTotal.cs @@ -62,6 +62,33 @@ namespace BBWY.Client.Models.PackTask /// public string MarkMessage { get; set; } + /// + /// 打包单价 + /// + public decimal? PackSingleFees { get; set; } + + /// + /// 打包费用 + /// + public decimal? PackAllFees { get; set; } + + /// + /// 箱子费用 + /// + public decimal? BoxConsumableFees { get; set; } + /// + /// 气泡纸耗材费 + /// + public decimal? AirConsumableFees { get; set; } + /// + /// 胶带耗材费 + /// + public decimal? TapeConsumableFees { get; set; } + /// + /// 其他耗材费 + /// + public decimal? OtherConsumableFees { get; set; } + public override string ToString() { return $"{TaskId},{CreateTime.ToString("yyyy-MM-dd")},{IsSettle},{DepartmentName},{ShopName}" + diff --git a/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs b/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs index 0b3e2472..50ab6337 100644 --- a/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs @@ -106,7 +106,8 @@ namespace BBWY.Client.ViewModels.PackTask Price = item.Price, Remark = item.Remark, Weigth = item.Weigth, - Width = item.Width + Width = item.Width, + ConsumableType = item.ConsumableType, }); }); diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 0bb26441..6783c61e 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -53,6 +53,11 @@ namespace BBWY.Client.ViewModels.PackTask "需要", "不需要" }; public ObservableCollection IsNeedBarCodeList { get => isNeedBarCodeList; set { Set(ref isNeedBarCodeList, value); } } + private ObservableCollection isNeedCerList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedCerList { get => isNeedCerList; set { Set(ref isNeedCerList, value); } } + + private ObservableCollection certificatePositionList = new ObservableCollection { "无","外部包装","产品包装" }; @@ -180,7 +185,7 @@ namespace BBWY.Client.ViewModels.PackTask { Set(ref isSetBarCode, value); - IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; + // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要; } } @@ -194,7 +199,7 @@ namespace BBWY.Client.ViewModels.PackTask { Set(ref isSetCertificate, value); - IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; } } private string setSpuCerStatus; @@ -325,6 +330,11 @@ namespace BBWY.Client.ViewModels.PackTask { return; } + if (TaskId>0&&string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据 + { + SearchSku(SkuId); + } + if (BarCodeModel == null) { BarCodeModel = new BarCodeModel(); @@ -425,7 +435,6 @@ namespace BBWY.Client.ViewModels.PackTask Logo = skuResponse.Data[0].Logo.Replace("80x80", "200x200"); SkuName = skuResponse.Data[0].Title; - SpuId = skuResponse.Data[0].ProductId; productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, 1); @@ -443,12 +452,42 @@ namespace BBWY.Client.ViewModels.PackTask } var productSku = packTaskService.GetProductSku(skuid); - if (productSku == null || !productSku.Success) + if (productSku == null || !productSku.Success||productSku.Data==null) + return; + BrandName = productSku.Data.BrandName; + CertificateModel = productSku.Data.Cers; + if (CertificateModel == null) { + CertificateModel = new CertificateModel[] { + new CertificateModel{ } + }; + - return; } + foreach (var item in CertificateModel) + { + item.Brand = Brand; + if (!string.IsNullOrEmpty(BrandName)) + item.BrandName = BrandName; + item.ProductNo = ProductNo; + item.SkuId = skuid; + } + BarCodeModel = productSku.Data.BarCodeModel; + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + } + BarCodeModel.Brand = Brand; + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.SkuId = skuid; + BarCodeModel.SkuName = SkuName; + + IsNeedBarCode = Need.需要; + IsSetBarCode = true; + IsSetCertificate = true; if (productSku.Data.PackConfig != null) { var config = productSku.Data.PackConfig; @@ -461,6 +500,11 @@ namespace BBWY.Client.ViewModels.PackTask CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无 : (CertificatePosition)config.CertificatePosition.Value; // Increment1 = config.Increment1; string[] increateDatas = config.Increment1.Split(','); + IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; + IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; + + IsSetBarCode = !config.NeedBar; + IsSetCertificate =!config.NeedCer; bool isSelected = false; foreach (var item in increates) @@ -481,42 +525,6 @@ namespace BBWY.Client.ViewModels.PackTask } } - - BrandName = productSku.Data.BrandName; - - - CertificateModel = productSku.Data.Cers; - IsSetCertificate = false; - if (CertificateModel == null) - { - CertificateModel = new CertificateModel[] { - new CertificateModel{ } - }; - IsSetCertificate = true; - - } - foreach (var item in CertificateModel) - { - item.Brand = Brand; - if (!string.IsNullOrEmpty(BrandName)) - item.BrandName = BrandName; - item.ProductNo = ProductNo; - item.SkuId = skuid; - } - - BarCodeModel = productSku.Data.BarCodeModel; - IsSetBarCode = false; - if (BarCodeModel == null) - { - BarCodeModel = new BarCodeModel(); - IsSetBarCode = true; - } - BarCodeModel.Brand = Brand; - if (!string.IsNullOrEmpty(BrandName)) - BarCodeModel.BrandName = BrandName; - BarCodeModel.ProductNo = ProductNo; - BarCodeModel.SkuId = skuid; - BarCodeModel.SkuName = SkuName; } else { @@ -525,6 +533,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } + //加载配置文件 } public void SearSpuCer() @@ -641,7 +650,7 @@ namespace BBWY.Client.ViewModels.PackTask }); }); } - SearchSku(SkuId); + // SearchSku(SkuId); } private void OpenSkuDetail(object param) @@ -663,9 +672,6 @@ namespace BBWY.Client.ViewModels.PackTask } } - - - private void CreateTask(object obj) { if (string.IsNullOrEmpty(SkuId)) @@ -706,12 +712,14 @@ namespace BBWY.Client.ViewModels.PackTask SkuCount = SkuCount, UserId = globalContext.User.Id.ToString(), ShopId = globalContext.User.Shop.ShopId.ToString(), + NeedBar =IsNeedBarCode==Need.需要, + NeedCer =IsNeedCertificateModel==Need.需要 //IsWorry = IsWorry }; if (IsNeedBarCode == Need.需要) { - if (BarCodeModel == null || BarCodeModel.Id <= 0) + if (BarCodeModel == null ||IsSetBarCode|| BarCodeModel.Id <= 0) { new TipsWindow("请设置条形码模板").Show(); return; @@ -720,7 +728,7 @@ namespace BBWY.Client.ViewModels.PackTask } if (IsNeedCertificateModel == Need.需要) { - if (CertificateModel == null || CertificateModel.Count() <= 0) + if (CertificateModel == null || IsSetCertificate || CertificateModel.Count() <= 0) { new TipsWindow("请设置合格证模板").Show(); return; diff --git a/BBWY.Client/Views/PackTask/Consumable.xaml b/BBWY.Client/Views/PackTask/Consumable.xaml index 14ce767d..5c8ddb4d 100644 --- a/BBWY.Client/Views/PackTask/Consumable.xaml +++ b/BBWY.Client/Views/PackTask/Consumable.xaml @@ -65,6 +65,7 @@ + @@ -73,14 +74,15 @@ - - - - - - - - + + + + + + + + + @@ -89,6 +91,7 @@ + + @@ -111,9 +115,10 @@ + @@ -121,7 +126,7 @@ @@ -129,12 +134,20 @@ + + + + @@ -146,14 +159,14 @@ - + - + - + + diff --git a/BBWY.Client/Views/PackTask/EditConsumable.xaml b/BBWY.Client/Views/PackTask/EditConsumable.xaml index d605e170..0c4b28d2 100644 --- a/BBWY.Client/Views/PackTask/EditConsumable.xaml +++ b/BBWY.Client/Views/PackTask/EditConsumable.xaml @@ -5,8 +5,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" - Title="TipsWindow" Height="350" Width="640" - xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" + Title="TipsWindow" Height="400" Width="640" + xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" + xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:cmodel="clr-namespace:BBWY.Client.Models" @@ -29,24 +30,49 @@ Background="{StaticResource Border.Background}"> - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml index e7b2b2df..aaef69e6 100644 --- a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml +++ b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml @@ -158,7 +158,7 @@ - + @@ -242,7 +242,7 @@ - +