From bf7aad5ab33cee841bc5557d541f047877bde37f Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 9 Jun 2023 16:59:27 +0800 Subject: [PATCH 1/6] 1 --- BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index d10dab7a..f645f141 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -756,14 +756,16 @@ namespace BBWY.Client.ViewModels { PurchaseSkuList.Add(item); continue; } - - var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + PurchaseSkuItemBasicInfoResponse skuItem = null; + if (list.Data != null) 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, + Logo = skuItem?.Logo, + Title = skuItem?.Title, IsNeedCer = item.IsNeedCer, PurchaseSkuId = item.PurchaseSkuId, CerDTO = item.CerDTO, From 4dc5d5ecb1837ba03a97f7271adeb2604b5b86db Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Fri, 9 Jun 2023 19:00:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=89=93=E5=8D=B0=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/GlobalContext.cs | 2 +- BBWY.Client/Helpers/MyPrintHelper.cs | 15 +++ BBWY.Client/Models/PackTask/PackTaskModel.cs | 11 +- .../QualityTask/QualityViewModel.cs | 53 ++++++---- .../Views/PackTask/ServiceWindow.xaml.cs | 100 +----------------- 5 files changed, 64 insertions(+), 117 deletions(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 7cc3b287..6d76bbda 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -9,7 +9,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10122"; + ClientVersion = "10123"; } private User user; diff --git a/BBWY.Client/Helpers/MyPrintHelper.cs b/BBWY.Client/Helpers/MyPrintHelper.cs index 12515e17..6296a880 100644 --- a/BBWY.Client/Helpers/MyPrintHelper.cs +++ b/BBWY.Client/Helpers/MyPrintHelper.cs @@ -9,6 +9,7 @@ using System.Drawing.Printing; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Text; using System.Windows.Media.Imaging; using WebSocketSharp; @@ -618,5 +619,19 @@ namespace BBWY.Client.Helpers } } + + public static void SetDefaultPrint(string printName) + { + SetDefaultPrinter(printName); + } + + /// + /// 调用win api将指定名称的打印机设置为默认打印机 + /// + /// + /// + [DllImport("winspool.drv")] + public static extern bool SetDefaultPrinter(string Name); + } } diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index ce5db38a..252775e4 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -103,7 +103,16 @@ namespace BBWY.Client.Models // qualityViewModel.TaskId = TaskId; qualityViewModel.OrderId = OrderId; qualityViewModel.SkuId = SkuId; - qualityViewModel.SearchSku(this); + try + { + qualityViewModel.SearchSku(this); + } + catch (Exception ex) + { + System.Windows.MessageBox.Show(ex.Message); + + } + //qualityViewModel.LoadPackDatas(); //qualityViewModel.SetAllFees = new Action>((feesItem, packUsers) => //{ diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index f645f141..452efd6a 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -552,28 +552,43 @@ namespace BBWY.Client.ViewModels request.PreCompeteTime = competeTime; - var competeRes = packPurchaseTaskService.CompeteQualityTask(request); - if (competeRes == null) - { - MessageBox.Show("网络异常"); - return; - } - if (!competeRes.Success) - { - MessageBox.Show(competeRes.Msg); - return; - } - BatchPrintWindow batchPrint = new BatchPrintWindow(); + try + { + 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(); + + if (ReflashWindow != null) ReflashWindow(); + var window = obj as BWindow; + App.Current.Dispatcher.Invoke(new Action(() => { - batchPrint.SetData(GoodProductQuantity, - PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() - , BarCodeModel); - batchPrint.ShowDialog(); + window.Close(); + })); + + } + catch (Exception ex) + { + + System.Windows.MessageBox.Show(ex.Message); + } + - if (ReflashWindow != null) ReflashWindow(); - var window = obj as BWindow; - window.Close(); + } diff --git a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs index cd1668ac..f51f2957 100644 --- a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs @@ -1,5 +1,6 @@ using BarcodeLib; using BBWY.Client.APIServices; +using BBWY.Client.Helpers; using BBWY.Client.ViewModels; using BBWY.Client.ViewModels.PackTask; using BBWY.Controls; @@ -50,9 +51,8 @@ namespace BBWY.Client.Views.PackTask MessageBox.Show("打印机处于错误状态"); return; } - //Print(this.printArea, cbPrintName.Text, "打印任务",1); - - + + MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 this.printArea.Arrange(new Rect(new Point(0, 0), new Size(printArea.ActualWidth, printArea.ActualHeight))); PrintDialog printDialog = new PrintDialog(); @@ -76,99 +76,7 @@ namespace BBWY.Client.Views.PackTask - /// - /// 打印 - /// - /// 流文档 - /// 打印机名称 - /// 打印描述 - /// 打印个数 - public static void Print(Visual document, string printer, string description, int copyCount) - { - var localPrintServer = new LocalPrintServer(); - var printQueue = localPrintServer.GetPrintQueue(printer); - if (printQueue.IsInError) - { - throw new Exception("打印机处于错误状态"); - } - - var printDialog = new PrintDialog - { - PrintQueue = printQueue, //打印队列 - PrintTicket = { CopyCount = copyCount } //打印个数 - }; - - //设置纸张大小 - var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); //小标签:114 - var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); //小标签:227 - printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); - - //设置纸张边距 - var paperSize = GetPaperSize(printer); //小标签:118*246 - //var offsetX = (int)Math.Ceiling((paperSize.Width - pageWidth) / 2f); - //var offsetY = (int)Math.Ceiling((paperSize.Height - pageHeight) / 2f); - //document.PagePadding = new Thickness(offsetX, offsetY, offsetX, offsetY); - - //打印 - var paginator = ((IDocumentPaginatorSource)document).DocumentPaginator; - printDialog.PrintDocument(paginator, description); - - var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); - File.WriteAllText(printNames, printer); - - } - - private static object GetPaperSize(string printer) - { - return null; - } - - public interface IDocumentRenderer - { - void Render(FlowDocument doc, object data); - } - - public class CommonDocumentRenderer : IDocumentRenderer - { - public void Render(FlowDocument doc, object data) - { - var model = data as PrintModel; - if (model == null) - { - throw new ArgumentException("data is not PrintModel"); - } - - var type = typeof(PrintModel); - var properties = type.GetProperties(); - foreach (var property in properties) - { - //文本赋值 - if (doc.FindName(property.Name) is TextBlock textBlock) - { - textBlock.Text = property.GetValue(model)?.ToString(); - } - } - } - } - - public class PrintModel - { - /// - /// 批号 - /// - public string BatchNumber { get; set; } - - /// - /// 订单号 - /// - public string OrderNumber { get; set; } - - /// - /// 物料代码 - /// - public string MaterialNumber { get; set; } - } + } } From 92f52e7fcd09c705f5b11ab1030c73d85c8ea3fe Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 11 Jun 2023 14:20:48 +0800 Subject: [PATCH 3/6] 1 --- BBWY.Client/Models/APIModel/Request/CerRequest.cs | 5 ++++- BBWY.Client/Models/Enums.cs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/BBWY.Client/Models/APIModel/Request/CerRequest.cs b/BBWY.Client/Models/APIModel/Request/CerRequest.cs index 194e8bee..cc221097 100644 --- a/BBWY.Client/Models/APIModel/Request/CerRequest.cs +++ b/BBWY.Client/Models/APIModel/Request/CerRequest.cs @@ -68,11 +68,14 @@ namespace BBWY.Client.Models.APIModel.Request /// public string ApplyAge { get; set; } - public int GoodsNumber { get; set; } + public long GoodsNumber { get; set; } public string ProduceDate { get; set; } public string PurchaseSkuId { get; set; } + + public SaveType? SaveType { get; set; } + } } diff --git a/BBWY.Client/Models/Enums.cs b/BBWY.Client/Models/Enums.cs index b0da91f3..c79f546c 100644 --- a/BBWY.Client/Models/Enums.cs +++ b/BBWY.Client/Models/Enums.cs @@ -452,4 +452,19 @@ { 增值服务工序 = 0, 基础包装工序 = 1/*,其他=2//基础包装 增量配件*/ } + + /// + /// 打包配置存放区分 + /// + public enum SaveType + { + /// + /// c端 + /// + C端 = 0, + /// + /// B端 + /// + B端 = 1 + } } From 61072fa45bf43d3325c41225349b84099a42d176 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 11 Jun 2023 16:19:08 +0800 Subject: [PATCH 4/6] 1 --- BBWY.Client/Models/PackTask/CertificateModel.cs | 16 +++++++++++----- .../ViewModels/QualityTask/QualityViewModel.cs | 6 ++++-- BBWY.Client/Views/PackTask/LookCerWindow.xaml | 2 +- BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs | 8 ++++++++ BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs | 2 +- BBWY.Client/Views/QualityTask/QualityWindow.xaml | 6 +++--- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/BBWY.Client/Models/PackTask/CertificateModel.cs b/BBWY.Client/Models/PackTask/CertificateModel.cs index 437d9a1a..91c03978 100644 --- a/BBWY.Client/Models/PackTask/CertificateModel.cs +++ b/BBWY.Client/Models/PackTask/CertificateModel.cs @@ -12,9 +12,6 @@ namespace BBWY.Client.Models /// 合格证id /// public long Id { get; set; } - - - /// /// skuid /// @@ -142,11 +139,20 @@ namespace BBWY.Client.Models - private int goodsNumber = 1; + private long goodsNumber = 1; + /// + /// 配件序号 + /// + public long GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + + + + private int goodsNumberIndex = 1; /// /// 配件序号 /// - public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } } + public int GoodsNumberIndex { get => goodsNumberIndex; set { Set(ref goodsNumberIndex, value); } } + private string produceDate; /// diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index f645f141..e91ac724 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -731,7 +731,7 @@ namespace BBWY.Client.ViewModels if (packTaskRes == null || !packTaskRes.Success) return; BarCodeModel = packTaskRes.Data.BarCodeDTO; IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; - IsSetBarCode = packTaskRes.Data.IsNeedBar ? false : true; + IsSetBarCode = packTaskRes.Data.BarCodeDTO==null ? true:false; IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; if (packTaskRes.Data.WareHourses != null) packTaskRes.Data.WareHourses.ToList().ForEach(w => @@ -742,9 +742,11 @@ namespace BBWY.Client.ViewModels if (packTaskRes.Data.PurchaseSkus != null) { - + int goodsIndex = 0; foreach (var item in packTaskRes.Data.PurchaseSkus) { + goodsIndex++; + if (item.CerDTO != null) item.CerDTO.GoodsNumberIndex = goodsIndex; item.IsSetCertificate = true; if (string.IsNullOrEmpty(item.PurchaseProductId)) { diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml b/BBWY.Client/Views/PackTask/LookCerWindow.xaml index d7893ee0..d6d90724 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml @@ -44,7 +44,7 @@ - + diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs index f5ff0e73..37631eae 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs @@ -29,11 +29,19 @@ namespace BBWY.Client.Views.PackTask InitializeComponent(); GoodsNumberCerList = new ObservableCollection(); + int goodsNumberIndex = 0; foreach (CertificateModel certificateModel in certificate) + { + goodsNumberIndex++; + certificateModel.GoodsNumberIndex = goodsNumberIndex; GoodsNumberCerList.Add(new GoodsNumberCer { CertificateModel = certificateModel.Copy(), + + }); + } + this.DataContext = this; } diff --git a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs index 55073097..fb46342b 100644 --- a/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/SetCerWindow.xaml.cs @@ -139,7 +139,7 @@ namespace BBWY.Client.Views.PackTask setSpuCerWindow.Show(); } - int selectCer = -1;//tabcontrol 选中事件 + long selectCer = -1;//tabcontrol 选中事件 private void InseartCer_Click(object sender, RoutedEventArgs e) { if (IsSetSpuCertificate) diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index a307c095..4136005c 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -212,7 +212,7 @@ ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemsSource="{Binding PurchaseSkuList,Mode=TwoWay}" BorderBrush="{StaticResource Border.Brush}" - BorderThickness="0" Visibility="{Binding OrderId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" + BorderThickness="0" Visibility="{Binding SkuPurchaseSchemeId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" Foreground="{StaticResource Text.Color}"> @@ -316,7 +316,7 @@ ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemsSource="{Binding PurchaseSkuList,Mode=TwoWay}" BorderBrush="{StaticResource Border.Brush}" - BorderThickness="0" Visibility="{Binding OrderId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Visible:Collapsed}" + BorderThickness="0" Visibility="{Binding SkuPurchaseSchemeId,Mode=TwoWay,Converter={StaticResource objConverter},ConverterParameter=#null:Visible:Collapsed}" Foreground="{StaticResource Text.Color}"> @@ -331,7 +331,7 @@ - + From 88541d6e4eed9f1172959d1b4e4caac0f474b6bb Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Sun, 11 Jun 2023 17:07:14 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E5=8C=BA=E5=88=86B?= =?UTF-8?q?=E7=AB=AFC=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/GlobalContext.cs | 2 +- .../PackPurchaseTask/QualityTaskResponse.cs | 6 ++++++ .../ViewModels/QualityTask/QualityViewModel.cs | 17 ++++++++++++----- .../QualityTask/QualitySetCerWindow.xaml.cs | 5 ++++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 6d76bbda..cbe0b1f3 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -9,7 +9,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10123"; + ClientVersion = "10124"; } private User user; diff --git a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs index f8f767c6..1a7c7571 100644 --- a/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs +++ b/BBWY.Client/Models/APIModel/Response/PackPurchaseTask/QualityTaskResponse.cs @@ -93,6 +93,12 @@ namespace BBWY.Client.Models.APIModel.Response.PackPurchaseTask /// 配件列表 /// public PurchaseSku[] PurchaseSkus { get; set; } + + + /// + /// + /// + public SaveType? SaveType { get; set; } } public class WareHourseDTO { diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 723289be..5276b081 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -20,6 +20,7 @@ using Org.BouncyCastle.Asn1.Crmf; using System.Runtime.InteropServices.WindowsRuntime; using NPOI.Util; using BBWY.Controls; +using WebSocketSharp; namespace BBWY.Client.ViewModels { @@ -585,12 +586,8 @@ namespace BBWY.Client.ViewModels System.Windows.MessageBox.Show(ex.Message); } - - - - } @@ -653,7 +650,7 @@ namespace BBWY.Client.ViewModels model.CerDTO.BrandName = BrandName; QualitySetCerWindow setCerWindow = new QualitySetCerWindow(); - setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate); + setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate, saveType); setCerWindow.SaveResult = (s, PackCerState) => { if (string.IsNullOrEmpty(s.PurchaseSkuId)) @@ -694,6 +691,9 @@ namespace BBWY.Client.ViewModels look.Show(); } + + + SaveType? saveType; /// /// 搜索 skuId(todo:) /// @@ -743,6 +743,13 @@ namespace BBWY.Client.ViewModels var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); + + + saveType = packTaskRes.Data.SaveType; + if (saveType==null) + { + saveType = OrderId.IsNullOrEmpty() ? SaveType.C端 : SaveType.B端; + } if (packTaskRes == null || !packTaskRes.Success) return; BarCodeModel = packTaskRes.Data.BarCodeDTO; IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; diff --git a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs index 477e0dbd..9ce656c1 100644 --- a/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs +++ b/BBWY.Client/Views/QualityTask/QualitySetCerWindow.xaml.cs @@ -35,14 +35,16 @@ namespace BBWY.Client.Views.QualityTask PackCerState = obj; } - public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate) + public void LoadData(bool isNeedCer, CertificateModel CertificateModel, PackPurchaseTaskService packTaskService, CertificateModel SpuCertificateModel, bool IsSetSpuCertificate,SaveType? saveType) { this.CertificateModel = CertificateModel.Copy(); this.packTaskService = packTaskService; PackCerState = isNeedCer ? PackCerState.合格证信息 : PackCerState.无需合格证; + SaveType = saveType; this.DataContext = this; } + public SaveType? SaveType { get; set; } public ICommand SetPackCerStateCommand { get; set; } @@ -123,6 +125,7 @@ namespace BBWY.Client.Views.QualityTask GoodsNumber = CertificateModel.GoodsNumber, ProduceDate = CertificateModel.ProduceDate, PurchaseSkuId = CertificateModel.PurchaseSkuId, + SaveType = SaveType }); if (resData == null || !resData.Success) { From aa2bef76651b71e49d99f7e4f769bebbc55b127b Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Mon, 12 Jun 2023 15:31:48 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=90=88=E6=A0=BC=E8=AF=81=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/GlobalContext.cs | 2 +- .../QualityTask/QualityViewModel.cs | 103 ++++++++++-------- .../Views/PackTask/LookCerWindow.xaml.cs | 4 + .../Views/QualityTask/QualityWindow.xaml | 2 +- 4 files changed, 65 insertions(+), 46 deletions(-) diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index cbe0b1f3..8d013252 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -9,7 +9,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10124"; + ClientVersion = "10125"; } private User user; diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index 5276b081..aa95f675 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -446,20 +446,20 @@ namespace BBWY.Client.ViewModels }; if (IsNeedBarCode == Need.需要) { - if (BarCodeModel==null|| BarCodeModel.Id <= 0) + if (BarCodeModel == null || BarCodeModel.Id <= 0) { MessageBox.Show("条形码不能为空"); return; } request.BarcodeId = BarCodeModel.Id; } - if (IsNeedCertificateModel == Need.需要) + if(PurchaseSkuList != null && PurchaseSkuList.Count > 0&&purchaseSkuList.Any(p=> p.IsNeedCer)) //(IsNeedCertificateModel == Need.需要) { - if (PurchaseSkuList == null && PurchaseSkuList.Count <= 0) - { - MessageBox.Show("无可用的合格证打印!"); - return; - } + //if () + //{ + // MessageBox.Show("无可用的合格证打印!"); + // return; + //} if (PurchaseSkuList.Where(p => p.IsSetCertificate).Count() > 0) { MessageBox.Show("存在未确认的合格证,请先完成确认!"); @@ -507,7 +507,7 @@ namespace BBWY.Client.ViewModels - if (competeTime now.AddDays(1).Date.AddHours(12)) + if (competeTime > now.AddDays(1).Date.AddHours(12)) { MessageBox.Show($"预计完成时间不能超过明天12点,请重新选择预计完成时间"); return; @@ -553,40 +553,41 @@ namespace BBWY.Client.ViewModels request.PreCompeteTime = competeTime; - try + try + { + var competeRes = packPurchaseTaskService.CompeteQualityTask(request); + if (competeRes == null) { - 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(); + MessageBox.Show("网络异常"); + return; + } + if (!competeRes.Success) + { + MessageBox.Show(competeRes.Msg); + return; + } + BatchPrintWindow batchPrint = new BatchPrintWindow(); - if (ReflashWindow != null) ReflashWindow(); - var window = obj as BWindow; - App.Current.Dispatcher.Invoke(new Action(() => { + batchPrint.SetData(GoodProductQuantity, + PurchaseSkuList.Where(p => p.IsNeedCer && p.CerDTO.Id > 0).Select(p => p.CerDTO).ToArray() + , BarCodeModel); + batchPrint.ShowDialog(); - window.Close(); - })); - - } - catch (Exception ex) + if (ReflashWindow != null) ReflashWindow(); + var window = obj as BWindow; + App.Current.Dispatcher.Invoke(new Action(() => { - System.Windows.MessageBox.Show(ex.Message); - } - + window.Close(); + })); + + } + catch (Exception ex) + { + + System.Windows.MessageBox.Show(ex.Message); + } + } @@ -717,6 +718,7 @@ namespace BBWY.Client.ViewModels BasicPack = model.BasicPack; CertificatePosition = model.CertificatePosition; + ArrivalQuantity = 0; GoodProductQuantity = 0; @@ -744,16 +746,29 @@ namespace BBWY.Client.ViewModels var packTaskRes = packPurchaseTaskService.GetQualityTask(model.TaskId); + if (packTaskRes==null) + { + MessageBox.Show("网络异常!"); + return; + } + if (!packTaskRes.Success || packTaskRes.Data==null) + { + MessageBox.Show(packTaskRes.Msg); + return; + } + + + SkuPurchaseSchemeId = packTaskRes.Data.SkuPurchaseSchemeId; saveType = packTaskRes.Data.SaveType; - if (saveType==null) + if (saveType == null) { saveType = OrderId.IsNullOrEmpty() ? SaveType.C端 : SaveType.B端; } if (packTaskRes == null || !packTaskRes.Success) return; BarCodeModel = packTaskRes.Data.BarCodeDTO; IsNeedBarCode = packTaskRes.Data.IsNeedBar ? Need.需要 : Need.不需要; - IsSetBarCode = packTaskRes.Data.BarCodeDTO==null ? true:false; + IsSetBarCode = packTaskRes.Data.BarCodeDTO == null ? true : false; IsNeedCertificateModel = packTaskRes.Data.IsNeedCer ? Need.需要 : Need.不需要; if (packTaskRes.Data.WareHourses != null) packTaskRes.Data.WareHourses.ToList().ForEach(w => @@ -782,8 +797,8 @@ namespace BBWY.Client.ViewModels } PurchaseSkuItemBasicInfoResponse skuItem = null; if (list.Data != null) skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); - - + + App.Current.Dispatcher.Invoke(new Action(() => { PurchaseSkuList.Add(new PurchaseSku @@ -832,7 +847,7 @@ namespace BBWY.Client.ViewModels - if (hour<12) + if (hour < 12) { PreCompeteTimeDayList.Add("今天"); PreCompeteTimeDayList.Add("明天"); @@ -841,7 +856,7 @@ namespace BBWY.Client.ViewModels PreCompeteTimeHour = "12点前"; } - else if (hour<18) + else if (hour < 18) { PreCompeteTimeDayList.Add("今天"); PreCompeteTimeDayList.Add("明天"); diff --git a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs index 37631eae..4ff41ffe 100644 --- a/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs @@ -32,6 +32,10 @@ namespace BBWY.Client.Views.PackTask int goodsNumberIndex = 0; foreach (CertificateModel certificateModel in certificate) { + if (certificateModel==null) + { + continue; + } goodsNumberIndex++; certificateModel.GoodsNumberIndex = goodsNumberIndex; GoodsNumberCerList.Add(new GoodsNumberCer diff --git a/BBWY.Client/Views/QualityTask/QualityWindow.xaml b/BBWY.Client/Views/QualityTask/QualityWindow.xaml index 4136005c..98e8d707 100644 --- a/BBWY.Client/Views/QualityTask/QualityWindow.xaml +++ b/BBWY.Client/Views/QualityTask/QualityWindow.xaml @@ -395,7 +395,7 @@ - +