diff --git a/BBWY.Client/Extensions/StringExtensions.cs b/BBWY.Client/Extensions/StringExtensions.cs new file mode 100644 index 00000000..29fad1d3 --- /dev/null +++ b/BBWY.Client/Extensions/StringExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; + +namespace BBWY.Client.Extensions +{ + public static class StringExtensions + { + public static bool IsSpecialChar(this string str) + { + Regex regExp = new Regex("[ \\[ \\] \\^ \\-_*×――(^)$%~!@@##$…&%¥—+=<>《》!!???::•`·、。,;,.;/\'\"{}()‘’“”-]"); + if (regExp.IsMatch(str)) + { + return true; + } + return false; + } + + } +} diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index ce278c1c..246ebae7 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -13,7 +13,7 @@ namespace BBWY.Client { ShopServiceGroupList = new List(); ShopServiceGroupLowerList = new List(); - ClientVersion = "10157"; + ClientVersion = "10158"; } private User user; diff --git a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml index 004b7825..da64c5a2 100644 --- a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml @@ -17,7 +17,7 @@ MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" RightButtonGroupMargin="0,5,5,0" - Width="450" Height="380" + Height="535" Width="272" > @@ -32,7 +32,7 @@ Background="{StaticResource Border.Background}"> - + @@ -41,7 +41,7 @@ - + @@ -56,7 +56,8 @@ - + + @@ -65,12 +66,14 @@ - - - - - + + + + + + + diff --git a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs index db57a044..5596ac11 100644 --- a/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetCloudWareBoxWindow.xaml.cs @@ -19,6 +19,7 @@ using System.Printing; using System.Reflection; using System.IO; using System.Threading; +using System.Drawing.Printing; namespace BBWY.Client.Views.FallWare { @@ -63,17 +64,32 @@ namespace BBWY.Client.Views.FallWare } MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 PrintDialog printDialog = new PrintDialog(); - printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 - var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); - var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 + PrintDocument document = new PrintDocument(); + document.PrinterSettings.PrinterName = printName; + + var pageWidth = document.DefaultPageSettings.Bounds.Size.Width; + var pageHeight = document.DefaultPageSettings.Bounds.Size.Height; + + //设置纸张大小 + //var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + //var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + + + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); + var printAreaWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth);//打印区宽度 + var printAreaHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight);//打印区高度 + + + + this.Height = pageHeight + 39;//492 + this.Width = pageWidth;//227 - this.Height = pageHeight + 39; - this.Width = pageWidth; - this.FontSize = 30; - box_margin.Margin = new Thickness(50, 50, 50, 50); - this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); + // this.FontSize = 30; + box_margin.Margin = new Thickness(2); + //this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); for (int i = 1; i <= JDWareBoxModel.BoxCount; i++) { this.Dispatcher.Invoke(() => { diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml index df819c59..bf5b1ad4 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml @@ -16,7 +16,7 @@ CloseButtonColor="{StaticResource WindowButtonColor}" MinButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed" - Width="480" Height="480" + Height="535" Width="272" RightButtonGroupMargin="0,5,5,0"> @@ -42,19 +42,19 @@ Background="{StaticResource Border.Background}"> - + - - + + - + @@ -69,26 +69,34 @@ - + + + + + - - - - - + + + + + + - - - - - + + + + + + + + diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs index 7f072968..f6829cc1 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow.xaml.cs @@ -36,7 +36,7 @@ namespace BBWY.Client.Views.FallWare InitializeComponent(); JDWareBoxModel = model; PurchaseOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PurchaseOrder, 420, 50); - PrewOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PrewOrder, 350, 50); + PrewOrderImage = MyPrintHelper.GetBarcodeImageV2(model.PrewOrder, 420, 50); this.DataContext =this; this.Dispatcher.Invoke(() => { tb_printcount.Text = "1"; @@ -80,17 +80,34 @@ namespace BBWY.Client.Views.FallWare MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机 PrintDialog printDialog = new PrintDialog(); - printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 - //设置纸张大小 - var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); - var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + printDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 + + PrintDocument document = new PrintDocument(); + document.PrinterSettings.PrinterName = printName; + + var pageWidth = document.DefaultPageSettings.Bounds.Size.Width; + var pageHeight = document.DefaultPageSettings.Bounds.Size.Height; + + //设置纸张大小 + //var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); + //var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); + + + printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); - this.Height = pageHeight + 39;//833 - this.Width = pageWidth;//1123 - this.FontSize = 30; - box_margin.Margin = new Thickness(50, 50, 50, 50); + + var printAreaWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth);//打印区宽度 + var printAreaHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight);//打印区高度 + + + + this.Height = pageHeight+39;//492 + this.Width = pageWidth;//227 + + // this.FontSize = 30; + box_margin.Margin = new Thickness(2); //box_margin.Margin = new Thickness(10); - this.jd_box.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight))); + //this.jd_box.Arrange(new Rect(new Point((printAreaWidth- pageWidth)/2, (printAreaHeight- pageHeight)/2), new Size(pageWidth, pageHeight))); for (int i = 1; i <= JDWareBoxModel.BoxCount; i++) { this.Dispatcher.Invoke(() => { diff --git a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs index 3eca7928..68c5aee7 100644 --- a/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs +++ b/BBWY.Client/Views/FallWare/SetJDWareBoxWindow2.xaml.cs @@ -1,4 +1,5 @@ using BBWY.Client.APIServices; +using BBWY.Client.Extensions; using BBWY.Client.Models; using BBWY.Client.Models.FallWare; using BBWY.Controls; @@ -162,6 +163,25 @@ namespace BBWY.Client.Views.FallWare return; } + if (wareType == WareType.聚水潭齐越仓) + { + if (JDWareBoxModel.PurchaseOrder.IsNullOrEmpty()) + { + MessageBox.Show("采购单不能为空!"); + return; + } + + if (JDWareBoxModel.PurchaseOrder.IsSpecialChar()) + { + MessageBox.Show("采购单不能含特殊符号!"); + return; + } + + + } + + + if (wareType == WareType.云仓 ) { if (!JDWareBoxModel.PurchaseOrder.ToUpper().StartsWith("CPL"))