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] 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