using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BWP.WinFormControl; namespace SegmentationWeight { public class SegmentationWeightPrint { public static void PrintByHTML(PrintEntity entity) { var dic = new Dictionary(); dic.Add("$Goods_Name", entity.Goods_Name); dic.Add("$Weight", entity.Weight); dic.Add("$Date", entity.Date.ToString("yyyy/MM/dd")); dic.Add("$Checker", entity.Checker); dic.Add("$StoreCondition", entity.StoreCondition); dic.Add("$TelNumber", entity.TelNumber); dic.Add("$Place", entity.Place); BwpClientPrint.BwpClientWebPrint.Create2DPic(entity._2DQRCode, "ImageUrl.png", 120); dic.Add("$ImageUrl", "ImageUrl.png"); BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrint.html", dic); } public static void PrintEndHTML(List list, string code) { string firstRow = "{0}:{1}{2}"; string template = "{0}:{1}{2}"; var builder = new StringBuilder(); bool first = true; foreach (var item in list) { if (first) { builder.Append(string.Format(firstRow, item.Goods_Name, item.Number, item.Weight, list.Count)); first = false; } else builder.Append(string.Format(template, item.Goods_Name, item.Number, item.Weight)); } var dic = new Dictionary(); dic.Add("$tableContent", builder.ToString()); BwpClientPrint.BwpClientWebPrint.Create2DPic(code.Replace("A26091201", ""), "ImageUrl.png", 120); dic.Add("$ImageUrl", "ImageUrl.png"); dic.Add("$DateTime", DateTime.Now.ToString("yyyy/MM/dd HH:ss")); BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrintEnd.html", dic); } } public class PrintEntity { public string AccountingUnit_Name { get; set; } public string Goods_Name { get; set; } public DateTime Date { get; set; } public string Checker { get; set; } public string StoreCondition { get; set; } public string Place { get; set; } public string TelNumber { get; set; } public string Address { get; set; } public string BarCode { get; set; } public string _2DQRCode { get; set; } public string Weight { get; set; } public string Number { get; set; } } }