屠宰场客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.6 KiB

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<string, string>();
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<PrintEntity> list, string code)
{
string firstRow = "<tr><td><span>{0}:</span></td><td>{1}</td><td>{2}</td><td rowspan='{3}' style='width:120px'><img src='$ImageUrl' style='width:120px;height:120px;margin-top:-5px;'/></td></tr>";
string template = "<tr><td><span>{0}:</span></td><td>{1}</td><td>{2}</td></tr>";
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<string, string>();
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; }
}
}