|
|
|
@ -9,53 +9,6 @@ namespace SegmentationWeight |
|
|
|
{ |
|
|
|
public class SegmentationWeightPrint |
|
|
|
{ |
|
|
|
public static void PrintEnd(PrintEntity entity) |
|
|
|
{ |
|
|
|
PrintAPI.B_GetUSBBufferLen(); |
|
|
|
PrintAPI.B_EnumUSB(new byte[128]); |
|
|
|
PrintAPI.B_CreateUSBPort(1); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("总重量:{0}", entity.Weight)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 200, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("总数量:{0}", entity.Number)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Barcode(42, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode); |
|
|
|
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity.BarCode); |
|
|
|
|
|
|
|
PrintAPI.B_Set_Direction('B'); |
|
|
|
PrintAPI.B_Print_Out(1); |
|
|
|
PrintAPI.B_ClosePrn(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void Print(PrintEntity entity) |
|
|
|
{ |
|
|
|
PrintAPI.B_GetUSBBufferLen(); |
|
|
|
PrintAPI.B_EnumUSB(new byte[128]); |
|
|
|
PrintAPI.B_CreateUSBPort(1); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "黑体", 1, 400, 0, 0, 0, "C2", string.Format("产品重量:{0}",entity.Weight)); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(300, 70, 31, "黑体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 120, 23, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd"))); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 160, 23, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker)); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 200, 23, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 240, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("电话:{0}", entity.TelNumber)); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(42, 280, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("产地:{0}", entity.Place)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Barcode(30, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode); |
|
|
|
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode); |
|
|
|
|
|
|
|
PrintAPI.B_Set_Direction('B'); |
|
|
|
PrintAPI.B_Print_Out(1); |
|
|
|
PrintAPI.B_ClosePrn(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void PrintByHTML(PrintEntity entity) |
|
|
|
{ |
|
|
|
var dic = new Dictionary<string, string>(); |
|
|
|
@ -71,54 +24,29 @@ namespace SegmentationWeight |
|
|
|
BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrint.html", dic); |
|
|
|
} |
|
|
|
|
|
|
|
public static void PrintEndHTML(PrintEntity entity) |
|
|
|
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("$Weight", entity.Weight); |
|
|
|
dic.Add("$Number", entity.Number); |
|
|
|
BwpClientPrint.BwpClientWebPrint.Create2DPic(entity.BarCode.Replace("A26091201", ""), "ImageUrl.png", 120); |
|
|
|
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 static void PrintEnd5050(PrintEntity entity) |
|
|
|
{ |
|
|
|
PrintAPI.B_GetUSBBufferLen(); |
|
|
|
PrintAPI.B_EnumUSB(new byte[128]); |
|
|
|
PrintAPI.B_CreateUSBPort(1); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 25, 31, "宋体", 1, 700, 0, 0, 0, "C1", "万福"); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 60, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("总重量:{0}", entity.Weight)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 95, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("总数量:{0}", entity.Number)); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Barcode(10, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode.Replace("A26091201", "")); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 400, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode.Replace("A26091201", "")); |
|
|
|
PrintAPI.B_Bar2d_QR(40, 130, 2, 6, 'M', 'A', 0, 0, 0, entity.BarCode.Replace("A26091201", "")); |
|
|
|
|
|
|
|
PrintAPI.B_Set_Direction('B'); |
|
|
|
PrintAPI.B_Print_Out(1); |
|
|
|
PrintAPI.B_ClosePrn(); |
|
|
|
} |
|
|
|
public static void Print5050(PrintEntity entity) |
|
|
|
{ |
|
|
|
PrintAPI.B_GetUSBBufferLen(); |
|
|
|
PrintAPI.B_EnumUSB(new byte[128]); |
|
|
|
PrintAPI.B_CreateUSBPort(1); |
|
|
|
|
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 26, 31, "黑体", 1, 700, 0, 0, 0, "C1", entity.Goods_Name); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 70, 31, "黑体", 1, 400, 0, 0, 0, "C2", string.Format("产品重量:{0}", entity.Weight)); |
|
|
|
|
|
|
|
|
|
|
|
PrintAPI.B_Prn_Barcode(10, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode.Replace("A26091201","")); |
|
|
|
PrintAPI.B_Prn_Text_TrueType(40, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode.Replace("A26091201", "")); |
|
|
|
PrintAPI.B_Bar2d_QR(40, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode.Replace("A26091201", "")); |
|
|
|
|
|
|
|
PrintAPI.B_Set_Direction('B'); |
|
|
|
PrintAPI.B_Print_Out(1); |
|
|
|
PrintAPI.B_ClosePrn(); |
|
|
|
} |
|
|
|
} |
|
|
|
public class PrintEntity |
|
|
|
{ |
|
|
|
|