屠宰场客户端
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.

108 lines
3.8 KiB

using BWP.WinFormControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BO.Utils;
using BO.Utils.BillRpc;
using BO.BO.Bill;
namespace WeighAndGrading
{
public static class WeightGradePrint
{
public static PrintEntity CreatePrintEntity(DateTime date, GradeAndWeight_Detail detail, bool add = false)
{
string goodsName;
if (detail.Technics_Name == "烫褪")
{
goodsName = "带皮白条"; //"带皮白条";
}
else
{
goodsName = "去皮白条"; //"去皮白条";
}
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = date;
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
if (string.IsNullOrWhiteSpace(detail.BarCode))
{
int order = LocalGradeAndWeightBL.GetOrderIndex(date, detail);
if (add)
order += 1;
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1:000}{2:000}", entity.Date, detail.Order, order);
}
else
{
entity.BarCode = detail.BarCode;
}
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}", entity.BarCode);
return entity;
}
//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, 700, 0, 0, 0, "C2", "合格证");
// PrintAPI.B_Prn_Text_TrueType(440, 70, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
// PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
// PrintAPI.B_Prn_Text_TrueType(42, 160, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
// PrintAPI.B_Prn_Text_TrueType(42, 200, 27, "宋体", 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(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._2DQRCode);
// PrintAPI.B_Set_Direction('B');
// PrintAPI.B_Print_Out(1);
// PrintAPI.B_ClosePrn();
//}
public static void Print(PrintEntity entity)
{
var dic = new Dictionary<string, string>();
dic.Add("$Goods_Name", entity.Goods_Name);
dic.Add("$Date", entity.Date.ToString("yyyy/MM/dd"));
BwpClientPrint.BwpClientWebPrint.Create2DPic(entity._2DQRCode, "ImageUrl.png", 120);
dic.Add("$ImageUrl", "ImageUrl.png");
BwpClientPrint.BwpClientWebPrint.Print("GradeWeightPrint.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; }
}
}