From af421e94f41fa22c7719bda9ba9a29425289bbdc Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 15 May 2023 16:06:57 +0800 Subject: [PATCH 01/12] 1 --- BBWY.Client/APIServices/PackTaskService.cs | 12 +- BBWY.Client/BBWYAppSettings.json | 4 +- .../Response/PackTask/ProductSkuResponse.cs | 2 + .../PackTask/PackTaskTotalViewModel.cs | 28 +- .../PackTask/PublishTaskViewModel.cs | 4 +- BBWY.Client/Views/MainWindow.xaml | 2 +- .../Views/PackTask/LookBarCodeWindow.xaml | 6 +- .../Views/PackTask/LookBarCodeWindow.xaml.cs | 7 +- BBWY.Client/Views/PackTask/PackTaskTotal.xaml | 104 +++---- .../Views/PackTask/PackTaskTotal.xaml.cs | 7 +- BBWY.Client/Views/PackTask/PrintWindow.xaml | 264 +++--------------- .../Views/PackTask/PrintWindow.xaml.cs | 9 +- .../Views/PackTask/PublishTaskWindow.xaml | 6 +- BBWY.Client/Views/PackTask/SetBarCode.xaml.cs | 5 +- .../Views/PackTask/SetCerWindow.xaml.cs | 1 + .../Views/PackTask/SetSpuCerWindow.xaml.cs | 7 +- 16 files changed, 140 insertions(+), 328 deletions(-) diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs index b15250e7..9c0d5bd7 100644 --- a/BBWY.Client/APIServices/PackTaskService.cs +++ b/BBWY.Client/APIServices/PackTaskService.cs @@ -35,7 +35,7 @@ namespace BBWY.Client.APIServices ) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNew2PackTaskList", new + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new { SkuId = skuId, @@ -59,7 +59,7 @@ namespace BBWY.Client.APIServices ) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNew2PackTaskList", new + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new { IsWorry = isWorry, DepartmentName = departmentName, @@ -95,7 +95,7 @@ namespace BBWY.Client.APIServices { HttpClientHelper helper = new HttpClientHelper(globalContext.QKApiHost); - string url = $"{globalContext.QKApiHost}/api/PackTask/SearchProductNew?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}"; + string url = $"{globalContext.QKApiHost}/api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}"; var data = helper.Get(url); return JsonConvert.DeserializeObject>(data); @@ -112,7 +112,7 @@ namespace BBWY.Client.APIServices public ApiResponse UpdateTask(CreateTaskRequest createTaskRequest) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/UpdatePackTaskNew", + return SendRequest(globalContext.QKApiHost, "api/PackTask/UpdatePackTask", createTaskRequest , null, HttpMethod.Post); } @@ -132,7 +132,7 @@ namespace BBWY.Client.APIServices public ApiResponse CreateTask(CreateTaskRequest createTaskRequest) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/CreatePackTaskNew", + return SendRequest(globalContext.QKApiHost, "api/PackTask/CreatePackTask", createTaskRequest , null, HttpMethod.Post); } @@ -156,7 +156,7 @@ namespace BBWY.Client.APIServices public ApiResponse SaveCer(CerRequest cerRequest) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitCerNew", cerRequest + return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitCer", cerRequest , null, HttpMethod.Post); } public ApiResponse SaveSpuCer(CerRequest cerRequest) 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/APIModel/Response/PackTask/ProductSkuResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs index a27a9d28..713ae946 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuResponse.cs @@ -48,6 +48,8 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask public BarCodeModel BarCodeModel { get; set; } + + /// /// 合格证信息 /// diff --git a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs index 57fcaee4..af420084 100644 --- a/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackTaskTotalViewModel.cs @@ -106,25 +106,9 @@ 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() { @@ -213,10 +197,7 @@ namespace BBWY.Client.ViewModels.PackTask private void SearchTaskTotal() { - if (IsBatchChecked) - { - BatchCheck(); - } + PackTaskTotalList = new ObservableCollection(); Task.Factory.StartNew(() => { @@ -233,7 +214,10 @@ namespace BBWY.Client.ViewModels.PackTask PackTaskTotalList.Add(shopTotal); }); } - + if (IsBatchChecked) + { + BatchCheck(); + } } IsLoading = false; diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 4a6a58fa..4479d6eb 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -20,8 +20,8 @@ namespace BBWY.Client.ViewModels.PackTask { public class PublishTaskViewModel : BaseVM, IDenpendency { - - #region 属性 + + #region 属性 private string searchSkuId; public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 9cdc135b..ad6b9b1e 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml index 489db23f..1302fa8a 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml @@ -29,7 +29,9 @@ Background="{StaticResource Border.Background}"> - + + + diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs index f8a08d1a..c021ac07 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml.cs @@ -23,10 +23,15 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); + + } + + public BarCodeModel BarCodeModel { get; set; } public void SetData(BarCodeModel BarCodeModel) { - this.DataContext = BarCodeModel; + this.BarCodeModel = BarCodeModel; + this.DataContext = this; } } } diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index ad9ac1aa..aad3fc9b 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -124,7 +124,9 @@ - + + + @@ -132,26 +134,26 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -171,10 +173,11 @@ - + + - + + + @@ -201,7 +206,6 @@ - @@ -217,7 +221,7 @@ - + @@ -228,70 +232,76 @@ + Margin=" 5,0,0,0"> + + + + + + + Margin=" 5,0,0,0"> + + + + + + - + - - - - - - - + + - + - + - + - - + + - - + + + + - + - - - - - - - + - + + + + - + diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs index 2ae3eb50..de7764b2 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml.cs @@ -34,10 +34,10 @@ namespace BBWY.Client.Views.PackTask } - public ShopService shopService; + public ShopService shopService; 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); @@ -90,10 +90,7 @@ namespace BBWY.Client.Views.PackTask } } - - List departments = new List(); - private void tb_TextChanged(object sender, TextChangedEventArgs e) { try diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml b/BBWY.Client/Views/PackTask/PrintWindow.xaml index 12c39279..cd2c9821 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" mc:Ignorable="d" Style="{StaticResource bwstyle}" - Height="532" Width="486" + Height="525" Width="486" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:ctr="clr-namespace:BBWY.Client.Converters" @@ -18,8 +18,16 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - ResizeMode="NoResize" > + + + + + + + + + @@ -32,230 +40,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index 86c4772e..c08d9268 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -83,25 +83,21 @@ namespace BBWY.Client.Views.PackTask // PrintData data = new PrintData(); if (CertificateModel != null) { - GoodsNumberCerList = new ObservableCollection(); foreach (CertificateModel certificateModel in CertificateModel) GoodsNumberCerList.Add(new GoodsNumberCer { CertificateModel = certificateModel.Copy(), }); - this.DataContext = this; - bar.Visibility = Visibility.Collapsed; cer.Visibility = Visibility.Visible; } - if (BarCodeModel != null) { - this.DataContext = BarCodeModel; cer.Visibility = Visibility.Collapsed; bar.Visibility = Visibility.Visible; } + this.DataContext = this; } public CertificateModel[] CertificateModel { get; set; } @@ -136,7 +132,6 @@ namespace BBWY.Client.Views.PackTask { PrintData(printCount, printName,null,cer); System.Threading.Thread.Sleep(100); - // MyPrintHelper.PrintCertificate(ref args, cer, font); } } @@ -177,7 +172,7 @@ namespace BBWY.Client.Views.PackTask { App.Current.Dispatcher.Invoke(() => { - new TipsWindow("打印失败").ShowDialog(); + new TipsWindow($"打印失败,{ex.Message}").Show(); }); } diff --git a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml index aaef69e6..890893c4 100644 --- a/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml +++ b/BBWY.Client/Views/PackTask/PublishTaskWindow.xaml @@ -214,9 +214,9 @@ - + - - + diff --git a/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs b/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs index 32397bc1..56db3411 100644 --- a/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetBarCode.xaml.cs @@ -65,16 +65,13 @@ namespace BBWY.Client.Views.PackTask }); if (resData == null || !resData.Success) { - //IsSetBarCode = false; return; } BarCodeModel.Id = resData.Data; if (SaveResult != null) SaveResult(BarCodeModel); - // IsNeedBarCode = "需要"; - //IsSetBarCode = false; - // setBarCodeWindow.Close(); + this.Close(); } diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs index 492d4cae..74627b12 100644 --- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs @@ -158,6 +158,7 @@ namespace BBWY.Client.Views.PackTask cer.CertificateModel.Shader = SpuCertificateModel.Shader; cer.CertificateModel.ProductShop = SpuCertificateModel.ProductShop; cer.CertificateModel.ApplyAge = SpuCertificateModel.ApplyAge; + cer.CertificateModel.ProduceDate = SpuCertificateModel.ProduceDate; } diff --git a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs index 65678572..d12c551e 100644 --- a/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetSpuCerWindow.xaml.cs @@ -62,11 +62,10 @@ namespace BBWY.Client.Views.PackTask ProductAdress = SpuCertificateModel.ProductAdress, ProductShop = SpuCertificateModel.ProductShop, Shader = SpuCertificateModel.Shader, - SkuId = SpuCertificateModel.SkuId, + //SkuId = SpuCertificateModel.SkuId, ApplyAge = SpuCertificateModel.ApplyAge, - - - + ProduceDate=SpuCertificateModel.ProduceDate, + }); if (resData == null || !resData.Success) { From 8562c08ce8fb7ee9bce4ab049b7f1907b9417bb6 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 19 May 2023 18:32:56 +0800 Subject: [PATCH 02/12] 1 --- .../APIServices/PackPurchaseTaskService.cs | 94 ++++ .../Request/UpdatePurchaseTaskRequest.cs | 139 +++++ .../PackPurchaseTask/ConfigPackResponse.cs | 62 +++ BBWY.Client/Models/Enums.cs | 4 + .../Models/PackTask/CertificateModel.cs | 10 +- BBWY.Client/Models/QualityTask/PurchaseSku.cs | 66 +++ .../PackTask/PublishTaskViewModel.cs | 5 +- .../QualityTask/QualityViewModel.cs | 476 ++++++++++++++++++ BBWY.Client/ViewModels/ViewModelLocator.cs | 10 + .../QualityTask/QualityLookCerWindow.xaml | 26 + .../QualityTask/QualityLookCerWindow.xaml.cs | 31 ++ .../QualityTask/QualitySetCerWindow.xaml | 52 ++ .../QualityTask/QualitySetCerWindow.xaml.cs | 122 +++++ .../Views/QualityTask/QualityWindow.xaml | 400 +++++++++++++++ .../Views/QualityTask/QualityWindow.xaml.cs | 16 + 15 files changed, 1508 insertions(+), 5 deletions(-) create mode 100644 BBWY.Client/APIServices/PackPurchaseTaskService.cs create mode 100644 BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs create mode 100644 BBWY.Client/Models/QualityTask/PurchaseSku.cs create mode 100644 BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs create mode 100644 BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualityWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs new file mode 100644 index 00000000..bfd26b7d --- /dev/null +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -0,0 +1,94 @@ +using BBWY.Client.Models.APIModel; +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Common.Http; +using BBWY.Common.Models; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; + +namespace BBWY.Client.APIServices +{ + public class PackPurchaseTaskService : BaseApiService, IDenpendency + { + public PackPurchaseTaskService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + } + public ApiResponse UpdatePurchaseTask(UpdatePurchaseTaskRequest updatePurchaseTaskRequest) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", updatePurchaseTaskRequest, null, HttpMethod.Post); + } + + public ApiResponse GetConfigPack(string skuId, string skuPurchaseSchemeId, string orderId) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/GetConfigPack", new + { + skuId, + skuPurchaseSchemeId, + orderId + } + , null, HttpMethod.Post); + } + /// + /// + /// + /// + /// + /// 到货情况(物流状态)(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public ApiResponse UpdateAvailabilityState(string orderId, string skuId, int availability) + { + return SendRequest(globalContext.QKApiHost, "api/PackPurchaseTask/UpdatePurchaseTask", new + { + orderId, + skuId, + availability + }, null, HttpMethod.Post); + } + + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel + , null, HttpMethod.Post); + } + + public ApiResponse SaveCer(CerRequest cerRequest) + { + return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitSkuCer", cerRequest + , null, HttpMethod.Post); + } + + + public ApiResponse GetProductSku(string skuId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackTask/SearchProduct?skuId={skuId}&ShopId={globalContext.User.Shop.ShopId}", null, null, HttpMethod.Get); + + } + + public ApiResponse UpdateOrderPackState(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/UpdateOrderPackState", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + public ApiResponse IsExitQikuTask(string skuId, string orderId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/IsExitQikuTask", new + { + skuId, + orderId + }, null, HttpMethod.Post); + + } + + + } +} diff --git a/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs new file mode 100644 index 00000000..09c44955 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/UpdatePurchaseTaskRequest.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Request +{ + /// + /// 修改采购单任务 + /// + public class UpdatePurchaseTaskRequest + { + + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 到货情况(已到货 = 0,部分到货 = 1,未到货 = 2) + /// + public int Availability { get; set; } + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2) + /// + public int PositionType { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 配件数量 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + /// + /// 增量耗材 + /// + public string Increment1 { get; set; } + + /// + /// 注意事项 + /// + public string MarkMessage { get; set; } + + /// + ///条形码Id + /// + public long? BarCodeId { get; set; } + + /// + /// 合格证Id 格式: id,id 186,187 + /// + public string CerId { get; set; } + /// + /// 是否需要条形码 + /// + public bool? NeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool? NeedCer { get; set; } + /// + /// 合格证位置 + /// + public int? CertificatePosition { get; set; } + + /// + /// 加急 + /// + public int IsWorry { get; set; } + + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + + /// + /// skuId + /// + public string SkuId { get; set; } + + #region 更新数据 + /// + /// 品名 + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + + /// + /// 图 + /// + public string Logo { get; set; } + + /// + /// 名称 + /// + public string SkuName { get; set; } + /// + /// 品牌 + /// + public string Brand { get; set; } + #endregion + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + + /// + /// 保存 配置商品合格证状态配置信息 + /// + public PurchaseSkuSpec[] PurchaseSkuSpecs { get; set; } + } + + /// + /// 配置商品合格证状态 + /// + public class PurchaseSkuSpec + { + /// + /// 商品配件id + /// + public string PurchaseSkuId { get; set; } + /// + /// 合格证配置状态 + /// + public bool IsNeedCer { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs new file mode 100644 index 00000000..f9005265 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs @@ -0,0 +1,62 @@ +using BBWY.Client.Models.APIModel.Response.PackTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + /// + /// 配置打包信息数据 + /// + public class ConfigPackResponse + { + + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { get; set; } + + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + /// + /// 条形码 + /// + public BarCodeModel BarCode { get; set; } + + public PackConfig PackConfig { get; set; } + } + /// + /// 配件sku + /// + public class PurchaseSku + { + /// + /// 配件图 + /// + public string Logo { get; set; } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get; set; } + + /// + /// 配件商品spuId + /// + public string PurchaseProductId { get; set; } + /// + /// 配件名称 + /// + public string Title { get; set; } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get; set; } + + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 3c353aee..61fd6544 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -402,4 +402,8 @@ 胶带 = 2, 其他 = 3 } + public enum PackCerState + { + 合格证信息 = 0, 无需合格证 = 1 + } } diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index cde4a7ad..437d9a1a 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -23,7 +23,7 @@ namespace BBWY.Client.Models private string spuId; /// - /// 品牌 + /// spu /// public string SpuId { get => spuId; set { Set(ref spuId, value); } } @@ -139,10 +139,10 @@ namespace BBWY.Client.Models } - - private int goodsNumber =1; + + private int goodsNumber = 1; /// /// 配件序号 /// @@ -154,5 +154,9 @@ namespace BBWY.Client.Models /// public string ProduceDate { get => produceDate; set { Set(ref produceDate, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get; set; } } } diff --git a/BBWY.Client/Models/QualityTask/PurchaseSku.cs b/BBWY.Client/Models/QualityTask/PurchaseSku.cs new file mode 100644 index 00000000..01693fe1 --- /dev/null +++ b/BBWY.Client/Models/QualityTask/PurchaseSku.cs @@ -0,0 +1,66 @@ +using GalaSoft.MvvmLight; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.QualityTask +{ + /// + /// 配件sku + /// + public class PurchaseSku : NotifyObject + { + + /// + /// 配件图 + /// + private string logo; + /// + /// 配件商品Id + /// + private string purchaseSkuId; + /// + /// 配件名称 + /// + private string title; + /// + /// 是否需要配置合格证 + /// + private bool isNeedCer; + /// + /// 配件图 + /// + public string Logo { get => logo; set { Set(ref logo, value); } } + /// + /// 配件商品Id + /// + public string PurchaseSkuId { get => purchaseSkuId; set { Set(ref purchaseSkuId, value); } } + /// + /// 配件名称 + /// + public string Title { get => title; set { Set(ref title, value); } } + /// + /// 是否需要配置合格证 + /// + public bool IsNeedCer { get => isNeedCer; set { Set(ref isNeedCer, value); } } + /// + /// 合格证配置信息 + /// + public CertificateModel CerDTO { get; set; } + + private bool isSetCertificate; + /// + /// 设置显示(合格证) + /// + public bool IsSetCertificate + { + get => isSetCertificate; set + { + + Set(ref isSetCertificate, value); + //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要; + } + } + + } +} diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 4479d6eb..18170d99 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -631,13 +631,14 @@ namespace BBWY.Client.ViewModels.PackTask IsNeedCertificateModel = model.CertificateModel == null ? Need.不需要 : Need.需要; CertificatePosition = model.CertificatePosition; TaskId = model.TaskId; - string[] increateDatas = model.Increment1.Split(','); + + string[] increateDatas = model.Increment1?.Split(','); bool isTrue = false; foreach (var item in increates) { isTrue = false; - if (increateDatas.Contains(item)) + if (increateDatas!=null&& increateDatas .Count()>0&& increateDatas.Contains(item)) { isTrue = true; } diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs new file mode 100644 index 00000000..8ccfc59e --- /dev/null +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -0,0 +1,476 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models.PackTask; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Common.Models; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Windows.Input; +using System.Windows; +using BBWY.Client.Models.QualityTask; +using BBWY.Client.Views.QualityTask; + +namespace BBWY.Client.ViewModels +{ + public class QualityViewModel:BaseVM,IDenpendency + { + #region 属性 + + private ObservableCollection purchaseSkuList; + public ObservableCollection PurchaseSkuList { get => purchaseSkuList; set { Set(ref purchaseSkuList, value); } } + + private string searchSkuId; + public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } + + // public long TaskId { get; set; } + //private bool isSelected; + //public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } + + private ObservableCollection worryList = new ObservableCollection { + "否","是" + }; + 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 PackTypeList { get => packTypeList; set { Set(ref packTypeList, value); } } + + 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 isNeedCerList = new ObservableCollection { + "需要", "不需要" }; + public ObservableCollection IsNeedCerList { get => isNeedCerList; set { Set(ref isNeedCerList, value); } } + + + private ObservableCollection certificatePositionList = new ObservableCollection { + "无","外部包装","产品包装" + }; + 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 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); } } + + + + public string OrderId { get; set; } + + 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,聚水潭仓=3) + /// + 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); } } + string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; + + PackPurchaseTaskService packPurchaseTaskService; + + ProductService productService; + GlobalContext globalContext; + private bool isLoading = false; + public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + #endregion + + public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService) + { + this.packPurchaseTaskService = packPurchaseTaskService; + this.productService = productService; + this.globalContext = globalContext; + + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); + SetBarCodeCommand = new RelayCommand(SetBarCode); + SetCertificateCommand = new RelayCommand(SetCertificate); + LookBarCommand = new RelayCommand(LookBar); + LookCerCommand = new RelayCommand(LookCer); + SearchSkuCommand = new RelayCommand(SearchSku); + IncreateList = new ObservableCollection(); + foreach (var item in increates) + { + IncreateList.Add(new IncreateModel + { + IncreateName = item, + IsSelected = false + }); + } + + this.purchaseService = purchaseService; +#if DEBUG + + //Test(); +#endif + } + PurchaseService purchaseService; + public string OriginShopName { get; set; } + public string SkuPurchaseSchemeId { get; set; } + public Platform Platform { get; set; } + public string ShopId { get; set; } + + public string UserName { get; set; } + public void Test(OrderSku order) + { + SearchSku(order); + + + } + + #region 方法 + public ICommand SetBarCodeCommand { get; set; } + public ICommand SetCertificateCommand { get; set; } + public ICommand LookBarCommand { get; set; } + public ICommand LookCerCommand { get; set; } + + public ICommand OpenSkuDetailCommand { get; set; } + public ICommand CreateTaskCommand { get; set; } + + public ICommand SearchSkuCommand { get; set; } + + private void SetBarCode() + { + if (string.IsNullOrEmpty(SkuId)) + { + return; + } + //if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据 + //{ + // SearchSku(SkuId); + //} + + if (BarCodeModel == null) + { + BarCodeModel = new BarCodeModel(); + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.Brand = Brand; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + } + if (!string.IsNullOrEmpty(BrandName)) + BarCodeModel.BrandName = BrandName; + + SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow(); + setBarCodeWindow.LoadData(BarCodeModel, packPurchaseTaskService); + setBarCodeWindow.SaveResult = b => + { + BarCodeModel = b; + IsSetBarCode = false; + IsNeedBarCode = Need.需要; + }; + setBarCodeWindow.Show(); + } + + /// + /// 设置合格证 + /// + private void SetCertificate(PurchaseSku model) + { + + if (model.CerDTO == null) + { + model.CerDTO = new CertificateModel + { + ProductNo = ProductNo, + Brand = Brand, + SkuId = SkuId, + PurchaseSkuId = model.PurchaseSkuId + + }; + } + if (!string.IsNullOrEmpty(BrandName)) + model.CerDTO.BrandName = BrandName; + + QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); + setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.SaveResult = (s, PackCerState) => + { + var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId); + skus.CerDTO = s; + skus.IsSetCertificate = false; + skus.IsNeedCer = PackCerState == PackCerState.合格证信息; + IsNeedCertificateModel = Need.需要; + }; + setCerWindow.Show(); + } + + + /// + /// 查看合格证 + /// + private void LookCer(string id) + { + LookCerWindow lookCerWindow = new LookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); + lookCerWindow.Show(); + } + /// + /// 查看条形码 + /// + private void LookBar() + { + LookBarCodeWindow look = new LookBarCodeWindow(); + look.SetData(BarCodeModel); + look.Show(); + } + + /// + /// 搜索 skuId(todo:) + /// + public void SearchSku(object obj) + { + InitData(); + } + public Action ReflashWindow { get; set; } + public void InitData() + { + + IsSetBarCode = true; + SkuTitle = ""; + BrandName = ""; + GoodsNumber = 0; + PackType = PackType.单件; + BasicPack = BasicPack.快递袋; + // Availability = (TaskState.)config.Availability; + //MarkMessage = config.MarkMessage; + CertificatePosition = CertificatePosition.无; + // Increment1 = config.Increment1; + + IsNeedBarCode = Need.需要; + IsNeedCertificateModel = Need.不需要; + } + private void OpenSkuDetail(object param) + { + var paramList = (object[])param; + // var orderId = paramList[0].ToString(); + var skuId = paramList[0].ToString(); + + + var url = $"https://item.jd.com/{skuId}.html"; + try + { + System.Diagnostics.Process.Start("explorer.exe", url); + } + catch (Exception ex) + { + Clipboard.SetText(url); + MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + + } + + #endregion + } +} diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 7ccd0dad..7a3489c0 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -294,5 +294,15 @@ namespace BBWY.Client.ViewModels return s.ServiceProvider.GetRequiredService(); } } + + + public QualityViewModel QualityTask + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } } } diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml new file mode 100644 index 00000000..01c8f2fa --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs new file mode 100644 index 00000000..8bc37874 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityLookCerWindow.xaml.cs @@ -0,0 +1,31 @@ +using BBWY.Client.Extensions; +using BBWY.Client.Models; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityLookCerWindow.xaml 的交互逻辑 + /// + public partial class QualityLookCerWindow : BWindow + { + public QualityLookCerWindow(CertificateModel certificate) + { + CertificateModel = certificate.Copy(); + InitializeComponent(); + this.DataContext = this; + } + public CertificateModel CertificateModel { get; set; } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml new file mode 100644 index 00000000..5b587f02 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs new file mode 100644 index 00000000..ea3f0c79 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -0,0 +1,122 @@ +using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using GalaSoft.MvvmLight.Command; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using BBWY.Client.Extensions; +using BBWY.Client.APIServices; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualitySetCerWindow.xaml 的交互逻辑 + /// + public partial class QualitySetCerWindow : Window + { + public QualitySetCerWindow() + { + InitializeComponent(); + SetPackCerStateCommand = new RelayCommand(SetPackCerState); + } + + private void SetPackCerState(PackCerState obj) + { + PackCerState = obj; + } + + public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate) + { + this.CertificateModel = CertificateModel.Copy(); + this.packTaskService = packTaskService; + PackCerState = isNeedCer ? PackCerState.合格证信息 : PackCerState.无需合格证; + this.DataContext = this; + } + + public ICommand SetPackCerStateCommand { get; set; } + //public PackCerState PackCerState { get; set; } + + + public PackCerState PackCerState + { + get + { + return (PackCerState)GetValue(PackCerStateProperty); + + } + set + { + SetValue(PackCerStateProperty, value); + + } + } + + + public static readonly DependencyProperty PackCerStateProperty = + DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(SetCerWindow)); + + public bool IsSetSpuCertificate { get; set; } + public PackPurchaseTaskService packTaskService { get; set; } + public CertificateModel CertificateModel { get; set; } + public CertificateModel SpuCertificateModel { get; set; } + + public Action SaveResult { get; set; } + + + private void save_btn_Click(object sender, RoutedEventArgs e) + { + + + if (string.IsNullOrEmpty(CertificateModel.ExcuteStander) + || string.IsNullOrEmpty(CertificateModel.Shader) || string.IsNullOrEmpty(CertificateModel.BrandName) + || string.IsNullOrEmpty(CertificateModel.Brand) || string.IsNullOrEmpty(CertificateModel.ProductShop) + || string.IsNullOrEmpty(CertificateModel.ProductAdress)) + { + //new TipsWindow("参数出错!请重新填写!").Show(); + return; + } + var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); + + var resData = packTaskService.SaveCer(new CerRequest + { + Brand = CertificateModel.Brand, + BrandName = CertificateModel.BrandName, + ProductNo = CertificateModel.ProductNo, + SkuId = CertificateModel.SkuId, + ExcuteStander = CertificateModel.ExcuteStander, + LabelModel = (int)CertificateModel.LabelModel, + FactoryNumber = CertificateModel.FactoryNumber, + IsLogo = CertificateModel.IsLogo, + ProductAdress = CertificateModel.ProductAdress, + ProductShop = CertificateModel.ProductShop, + Shader = CertificateModel.Shader, + ApplyAge = CertificateModel.ApplyAge, + GoodsNumber = CertificateModel.GoodsNumber, + ProduceDate = CertificateModel.ProduceDate, + PurchaseSkuId = CertificateModel.PurchaseSkuId + + }); + if (resData == null || !resData.Success) + { + + return; + } + + CertificateModel.Id = resData.Data; + if (SaveResult != null) SaveResult(CertificateModel, PackCerState); + + + + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml new file mode 100644 index 00000000..3880d1c9 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs new file mode 100644 index 00000000..fadef789 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml.cs @@ -0,0 +1,16 @@ +using BBWY.Controls; + + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualityWindow.xaml 的交互逻辑 + /// + public partial class QualityWindow : BWindow + { + public QualityWindow() + { + InitializeComponent(); + } + } +} From 5dcd07f2560cd2d268eba832a5f43b8d4bf75fed Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 19 May 2023 21:17:37 +0800 Subject: [PATCH 03/12] 1 --- BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs | 3 ++- BBWY.Client/Views/QualityTask/QualityWindow.xaml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index ea3f0c79..0e572aa4 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -15,13 +15,14 @@ using System.Windows.Media.Imaging; using System.Windows.Shapes; using BBWY.Client.Extensions; using BBWY.Client.APIServices; +using BBWY.Controls; namespace BBWY.Client.Views.QualityTask { /// /// QualitySetCerWindow.xaml 的交互逻辑 /// - public partial class QualitySetCerWindow : Window + public partial class QualitySetCerWindow : BWindow { public QualitySetCerWindow() { diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 3880d1c9..8432f93e 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -6,7 +6,6 @@ mc:Ignorable="d" xmlns:b="http://schemas.microsoft.com/xaml/behaviors" xmlns:hc="https://handyorg.github.io/handycontrol" - mc:Ignorable="d" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" CloseButtonVisibility="Visible" CloseButtonColor="{StaticResource WindowButtonColor}" From 23ab10ded5ea1b611845eeb1c5ad15a57adda92c Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 21 May 2023 14:33:14 +0800 Subject: [PATCH 04/12] 1 --- .../Models/APIModel/Request/CerRequest.cs | 3 +++ .../QualityTask/QualityViewModel.cs | 11 +++++----- .../Views/QualityTask/QualityWindow.xaml | 20 +++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/BBWY.Client/Models/APIModel/Request/CerRequest.cs b/BBWY.Client/Models/APIModel/Request/CerRequest.cs index 7a10d65d..194e8bee 100644 --- a/BBWY.Client/Models/APIModel/Request/CerRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/CerRequest.cs @@ -71,5 +71,8 @@ namespace BBWY.Client.Models.APIModel.Request public int GoodsNumber { get; set; } public string ProduceDate { get; set; } + + + public string PurchaseSkuId { get; set; } } } diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 8ccfc59e..bd8e0a7b 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -281,19 +281,19 @@ namespace BBWY.Client.ViewModels string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" }; PackPurchaseTaskService packPurchaseTaskService; - + PackTaskService packTaskService; ProductService productService; GlobalContext globalContext; private bool isLoading = false; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } #endregion - public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService) + public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService) { this.packPurchaseTaskService = packPurchaseTaskService; this.productService = productService; this.globalContext = globalContext; - + OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); SetBarCodeCommand = new RelayCommand(SetBarCode); SetCertificateCommand = new RelayCommand(SetCertificate); @@ -311,6 +311,7 @@ namespace BBWY.Client.ViewModels } this.purchaseService = purchaseService; + this.packTaskService = packTaskService; #if DEBUG //Test(); @@ -364,7 +365,7 @@ namespace BBWY.Client.ViewModels BarCodeModel.BrandName = BrandName; SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow(); - setBarCodeWindow.LoadData(BarCodeModel, packPurchaseTaskService); + setBarCodeWindow.LoadData(BarCodeModel, packTaskService); setBarCodeWindow.SaveResult = b => { BarCodeModel = b; @@ -413,7 +414,7 @@ namespace BBWY.Client.ViewModels /// private void LookCer(string id) { - LookCerWindow lookCerWindow = new LookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); + QualityLookCerWindow lookCerWindow = new QualityLookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); lookCerWindow.Show(); } /// diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 8432f93e..d8b00898 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -13,7 +13,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - Height="450" Width="1305"> + Height="800" Width="1305"> @@ -131,7 +131,7 @@ - + @@ -155,19 +155,19 @@ - + - - - - + + + + - - + + @@ -183,7 +183,7 @@ ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemsSource="{Binding PurchaseSkuList,Mode=TwoWay}" BorderBrush="{StaticResource Border.Brush}" - BorderThickness="0" + BorderThickness="0" Foreground="{StaticResource Text.Color}"> From f1e2d8016c24c8273366e560e9eec6306ba8962e Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 21 May 2023 15:15:19 +0800 Subject: [PATCH 05/12] 1 --- BBWY.Client/Models/PackTask/PackTaskModel.cs | 27 +++++++++++++++++-- .../QualityTask/QualityViewModel.cs | 1 - .../Views/PackTask/WareHouseListControl.xaml | 14 +++++++++- .../Views/QualityTask/QualityWindow.xaml | 11 +++----- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 1f2f0dbd..c0db5732 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -2,6 +2,7 @@ using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.ViewModels; using BBWY.Client.Views.PackTask; +using BBWY.Client.Views.QualityTask; using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; @@ -35,13 +36,13 @@ namespace BBWY.Client.Models public ICommand LookCerCommand { get; set; } public ICommand LookBarCommand { get; set; } public ICommand SetServiceCommand { get; set; } - /// /// 修改任务 /// public ICommand UpdateTaskCommand { get; set; } - + public ICommand QualityTaskCommand { get; set; } + public Action ReflashTask { get; set; } @@ -85,6 +86,28 @@ namespace BBWY.Client.Models LookCerCommand = new RelayCommand(LookCer); SetServiceCommand = new RelayCommand(SetService); UpdateTaskCommand = new RelayCommand(UpdateTask); + QualityTaskCommand=new RelayCommand(QualityTask); + } + + private void QualityTask() + { + QualityWindow service = new QualityWindow(); + //加载数据 + ViewModelLocator viewModelLocator = new ViewModelLocator(); + var qualityViewModel = viewModelLocator.QualityTask; + qualityViewModel.TaskCount = SkuCount; + qualityViewModel.TaskId = TaskId; + qualityViewModel.OrderId = OrderId; + qualityViewModel.SkuId = SkuId; + qualityViewModel.LoadPackDatas(); + qualityViewModel.SetAllFees = new Action>((feesItem, packUsers) => + { + FeesItemResponse = feesItem; + PackUser = string.Join("\r\n", packUsers); + FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; + IsShowFees = feesItem.AllFees > 0 ? true : false; + }); + service.Show(); } private void SetService() diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index bd8e0a7b..ba6b5dbd 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -339,7 +339,6 @@ namespace BBWY.Client.ViewModels public ICommand OpenSkuDetailCommand { get; set; } public ICommand CreateTaskCommand { get; set; } - public ICommand SearchSkuCommand { get; set; } private void SetBarCode() diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index 85c0bad7..c61bda2c 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -574,10 +574,22 @@ - + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index d8b00898..5bacd36b 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -13,7 +13,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - Height="800" Width="1305"> + Height="700" Width="1305"> @@ -37,7 +37,7 @@ - + @@ -290,7 +290,7 @@ - + @@ -344,9 +344,6 @@ - - - - From 2c2d2b8fa57844de4ae6b60ea200fe69c823e592 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 21 May 2023 21:30:59 +0800 Subject: [PATCH 06/12] 1 --- .../APIServices/PackPurchaseTaskService.cs | 6 + BBWY.Client/APIServices/PurchaseService.cs | 15 ++ BBWY.Client/BBWYAppSettings.json | 4 +- .../PackPurchaseTask/ConfigPackResponse.cs | 61 +++++---- .../PackPurchaseTask/QualityTaskResponse.cs | 111 +++++++++++++++ .../PurchaseSkuBasicInfoResponse.cs | 56 ++++++++ BBWY.Client/Models/PackTask/PackTaskModel.cs | 21 +-- BBWY.Client/Models/QualityTask/PurchaseSku.cs | 2 + .../QualityTask/QualityViewModel.cs | 128 ++++++++++++++++-- .../Views/PackTask/WareHouseListControl.xaml | 8 +- .../Views/QualityTask/QualityWindow.xaml | 60 ++++++-- 11 files changed, 405 insertions(+), 67 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs create mode 100644 BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs index bfd26b7d..16a0925b 100644 --- a/BBWY.Client/APIServices/PackPurchaseTaskService.cs +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -1,5 +1,6 @@ using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel.Request; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Common.Http; using BBWY.Common.Models; @@ -89,6 +90,11 @@ namespace BBWY.Client.APIServices } + public ApiResponse GetQualityTask(long taskId) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/GetQualityTask?taskId={taskId}", null, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/APIServices/PurchaseService.cs b/BBWY.Client/APIServices/PurchaseService.cs index 8a5c92ca..19bc8b84 100644 --- a/BBWY.Client/APIServices/PurchaseService.cs +++ b/BBWY.Client/APIServices/PurchaseService.cs @@ -80,5 +80,20 @@ namespace BBWY.Client.APIServices { return SendRequest(globalContext.BBYWApiHost, $"api/purchasescheme/DeletePurchaseScheme/{schemeId}", null, null, HttpMethod.Delete); } + + + + public ApiResponse GetPurchaseSkuBasicInfo(string purchaseProductId, Platform platform = Platform.阿里巴巴, int priceMode = 0, int firstApiMode = 0) + { + + + return SendRequest("http://bbwyb.qiyue666.com", $"Api/PurchaseScheme/GetPurchaseSkuBasicInfo", new + { + purchaseProductId, + platform, + priceMode, + firstApiMode + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/BBWYAppSettings.json b/BBWY.Client/BBWYAppSettings.json index 9622efaf..e1b3dcff 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/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs index f9005265..0e12d342 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/ConfigPackResponse.cs @@ -1,4 +1,5 @@ using BBWY.Client.Models.APIModel.Response.PackTask; +using BBWY.Client.Models.QualityTask; using System; using System.Collections.Generic; using System.Text; @@ -27,36 +28,36 @@ namespace BBWY.Client.Models.APIModel public PackConfig PackConfig { get; set; } } - /// - /// 配件sku - /// - public class PurchaseSku - { - /// - /// 配件图 - /// - public string Logo { get; set; } - /// - /// 配件商品Id - /// - public string PurchaseSkuId { get; set; } + ///// + ///// 配件sku + ///// + //public class PurchaseSku + //{ + // /// + // /// 配件图 + // /// + // public string Logo { get; set; } + // /// + // /// 配件商品Id + // /// + // public string PurchaseSkuId { get; set; } - /// - /// 配件商品spuId - /// - public string PurchaseProductId { get; set; } - /// - /// 配件名称 - /// - public string Title { get; set; } - /// - /// 是否需要配置合格证 - /// - public bool IsNeedCer { get; set; } + // /// + // /// 配件商品spuId + // /// + // public string PurchaseProductId { get; set; } + // /// + // /// 配件名称 + // /// + // public string Title { get; set; } + // /// + // /// 是否需要配置合格证 + // /// + // public bool IsNeedCer { get; set; } - /// - /// 合格证配置信息 - /// - public CertificateModel CerDTO { get; set; } - } + // /// + // /// 合格证配置信息 + // /// + // public CertificateModel CerDTO { get; set; } + //} } diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs new file mode 100644 index 00000000..84b3a937 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -0,0 +1,111 @@ +using BBWY.Client.Models.QualityTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask +{ + public class QualityTaskResponse + { + /// + /// 任务id + /// + public long Id { get; set; } + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + /// + /// 备注信息 + /// + public string MarkMessage { get; set; } + /// + /// Sku打包数量 + /// + public int SkuCount { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + + /// + /// sku标题 + /// + public string SkuName { get; set; } + /// + /// 采购方案id + /// + public string SkuPurchaseSchemeId { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + /// + /// 货号品名(手写上传) + /// + public string BrandName { get; set; } + /// + /// 货号 + /// + public string ProductNo { get; set; } + /// + /// 分箱配置 + /// + public WareHourseDTO[] WareHourses { get; set; } + + + public BarCodeModel BarCodeDTO { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedCer { get; set; } + + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + /// + /// 配件列表 + /// + public PurchaseSku[] PurchaseSkus { get; set; } + } + public class WareHourseDTO + { + + public int Index { get; set; } + public string WareId { get; set; } + /// + /// 仓库名称 + /// + public string WareName { get; set; } + /// + /// 数量 + /// + public int Count { get; set; } + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs b/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs new file mode 100644 index 00000000..24e194cd --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PurchaseOrder/PurchaseSkuBasicInfoResponse.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models +{ + + /// + /// 采购Sku基础信息对象 + /// + public class PurchaseSkuBasicInfoResponse + { + /// + /// 采购SKU基础信息列表 + /// + public IList ItemList { get; set; } + + /// + /// 采购商 + /// + public Purchaser Purchaser { get; set; } + } + + /// + /// 采购Sku基础信息对象 + /// + public class PurchaseSkuItemBasicInfoResponse + { + /// + /// 采购SPU + /// + public string PurchaseProductId { get; set; } + + /// + /// 采购SKU + /// + public string PurchaseSkuId { get; set; } + + /// + /// 采购SPEC 1688独有属性 下单需要 + /// + public string PurchaseSkuSpecId { get; set; } + + /// + /// SKU标题 + /// + public string Title { get; set; } + + public string Logo { get; set; } + + /// + /// 单价 + /// + public decimal Price { get; set; } + } +} diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index c0db5732..e6a27041 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -95,18 +95,19 @@ namespace BBWY.Client.Models //加载数据 ViewModelLocator viewModelLocator = new ViewModelLocator(); var qualityViewModel = viewModelLocator.QualityTask; - qualityViewModel.TaskCount = SkuCount; - qualityViewModel.TaskId = TaskId; + //qualityViewModel.TaskCount = SkuCount; + // qualityViewModel.TaskId = TaskId; qualityViewModel.OrderId = OrderId; qualityViewModel.SkuId = SkuId; - qualityViewModel.LoadPackDatas(); - qualityViewModel.SetAllFees = new Action>((feesItem, packUsers) => - { - FeesItemResponse = feesItem; - PackUser = string.Join("\r\n", packUsers); - FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; - IsShowFees = feesItem.AllFees > 0 ? true : false; - }); + qualityViewModel.SearchSku(this); + //qualityViewModel.LoadPackDatas(); + //qualityViewModel.SetAllFees = new Action>((feesItem, packUsers) => + //{ + // FeesItemResponse = feesItem; + // PackUser = string.Join("\r\n", packUsers); + // FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; + // IsShowFees = feesItem.AllFees > 0 ? true : false; + //}); service.Show(); } diff --git a/BBWY.Client/Models/QualityTask/PurchaseSku.cs b/BBWY.Client/Models/QualityTask/PurchaseSku.cs index 01693fe1..2b521a38 100644 --- a/BBWY.Client/Models/QualityTask/PurchaseSku.cs +++ b/BBWY.Client/Models/QualityTask/PurchaseSku.cs @@ -11,6 +11,8 @@ namespace BBWY.Client.Models.QualityTask public class PurchaseSku : NotifyObject { + public string PurchaseProductId { get; set; } + /// /// 配件图 /// diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index ba6b5dbd..101eedda 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -13,10 +13,13 @@ using System.Windows.Input; using System.Windows; using BBWY.Client.Models.QualityTask; using BBWY.Client.Views.QualityTask; +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; +using NPOI.Util.ArrayExtensions; +using static Org.BouncyCastle.Math.EC.ECCurve; namespace BBWY.Client.ViewModels { - public class QualityViewModel:BaseVM,IDenpendency + public class QualityViewModel : BaseVM, IDenpendency { #region 属性 @@ -68,6 +71,25 @@ namespace BBWY.Client.ViewModels }; public ObservableCollection AvailabilityList { get => availabilityList; set { Set(ref availabilityList, value); } } + + private ObservableCollection preCompeteTimeDayList = new ObservableCollection { + "今天" + }; + public ObservableCollection PreCompeteTimeDayList { get => preCompeteTimeDayList; set { Set(ref preCompeteTimeDayList, value); } } + + + private ObservableCollection preCompeteTimeHourList = new ObservableCollection { + 12,18,21 + }; + public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } + + + private ObservableCollection wareHourseList = new ObservableCollection { }; + public ObservableCollection WareHourseList { get => wareHourseList; set { Set(ref wareHourseList, value); } } + + + public int WareHourseCount { get; set; } + private int skuCount; /// /// Sku任务数 @@ -299,7 +321,7 @@ namespace BBWY.Client.ViewModels SetCertificateCommand = new RelayCommand(SetCertificate); LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); - SearchSkuCommand = new RelayCommand(SearchSku); + //SearchSkuCommand = new RelayCommand(SearchSku); IncreateList = new ObservableCollection(); foreach (var item in increates) { @@ -324,13 +346,6 @@ namespace BBWY.Client.ViewModels public string ShopId { get; set; } public string UserName { get; set; } - public void Test(OrderSku order) - { - SearchSku(order); - - - } - #region 方法 public ICommand SetBarCodeCommand { get; set; } public ICommand SetCertificateCommand { get; set; } @@ -429,9 +444,99 @@ namespace BBWY.Client.ViewModels /// /// 搜索 skuId(todo:) /// - public void SearchSku(object obj) + public void SearchSku(PackTaskModel model) { InitData(); + + + SkuId = model.SkuId; + SkuName = model.ItemList[0].SkuName; + Logo = model.ItemList[0].Logo.Replace("80x80", "200x200"); + BrandName = model.ItemList[0].BrandName; + + SkuCount = model.SkuCount; + + ProductNo = model.ProductNo; + MarkMessage = model.MarkMessage; + PackType = model.PackType; + GoodsNumber = model.GoodsNumber; + SkuTitle = model.SkuTitle; + BasicPack = model.BasicPack; + CertificatePosition = model.CertificatePosition ; + + + string[] increateDatas = model.Increment1?.Split(','); + bool isSelected = false; + 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 + }); + }); + } + + + var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); + if (packTaskRes == null || !packTaskRes.Success) return; + BarCodeModel = packTaskRes.Data.BarCodeDTO; + IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; + IsSetBarCode = packTaskRes.Data.IsNeedBar ? false : true; + IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; + if (packTaskRes.Data.WareHourses != null) + packTaskRes.Data.WareHourses.ToList().ForEach(w => + { + WareHourseList.Add(w); + }); + if (packTaskRes.Data.PurchaseSkus != null) + { + PurchaseSkuList = new ObservableCollection(); + + foreach (var item in packTaskRes.Data.PurchaseSkus) + { + if (string.IsNullOrEmpty(item.PurchaseProductId)) + { + PurchaseSkuList.Add(item);continue; + } + + var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); + if (list == null) + { + PurchaseSkuList.Add(item); continue; + } + + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + App.Current.Dispatcher.Invoke(new Action(() => + { + PurchaseSkuList.Add(new PurchaseSku + { + Logo = skuItem.Logo, + Title = skuItem.Title, + IsNeedCer = item.IsNeedCer, + PurchaseSkuId = item.PurchaseSkuId, + CerDTO = item.CerDTO, + IsSetCertificate = item.CerDTO == null ? true : false, + }); + })); + PurchaseSkuList.Add(item); + } + } + + + + + + + + } public Action ReflashWindow { get; set; } public void InitData() @@ -451,6 +556,7 @@ namespace BBWY.Client.ViewModels IsNeedBarCode = Need.需要; IsNeedCertificateModel = Need.不需要; } + private void OpenSkuDetail(object param) { var paramList = (object[])param; @@ -470,7 +576,7 @@ namespace BBWY.Client.ViewModels } } - + #endregion } } diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index c61bda2c..db92ba51 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -574,14 +574,14 @@ - - + - diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 5bacd36b..4f910c29 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -116,33 +116,33 @@ - + - + - + - + - - + - + @@ -155,7 +155,47 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -199,7 +239,7 @@ Width="150" Height="150" VerticalAlignment="Top" Margin="25 0 0 0" Cursor="Hand"> - + From 05125d3cb9cd199d0e969af63b3c72a7dfb96d59 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 22 May 2023 21:09:30 +0800 Subject: [PATCH 07/12] 1 --- .../APIServices/PackPurchaseTaskService.cs | 7 + BBWY.Client/App.xaml.cs | 2 + .../APIModel/Request/QualityTaskRequest.cs | 97 ++++++++ .../PackPurchaseTask/QualityTaskResponse.cs | 6 + .../QualityTask/QualityViewModel.cs | 221 ++++++++++++++---- .../Views/PackTask/LookBarCodeWindow.xaml | 73 +----- .../Views/PackTask/PrintWindow.xaml.cs | 4 - BBWY.Client/Views/PackTask/SetBarCode.xaml | 3 +- BBWY.Client/Views/PackTask/SetCerControl.xaml | 18 +- .../Views/QualityTask/BatchPrintWindow.xaml | 75 ++++++ .../QualityTask/BatchPrintWindow.xaml.cs | 205 ++++++++++++++++ .../QualityTask/QualitySetCerControl.xaml | 164 +++++++++++++ .../QualityTask/QualitySetCerControl.xaml.cs | 52 +++++ .../QualityTask/QualitySetCerWindow.xaml | 11 +- .../QualityTask/QualitySetCerWindow.xaml.cs | 23 +- .../Views/QualityTask/QualityWindow.xaml | 161 +++++++++---- 16 files changed, 931 insertions(+), 191 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs create mode 100644 BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml create mode 100644 BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml create mode 100644 BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs index 16a0925b..23f0aee9 100644 --- a/BBWY.Client/APIServices/PackPurchaseTaskService.cs +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -96,5 +96,12 @@ namespace BBWY.Client.APIServices return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/GetQualityTask?taskId={taskId}", null, null, HttpMethod.Post); } + + public ApiResponse CompeteQualityTask(QualityTaskRequest competeQualityTask) + { + + return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/CompeteQualityTask", competeQualityTask, null, HttpMethod.Post); + + } } } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index e749423e..5014528f 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -6,8 +6,10 @@ using BBWY.Common.Http; using BBWY.Common.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; using QuanTan.SDK.Client; using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.MemoryMappedFiles; diff --git a/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs new file mode 100644 index 00000000..fb10e901 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/QualityTaskRequest.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel.Request +{ + public class QualityTaskRequest + { + + /// + /// 任务id + /// + public long TaskId { get; set; } + /// + /// 拳探订单id + /// + public string OrderId { get; set; } + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// 备注信息 + /// + public string MarkMessage { get; set; } + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public BasicPack BasicPack { get; set; } + + /// + /// 打包类型(单件=0,多件=1) + /// + public PackType PackType { get; set; } + /// + /// 货号品名(手写上传) + /// + public string BrandName { get; set; } + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public CertificatePosition CertificatePosition { get; set; } + + /// + /// 合格证id + /// + public string CerId { get; set; } + /// + /// 显示的条码Id + /// + public long? BarcodeId { get; set; } + //public BarCodeDTO BarCodeDTO { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedBar { get; set; } + /// + /// 是否需要合格证 + /// + public bool IsNeedCer { get; set; } + + ///// + ///// 配件列表 + ///// + //public PurchaseSku[] PurchaseSkus { get; set; } + + /// + /// 到货数量 + /// + public int ArrivalQuantity { get; set; } + + /// + /// 良品数量 + /// + public int GoodProductQuantity { get; set; } + + /// + /// 预计完成时间 + /// + public DateTime? PreCompeteTime { get; set; } + + } +} diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index 84b3a937..2da69ce7 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -97,7 +97,13 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask public class WareHourseDTO { + /// + /// 序号 + /// public int Index { get; set; } + /// + /// 仓库id + /// public string WareId { get; set; } /// /// 仓库名称 diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 101eedda..ef412e62 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -15,7 +15,11 @@ using BBWY.Client.Models.QualityTask; using BBWY.Client.Views.QualityTask; using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; using NPOI.Util.ArrayExtensions; -using static Org.BouncyCastle.Math.EC.ECCurve; +using System.Threading.Tasks; +using Org.BouncyCastle.Asn1.Crmf; +using System.Runtime.InteropServices.WindowsRuntime; +using NPOI.Util; +using BBWY.Controls; namespace BBWY.Client.ViewModels { @@ -23,6 +27,25 @@ namespace BBWY.Client.ViewModels { #region 属性 + + public int goodProductQuantity; + public int arrivalQuantity; + + /// + /// 到货数量 + /// + public int ArrivalQuantity { get => arrivalQuantity; set { Set(ref arrivalQuantity, value); } } + + /// + /// 良品数量 + /// + public int GoodProductQuantity { get => goodProductQuantity; set { Set(ref goodProductQuantity, value); } } + + /// + /// 预计完成时间 + /// + public DateTime? PreCompeteTime { get; set; } + private ObservableCollection purchaseSkuList; public ObservableCollection PurchaseSkuList { get => purchaseSkuList; set { Set(ref purchaseSkuList, value); } } @@ -78,17 +101,23 @@ namespace BBWY.Client.ViewModels public ObservableCollection PreCompeteTimeDayList { get => preCompeteTimeDayList; set { Set(ref preCompeteTimeDayList, value); } } - private ObservableCollection preCompeteTimeHourList = new ObservableCollection { - 12,18,21 + private ObservableCollection preCompeteTimeHourList = new ObservableCollection { + "12点前","18点前","21点前" }; - public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } + public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } + + + public string preCompeteTimeHour; + public string PreCompeteTimeHour { get => preCompeteTimeHour; set { Set(ref preCompeteTimeHour, value); } } private ObservableCollection wareHourseList = new ObservableCollection { }; public ObservableCollection WareHourseList { get => wareHourseList; set { Set(ref wareHourseList, value); } } + private int wareHourseCount; + public int WareHourseCount { get => wareHourseCount; set { Set(ref wareHourseCount, value); } } + - public int WareHourseCount { get; set; } private int skuCount; /// @@ -308,6 +337,23 @@ namespace BBWY.Client.ViewModels GlobalContext globalContext; private bool isLoading = false; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } + + PurchaseService purchaseService; + public string OriginShopName { get; set; } + public string SkuPurchaseSchemeId { get; set; } + public Platform Platform { get; set; } + public string ShopId { get; set; } + public long TaskId { get; set; } + public string UserName { get; set; } + + public ICommand SetBarCodeCommand { get; set; } + public ICommand SetCertificateCommand { get; set; } + public ICommand LookBarCommand { get; set; } + public ICommand LookCerCommand { get; set; } + + public ICommand OpenSkuDetailCommand { get; set; } + public ICommand CompeteQualityTaskCommand { get; set; } + public ICommand SearchSkuCommand { get; set; } #endregion public QualityViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService, PackTaskService packTaskService) @@ -322,6 +368,7 @@ namespace BBWY.Client.ViewModels LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); //SearchSkuCommand = new RelayCommand(SearchSku); + CompeteQualityTaskCommand = new RelayCommand(CompeteQualityTask); IncreateList = new ObservableCollection(); foreach (var item in increates) { @@ -339,22 +386,103 @@ namespace BBWY.Client.ViewModels //Test(); #endif } - PurchaseService purchaseService; - public string OriginShopName { get; set; } - public string SkuPurchaseSchemeId { get; set; } - public Platform Platform { get; set; } - public string ShopId { get; set; } - public string UserName { get; set; } + #region 方法 - public ICommand SetBarCodeCommand { get; set; } - public ICommand SetCertificateCommand { get; set; } - public ICommand LookBarCommand { get; set; } - public ICommand LookCerCommand { get; set; } + private void CompeteQualityTask(object obj) + { + + + if (GoodProductQuantity > ArrivalQuantity) + { + MessageBox.Show($"良品数量:{GoodProductQuantity}不能大于到货数量:{ArrivalQuantity}"); + return; + } + + if (ArrivalQuantity == 0) + { + MessageBox.Show($"到货数量不能:{ArrivalQuantity}!"); + return; + } + + var request = new Models.APIModel.Request.QualityTaskRequest + { + BasicPack = BasicPack, + ArrivalQuantity = ArrivalQuantity, + GoodProductQuantity = GoodProductQuantity, + Increment1 = string.Join(",", IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName)), + BrandName = BrandName, + CertificatePosition = CertificatePosition, + MarkMessage = MarkMessage, + OrderId = OrderId, + PackType = PackType, + GoodsNumber = GoodsNumber, + SkuGoodsTitle = SkuTitle, + SkuId = SkuId, + IsNeedBar = IsNeedBarCode == Need.需要, + IsNeedCer = IsNeedCertificateModel == Need.需要, + TaskId = TaskId + + + + }; + if (IsNeedBarCode == Need.需要) + { + if (BarCodeModel.Id <= 0) + { + MessageBox.Show("条形码不能为空"); + return; + } + request.BarcodeId = BarCodeModel.Id; + } + if (IsNeedCertificateModel == Need.需要) + { + if (PurchaseSkuList == null && PurchaseSkuList.Count <= 0) + { + MessageBox.Show("无可用的合格证打印!"); + return; + } + if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) + { + MessageBox.Show("存在未确认的合格证,请先完成确认!"); + return; + } + if (PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Count() <= 0) + { + MessageBox.Show("无可选的合格证打印!"); + return; + } + request.CerId = string.Join(",", PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO.Id)); + + } + + int hour = Convert.ToInt32(PreCompeteTimeHour.Replace("点前", "")); + request.PreCompeteTime = DateTime.Now.Date.AddHours(hour); + + + var competeRes = packPurchaseTaskService.CompeteQualityTask(request); + if (competeRes == null) + { + MessageBox.Show("网络异常"); + return; + } + if (!competeRes.Success) + { + MessageBox.Show(competeRes.Msg); + return; + } + BatchPrintWindow batchPrint = new BatchPrintWindow(); + + batchPrint.SetData(GoodProductQuantity, + PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() + , BarCodeModel); + + batchPrint.ShowDialog(); + var window = obj as BWindow; + window.Close(); + } + - public ICommand OpenSkuDetailCommand { get; set; } - public ICommand CreateTaskCommand { get; set; } - public ICommand SearchSkuCommand { get; set; } private void SetBarCode() { @@ -447,22 +575,22 @@ namespace BBWY.Client.ViewModels public void SearchSku(PackTaskModel model) { InitData(); - + TaskId = model.TaskId; SkuId = model.SkuId; SkuName = model.ItemList[0].SkuName; - Logo = model.ItemList[0].Logo.Replace("80x80", "200x200"); + Logo = model.ItemList[0].Logo.Replace("80x80", "200x200").Replace("200x200", "150x150"); BrandName = model.ItemList[0].BrandName; SkuCount = model.SkuCount; - + ProductNo = model.ProductNo; MarkMessage = model.MarkMessage; PackType = model.PackType; GoodsNumber = model.GoodsNumber; SkuTitle = model.SkuTitle; BasicPack = model.BasicPack; - CertificatePosition = model.CertificatePosition ; + CertificatePosition = model.CertificatePosition; string[] increateDatas = model.Increment1?.Split(','); @@ -496,15 +624,17 @@ namespace BBWY.Client.ViewModels { WareHourseList.Add(w); }); + WareHourseCount = WareHourseList.Count(); if (packTaskRes.Data.PurchaseSkus != null) { - PurchaseSkuList = new ObservableCollection(); + foreach (var item in packTaskRes.Data.PurchaseSkus) { + item.IsSetCertificate = true; if (string.IsNullOrEmpty(item.PurchaseProductId)) { - PurchaseSkuList.Add(item);continue; + PurchaseSkuList.Add(item); continue; } var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); @@ -512,36 +642,37 @@ namespace BBWY.Client.ViewModels { PurchaseSkuList.Add(item); continue; } - - var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); - App.Current.Dispatcher.Invoke(new Action(() => + + var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + App.Current.Dispatcher.Invoke(new Action(() => + { + PurchaseSkuList.Add(new PurchaseSku { - PurchaseSkuList.Add(new PurchaseSku - { - Logo = skuItem.Logo, - Title = skuItem.Title, - IsNeedCer = item.IsNeedCer, - PurchaseSkuId = item.PurchaseSkuId, - CerDTO = item.CerDTO, - IsSetCertificate = item.CerDTO == null ? true : false, - }); - })); - PurchaseSkuList.Add(item); + Logo = skuItem.Logo, + Title = skuItem.Title, + IsNeedCer = item.IsNeedCer, + PurchaseSkuId = item.PurchaseSkuId, + CerDTO = item.CerDTO, + IsSetCertificate = item.IsSetCertificate, + }); + })); + //PurchaseSkuList.Add(item); } } - - - - - - + + + + + + } public Action ReflashWindow { get; set; } public void InitData() { - + PurchaseSkuList = new ObservableCollection(); + WareHourseList = new ObservableCollection(); IsSetBarCode = true; SkuTitle = ""; BrandName = ""; diff --git a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml index 1302fa8a..defbffe6 100644 --- a/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookBarCodeWindow.xaml @@ -31,78 +31,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs index c08d9268..7f91e2a0 100644 --- a/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/PrintWindow.xaml.cs @@ -133,11 +133,7 @@ namespace BBWY.Client.Views.PackTask PrintData(printCount, printName,null,cer); System.Threading.Thread.Sleep(100); } - } - - - }); } diff --git a/BBWY.Client/Views/PackTask/SetBarCode.xaml b/BBWY.Client/Views/PackTask/SetBarCode.xaml index f797d050..8dc050ee 100644 --- a/BBWY.Client/Views/PackTask/SetBarCode.xaml +++ b/BBWY.Client/Views/PackTask/SetBarCode.xaml @@ -1,5 +1,5 @@  - + diff --git a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml new file mode 100644 index 00000000..eb412902 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs new file mode 100644 index 00000000..6b581ad3 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs @@ -0,0 +1,205 @@ +using BBWY.Client.Helpers; +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using BBWY.Controls; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Printing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// BatchPrintWindow.xaml 的交互逻辑 + /// + public partial class BatchPrintWindow : BWindow + { + public BatchPrintWindow() + { + InitializeComponent(); + this.Loaded += BatchPrintWindow_Loaded; + } + + public void SetData(int GoodProductQuantity, CertificateModel[] CertificateModel, BarCodeModel BarCodeModel) + { + this.BarCodeModel = BarCodeModel; + this.GoodProductQuantity = GoodProductQuantity; + goodProductQuantity.Text = GoodProductQuantity.ToString(); + this.CertificateModel = CertificateModel; + + this.DataContext = this; + } + + + + public CertificateModel[] CertificateModel { get; set; } + + public BarCodeModel BarCodeModel { get; set; } + + + public int GoodProductQuantity { get; set; } + + private void BatchPrintWindow_Loaded(object sender, RoutedEventArgs e) + { + LoadPrints(); + } + /// + /// 获取打印机名称 + /// + private void LoadPrints() + { + var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据 + int index = -1; + int selectIndex = 0; + foreach (string name in printingNames) + { + if (name == "Microsoft XPS Document Writer" || name == "Microsoft Print to PDF" || name == "Fax") + { + continue; + } + index++; + if (name.Contains("Deli")) + { + selectIndex = index; + } + cbPrints.Items.Add(name); + } + if (cbPrints.Items.Count > selectIndex) + { + cbPrints.SelectedIndex = selectIndex; + } + } + + + + + private void PrintData(int printCount, string printName, BarCodeModel barCode = null, CertificateModel certificateModel = null) + { + try + { + + PrintDocument document = new PrintDocument(); + document.PrinterSettings.PrinterName = printName;//使用打印机名称,指定特定的打印机进行打印。 + //设置打印页面 + //document.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 236, 157); + document.PrintPage += (s, a) => + { + Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular); + if (barCode != null) + { + MyPrintHelper.PrintBarcode(ref a, barCode, font); + } + if (certificateModel != null) + { + MyPrintHelper.PrintCertificate(ref a, certificateModel, font); + } + + }; + document.PrinterSettings.Copies = (short)printCount;//打印份数 + document.Print(); + + } + catch (Exception ex) + { + App.Current.Dispatcher.Invoke(() => + { + new TipsWindow($"打印失败,{ex.Message}").Show(); + }); + + } + } + + private void Document_PrintPage(object sender, PrintPageEventArgs args) + { + + Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular); + if (BarCodeModel != null) + { + MyPrintHelper.PrintBarcode(ref args, BarCodeModel, font); + } + if (CertificateModel != null) + { + foreach (var cer in CertificateModel) + { + MyPrintHelper.PrintCertificate(ref args, cer, font); + } + + } + + } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + int cerNum = 0, barNum = 0; + if (!string.IsNullOrEmpty(cerNumber.Text)) + try + { + cerNum = Convert.ToInt32(cerNumber.Text); + } + catch + { + MessageBox.Show("请输入数字"); + return; + } + if (!string.IsNullOrEmpty(barNumber.Text)) + try + { + cerNum = Convert.ToInt32(barNumber.Text); + } + catch + { + MessageBox.Show("请输入数字"); + return; + } + + + + if (barNum > 0) + { + if (BarCodeModel == null) + { + MessageBox.Show("未设置条形码模板"); + return; + } + } + if (cerNum > 0) + { + if (CertificateModel == null || CertificateModel.Count() <= 0) + { + MessageBox.Show("未设置合格证模板"); + return; + } + } + + string printName = cbPrints.Text; + Task.Factory.StartNew(() => + { + + if (barNum > 0) + { + if (BarCodeModel != null) + PrintData(barNum, printName, BarCodeModel); + + } + if (cerNum > 0) + { + if (CertificateModel != null && CertificateModel.Count() > 0) + foreach (var cer in CertificateModel) + PrintData(cerNum, printName, null, cer); + } + }); + + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml new file mode 100644 index 00000000..2d0603ed --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs new file mode 100644 index 00000000..cec000a1 --- /dev/null +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs @@ -0,0 +1,52 @@ +using BBWY.Client.Models; +using BBWY.Client.Views.PackTask; +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BBWY.Client.Views.QualityTask +{ + /// + /// QualitySetCerControl.xaml 的交互逻辑 + /// + public partial class QualitySetCerControl : UserControl + { + public QualitySetCerControl() + { + InitializeComponent(); + } + + /// + /// + /// + public CertificateModel model + { + get { return (CertificateModel)GetValue(modelProperty); } + set + { + SetValue(modelProperty, value); + } + } + public static readonly DependencyProperty modelProperty = + DependencyProperty.Register("model", typeof(CertificateModel), typeof(QualitySetCerControl), new PropertyMetadata(ChangedProperty)); + + private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //var control = d as CerControl; + //var data = e.NewValue as CertificateModel; + //if (data != null) + //{ + // control.SetData(data); + //} + } + } +} diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml index 5b587f02..970feb65 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml @@ -3,16 +3,17 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" + + xmlns:local ="clr-namespace:BBWY.Client.Views.QualityTask" xmlns:cmodel="clr-namespace:BBWY.Client.Models" mc:Ignorable="d" xmlns:c ="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" CloseButtonVisibility="Visible" CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" - MaxButtonVisibility="Collapsed" + MaxButtonVisibility="Collapsed" Height="480" Width="383" RightButtonGroupMargin="0,5,5,0"> - + @@ -41,12 +42,12 @@ - + - diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index 0e572aa4..28d2b4ba 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -44,7 +44,6 @@ namespace BBWY.Client.Views.QualityTask } public ICommand SetPackCerStateCommand { get; set; } - //public PackCerState PackCerState { get; set; } public PackCerState PackCerState @@ -63,7 +62,7 @@ namespace BBWY.Client.Views.QualityTask public static readonly DependencyProperty PackCerStateProperty = - DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(SetCerWindow)); + DependencyProperty.Register("PackCerState", typeof(PackCerState), typeof(QualitySetCerWindow)); public bool IsSetSpuCertificate { get; set; } public PackPurchaseTaskService packTaskService { get; set; } @@ -83,8 +82,28 @@ namespace BBWY.Client.Views.QualityTask || string.IsNullOrEmpty(CertificateModel.ProductAdress)) { //new TipsWindow("参数出错!请重新填写!").Show(); + MessageBox.Show("有未填写的参数"); return; } + if((CertificateModel.LabelModel== CertificateLabelModel.标准无3c|| CertificateModel.LabelModel == CertificateLabelModel.标准有3c) && string.IsNullOrEmpty( CertificateModel.ProductNo)) + { + MessageBox.Show("型号不能为空"); + return; + } + if ( CertificateModel.LabelModel == CertificateLabelModel.标准有3c && string.IsNullOrEmpty(CertificateModel.FactoryNumber)) + { + MessageBox.Show("工厂编号不能为空"); + return; + } + if (CertificateModel.LabelModel == CertificateLabelModel.适用年龄 && string.IsNullOrEmpty(CertificateModel.ApplyAge)) + { + MessageBox.Show("适用年龄不能为空"); + return; + } + + + + var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); var resData = packTaskService.SaveCer(new CerRequest diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 4f910c29..8532677f 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -13,7 +13,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - Height="700" Width="1305"> + Height="666" Width="1200"> @@ -46,22 +46,25 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -128,24 +131,23 @@ - - + + - + - + - - + + @@ -153,7 +155,7 @@ - + @@ -179,8 +181,8 @@ - - + + @@ -195,7 +197,7 @@ - + - + @@ -234,10 +236,10 @@ - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -423,14 +492,16 @@ + + - + \ No newline at end of file From 2bcdfd31dc31cac222cb75cf99a8aece35e866b6 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 22 May 2023 21:09:47 +0800 Subject: [PATCH 08/12] 1 --- .../QualityTask/QualitySetCerControl.xaml | 22 ++++++++++--------- .../QualityTask/QualitySetCerControl.xaml.cs | 12 ++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml index 2d0603ed..1222c63d 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml @@ -5,13 +5,23 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BBWY.Client.Views.QualityTask" mc:Ignorable="d" + xmlns:cmodel="clr-namespace:BBWY.Client.Models" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" d:DesignHeight="300" d:DesignWidth="382"> - + + + + + + + + + + + - @@ -42,12 +52,8 @@ - - - - @@ -80,7 +86,6 @@ - @@ -116,7 +121,6 @@ - @@ -157,8 +161,6 @@ - - diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs index cec000a1..265ff4bf 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerControl.xaml.cs @@ -48,5 +48,17 @@ namespace BBWY.Client.Views.QualityTask // control.SetData(data); //} } + private void RadioButton_Checked(object sender, RoutedEventArgs e) + { + var rabtn = sender as RadioButton; + if (rabtn != null && rabtn.CommandParameter != null) + { + var labModel = Enum.Parse(rabtn.CommandParameter.ToString()); + model.LabelModel = labModel; + model.IsLogo = labModel == CertificateLabelModel.标准有3c ? 1 : 0; + } + + var data = e.Source as string; + } } } From d4365cadd05864baa6079ee522d8d2f5da967768 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 22 May 2023 21:31:03 +0800 Subject: [PATCH 09/12] 1 --- BBWY.Client/APIServices/PackPurchaseTaskService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs index 23f0aee9..bf6b8168 100644 --- a/BBWY.Client/APIServices/PackPurchaseTaskService.cs +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -56,7 +56,7 @@ namespace BBWY.Client.APIServices public ApiResponse SaveCer(CerRequest cerRequest) { - return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitSkuCer", cerRequest + return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitCer", cerRequest , null, HttpMethod.Post); } From 4a39b1c555dfadee119c0f44748e99c5dbc65775 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Tue, 23 May 2023 11:25:18 +0800 Subject: [PATCH 10/12] 1 --- .../APIServices/PackPurchaseTaskService.cs | 2 +- BBWY.Client/Models/QualityTask/PurchaseSku.cs | 7 ++++++- .../ViewModels/QualityTask/QualityViewModel.cs | 16 +++++++++++++--- .../Views/QualityTask/BatchPrintWindow.xaml.cs | 7 ++++++- .../QualityTask/QualitySetCerWindow.xaml.cs | 5 ++++- BBWY.Client/Views/QualityTask/QualityWindow.xaml | 6 +++--- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs index bf6b8168..4031fb82 100644 --- a/BBWY.Client/APIServices/PackPurchaseTaskService.cs +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -56,7 +56,7 @@ namespace BBWY.Client.APIServices public ApiResponse SaveCer(CerRequest cerRequest) { - return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitCer", cerRequest + return SendRequest(globalContext.QKApiHost, "api/Certificate/CommitCerData", cerRequest , null, HttpMethod.Post); } diff --git a/BBWY.Client/Models/QualityTask/PurchaseSku.cs b/BBWY.Client/Models/QualityTask/PurchaseSku.cs index 2b521a38..67f253c9 100644 --- a/BBWY.Client/Models/QualityTask/PurchaseSku.cs +++ b/BBWY.Client/Models/QualityTask/PurchaseSku.cs @@ -45,10 +45,15 @@ namespace BBWY.Client.Models.QualityTask /// 是否需要配置合格证 /// public bool IsNeedCer { get => isNeedCer; set { Set(ref isNeedCer, value); } } + + /// + /// 合格证配置信息 + /// + public CertificateModel cerDTO; /// /// 合格证配置信息 /// - public CertificateModel CerDTO { get; set; } + public CertificateModel CerDTO { get => cerDTO; set { Set(ref cerDTO, value); } } private bool isSetCertificate; /// diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index ef412e62..14dfaeb2 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -366,7 +366,7 @@ namespace BBWY.Client.ViewModels SetBarCodeCommand = new RelayCommand(SetBarCode); SetCertificateCommand = new RelayCommand(SetCertificate); LookBarCommand = new RelayCommand(LookBar); - LookCerCommand = new RelayCommand(LookCer); + LookCerCommand = new RelayCommand(LookCer); //SearchSkuCommand = new RelayCommand(SearchSku); CompeteQualityTaskCommand = new RelayCommand(CompeteQualityTask); IncreateList = new ObservableCollection(); @@ -541,6 +541,15 @@ namespace BBWY.Client.ViewModels setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); setCerWindow.SaveResult = (s, PackCerState) => { + if (string.IsNullOrEmpty(s.PurchaseSkuId)) + { + var sku = PurchaseSkuList.SingleOrDefault(p => p.CerDTO.GoodsNumber == s.GoodsNumber); + sku.CerDTO = s; + sku.IsSetCertificate = false; + sku.IsNeedCer = PackCerState == PackCerState.合格证信息; + IsNeedCertificateModel = Need.需要; + return; + } var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId); skus.CerDTO = s; skus.IsSetCertificate = false; @@ -554,9 +563,10 @@ namespace BBWY.Client.ViewModels /// /// 查看合格证 /// - private void LookCer(string id) + private void LookCer(CertificateModel certificate) { - QualityLookCerWindow lookCerWindow = new QualityLookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO); + + QualityLookCerWindow lookCerWindow = new QualityLookCerWindow(certificate); lookCerWindow.Show(); } /// diff --git a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs index 6b581ad3..8f7a5be7 100644 --- a/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/BatchPrintWindow.xaml.cs @@ -155,7 +155,7 @@ namespace BBWY.Client.Views.QualityTask if (!string.IsNullOrEmpty(barNumber.Text)) try { - cerNum = Convert.ToInt32(barNumber.Text); + barNum = Convert.ToInt32(barNumber.Text); } catch { @@ -198,6 +198,11 @@ namespace BBWY.Client.Views.QualityTask foreach (var cer in CertificateModel) PrintData(cerNum, printName, null, cer); } + + App.Current.Dispatcher.Invoke(new Action(() => + { + this.Close(); + })); }); } diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index 28d2b4ba..2f1dd2d7 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -106,6 +106,8 @@ namespace BBWY.Client.Views.QualityTask var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); + + var resData = packTaskService.SaveCer(new CerRequest { Brand = CertificateModel.Brand, @@ -122,7 +124,8 @@ namespace BBWY.Client.Views.QualityTask ApplyAge = CertificateModel.ApplyAge, GoodsNumber = CertificateModel.GoodsNumber, ProduceDate = CertificateModel.ProduceDate, - PurchaseSkuId = CertificateModel.PurchaseSkuId + PurchaseSkuId = CertificateModel.PurchaseSkuId, + }); if (resData == null || !resData.Success) diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 8532677f..66e382f4 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -345,7 +345,7 @@ - + @@ -353,7 +353,7 @@ + Visibility="{Binding IsNeedCer, Converter={StaticResource objConverter}, ConverterParameter=true:Visible:Collapsed }"> Date: Wed, 24 May 2023 14:20:56 +0800 Subject: [PATCH 11/12] 1 --- .../APIServices/PackPurchaseTaskService.cs | 13 +- BBWY.Client/APIServices/PackTaskService.cs | 41 ++- BBWY.Client/Extensions/CopyExtensions.cs | 9 + .../PackPurchaseTask/QualityTaskResponse.cs | 4 + .../PackTask/ProductSkuCountsResponse.cs | 30 +- .../PackTask/SearchTaskListResponse.cs | 169 ++++++++++ BBWY.Client/Models/Enums.cs | 29 +- BBWY.Client/Models/PackTask/PackTaskModel.cs | 21 +- BBWY.Client/ViewModels/MainViewModel.cs | 16 +- .../PackTask/CreatePackTaskViewModel.cs | 22 +- .../PackTask/PublishTaskViewModel.cs | 13 +- .../ViewModels/PackTask/TaskListViewModel.cs | 14 +- .../PackTask/WareHouseListViewModel.cs | 203 ++++++++---- .../QualityTask/QualityViewModel.cs | 64 ++-- BBWY.Client/Views/PackTask/PackTaskTotal.xaml | 8 +- BBWY.Client/Views/PackTask/WareHouseList.xaml | 308 +++++------------- .../Views/PackTask/WareHouseList.xaml.cs | 145 ++++++++- .../Views/PackTask/WareHouseListControl.xaml | 281 +++------------- .../QualityTask/QualitySetCerWindow.xaml.cs | 20 +- .../Views/QualityTask/QualityWindow.xaml | 42 +-- 20 files changed, 809 insertions(+), 643 deletions(-) create mode 100644 BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs diff --git a/BBWY.Client/APIServices/PackPurchaseTaskService.cs b/BBWY.Client/APIServices/PackPurchaseTaskService.cs index 4031fb82..dc395cb9 100644 --- a/BBWY.Client/APIServices/PackPurchaseTaskService.cs +++ b/BBWY.Client/APIServices/PackPurchaseTaskService.cs @@ -1,4 +1,5 @@ -using BBWY.Client.Models.APIModel; +using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel.Request; using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; using BBWY.Client.Models.APIModel.Response.PackTask; @@ -103,5 +104,15 @@ namespace BBWY.Client.APIServices return SendRequest(globalContext.QKApiHost, $"api/PackPurchaseTask/CompeteQualityTask", competeQualityTask, null, HttpMethod.Post); } + + public ApiResponse SearchBarCode(string skuId) + { + + return SendRequest(globalContext.QKApiHost, $"api/Barcode/SearchBarCodeBySkuId?skuId={skuId}", null, null, HttpMethod.Get); + + } + + + } } diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs index 9c0d5bd7..37a42620 100644 --- a/BBWY.Client/APIServices/PackTaskService.cs +++ b/BBWY.Client/APIServices/PackTaskService.cs @@ -1,5 +1,6 @@ using BBWY.Client.Helpers; using BBWY.Client.Models; +using BBWY.Client.Models.APIModel; using BBWY.Client.Models.APIModel.Request; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.Models.PackTask; @@ -35,6 +36,18 @@ namespace BBWY.Client.APIServices ) { + + if (taskId!=null&&!string.IsNullOrEmpty(taskId.Trim())) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new + { + + + TaskId = taskId, + + ShopId = globalContext.User.Shop.ShopId.ToString() + }, null, HttpMethod.Post); + } return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new { @@ -49,17 +62,24 @@ namespace BBWY.Client.APIServices ShopId = globalContext.User.Shop.ShopId.ToString() }, null, HttpMethod.Post); } - public ApiResponse GetWareHouseList(int? isWorry = null, string departmentName = null, string skuId = null, string taskId = null, + public ApiResponse GetWareHouseList(int? isWorry = null, string departmentName = null, string skuId = null, string taskId = null, DateTime? startTime = null, DateTime? endTime = null, - TaskState? availability = null, - int? taskStatus = null, + PackTaskState? TaskState = null, + string ShopName = null, int pageIndex = 1, int pageSize = 10 - ) { - return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchNewPackTaskList", new + if (taskId != null && !string.IsNullOrEmpty(taskId.Trim())) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new + { + TaskId = taskId + + }, null, HttpMethod.Post); + } + return SendRequest(globalContext.QKApiHost, "api/PackTask/SearchTaskList", new { IsWorry = isWorry, DepartmentName = departmentName, @@ -67,13 +87,13 @@ namespace BBWY.Client.APIServices TaskId = taskId, StartTime = startTime, EndTime = endTime, - Availability = availability, - TaskStatus = taskStatus, + TaskState = TaskState, PageIndex = pageIndex, - PageSize = pageSize + PageSize = pageSize, + ShopName = ShopName, }, null, HttpMethod.Post); } - + @@ -242,6 +262,9 @@ namespace BBWY.Client.APIServices userId = globalContext.User.Id.ToString(), }, null, HttpMethod.Post); } + + + } public class AddConsumableRequest { diff --git a/BBWY.Client/Extensions/CopyExtensions.cs b/BBWY.Client/Extensions/CopyExtensions.cs index c2f2d442..b47fee80 100644 --- a/BBWY.Client/Extensions/CopyExtensions.cs +++ b/BBWY.Client/Extensions/CopyExtensions.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using System; namespace BBWY.Client.Extensions { @@ -9,4 +10,12 @@ namespace BBWY.Client.Extensions return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(p)); } } + + public static class EnumExtension + { + public static T ToEnum(this string value) + { + return (T)Enum.Parse(typeof(T), value); + } + } } diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index 2da69ce7..f8f767c6 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -113,5 +113,9 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask /// 数量 /// public int Count { get; set; } + /// + /// 仓库类型 + /// + public WareType? WareType { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs index 4d7a8813..e6dd9cd9 100644 --- a/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackTask/ProductSkuCountsResponse.cs @@ -6,13 +6,35 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask { public class ProductSkuCountsResponse { - + /// + /// 已到货(质检) + /// public int ArrivedCount { get; set; } - + /// + /// 未到货 + /// public int NoArrivedCount { get; set; } - + /// + /// 部分到货 + /// public int SomeArrivedCount { get; set; } - + /// + /// 加急数量 + /// public int WorryCount { get; set; } + + /// + /// 待打包数 + /// + public int? WaitPackCount { get; set; } + + /// + /// 带封箱数 + /// + public int? WaitSealBox { get; set; } + /// + /// 待出库数 + /// + public int? WaitOutbound { get; set; } } } diff --git a/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs new file mode 100644 index 00000000..27dbc3f8 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/PackTask/SearchTaskListResponse.cs @@ -0,0 +1,169 @@ +using BBWY.Client.Models.APIModel.Response.PackPurchaseTask; +using BBWY.Client.Models.APIModel.Response.PackTask; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Client.Models.APIModel +{ + public class SearchTaskListResponse + { + /// + /// 查询总数据(判断总页数) + /// + public int TotalCount { get; set; } + + /// + /// 页面返回的数据 + /// + public PackTaskData[] Items { get; set; } + } + + + public class PackTaskData + { + /// + /// 图片链接 + /// + public string Logo { get; set; } + + /// + /// 任务id + /// + public long TaskId { get; set; } + + /// + /// 需求方创建日期 + /// + public DateTime CreateTime { get; set; } + + /// + /// 任务状态 + /// + public PackTaskState TaskState { get; set; } + + /// + /// 需求方团队 + /// + public string DepartmentName { get; set; } + + /// + /// 需求方店铺 + /// + public string ShopName { get; set; } + + /// + /// 货号 + /// + public string ProductItemNum { get; set; } + + /// + /// 货号品名 + /// + public string BrandName { get; set; } + + /// + /// 对接人 + /// + public string UserName { get; set; } + + /// + /// 打包人 + /// + public string[] PackUserName { get; set; } + + /// + /// skuid + /// + public string SkuId { get; set; } + /// + /// SKU标题 + /// + public string SkuName { get; set; } + /// + /// sku数量 + /// + public int SkuCount { get; set; } + /// + /// 打包类型(单件=0,多件=1) + /// + public int PackType { get; set; } + + /// + /// 落仓(本地仓=0,齐越仓=1,京东仓=2,聚水潭=3) + /// + public string PositionType { get; set; } + + /// + /// 基础包装(快递袋=0,纸箱=1,麻袋=2) + /// + public int BasicPack { get; set; } + + /// + /// 增量1() + /// + public string Increment1 { get; set; } + + + /// + /// 到货情况(待收货=0,部分收货=1,已到货=2) + /// + public int Availability { get; set; } + + + /// + /// 服务费用数据 + /// + public FeesItemResponse FeesItemResponse { get; set; } + + + /// + /// 合格证位置(外部包装=0,产品包装=1) + /// + public int? CertificatePosition { get; set; } + + + /// + /// sku配件名称 + /// + public string SkuGoodsTitle { get; set; } + + /// + /// 配件数 + /// + public int GoodsNumber { get; set; } + + + /// + /// 注意事项(对接备注) + /// + public string MarkMessage { get; set; } + + + /// + /// 条形码数据 + /// + public BarCodeModel BarCodeDTO { get; set; } + + /// + /// 合格证数据 + /// + public CertificateModel[] Cers { get; set; } + /// + /// 是否加急 + /// + public int IsWorry { get; set; } + + /// + /// 品牌 + /// + public string Brand { get; set; } + + public string OrderId { get; set; } + + /// + ///分箱情况 + /// + public WareHourseDTO[] WareHourses { get; set; } + } +} diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index 42c855db..0a4e7347 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -209,9 +209,9 @@ } - /// - /// 快递到货情况 - /// + ///// + ///// 快递到货情况 + ///// public enum TaskState { 已到货 = 0, @@ -221,6 +221,24 @@ 全部 = 4, 加急 = 5 } + /// + /// 仓库打包任务状态 + /// + public enum PackTaskState + { + 未到货 = 0, + 部分到货 = 1, + 待质检 = 2,//已到货 + 待打包 = 3, + 待封箱 = 4, + 待出库 = 5, + 已完成 = 6, + 已取消 = 7 + } + + + + /// /// 打包类型 /// @@ -422,4 +440,9 @@ { 合格证信息 = 0, 无需合格证 = 1 } + public enum WareType + { + 京仓 = 0, 云仓 = 1, 商家仓 = 2, 聚水潭 = 3 + } + } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index e6a27041..ad43c341 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -1,6 +1,7 @@ using BBWY.Client.APIServices; using BBWY.Client.Models.APIModel.Response.PackTask; using BBWY.Client.ViewModels; +using BBWY.Client.ViewModels.PackTask; using BBWY.Client.Views.PackTask; using BBWY.Client.Views.QualityTask; using GalaSoft.MvvmLight.Command; @@ -95,8 +96,11 @@ namespace BBWY.Client.Models //加载数据 ViewModelLocator viewModelLocator = new ViewModelLocator(); var qualityViewModel = viewModelLocator.QualityTask; + + if (qualityViewModel.ReflashWindow == null) + qualityViewModel.ReflashWindow = ReflashTask; //qualityViewModel.TaskCount = SkuCount; - // qualityViewModel.TaskId = TaskId; + // qualityViewModel.TaskId = TaskId; qualityViewModel.OrderId = OrderId; qualityViewModel.SkuId = SkuId; qualityViewModel.SearchSku(this); @@ -122,12 +126,16 @@ namespace BBWY.Client.Models serviceViewModel.OrderId= OrderId; serviceViewModel.SkuId =SkuId ; serviceViewModel.LoadPackDatas(); + + serviceViewModel.SetAllFees = new Action>((feesItem, packUsers) => { FeesItemResponse = feesItem; PackUser = string.Join("\r\n", packUsers); FeesItemResponse.DiscountAllFees = feesItem.disCount * feesItem.AllFees; IsShowFees = feesItem.AllFees > 0 ? true : false; + + if (ReflashTask != null) ReflashTask(); }); service.Show(); } @@ -334,6 +342,13 @@ namespace BBWY.Client.Models public TaskStateType TaskStatus { get => taskStatus; set { Set(ref taskStatus, value); } } + private PackTaskState taskState; + /// + /// 打包仓库任务状态 + /// + public PackTaskState TaskState { get => taskState; set { Set(ref taskState, value); } } + + private PackType packType; /// /// 打包类型(单件=0,多件=1) @@ -377,11 +392,11 @@ namespace BBWY.Client.Models public Increment Increment2 { get => increment2; set { Set(ref increment2, value); } } - private PositionType positionType; + private string positionType; /// /// 落仓(本地仓=0,齐越仓=1,京东仓=2) /// - public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } + public string PositionType { get => positionType; set { Set(ref positionType, value); } } diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 1cd0a7ce..0fc9c5ad 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -31,6 +31,7 @@ namespace BBWY.Client.ViewModels private bool showWB2RuntimeDownloadPanel; private double wb2DownloadProgress; private IList managerDepartment; + private IList packDepartment; private WebView2Manager w2m; public GlobalContext GlobalContext { get; set; } public IList MenuList { get; set; } @@ -91,6 +92,9 @@ namespace BBWY.Client.ViewModels { this.w2m = w2m; this.managerDepartment = new List() { "董事办", "财务部", "技术部", "总经办" }; + this.packDepartment = new List() { "打包组" ,"发货组" , "仓储部" }; + + this.httpClientFactory = httpClientFactory; this.mdsApiService = mdsApiService; this.logisticsService = logisticsService; @@ -119,7 +123,7 @@ namespace BBWY.Client.ViewModels /// private void CreateMenu() { - if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部") + if (this.packDepartment.Contains(GlobalContext.User.TeamName)) { App.Current.Dispatcher.Invoke(() => @@ -268,13 +272,10 @@ namespace BBWY.Client.ViewModels CreateMenu(); - if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部") - { - return; - } + IList departmentList = null; - if (GlobalContext.User.TeamName == "刷单组" || + if (GlobalContext.User.TeamName == "刷单组" || this.packDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { @@ -346,6 +347,9 @@ namespace BBWY.Client.ViewModels } GlobalContext.User.DepartmentList = departmentList; + if (this.packDepartment.Contains(GlobalContext.User.TeamName)) + return; + if (GlobalContext.User.TeamName == "刷单组") return; diff --git a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs index 9905066c..0b56c063 100644 --- a/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs @@ -1,5 +1,6 @@ using BarcodeLib; using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Helpers; using BBWY.Client.Models; using BBWY.Client.Models.APIModel.Request; @@ -426,7 +427,7 @@ namespace BBWY.Client.ViewModels.PackTask return; } SaveTask = "保存"; - Logo = model.ItemList[0].Logo; + Logo = model.ItemList[0].Logo.Copy(); SearchSkuId = model.SkuId; SkuId = model.SkuId; SkuCount = model.SkuCount; @@ -443,7 +444,12 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = model.GoodsNumber; Availability = model.Availability; IsWorry = model.IsWorry; - PositionType = model.PositionType; + + if (string.IsNullOrEmpty(model.OrderId)) + { + PositionType = model.PositionType.ToEnum(); + } + PackType = model.PackType; BasicPack = model.BasicPack; IsNeedBarCode = model.BarCodeModel == null ? Need.不需要 : Need.需要; @@ -789,7 +795,7 @@ namespace BBWY.Client.ViewModels.PackTask } if (!string.IsNullOrEmpty(BrandName)) foreach (var item in CertificateModel) item.BrandName = BrandName; - //CertificateModel.Foreach(c=>c.BrandName = BrandName) ; + //CertificateModel.Foreach(c=>c.BrandName = BrandName) ; SetCerWindow setCerWindow = new SetCerWindow(); setCerWindow.LoadData(CertificateModel, packTaskService, spuCertificateModel, IsSetSpuCertificate); setCerWindow.SaveResult = s => @@ -905,7 +911,7 @@ namespace BBWY.Client.ViewModels.PackTask new TipsWindow("请设置合格证模板").Show(); return; } - createTaskModel.CerId =string.Join(",", CertificateModel.Select(c=>c.Id));// + createTaskModel.CerId = string.Join(",", CertificateModel.Select(c => c.Id));// } ApiResponse res = null; if (TaskId > 0)//修改界面 @@ -1014,7 +1020,7 @@ namespace BBWY.Client.ViewModels.PackTask IsSetCertificate = false; if (CertificateModel == null) { - CertificateModel = new CertificateModel[] { + CertificateModel = new CertificateModel[] { new CertificateModel{ } }; IsSetCertificate = true; @@ -1022,7 +1028,7 @@ namespace BBWY.Client.ViewModels.PackTask } foreach (var item in CertificateModel) item.Brand = Brand; - + if (!string.IsNullOrEmpty(BrandName)) foreach (var item in CertificateModel) { @@ -1030,8 +1036,8 @@ namespace BBWY.Client.ViewModels.PackTask item.ProductNo = ProductNo; item.SkuId = SkuId; } - - + + BarCodeModel = productSku.Data.BarCodeModel; IsSetBarCode = false; if (BarCodeModel == null) diff --git a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs index 8d6325a6..b21b907d 100644 --- a/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PublishTaskViewModel.cs @@ -1,4 +1,5 @@ using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Models; using BBWY.Client.Models.PackTask; using BBWY.Client.Views.PackTask; @@ -624,7 +625,15 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = model.GoodsNumber; Availability = model.Availability; IsWorry = model.IsWorry; - PositionType = model.PositionType; + try + { + PositionType = model.PositionType.ToEnum();//多个仓库异常 + } + catch + { + + } + PackType = model.PackType; BasicPack = model.BasicPack; IsNeedBarCode = model.BarCodeModel == null ? Need.不需要 : Need.需要; @@ -694,7 +703,7 @@ namespace BBWY.Client.ViewModels.PackTask var createTaskModel = new Models.APIModel.Request.CreateTaskRequest { ProductNo = ProductNo, - Logo = Logo, + Logo = Logo.Replace( "200x200", "80x80"), SkuName = SkuName, TaskId = TaskId, BrandName = BrandName, diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index 30903b91..8680ba77 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -275,6 +275,18 @@ namespace BBWY.Client.ViewModels.PackTask /// public void SearchTaskList() { + try + { + if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) + Convert.ToInt64(SearchTaskId); + } + catch + { + System.Windows.MessageBox.Show("任务id必须为数字"); + return; + + } + IsLoading = true; Task.Factory.StartNew(() => { @@ -314,7 +326,7 @@ namespace BBWY.Client.ViewModels.PackTask MarkMessage = item.MarkMessage, PackType = (PackType)item.PackType, - PositionType = (PositionType)item.PositionType, + PositionType = ((PositionType)item.PositionType).ToString(), SkuCount = item.SkuCount, SkuTitle = item.SkuGoodsTitle, TaskId = item.TaskId, diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index d6af7ec4..b8473407 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -18,6 +18,7 @@ using HandyControl.Controls; using System.Windows; using System.Collections; using NPOI.SS.Formula.Functions; +using GalaSoft.MvvmLight.Messaging; namespace BBWY.Client.ViewModels.PackTask { @@ -35,6 +36,20 @@ namespace BBWY.Client.ViewModels.PackTask private DateTime endTime; public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } } + + + + + + private string searchShopName; + public string SearchShopName + { + get => searchShopName; set + { + Set(ref searchShopName, value); + } + } + /// /// 查询任务id /// @@ -53,11 +68,11 @@ namespace BBWY.Client.ViewModels.PackTask private string searchSkuId; public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } } - public TaskState? taskState; + public PackTaskState? taskState; /// /// 任务状态 /// - public TaskState? TaskState + public PackTaskState? TaskState { get => taskState; private set { @@ -78,25 +93,46 @@ namespace BBWY.Client.ViewModels.PackTask /// /// 未到货数量 /// - public int NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } } - private int noArrivedCount; - private int someArrivedCount; + public string NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } } + private string noArrivedCount; + private string someArrivedCount; /// /// 部分到货数量 /// - public int SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } } - private int worryCount; + public string SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } } + private string worryCount; /// /// 加急数 /// - public int WorryCount { get => worryCount; set { Set(ref worryCount, value); } } + public string WorryCount { get => worryCount; set { Set(ref worryCount, value); } } - private int arrivedCount; + private string arrivedCount; /// /// 已到货数量 /// - public int ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } } + public string ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } } + + + + + private string waitPackCount; + /// + /// 待打包数 + /// + public string WaitPackCount { get => waitPackCount; set { Set(ref waitPackCount, value); } } + private string waitSealBox; + /// + /// 带封箱数 + /// + public string WaitSealBox { get => waitSealBox; set { Set(ref waitSealBox, value); } } + private string waitOutbound; + /// + /// 待出库数 + /// + public string WaitOutbound { get => waitOutbound; set { Set(ref waitOutbound, value); } } + + //private int totalCount; ///// ///// 全部数量 @@ -113,7 +149,7 @@ namespace BBWY.Client.ViewModels.PackTask private bool isLoading; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } - + private int? IsWorry { get; set; } public int? taskStatus { get; set; } private ObservableCollection packTaskList; @@ -146,13 +182,19 @@ namespace BBWY.Client.ViewModels.PackTask private readonly WorkProcessService workProcessService; private readonly PackTaskService packTaskService; private readonly IncreateServiceService increateServiceService; - public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService) + public GlobalContext globalContext; + public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService, BatchPurchaseService batchPurchaseService, GlobalContext globalContext) { + this.globalContext = globalContext; + + this.packTaskService = packTaskService; this.consumableService = consumableService; + + //Messenger.Default.Send(globalContext, "AcceptGlobalContext"); PackTaskList = new ObservableCollection();//初始化数据 - SetTaskStateCommand = new RelayCommand(SetTaskState); + SetTaskStateCommand = new RelayCommand(SetTaskState); SearchTaskCommand = new RelayCommand(() => { @@ -184,11 +226,15 @@ namespace BBWY.Client.ViewModels.PackTask SetTaskStatusCommand = new RelayCommand(SetTaskStatus); //加载数据 - SetTaskState(Models.TaskState.全部); + SetTaskState(null); this.workProcessService = workProcessService; this.increateServiceService = increateServiceService; this.productService = productService; this.batchPurchaseService = batchPurchaseService; + + + + } #region 事件绑定 @@ -224,52 +270,57 @@ namespace BBWY.Client.ViewModels.PackTask BatchPurchaseService batchPurchaseService; - public void SetTaskStatus(object obj ) + public void SetTaskStatus(object obj) { var objList = (object[])obj; long taskId = (long)objList[0]; - string orderId=(string)objList[1]; + string orderId = (string)objList[1]; ///修改完成 - var model = packTaskService.UpdateTaskStatus(taskId, 1,orderId); + var model = packTaskService.UpdateTaskStatus(taskId, 1, orderId); if (model != null && model.Success) SearchTaskList(); - - } - public void SetTaskState(TaskState? taskState) + } + public void SetTaskState(PackTaskState? taskState) { - IsWorry = null; - TaskState = null; - taskStatus = null; - switch (taskState) - { - case null: - break; - case Models.TaskState.已到货: - case Models.TaskState.部分到货: //未完成的数据 - case Models.TaskState.未到货: - TaskState = taskState; - taskStatus = 0; - break; - case Models.TaskState.全部: //所有数据 - - break; - case Models.TaskState.已完成: - - taskStatus = 1; - break; - case Models.TaskState.加急: - taskStatus = 0; - IsWorry = 1; - break; - default: - break; - } + TaskState = taskState; SearchTaskList(); } + //public void SetTaskState(TaskState? taskState) + //{ + // IsWorry = null; + // TaskState = null; + // taskStatus = null; + // switch (taskState) + // { + // case null: + // break; + // case Models.TaskState.已到货: + // case Models.TaskState.部分到货: //未完成的数据 + // case Models.TaskState.未到货: + // TaskState = taskState; + // taskStatus = 0; + // break; + // case Models.TaskState.全部: //所有数据 + + // break; + // case Models.TaskState.已完成: + + // taskStatus = 1; + // break; + // case Models.TaskState.加急: + // taskStatus = 0; + // IsWorry = 1; + // break; + // default: + // break; + // } + // SearchTaskList(); + + //} /// @@ -277,11 +328,33 @@ namespace BBWY.Client.ViewModels.PackTask /// public void SearchTaskList() { + try + { + if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim())) + Convert.ToInt64(SearchTaskId); + } + catch + { + System.Windows.MessageBox.Show("任务id必须为数字"); + return; + + } + + //string shopId = null; + //if (!string.IsNullOrEmpty(SearchShopName)) + //{ + // var searchShop = globalContext.User.ShopList.FirstOrDefault(g => g.ShopName == SearchShopName); + // if (searchShop != null) shopId = searchShop.ShopId.ToString(); + //} + + + IsLoading = true; Task.Factory.StartNew(() => { PackTaskList = new ObservableCollection();//初始化数据 - var datas = packTaskService.GetWareHouseList(IsWorry, SearchDepartment, SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus, + + var datas = packTaskService.GetWareHouseList(IsWorry, SearchDepartment, SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), SearchShopName, PageIndex, PageSize); if (datas != null && datas.Data != null && datas.Success) { @@ -299,7 +372,6 @@ namespace BBWY.Client.ViewModels.PackTask GoodsNumber = item.GoodsNumber, Increment1 = item.Increment1, - Increment2 = (Increment)item.Increment2, ItemList = new List() { new SkuMessage { BrandName = item.BrandName, GoodsNo = item.ProductItemNum, Logo= item.Logo, @@ -309,17 +381,16 @@ namespace BBWY.Client.ViewModels.PackTask } }, MarkMessage = item.MarkMessage, PackType = (PackType)item.PackType, - - PositionType = (PositionType)item.PositionType, + TaskState = item.TaskState, + PositionType = item.PositionType, SkuCount = item.SkuCount, SkuTitle = item.SkuGoodsTitle, TaskId = item.TaskId, - TaskStatus = (TaskStateType)item.TaskStatus, EndTime = item.CreateTime, - OrderId= item.OrderId, + OrderId = item.OrderId, SkuId = item.SkuId, SkuName = item.SkuName, - + }; if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0) { @@ -327,12 +398,14 @@ namespace BBWY.Client.ViewModels.PackTask data.BarCodeModel = item.BarCodeDTO; } - if (item.cers != null) + if (item.Cers != null) { - data.CertificateModel = item.cers; + data.CertificateModel = item.Cers; } + data.ReflashTask = ReflashTask; + if (item.FeesItemResponse != null) { data.FeesItemResponse = item.FeesItemResponse; @@ -379,10 +452,13 @@ namespace BBWY.Client.ViewModels.PackTask { App.Current.Dispatcher.Invoke(() => { - ArrivedCount = packTaskResult.Data.ArrivedCount; - NoArrivedCount = packTaskResult.Data.NoArrivedCount; - SomeArrivedCount = packTaskResult.Data.SomeArrivedCount; - WorryCount = packTaskResult.Data.WorryCount; + ArrivedCount = packTaskResult.Data.ArrivedCount.ToString(); + NoArrivedCount = packTaskResult.Data.NoArrivedCount.ToString(); + SomeArrivedCount = packTaskResult.Data.SomeArrivedCount.ToString(); + WorryCount = packTaskResult.Data.WorryCount.ToString(); + WaitOutbound = packTaskResult.Data.WaitOutbound?.ToString(); + WaitPackCount = packTaskResult.Data.WaitPackCount?.ToString(); + WaitSealBox = packTaskResult.Data.WaitSealBox?.ToString(); }); } } @@ -391,10 +467,15 @@ namespace BBWY.Client.ViewModels.PackTask PageIndex = pageIndex;// SearchTaskList(); } + public void ReflashTask()//刷新界面 + { + SearchTaskList(); + } + private void OpenSkuDetail(object param) { - var paramList = (object[])param; + var paramList = (object[])param; var skuId = paramList[1].ToString(); var url = $"https://item.jd.com/{skuId}.html"; try diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 14dfaeb2..dc28d734 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -96,7 +96,7 @@ namespace BBWY.Client.ViewModels private ObservableCollection preCompeteTimeDayList = new ObservableCollection { - "今天" + }; public ObservableCollection PreCompeteTimeDayList { get => preCompeteTimeDayList; set { Set(ref preCompeteTimeDayList, value); } } @@ -106,6 +106,11 @@ namespace BBWY.Client.ViewModels }; public ObservableCollection PreCompeteTimeHourList { get => preCompeteTimeHourList; set { Set(ref preCompeteTimeHourList, value); } } + // + public string preCompeteTimeDay; + public string PreCompeteTimeDay { get => preCompeteTimeDay; set { Set(ref preCompeteTimeDay, value); } } + + public string preCompeteTimeHour; public string PreCompeteTimeHour { get => preCompeteTimeHour; set { Set(ref preCompeteTimeHour, value); } } @@ -367,7 +372,6 @@ namespace BBWY.Client.ViewModels SetCertificateCommand = new RelayCommand(SetCertificate); LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); - //SearchSkuCommand = new RelayCommand(SearchSku); CompeteQualityTaskCommand = new RelayCommand(CompeteQualityTask); IncreateList = new ObservableCollection(); foreach (var item in increates) @@ -381,10 +385,7 @@ namespace BBWY.Client.ViewModels this.purchaseService = purchaseService; this.packTaskService = packTaskService; -#if DEBUG - //Test(); -#endif } @@ -422,9 +423,6 @@ namespace BBWY.Client.ViewModels IsNeedBar = IsNeedBarCode == Need.需要, IsNeedCer = IsNeedCertificateModel == Need.需要, TaskId = TaskId - - - }; if (IsNeedBarCode == Need.需要) { @@ -457,7 +455,10 @@ namespace BBWY.Client.ViewModels } int hour = Convert.ToInt32(PreCompeteTimeHour.Replace("点前", "")); - request.PreCompeteTime = DateTime.Now.Date.AddHours(hour); + + var date = Convert.ToDateTime(PreCompeteTimeDay); + + request.PreCompeteTime = date.AddHours(hour); var competeRes = packPurchaseTaskService.CompeteQualityTask(request); @@ -478,8 +479,14 @@ namespace BBWY.Client.ViewModels , BarCodeModel); batchPrint.ShowDialog(); + + + if (ReflashWindow != null) ReflashWindow(); var window = obj as BWindow; + window.Close(); + + } @@ -490,18 +497,22 @@ namespace BBWY.Client.ViewModels { return; } - //if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据 - //{ - // SearchSku(SkuId); - //} - if (BarCodeModel == null) { - BarCodeModel = new BarCodeModel(); - BarCodeModel.ProductNo = ProductNo; - BarCodeModel.Brand = Brand; - BarCodeModel.SkuId = SkuId; - BarCodeModel.SkuName = SkuName; + var resCode = packPurchaseTaskService.SearchBarCode(SkuId); + if (resCode==null) + { + BarCodeModel = new BarCodeModel(); + BarCodeModel.ProductNo = ProductNo; + BarCodeModel.Brand = Brand; + BarCodeModel.SkuId = SkuId; + BarCodeModel.SkuName = SkuName; + } + else + { + BarCodeModel = resCode.Data; + } + } if (!string.IsNullOrEmpty(BrandName)) BarCodeModel.BrandName = BrandName; @@ -586,13 +597,14 @@ namespace BBWY.Client.ViewModels { InitData(); TaskId = model.TaskId; - + OrderId =model.OrderId; SkuId = model.SkuId; SkuName = model.ItemList[0].SkuName; Logo = model.ItemList[0].Logo.Replace("80x80", "200x200").Replace("200x200", "150x150"); BrandName = model.ItemList[0].BrandName; SkuCount = model.SkuCount; + brand = model.Brand; ProductNo = model.ProductNo; MarkMessage = model.MarkMessage; @@ -648,7 +660,7 @@ namespace BBWY.Client.ViewModels } var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); - if (list == null) + if (list == null&&!list.Success) { PurchaseSkuList.Add(item); continue; } @@ -683,6 +695,16 @@ namespace BBWY.Client.ViewModels { PurchaseSkuList = new ObservableCollection(); WareHourseList = new ObservableCollection(); + PreCompeteTimeDayList = new ObservableCollection(); + + var date = DateTime.Now.Date; + for (int i = 0; i < 7; i++) + { + PreCompeteTimeDayList.Add(date.AddDays(i).ToString("yyyy-MM-dd")); + } + + PreCompeteTimeDay = date.ToString("yyyy-MM-dd"); + IsSetBarCode = true; SkuTitle = ""; BrandName = ""; diff --git a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml index aad3fc9b..8247fa47 100644 --- a/BBWY.Client/Views/PackTask/PackTaskTotal.xaml +++ b/BBWY.Client/Views/PackTask/PackTaskTotal.xaml @@ -121,8 +121,8 @@ - - + + @@ -193,8 +193,8 @@ - - + + diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml b/BBWY.Client/Views/PackTask/WareHouseList.xaml index 71decbf0..df7c406b 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml @@ -14,23 +14,68 @@ d:DesignHeight="450" d:DesignWidth="2048" Title="TaskList"> + + + - + + + + + + + - + @@ -40,7 +85,7 @@ - + @@ -58,7 +103,14 @@ - + + + + + + + + @@ -74,229 +126,29 @@ - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - diff --git a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs index 22385b47..2b5c7616 100644 --- a/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs +++ b/BBWY.Client/Views/PackTask/WareHouseList.xaml.cs @@ -1,6 +1,8 @@ using BBWY.Client.Helpers; using BBWY.Client.Models.PackTask; +using BBWY.Client.ViewModels; using BBWY.Common.Models; +using GalaSoft.MvvmLight.Messaging; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using System; @@ -33,38 +35,81 @@ namespace BBWY.Client.Views.PackTask { InitializeComponent(); + + //Messenger.Default.Register(this,"AcceptGlobalContext", g => { globalContext = g; LoadShops(g); }); this.Loaded += Load; + + // this.Unloaded += WareHouseList_Unloaded; + + // GlobalContext.User.DepartmentList + } + + //private void WareHouseList_Unloaded(object sender, RoutedEventArgs e) + //{ + // Messenger.Default.Unregister("AcceptGlobalContext"); + //} + + GlobalContext globalContext; + + public void LoadShops(GlobalContext globalContext) + { + this.globalContext = globalContext; + shops = globalContext.User.ShopList.Select(s => s.ShopName).ToList(); } 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(); - QKApiHost = Configuration.GetSection("QKApiHost").Value; - HttpClientHelper helper = new HttpClientHelper(QKApiHost); + try + { + var model = new ViewModelLocator().Main; + + LoadShops(model.GlobalContext); + } + catch + { + + + } - string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 - var data = helper.Get(url); - var res = JsonConvert.DeserializeObject>(data); - //创建一个ListBoxIem - if (res.Success) + try { - if (res.Data != null && res.Data.Count() > 0) + var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); + 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) { - foreach (var department in res.Data) + if (res.Data != null && res.Data.Count() > 0) { - if (!departments.Contains(department.DePartmentName)) + foreach (var department in res.Data) { - departments.Add(department.DePartmentName); + if (!departments.Contains(department.DePartmentName)) + { + departments.Add(department.DePartmentName); + } } } } } + catch (Exception) + { + + + } + + } - public string QKApiHost {get;set;} + public string QKApiHost { get; set; } public void SelectionChangeCommand(object sender, SelectionChangedEventArgs e) { try @@ -86,10 +131,9 @@ namespace BBWY.Client.Views.PackTask } } - - List departments = new List(); + List shops = new List(); private void tb_TextChanged(object sender, TextChangedEventArgs e) { try @@ -155,5 +199,72 @@ namespace BBWY.Client.Views.PackTask } } + + private void tbShop_TextChanged(object sender, TextChangedEventArgs e) + { + try + { + var textBoxt = (TextBox)sender; + //创建一个ListBox + + if (tipBoxShop != null && tipBoxShop.Items.Count > 0) + { + tipBoxShop.Items.Clear(); + + } + + if (shops.Count <= 0) + { + if (globalContext != null) + LoadShops(globalContext); + } + + if (string.IsNullOrEmpty(textBoxt.Text)) + { + tipBoxShop.Visibility = Visibility.Collapsed; + return; + } + foreach (var department in shops) + { + if (department.Contains(textBoxt.Text)) + { + ListBoxItem item = new ListBoxItem(); + Label lb = new Label(); + lb.Content = department; + item.Content = lb; + tipBoxShop.Items.Add(item); + } + + } + + tipBoxShop.Visibility = Visibility.Visible; + } + catch (Exception) + { + + + } + } + + private void tipBoxShop_SelectionChanged(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; + tbShop.Text = content.Content.ToString(); + tipBoxShop.Visibility = Visibility.Collapsed; + } + catch (Exception) + { + + + } + } } } diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index db92ba51..4e0108bc 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -43,9 +43,10 @@ + - + @@ -56,6 +57,8 @@ + + @@ -70,6 +73,7 @@ + + @@ -111,7 +116,7 @@ CommandParameter="{Binding TaskId}" Margin=" 5,0,7,0"/> - - - - - - - - - - - - - - - + @@ -151,6 +143,7 @@ + - - - - - - - - - + + + + + + @@ -345,7 +338,7 @@ - + @@ -369,223 +362,22 @@ - - + - + - - - - @@ -602,6 +394,32 @@ /> + + + + + + + + + + + + + + + + + + + + + @@ -617,6 +435,7 @@ + diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index 2f1dd2d7..477e0dbd 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -75,7 +75,12 @@ namespace BBWY.Client.Views.QualityTask private void save_btn_Click(object sender, RoutedEventArgs e) { - + if (PackCerState== PackCerState.无需合格证) + { + if (SaveResult != null) SaveResult(CertificateModel, PackCerState); + this.Close(); + return; + } if (string.IsNullOrEmpty(CertificateModel.ExcuteStander) || string.IsNullOrEmpty(CertificateModel.Shader) || string.IsNullOrEmpty(CertificateModel.BrandName) || string.IsNullOrEmpty(CertificateModel.Brand) || string.IsNullOrEmpty(CertificateModel.ProductShop) @@ -100,14 +105,7 @@ namespace BBWY.Client.Views.QualityTask MessageBox.Show("适用年龄不能为空"); return; } - - - - var standers = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries); - - - var resData = packTaskService.SaveCer(new CerRequest { Brand = CertificateModel.Brand, @@ -125,20 +123,14 @@ namespace BBWY.Client.Views.QualityTask GoodsNumber = CertificateModel.GoodsNumber, ProduceDate = CertificateModel.ProduceDate, PurchaseSkuId = CertificateModel.PurchaseSkuId, - - }); if (resData == null || !resData.Success) { - return; } CertificateModel.Id = resData.Data; if (SaveResult != null) SaveResult(CertificateModel, PackCerState); - - - this.Close(); } } diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 66e382f4..030267de 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -139,15 +139,13 @@ - - + + - + @@ -197,25 +195,7 @@ - - + @@ -225,7 +205,7 @@ ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemsSource="{Binding PurchaseSkuList,Mode=TwoWay}" BorderBrush="{StaticResource Border.Brush}" - BorderThickness="0" Visibility="{Binding OrderId,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" + BorderThickness="0" Visibility="{Binding OrderId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" Foreground="{StaticResource Text.Color}"> @@ -330,7 +310,7 @@ ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemsSource="{Binding PurchaseSkuList,Mode=TwoWay}" BorderBrush="{StaticResource Border.Brush}" - BorderThickness="0" Visibility="{Binding OrderId,Converter={StaticResource objConverter},ConverterParameter=#null:Visible:Collapsed}" + BorderThickness="0" Visibility="{Binding OrderId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Visible:Collapsed}" Foreground="{StaticResource Text.Color}"> @@ -344,12 +324,12 @@ - + - + - + From b1f2b6b87dab81f252ef047c9d7714177399839a Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Wed, 24 May 2023 15:28:52 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/APIServices/PackTaskService.cs | 17 ++++++- .../PackTask/WareHouseListViewModel.cs | 45 ++++++++++++++++++- .../Views/PackTask/TaskListControl.xaml | 2 +- .../Views/PackTask/WareHouseListControl.xaml | 21 ++++++++- 4 files changed, 80 insertions(+), 5 deletions(-) diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs index 37a42620..2ef1068c 100644 --- a/BBWY.Client/APIServices/PackTaskService.cs +++ b/BBWY.Client/APIServices/PackTaskService.cs @@ -99,8 +99,8 @@ namespace BBWY.Client.APIServices public ApiResponse GetAllCount() { - return SendRequest(globalContext.QKApiHost, "api/PackTask/GetProductSkuCount", - new { ShopId = globalContext.User.Shop.ShopId.ToString() } + return SendRequest(globalContext.QKApiHost, $"api/PackTask/GetProductSkuCount?shopId={globalContext.User.Shop.ShopId.ToString()}", + null , null, HttpMethod.Get); } public ApiResponse GetWareAllCount() @@ -168,6 +168,19 @@ namespace BBWY.Client.APIServices , null, HttpMethod.Post); } + + + + public ApiResponse SetPackTaskState(long taskId, PackTaskState packTaskState) + { + return SendRequest(globalContext.QKApiHost, "api/PackTask/SetPackTaskState", new + { + taskId = taskId, + TaskState= packTaskState + } + , null, HttpMethod.Post); + } + public ApiResponse SaveBarCode(BarCodeRequest barCodeModel) { return SendRequest(globalContext.QKApiHost, "api/PackTask/CommitBarCode", barCodeModel diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index b8473407..225a331b 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -232,10 +232,12 @@ namespace BBWY.Client.ViewModels.PackTask this.productService = productService; this.batchPurchaseService = batchPurchaseService; - + UpdateTaskStateCommand = new RelayCommand(UpdateTaskState); } + + #region 事件绑定 public ICommand SetTaskStatusCommand { get; set; } @@ -253,6 +255,10 @@ namespace BBWY.Client.ViewModels.PackTask /// public ICommand SetTaskStateCommand { get; set; } + /// + /// 修改任务状态 + /// + public ICommand UpdateTaskStateCommand { get; set; } /// /// 搜索数据 /// @@ -270,6 +276,43 @@ namespace BBWY.Client.ViewModels.PackTask BatchPurchaseService batchPurchaseService; + + private void UpdateTaskState(object obj) + { + var objList = (object[])obj; + long taskId = (long)objList[0]; + var packTaskState = (PackTaskState)objList[1]; + + ApiResponse res = null; + switch (packTaskState) + { + case PackTaskState.未到货: + break; + case PackTaskState.部分到货: + break; + case PackTaskState.待质检: + break; + case PackTaskState.待打包: + res= packTaskService.SetPackTaskState(taskId, PackTaskState.待封箱); + break; + case PackTaskState.待封箱: + break; + case PackTaskState.待出库: + break; + case PackTaskState.已完成: + break; + case PackTaskState.已取消: + break; + default: + break; + } + if (res!=null&&res.Success) + { + SearchTaskList(); + } + + + } public void SetTaskStatus(object obj) { var objList = (object[])obj; diff --git a/BBWY.Client/Views/PackTask/TaskListControl.xaml b/BBWY.Client/Views/PackTask/TaskListControl.xaml index 84ee9353..39c31f7a 100644 --- a/BBWY.Client/Views/PackTask/TaskListControl.xaml +++ b/BBWY.Client/Views/PackTask/TaskListControl.xaml @@ -121,7 +121,7 @@ + Margin="5,0,0,0" Style="{StaticResource LinkButton}" Content="取消" /> diff --git a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml index 4e0108bc..3af203f9 100644 --- a/BBWY.Client/Views/PackTask/WareHouseListControl.xaml +++ b/BBWY.Client/Views/PackTask/WareHouseListControl.xaml @@ -402,8 +402,27 @@ Command="{Binding QualityTaskCommand}" Visibility="{Binding TaskState,Converter={StaticResource objConverter},ConverterParameter=待质检:Visible:Collapsed}" /> + + + + + + + + + + + + + + + +