diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index d5bd7c5e..81e519b5 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -126,7 +126,7 @@ namespace BBWY.Client serviceCollection.AddTransient<SealBoxConfigureViewModel>(); serviceCollection.AddTransient<PublishTaskViewModel>(); serviceCollection.AddTransient<QualityViewModel>(); - //serviceCollection.AddScoped<PackServiceViewModel>(); + serviceCollection.AddScoped<PackServiceViewModel>(); #region 注册拳探SDK相关类 serviceCollection.AddSingleton<QuanTanProductClient>(); diff --git a/BBWY.Client/Helpers/MyPrintHelper.cs b/BBWY.Client/Helpers/MyPrintHelper.cs index cb054b7e..3ee35e82 100644 --- a/BBWY.Client/Helpers/MyPrintHelper.cs +++ b/BBWY.Client/Helpers/MyPrintHelper.cs @@ -1,6 +1,7 @@ using BarcodeLib; using BBWY.Client.Extensions; using BBWY.Client.Models; +using BBWY.Client.Models.FallWare; using BBWY.Client.Models.PackTask; using NPOI.XSSF.UserModel; using Spire.Xls; @@ -198,100 +199,100 @@ namespace BBWY.Client.Helpers private static void SetCerStander(ref PrintPageEventArgs args, CertificateModel certificate, Font font) { -//#if DEBUG -// Bitmap bitmap = new Bitmap(236, 157); -// // Bitmap bitmap = new Bitmap(500, 500); -// Graphics graphics = Graphics.FromImage(bitmap); - -// var sige = graphics.VisibleClipBounds;// 宽:236 高:157 打印可视化区域 -// graphics.TranslateTransform((sige.Width - 236) / 2, 0);//设置起始位置 -// graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.Brushes.Black), 5, 5, sige.Width - 10, sige.Height - 10);//画出条码编辑区域 -// int bigJiange = 20;//合格证与品牌的高度差 -// var heightSpace = 4;//所有行间隔高度 -// if (!string.IsNullOrEmpty(certificate.ProduceDate)) -// { -// bigJiange = 10; heightSpace = 3; -// } - -// int standerSpace = 1;//执行标准之间的 -// if (certificate.IsLogo == 1)//含图标 -// { -// string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); -// string path = appPath + $"/Resources/Images/3c.png"; -// Image image = Image.FromFile(path); -// graphics.DrawImage(image, 190, 7, 28, 21); -// graphics.DrawString(certificate.FactoryNumber, font, System.Drawing.Brushes.Black, 188, 28); -// } - -// var fontBig = new Font("宋体", 14, System.Drawing.FontStyle.Regular); -// string cerName = "合格证"; -// SizeF bigSize = graphics.MeasureString(cerName, fontBig); - -// float verHeight = bigJiange + bigSize.Height; -// graphics.DrawString(cerName, fontBig, System.Drawing.Brushes.Black, new PointF((236 - bigSize.Width) / 2, 10)); - -// graphics.DrawString($"品牌: {certificate.Brand}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); -// if (!string.IsNullOrEmpty(certificate.ProductNo)) -// graphics.DrawString($"型号: {certificate.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); -// var smallSize = graphics.MeasureString(certificate.Brand, font);//小字体高度 - -// verHeight += (smallSize.Height + heightSpace); -// graphics.DrawString($"品名: {certificate.BrandName}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); - -// graphics.DrawString($"材质: {certificate.Shader}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); - -// StringBuilder sb = new StringBuilder(); -// var excutes = certificate.ExcuteStander.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); -// int hangCount = excutes.Count() / 2 + excutes.Count() % 2;//获取行数 - -// for (int i = 0; i < excutes.Count(); i++) -// { -// if (i % 2 == 0 && i > 0)//间隔两个换行 -// { -// sb.Append("\n"); -// } -// sb.Append(excutes[i]).Append(" "); -// } -// sb.Remove(sb.Length - 3, 3); -// var rows = sb.ToString().Split('\n'); -// string excuteStander = "执行标准: "; -// smallSize = graphics.MeasureString(excuteStander, font); -// verHeight += (smallSize.Height + heightSpace); -// graphics.DrawString($"执行标准: {rows[0]}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); - -// for (int i = 1; i < rows.Count(); i++) -// { -// verHeight += (smallSize.Height + standerSpace); -// graphics.DrawString($"{rows[i]}", font, System.Drawing.Brushes.Black, new PointF(12 + smallSize.Width, verHeight)); -// } - -// if (!string.IsNullOrEmpty(certificate.ProduceDate)) -// { -// verHeight += (smallSize.Height + heightSpace) - 3; -// graphics.DrawString($"生产日期: {certificate.ProduceDate}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); -// } - -// verHeight += (smallSize.Height + heightSpace); -// RectangleF rect = new RectangleF(10, verHeight, 220, smallSize.Height * 2 + heightSpace); -// var productStr = $"生产商: {certificate.ProductShop}"; -// if (graphics.MeasureString(productStr, font).Width <= 220) -// { -// graphics.DrawString(productStr, font, System.Drawing.Brushes.Black, 10, verHeight); -// verHeight += smallSize.Height + heightSpace; -// } -// else -// { -// graphics.DrawString(productStr, font, System.Drawing.Brushes.Black, rect); -// verHeight += 2 * smallSize.Height + heightSpace; -// } -// var productShop = graphics.MeasureString("生产商", font); -// var adress = graphics.MeasureString("地 址", font); - -// var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight - 2, 220, smallSize.Height * 3 + heightSpace); -// graphics.DrawString($"地 址: {certificate.ProductAdress}", font, System.Drawing.Brushes.Black, rect1); - -// var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); -// bitmap.Save($"{applicationPath}/{certificate.LabelModel}-{certificate.GoodsNumber}.jpg", ImageFormat.Png); + //#if DEBUG + // Bitmap bitmap = new Bitmap(236, 157); + // // Bitmap bitmap = new Bitmap(500, 500); + // Graphics graphics = Graphics.FromImage(bitmap); + + // var sige = graphics.VisibleClipBounds;// 宽:236 高:157 打印可视化区域 + // graphics.TranslateTransform((sige.Width - 236) / 2, 0);//设置起始位置 + // graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.Brushes.Black), 5, 5, sige.Width - 10, sige.Height - 10);//画出条码编辑区域 + // int bigJiange = 20;//合格证与品牌的高度差 + // var heightSpace = 4;//所有行间隔高度 + // if (!string.IsNullOrEmpty(certificate.ProduceDate)) + // { + // bigJiange = 10; heightSpace = 3; + // } + + // int standerSpace = 1;//执行标准之间的 + // if (certificate.IsLogo == 1)//含图标 + // { + // string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + // string path = appPath + $"/Resources/Images/3c.png"; + // Image image = Image.FromFile(path); + // graphics.DrawImage(image, 190, 7, 28, 21); + // graphics.DrawString(certificate.FactoryNumber, font, System.Drawing.Brushes.Black, 188, 28); + // } + + // var fontBig = new Font("宋体", 14, System.Drawing.FontStyle.Regular); + // string cerName = "合格证"; + // SizeF bigSize = graphics.MeasureString(cerName, fontBig); + + // float verHeight = bigJiange + bigSize.Height; + // graphics.DrawString(cerName, fontBig, System.Drawing.Brushes.Black, new PointF((236 - bigSize.Width) / 2, 10)); + + // graphics.DrawString($"品牌: {certificate.Brand}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); + // if (!string.IsNullOrEmpty(certificate.ProductNo)) + // graphics.DrawString($"型号: {certificate.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); + // var smallSize = graphics.MeasureString(certificate.Brand, font);//小字体高度 + + // verHeight += (smallSize.Height + heightSpace); + // graphics.DrawString($"品名: {certificate.BrandName}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); + + // graphics.DrawString($"材质: {certificate.Shader}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); + + // StringBuilder sb = new StringBuilder(); + // var excutes = certificate.ExcuteStander.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries); + // int hangCount = excutes.Count() / 2 + excutes.Count() % 2;//获取行数 + + // for (int i = 0; i < excutes.Count(); i++) + // { + // if (i % 2 == 0 && i > 0)//间隔两个换行 + // { + // sb.Append("\n"); + // } + // sb.Append(excutes[i]).Append(" "); + // } + // sb.Remove(sb.Length - 3, 3); + // var rows = sb.ToString().Split('\n'); + // string excuteStander = "执行标准: "; + // smallSize = graphics.MeasureString(excuteStander, font); + // verHeight += (smallSize.Height + heightSpace); + // graphics.DrawString($"执行标准: {rows[0]}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); + + // for (int i = 1; i < rows.Count(); i++) + // { + // verHeight += (smallSize.Height + standerSpace); + // graphics.DrawString($"{rows[i]}", font, System.Drawing.Brushes.Black, new PointF(12 + smallSize.Width, verHeight)); + // } + + // if (!string.IsNullOrEmpty(certificate.ProduceDate)) + // { + // verHeight += (smallSize.Height + heightSpace) - 3; + // graphics.DrawString($"生产日期: {certificate.ProduceDate}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); + // } + + // verHeight += (smallSize.Height + heightSpace); + // RectangleF rect = new RectangleF(10, verHeight, 220, smallSize.Height * 2 + heightSpace); + // var productStr = $"生产商: {certificate.ProductShop}"; + // if (graphics.MeasureString(productStr, font).Width <= 220) + // { + // graphics.DrawString(productStr, font, System.Drawing.Brushes.Black, 10, verHeight); + // verHeight += smallSize.Height + heightSpace; + // } + // else + // { + // graphics.DrawString(productStr, font, System.Drawing.Brushes.Black, rect); + // verHeight += 2 * smallSize.Height + heightSpace; + // } + // var productShop = graphics.MeasureString("生产商", font); + // var adress = graphics.MeasureString("地 址", font); + + // var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight - 2, 220, smallSize.Height * 3 + heightSpace); + // graphics.DrawString($"地 址: {certificate.ProductAdress}", font, System.Drawing.Brushes.Black, rect1); + + // var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + // bitmap.Save($"{applicationPath}/{certificate.LabelModel}-{certificate.GoodsNumber}.jpg", ImageFormat.Png); int bigJiange = 20;//合格证与品牌的高度差 @@ -322,8 +323,8 @@ namespace BBWY.Client.Helpers args.Graphics.DrawString(cerName, fontBig, System.Drawing.Brushes.Black, new PointF((236 - bigSize.Width) / 2, 10)); args.Graphics.DrawString($"品牌: {certificate.Brand}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); - if(!string.IsNullOrEmpty(certificate.ProductNo)) - args.Graphics.DrawString($"型号: {certificate.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); + if (!string.IsNullOrEmpty(certificate.ProductNo)) + args.Graphics.DrawString($"型号: {certificate.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight)); var smallSize = args.Graphics.MeasureString(certificate.Brand, font);//小字体高度 verHeight += (smallSize.Height + heightSpace); @@ -378,7 +379,7 @@ namespace BBWY.Client.Helpers var productShop = args.Graphics.MeasureString("生产商", font); var adress = args.Graphics.MeasureString("地 址", font); - var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight- 2, 220, smallSize.Height * 3 + heightSpace); + var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight - 2, 220, smallSize.Height * 3 + heightSpace); args.Graphics.DrawString($"地 址: {certificate.ProductAdress}", font, System.Drawing.Brushes.Black, rect1); @@ -492,7 +493,7 @@ namespace BBWY.Client.Helpers int bigJiange = 20;//合格证与品牌的高度差 var heightSpace = 4;//所有行间隔高度 int standerSpace = 1;//执行标准之间的 - if (!string.IsNullOrEmpty(certificate.ProduceDate)) bigJiange = 10; + if (!string.IsNullOrEmpty(certificate.ProduceDate)) bigJiange = 10; var fontBig = new Font("宋体", 14, System.Drawing.FontStyle.Regular); string cerName = "合格证"; SizeF bigSize = args.Graphics.MeasureString(cerName, fontBig); @@ -551,7 +552,7 @@ namespace BBWY.Client.Helpers } if (!string.IsNullOrEmpty(certificate.ProduceDate)) { - verHeight += (smallSize.Height + heightSpace)-3; + verHeight += (smallSize.Height + heightSpace) - 3; args.Graphics.DrawString($"生产日期: {certificate.ProduceDate}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight)); } verHeight += (smallSize.Height + heightSpace); @@ -571,7 +572,7 @@ namespace BBWY.Client.Helpers var productShop = args.Graphics.MeasureString("生产商", font); var adress = args.Graphics.MeasureString("地 址", font); - var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight-2, 220, smallSize.Height * 3 + heightSpace); + var rect1 = new RectangleF(10 + productShop.Width - adress.Width, verHeight - 2, 220, smallSize.Height * 3 + heightSpace); args.Graphics.DrawString($"地 址: {certificate.ProductAdress}", font, System.Drawing.Brushes.Black, rect1); @@ -596,7 +597,7 @@ namespace BBWY.Client.Helpers - public static BitmapImage GetBarcodeImage(string printStr,int width,int height) + public static BitmapImage GetBarcodeImage(string printStr, int width, int height) { Bitmap image = new Bitmap(width, height); Graphics graphics2 = Graphics.FromImage(image); @@ -606,7 +607,7 @@ namespace BBWY.Client.Helpers return bitmapToBitmapImage(image); } - static BitmapImage bitmapToBitmapImage(Bitmap bitmap) + static BitmapImage bitmapToBitmapImage(Bitmap bitmap) { using (var stream = new MemoryStream()) { @@ -623,18 +624,21 @@ namespace BBWY.Client.Helpers } - public static void PrintSealBoxData(SealBoxModel sealBoxModel, string printName, int boxCount, int printCount ) + + /// <summary> + /// 打印封箱 + /// </summary> + /// <param name="sealBoxModel"></param> + /// <param name="printName"></param> + /// <param name="boxCount"></param> + /// <param name="printCount"></param> + public static void PrintSealBoxData(SealBoxModel sealBoxModel, string printName, int boxCount, int printCount) { // 100*180 UnitConverHelper unitConverHelper = new UnitConverHelper(); - var data = unitConverHelper.MmToPx(100, 180); - - - - - + var data = unitConverHelper.MmToPx(100, 180); var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string printNamePath = $"{applicationPath}/printSealName.init"; if (File.Exists(printNamePath)) @@ -659,11 +663,8 @@ namespace BBWY.Client.Helpers XSSFWorkbook wb2 = new XSSFWorkbook(); - //wb2.CreateSheet("Sheet1"); sheet.CopyTo(wb2, "Sheet1", true, false); var sheet2 = wb2.GetSheet("Sheet1"); - - var nameCell2 = sheet2.GetRow(0).GetCell(1); nameCell2.SetCellValue(sealBoxModel.ShopName); @@ -693,7 +694,7 @@ namespace BBWY.Client.Helpers Workbook workbook = new Workbook(); workbook.LoadFromFile(newExccel); - + Worksheet wsheet = workbook.Worksheets[0]; wsheet.PageSetup.PaperSize = PaperSizeType.PaperA4; @@ -711,6 +712,15 @@ namespace BBWY.Client.Helpers print.Print(); } + /// <summary> + /// 打印京东箱唛 + /// </summary> + public static void PrintJDBoxWareData(JDWareBoxModel jDWareBoxModel,string printName) + { + + } + + public static void SetDefaultPrint(string printName) { diff --git a/BBWY.Client/Models/MappingProfile.cs b/BBWY.Client/Models/MappingProfile.cs index adfde434..79e99062 100644 --- a/BBWY.Client/Models/MappingProfile.cs +++ b/BBWY.Client/Models/MappingProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using BBWY.Client.Models.Statistics.AfterSaleOrder; namespace BBWY.Client.Models { diff --git a/BBWY.Client/Models/Order/Order.cs b/BBWY.Client/Models/Order/Order.cs index d1a22b7e..a93c95dd 100644 --- a/BBWY.Client/Models/Order/Order.cs +++ b/BBWY.Client/Models/Order/Order.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using BBWY.Client.Models.Statistics.AfterSaleOrder; namespace BBWY.Client.Models { diff --git a/BBWY.Client/Models/PackTask/PackTaskModel.cs b/BBWY.Client/Models/PackTask/PackTaskModel.cs index 35f32384..9d46cf3b 100644 --- a/BBWY.Client/Models/PackTask/PackTaskModel.cs +++ b/BBWY.Client/Models/PackTask/PackTaskModel.cs @@ -101,26 +101,9 @@ namespace BBWY.Client.Models private void SetService() { - ServiceWindow service = new ServiceWindow(); - //加载数据 - ViewModelLocator viewModelLocator = (ViewModelLocator)App.Current.Resources["Locator"]; - var serviceViewModel = viewModelLocator.PackServiceList; - - serviceViewModel.PackTaskModel = this; - serviceViewModel.PackTaskList = new System.Collections.ObjectModel.ObservableCollection<PackTaskModel> { this }; - serviceViewModel.FloorDragNumber = this.FloorDragNumber; - serviceViewModel.TaskCount = SkuCount; - serviceViewModel.TaskId = TaskId; - serviceViewModel.OrderId = OrderId; - serviceViewModel.SkuId = SkuId; - serviceViewModel.PackUserName = this.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ","); - serviceViewModel.LoadPackDatas(); - - - serviceViewModel.SetAllFees = new Action(() => - { - if (ReflashTask != null) ReflashTask(); - }); + + + ServiceWindow service = new ServiceWindow(this, ReflashTask); service.Show(); } diff --git a/BBWY.Client/Models/AfterSaleOrder/AfterSaleOrder.cs b/BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrder.cs similarity index 97% rename from BBWY.Client/Models/AfterSaleOrder/AfterSaleOrder.cs rename to BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrder.cs index 04785a6d..efcd93b4 100644 --- a/BBWY.Client/Models/AfterSaleOrder/AfterSaleOrder.cs +++ b/BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrder.cs @@ -1,6 +1,6 @@ using System; -namespace BBWY.Client.Models +namespace BBWY.Client.Models.Statistics.AfterSaleOrder { public class AfterSaleOrder : NotifyObject, ICloneable { @@ -146,7 +146,7 @@ namespace BBWY.Client.Models public object Clone() { - return this.MemberwiseClone(); + return MemberwiseClone(); } } } diff --git a/BBWY.Client/Models/AfterSaleOrder/AfterSaleOrderGroup.cs b/BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrderGroup.cs similarity index 85% rename from BBWY.Client/Models/AfterSaleOrder/AfterSaleOrderGroup.cs rename to BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrderGroup.cs index 49840022..92a26953 100644 --- a/BBWY.Client/Models/AfterSaleOrder/AfterSaleOrderGroup.cs +++ b/BBWY.Client/Models/Statistics/AfterSaleOrder/AfterSaleOrderGroup.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace BBWY.Client.Models +namespace BBWY.Client.Models.Statistics.AfterSaleOrder { public class AfterSaleOrderGroup { diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 28946e89..3372a4c3 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -1,6 +1,7 @@ using BBWY.Client.APIServices; using BBWY.Client.Helpers; using BBWY.Client.Models; +using BBWY.Client.Models.Statistics.AfterSaleOrder; using BBWY.Client.Views.Order; using BBWY.Common.Extensions; using BBWY.Common.Models; diff --git a/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs index a821ab98..bc724769 100644 --- a/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs @@ -32,7 +32,7 @@ using System.Windows.Media.Imaging; namespace BBWY.Client.ViewModels.PackTask { - public class PackServiceViewModel : BaseVM, IDenpendency + public class PackServiceViewModel : BaseVM { @@ -132,7 +132,7 @@ namespace BBWY.Client.ViewModels.PackTask readonly PackTaskService packTaskService; readonly ConsumableService consumableService; readonly PackDetailService packDetailService; - readonly BatchPurchaseService batchPurchaseService; + private ObservableCollection<PackItemModel> increateList = new ObservableCollection<PackItemModel>(); public ObservableCollection<PackItemModel> IncreateList { get => increateList; set { Set(ref increateList, value); } } // @@ -179,7 +179,7 @@ namespace BBWY.Client.ViewModels.PackTask /// </summary> public ObservableCollection<PackServiceDTO> BasicPackServiceList { get; set; } = new ObservableCollection<PackServiceDTO>(); - private readonly PackServiceService packServiceService; + /// <summary> /// 加载原数据 @@ -236,14 +236,14 @@ namespace BBWY.Client.ViewModels.PackTask } - public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, PackServiceService packServiceService, PackDetailService packDetailService, BatchPurchaseService batchPurchaseService)//, long taskId + public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, PackDetailService packDetailService)//, long taskId { //TaskId = taskId; this.consumableService = consumableService; this.packTaskService = packTaskService; - this.packServiceService = packServiceService; + this.packDetailService = packDetailService; - this.batchPurchaseService = batchPurchaseService; + AddIncreateServiceCommand = new RelayCommand(AddIncreateService); @@ -616,7 +616,7 @@ namespace BBWY.Client.ViewModels.PackTask var res = packDetailService.SetPackTaskDetail(packTaskDetail); - if (res==null) + if (res == null) { System.Windows.MessageBox.Show("网络异常!"); return; @@ -627,18 +627,18 @@ namespace BBWY.Client.ViewModels.PackTask return; } - - // new TipsWindow("上传成功!").Show(); - var win = obj as System.Windows.Window; - if (SetAllFees != null) - SetAllFees(); - win.Close(); - + + // new TipsWindow("上传成功!").Show(); + var win = obj as System.Windows.Window; + if (ReflashWindow != null) + ReflashWindow(); + win.Close(); + } /// <summary> - /// 更新 打包员 和费用数据 + /// 刷新界面 /// </summary> - public Action SetAllFees { get; set; } + public Action ReflashWindow { get; set; } private void AddPackService() { diff --git a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs index c6e222e3..2bf03a4b 100644 --- a/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs @@ -652,6 +652,7 @@ namespace BBWY.Client.ViewModels.PackTask } } IsLoadSealBoxCount(); + IsLoadCount(); } catch (Exception ex) { @@ -723,6 +724,7 @@ namespace BBWY.Client.ViewModels.PackTask } IsLoadFallWareCount(); + IsLoadCount(); } catch (Exception ex) diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 37acb084..2159ac70 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -263,9 +263,6 @@ namespace BBWY.Client.ViewModels.PackTask //加载数据 SetTaskState(null); - - - UpdateTaskStateCommand = new RelayCommand<object>(UpdateTaskState); CompeteSealBoxCommand = new RelayCommand<object>(CompeteSealBox); @@ -285,6 +282,40 @@ namespace BBWY.Client.ViewModels.PackTask LookBoxConfigureCommand = new RelayCommand<object>(LookBoxConfigure); + + PrintBoxConfigureCommand = new RelayCommand<object>(PrintBoxConfigure); + } + + + /// <summary> + /// todo: 打印数据 + /// </summary> + /// <param name="obj"></param> + private void PrintBoxConfigure(object obj) + { + var fallware = obj as WaitFallWareModel; + + JDWareBoxModel model = new JDWareBoxModel + { + ShopName = globalContext.User.Shop.ShopName, + WareName = fallware.WareName, + SealBoxId = fallware.SealBoxId, + ProductCount = fallware.ProductCount, + BoxCount = fallware.SealBoxCount, + PrewOrder = fallware.BoxConfigureData.PrewOrder, + ProductTitle = fallware.BoxConfigureData.ProductTitle, + PurchaseOrder = fallware.BoxConfigureData.PurchaseOrder, + WaybillNo = fallware.BoxConfigureData.WaybillNo + }; + if (fallware.WareType == WareType.京仓) + { + //加载模板数据 + } + if (fallware.WareType == WareType.云仓) + { + + } + //打印 } private void LookBoxConfigure(object obj) @@ -406,16 +437,20 @@ namespace BBWY.Client.ViewModels.PackTask /// 设置分箱数量 /// </summary> public ICommand SetSealBoxCommand { get; set; } + + /// <summary> + /// 打印封箱数据 + /// </summary> + public ICommand PrintBoxConfigureCommand { get; set; } - - /// <summary> - /// 完成封箱 - /// </summary> - /// <param name="obj"></param> - private void CompeteSealBox(object obj) + /// <summary> + /// 完成封箱 + /// </summary> + /// <param name="obj"></param> + private void CompeteSealBox(object obj) { var model = (SealBoxModel)obj; diff --git a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs index ef1ec561..7f61d55e 100644 --- a/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs +++ b/BBWY.Client/ViewModels/QualityTask/QualityViewModel.cs @@ -663,7 +663,7 @@ namespace BBWY.Client.ViewModels IsNeedCertificateModel = Need.需要; return; } - var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId); + var skus = PurchaseSkuList.SingleOrDefault(p =>p.cerDTO!=null&& p.cerDTO.PurchaseSkuId == s.PurchaseSkuId); skus.CerDTO = s; skus.IsSetCertificate = false; skus.IsNeedCer = PackCerState == PackCerState.合格证信息; diff --git a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml index fb4eb870..0603d262 100644 --- a/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml +++ b/BBWY.Client/Views/FallWare/WaitFallWareControl.xaml @@ -249,9 +249,13 @@ Command="{Binding DataContext.LookBoxConfigureCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" /> - + <c:BButton Grid.Column="11" HorizontalAlignment="Stretch" Style="{StaticResource LinkButton}" VerticalAlignment="Center" Content="打印" + Command="{Binding DataContext.PrintBoxConfigureCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}" + CommandParameter="{Binding}" + Visibility="Collapsed" + /> </StackPanel> - <TextBlock Style="{StaticResource middleTextBlock}" Text="未上传" + <TextBlock Style="{StaticResource middleTextBlock}" Text="未配置" Visibility="{Binding BoxConfigureData,Converter={StaticResource objConverter},ConverterParameter=#null:Visible:Collapsed}" /> diff --git a/BBWY.Client/Views/Order/EditAfterSaleOrderRefundPurchaseAmount.xaml.cs b/BBWY.Client/Views/Order/EditAfterSaleOrderRefundPurchaseAmount.xaml.cs index cfd865a1..2844739a 100644 --- a/BBWY.Client/Views/Order/EditAfterSaleOrderRefundPurchaseAmount.xaml.cs +++ b/BBWY.Client/Views/Order/EditAfterSaleOrderRefundPurchaseAmount.xaml.cs @@ -1,4 +1,4 @@ -using BBWY.Client.Models; +using BBWY.Client.Models.Statistics.AfterSaleOrder; using BBWY.Controls; using System.Windows; diff --git a/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs index 2ee8b953..15675dcc 100644 --- a/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs +++ b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs @@ -1,4 +1,4 @@ -using BBWY.Client.Models; +using BBWY.Client.Models.Statistics.AfterSaleOrder; using BBWY.Controls; namespace BBWY.Client.Views.Order diff --git a/BBWY.Client/Views/PackTask/PersonList.xaml b/BBWY.Client/Views/PackTask/PersonList.xaml deleted file mode 100644 index 0b6eb677..00000000 --- a/BBWY.Client/Views/PackTask/PersonList.xaml +++ /dev/null @@ -1,95 +0,0 @@ -<Page x:Class="BBWY.Client.Views.PackTask.PersonList" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" - xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" - xmlns:ctr="clr-namespace:BBWY.Client.Converters" - xmlns:cmodel="clr-namespace:BBWY.Client.Models" - xmlns:b="http://schemas.microsoft.com/xaml/behaviors" - xmlns:sys="clr-namespace:System;assembly=mscorlib" - DataContext="{Binding WareHouseList,Source={StaticResource Locator}}" - mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="2048" - Title="TaskList"> - <Page.Resources> - <sys:Int32 x:Key="d0">0</sys:Int32> - <sys:Int32 x:Key="d1">1</sys:Int32> - <sys:Int32 x:Key="d3">2</sys:Int32> - <sys:Int32 x:Key="d7">6</sys:Int32> - <sys:Int32 x:Key="d15">14</sys:Int32> - <sys:Int32 x:Key="d30">29</sys:Int32> - - </Page.Resources> - <Grid> - <StackPanel Panel.ZIndex="10" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="810,15,0,0"> - <c:BTextBox x:Name="tb" Width="150" Height="30" TextChanged="tb_TextChanged" Text="{Binding SearchDepartment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></c:BTextBox> - <ListBox MaxHeight="300" x:Name="tipBox" SelectionChanged="SelectionChangeCommand" Background="{StaticResource Border.Background}"> - </ListBox> - </StackPanel> - - <c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> - <Grid Margin="5,0"> - <Grid.RowDefinitions> - <RowDefinition Height="50"/> - <RowDefinition Height="40"/> - <RowDefinition Height="*"/> - <RowDefinition Height="30"/> - <!----> - </Grid.RowDefinitions> - <Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Panel.ZIndex="999" Margin="0,5,0,0" Width="1100"> - <Grid.ColumnDefinitions> - <ColumnDefinition /> - <ColumnDefinition Width="auto"/> - </Grid.ColumnDefinitions> - <StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30"> - <StackPanel.Resources> - <Style TargetType="DatePickerTextBox"> - <Setter Property="IsReadOnly" Value="True"/> - </Style> - </StackPanel.Resources> - <TextBlock Text="提交时间:" VerticalAlignment="Center" Margin="11,0,0,0"/> - <DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/> - <DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="10,0,0,0"/> - <TextBlock Text="花名:" VerticalAlignment="Center" Margin="16,0,0,0"/> - <c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="" Text="{Binding SearchSkuId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/> - <TextBlock Text="任务ID:" VerticalAlignment="Center" Margin="16,0,0,0"/> - <c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchTaskId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark=""/> - - <TextBlock Text="部门:" VerticalAlignment="Center" Margin="16,0,0,0"/> - - - </StackPanel> - - <Grid Grid.Column="1" > - <Grid.ColumnDefinitions> - <ColumnDefinition/> - <ColumnDefinition/> - </Grid.ColumnDefinitions> - <Button Content="搜索" Width="80" VerticalAlignment="Stretch" Margin="5,0,0,0" - Command="{Binding SearchTaskCommand}" - Grid.RowSpan="2" Background="{StaticResource Button.Selected.Background}" BorderThickness="0" Foreground="White"/> - - </Grid> - </Grid> - - - <Border Grid.Row="2" Margin="0,5,0,0" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,1,0,0"/> - - - - <c:PageControl PageIndex="{Binding PageIndex}" - PageSize="{Binding PageSize}" - RecordCount="{Binding OrderCount}" - Grid.Row="3" - HorizontalAlignment="Left" Width="450"> - <b:Interaction.Triggers> - <b:EventTrigger EventName="OnPageIndexChanged"> - <b:InvokeCommandAction Command="{Binding TaskPageIndexChangedCommand}" PassEventArgsToCommand="True"/> - </b:EventTrigger> - </b:Interaction.Triggers> - </c:PageControl> - </Grid> - </Grid> -</Page> diff --git a/BBWY.Client/Views/PackTask/PersonList.xaml.cs b/BBWY.Client/Views/PackTask/PersonList.xaml.cs deleted file mode 100644 index 91d5f389..00000000 --- a/BBWY.Client/Views/PackTask/PersonList.xaml.cs +++ /dev/null @@ -1,135 +0,0 @@ -using BBWY.Client.Helpers; -using BBWY.Client.Models.PackTask; -using BBWY.Common.Models; -using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Reflection; -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; -using System.Linq; - -namespace BBWY.Client.Views.PackTask -{ - /// <summary> - /// PersonList.xaml 的交互逻辑 - /// </summary> - public partial class PersonList : Page - { - public PersonList() - { - InitializeComponent(); - - 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; - - } - /// <summary> - /// 主机域名 - /// </summary> - string QKApiHost = ""; - public void SelectionChangeCommand(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; - tb.Text = content.Content.ToString(); - tipBox.Visibility = Visibility.Collapsed; - } - catch (Exception) - { - - - } - - } - - - List<string> departments = new List<string>(); - - private void tb_TextChanged(object sender, TextChangedEventArgs e) - { - try - { - var textBoxt = (TextBox)sender; - //创建一个ListBox - - if (tipBox != null && tipBox.Items.Count > 0) - { - tipBox.Items.Clear(); - - } - - if (departments.Count <= 0) - { - HttpClientHelper helper = new HttpClientHelper(QKApiHost); - - string url = $"{QKApiHost}/api/PackTask/GetAllDepartment";//获取所有数据 - var data = helper.Get(url); - - var res = JsonConvert.DeserializeObject<ApiResponse<UserDepartment[]>>(data); - //创建一个ListBoxIem - if (res.Success) - { - if (res.Data != null && res.Data.Count() > 0) - { - foreach (var department in res.Data) - { - if (!departments.Contains(department.DePartmentName)) - { - departments.Add(department.DePartmentName); - } - - - - } - } - } - } - - if (string.IsNullOrEmpty(textBoxt.Text)) - { - tipBox.Visibility = Visibility.Collapsed; - return; - } - foreach (var department in departments) - { - if (department.Contains(textBoxt.Text)) - { - ListBoxItem item = new ListBoxItem(); - Label lb = new Label(); - lb.Content = department; - item.Content = lb; - tipBox.Items.Add(item); - } - - } - - tipBox.Visibility = Visibility.Visible; - } - catch (Exception) - { - - - } - - } - } -} diff --git a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs index d2d77cf4..87f8817b 100644 --- a/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs @@ -1,6 +1,7 @@ using BarcodeLib; using BBWY.Client.APIServices; using BBWY.Client.Helpers; +using BBWY.Client.Models; using BBWY.Client.ViewModels; using BBWY.Client.ViewModels.PackTask; using BBWY.Controls; @@ -15,6 +16,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using System.Text; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -31,9 +33,23 @@ namespace BBWY.Client.Views.PackTask /// </summary> public partial class ServiceWindow : BWindow { - public ServiceWindow() + public ServiceWindow(PackTaskModel model,Action reflashWindow) { InitializeComponent(); + + var serviceViewModel= this.DataContext as PackServiceViewModel; + //加载数据 + serviceViewModel.PackTaskModel = model; + serviceViewModel.PackTaskList = new System.Collections.ObjectModel.ObservableCollection<PackTaskModel> { model }; + serviceViewModel.FloorDragNumber = model.FloorDragNumber; + serviceViewModel.TaskCount = model.SkuCount; + serviceViewModel.TaskId = model. TaskId; + serviceViewModel.OrderId = model. OrderId; + serviceViewModel.SkuId = model. SkuId; + serviceViewModel.PackUserName = model.PackUser?.Replace("\r\n", ",")?.Replace("\n", ",")?.Replace("\r", ","); + serviceViewModel.LoadPackDatas(); + if (reflashWindow != null) + serviceViewModel.ReflashWindow = reflashWindow; } private void BButton_Click(object sender, RoutedEventArgs e) {