| @ -1,71 +1,63 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本: 4.0.30319.42000 | |||
| // 运行时版本:4.0.30319.42000 | |||
| // | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将丢失。 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace B3DealerClient.Properties | |||
| { | |||
| /// <summary> | |||
| /// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
| /// </summary> | |||
| // 此类是由 StronglyTypedResourceBuilder | |||
| // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||
| // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||
| // (以 /str 作为命令选项),或重新生成 VS 项目。 | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | |||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| internal class Resources | |||
| { | |||
| private static global::System.Resources.ResourceManager resourceMan; | |||
| private static global::System.Globalization.CultureInfo resourceCulture; | |||
| [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |||
| internal Resources() | |||
| { | |||
| } | |||
| namespace B3DealerClient.Properties { | |||
| using System; | |||
| /// <summary> | |||
| /// 返回此类使用的、缓存的 ResourceManager 实例。 | |||
| /// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Resources.ResourceManager ResourceManager | |||
| { | |||
| get | |||
| { | |||
| if ((resourceMan == null)) | |||
| { | |||
| global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("B3DealerClient.Properties.Resources", typeof(Resources).Assembly); | |||
| resourceMan = temp; | |||
| // 此类是由 StronglyTypedResourceBuilder | |||
| // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||
| // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||
| // (以 /str 作为命令选项),或重新生成 VS 项目。 | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | |||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| internal class Resources { | |||
| private static global::System.Resources.ResourceManager resourceMan; | |||
| private static global::System.Globalization.CultureInfo resourceCulture; | |||
| [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |||
| internal Resources() { | |||
| } | |||
| /// <summary> | |||
| /// 返回此类使用的缓存的 ResourceManager 实例。 | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Resources.ResourceManager ResourceManager { | |||
| get { | |||
| if (object.ReferenceEquals(resourceMan, null)) { | |||
| global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("B3DealerClient.Properties.Resources", typeof(Resources).Assembly); | |||
| resourceMan = temp; | |||
| } | |||
| return resourceMan; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// 使用此强类型资源类,为所有资源查找 | |||
| /// 重写当前线程的 CurrentUICulture 属性。 | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Globalization.CultureInfo Culture { | |||
| get { | |||
| return resourceCulture; | |||
| } | |||
| set { | |||
| resourceCulture = value; | |||
| } | |||
| } | |||
| return resourceMan; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// 为所有资源查找重写当前线程的 CurrentUICulture 属性, | |||
| /// 方法是使用此强类型资源类。 | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Globalization.CultureInfo Culture | |||
| { | |||
| get | |||
| { | |||
| return resourceCulture; | |||
| } | |||
| set | |||
| { | |||
| resourceCulture = value; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -1,30 +1,26 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // This code was generated by a tool. | |||
| // Runtime Version:4.0.30319.42000 | |||
| // 此代码由工具生成。 | |||
| // 运行时版本:4.0.30319.42000 | |||
| // | |||
| // Changes to this file may cause incorrect behavior and will be lost if | |||
| // the code is regenerated. | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace B3DealerClient.Properties | |||
| { | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] | |||
| internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase | |||
| { | |||
| private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | |||
| public static Settings Default | |||
| { | |||
| get | |||
| { | |||
| return defaultInstance; | |||
| } | |||
| namespace B3DealerClient.Properties { | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] | |||
| internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { | |||
| private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | |||
| public static Settings Default { | |||
| get { | |||
| return defaultInstance; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,99 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Drawing; | |||
| using System.Drawing.Imaging; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using System.Windows.Forms; | |||
| using Microsoft.Win32; | |||
| using ZXing; | |||
| namespace B3DealerClient.Utils | |||
| { | |||
| public class BwpClientWebPrint | |||
| { | |||
| static string htmlPath = Application.StartupPath + "\\print.html"; | |||
| public static void Print(string templatePath, IDictionary<string, string> parameters) | |||
| { | |||
| if (!File.Exists(templatePath)) | |||
| throw new Exception("打印模板不存在!"); | |||
| ChangePageSettingByRegist(); | |||
| CreatePrintHtml(templatePath, parameters); | |||
| pd_PrintPage(); | |||
| } | |||
| private static void CreatePrintHtml(string templatePath, IDictionary<string, string> dic) | |||
| { | |||
| using (FileStream fs = new FileStream(htmlPath, FileMode.Create, FileAccess.ReadWrite)) | |||
| { | |||
| using (StreamWriter sw = new StreamWriter(fs)) | |||
| { | |||
| var text = File.ReadAllText(templatePath); | |||
| foreach (var item in dic) | |||
| text = text.Replace(item.Key, item.Value); | |||
| sw.Write(text); | |||
| sw.Close(); | |||
| fs.Close(); | |||
| } | |||
| } | |||
| } | |||
| public static void Create2DPic(string content, string path, int size) | |||
| { | |||
| var writer = new BarcodeWriter(); | |||
| writer.Options.Margin = 0; | |||
| writer.Options.Width = size; | |||
| writer.Options.Height = size; | |||
| writer.Format = BarcodeFormat.QR_CODE; | |||
| writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET, "UTF-8"); | |||
| using (var bitMap = writer.Write(content)) | |||
| { | |||
| bitMap.Save(path, ImageFormat.Png); | |||
| } | |||
| } | |||
| public static void CreateBarCode(string content, string path, Size size) | |||
| { | |||
| var writer = new BarcodeWriter(); | |||
| writer.Options.Margin = 1; | |||
| writer.Options.Width = size.Width; | |||
| writer.Options.Height = size.Height; | |||
| writer.Format = BarcodeFormat.CODE_128; | |||
| writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET, "UTF-8"); | |||
| using (var bitMap = writer.Write(content)) | |||
| { | |||
| bitMap.Save(path, ImageFormat.Png); | |||
| } | |||
| } | |||
| private static void ChangePageSettingByRegist() | |||
| { | |||
| RegistryKey hklm = Registry.CurrentUser; | |||
| RegistryKey software = hklm.OpenSubKey(@"Software\Microsoft\Internet Explorer\PageSetup".ToUpper(), true); | |||
| software.SetValue("header", ""); | |||
| software.SetValue("footer", ""); | |||
| software.SetValue("margin_bottom", 0); | |||
| software.SetValue("margin_left", 0.1); | |||
| software.SetValue("margin_right", 0.05); | |||
| software.SetValue("margin_top", 0.1); | |||
| software.SetValue("Shrink_To_Fit", "yes"); | |||
| } | |||
| private static void pd_PrintPage() | |||
| { | |||
| WebBrowser webBrowserForPrinting = new WebBrowser(); | |||
| webBrowserForPrinting.Url = new Uri(htmlPath); | |||
| webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument); | |||
| } | |||
| private static void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e) | |||
| { | |||
| var browser = (WebBrowser)sender; | |||
| browser.Print(); | |||
| browser.Dispose(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,35 @@ | |||
| using System.Collections.Generic; | |||
| using System.Drawing; | |||
| using System.Drawing.Printing; | |||
| using System.IO; | |||
| using B3DealerClient.BO; | |||
| using B3DealerClient.Utils; | |||
| using System; | |||
| using System.Globalization; | |||
| namespace B3DealerClient.Windows.CarcassInStoreWindow_ | |||
| { | |||
| public static class CarcassInStoreConfigPrint | |||
| { | |||
| static string TEMPLATE = Path.Combine(AppDomain.CurrentDomain.BaseDirectory , @"CarcassInStoreConfigPrint.html"); | |||
| static string PicUrl = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"img.png"); | |||
| private static DateTime currentdate= DateTime.Now; | |||
| public static void Print(CarcassInStore_Receive entity,string supplier) | |||
| { | |||
| var dic = new Dictionary<string, string>(); | |||
| dic.Add("$NetWeight",entity.NetWeight.ToString(CultureInfo.InvariantCulture)); | |||
| dic.Add("$Pics", entity.Pics.ToString(CultureInfo.InvariantCulture)); | |||
| dic.Add("$GoodsName", entity.Goods_Name.ToString(CultureInfo.InvariantCulture)); | |||
| if (supplier != null) | |||
| { | |||
| dic.Add("$supplier",supplier); | |||
| } | |||
| BwpClientWebPrint.Create2DPic("$NetWeight", PicUrl, 120); | |||
| dic.Add("$picUrl", PicUrl); | |||
| dic.Add("$date", currentdate.ToString()); | |||
| BwpClientWebPrint.Print(TEMPLATE, dic); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,48 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| <title></title> | |||
| <style type='text/css'> | |||
| * { | |||
| margin: 0; | |||
| padding: 0; | |||
| } | |||
| .AA { | |||
| height: 400PX; | |||
| width: 400PX; | |||
| float: left; | |||
| } | |||
| body { | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| </head> | |||
| <body> | |||
| <div style="width:100%;height:400px"> | |||
| <div class="AA"> | |||
| <div style="height:50px;text-align:center;line-height:50px;font-size:1.2rem">上海牧联电子商务有限公司</div> | |||
| <div style="height:20px;text-align:left;line-height:20px;font-size:0.8rem">$GoodsName-10kg/箱</div> | |||
| <div style="height:150px;width:100%"> | |||
| <div style="height:200px;width:50%;float:left"> | |||
| <img border="0" src=$picUrl /> | |||
| </div> | |||
| <div style="height: 200px; width: 50%; float: right"> | |||
| <div style="height:20px;text-align:center;line-height:20px;font-size:0.8rem">重量:$NetWeight</div> | |||
| <div style="height:20px;text-align:center; line-height: 20px; font-size: 0.8rem">件数:$Pics</div> | |||
| </div> | |||
| </div> | |||
| <div style="font-size: 1.5em;"> | |||
| <div>供应商:$supplier</div> | |||
| <div>打印时间:$date</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @ -0,0 +1,33 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Drawing; | |||
| using System.Globalization; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| using B3DealerClient.BO; | |||
| using B3DealerClient.Utils; | |||
| namespace B3DealerClient.Windows.CarcassSaleOutWindow_ | |||
| { | |||
| public static class CarcassSaleOutConfigPrint | |||
| { | |||
| static string TEMPLATE = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"CarcassSaleOutConfigPrint.html"); | |||
| static string PicUrl = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"img.png"); | |||
| public static void Print(CarcassSaleOut_Record entity,string deliverLineName,string customer) | |||
| { | |||
| var dic = new Dictionary<string, string>(); | |||
| dic.Add("$User", customer); | |||
| dic.Add("$NetWeight",entity.NetWeight.ToString(CultureInfo.InvariantCulture)); | |||
| dic.Add("$Pics",entity.SecondNumber.ToString(CultureInfo.InvariantCulture)); | |||
| dic.Add("$LineName",deliverLineName); | |||
| dic.Add("$GoodsName", entity.Goods_Name); | |||
| BwpClientWebPrint.Create2DPic(dic["$NetWeight"], PicUrl, 120); | |||
| dic.Add("$picUrl", PicUrl); | |||
| BwpClientWebPrint.Print(TEMPLATE, dic); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,50 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |||
| <head> | |||
| <meta charset="utf-8" /> | |||
| <title></title> | |||
| <style> | |||
| * { | |||
| margin: 0; | |||
| padding: 0; | |||
| } | |||
| .AA { | |||
| height: 400PX; | |||
| width: 400PX; | |||
| float: left; | |||
| } | |||
| body { | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| </head> | |||
| <body> | |||
| <div style="width:100%;height:400px"> | |||
| <div class="AA"> | |||
| <div style="height:50px;text-align:center;line-height:50px;font-size:1.5rem">上海牧联电子商务有限公司</div> | |||
| <div style="height:20px;text-align:left;line-height:20px;font-size:0.8rem">$User</div> | |||
| <div style="height:20px;text-align:left;line-height:20px;font-size:0.8rem">$GoodsName-10kg/箱</div> | |||
| <div style="height:150px;width:100%"> | |||
| <div style="height:200px;width:50%;float:left"> | |||
| <img border="0" src=$picUrl /> | |||
| </div> | |||
| <div style="height: 200px; width: 50%; float: right"> | |||
| <div style="height:20px;text-align:center;line-height:20px;font-size:0.8rem">线路:$LineName</div> | |||
| <div style="height:20px;text-align:center;line-height:20px;font-size:0.8rem">重量:$NetWeight</div> | |||
| <div style="height:20px;text-align:center;line-height:20px;font-size:0.8rem">件数:$Pics</div> | |||
| </div> | |||
| </div> | |||
| <div style="font-size:1.5em;"> | |||
| <div>地址:上海市嘉定区昌翔路88弄30号</div> | |||
| <div>销售热线:18063329988</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||