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 }">