|
|
@ -16,10 +16,15 @@ namespace ButcherFactory.SegmentProduction_ |
|
|
const string PRINTFILE = @"PrintTemplate\"; |
|
|
const string PRINTFILE = @"PrintTemplate\"; |
|
|
const string ENDFILE = @"PrintTemplate\SegmentProductionPrintEnd.html"; |
|
|
const string ENDFILE = @"PrintTemplate\SegmentProductionPrintEnd.html"; |
|
|
const string IMGFILE = @"TempImg\_img{0}.png"; |
|
|
const string IMGFILE = @"TempImg\_img{0}.png"; |
|
|
|
|
|
static string CustomerDefine =null; |
|
|
public static void Print(SegmentProduction entity, DateTime? dt, string template, string customerDefine) |
|
|
public static void Print(SegmentProduction entity, DateTime? dt, string template, string customerDefine) |
|
|
{ |
|
|
{ |
|
|
if (AppContext.ConnectInfo.TraceBackUrl == "default") |
|
|
if (AppContext.ConnectInfo.TraceBackUrl == "default") |
|
|
throw new Exception("请先配置追溯服务器地址"); |
|
|
throw new Exception("请先配置追溯服务器地址"); |
|
|
|
|
|
if (string.IsNullOrEmpty(CustomerDefine) && File.Exists(@"PrintTemplate\CustomerDefine.txt")) |
|
|
|
|
|
{ |
|
|
|
|
|
CustomerDefine = File.ReadAllText(@"PrintTemplate\CustomerDefine.txt"); |
|
|
|
|
|
} |
|
|
if (dt == null) |
|
|
if (dt == null) |
|
|
dt = DateTime.Today; |
|
|
dt = DateTime.Today; |
|
|
var dic = new Dictionary<string, string>(); |
|
|
var dic = new Dictionary<string, string>(); |
|
|
@ -33,7 +38,7 @@ namespace ButcherFactory.SegmentProduction_ |
|
|
dic.Add("$Info", info); |
|
|
dic.Add("$Info", info); |
|
|
dic.Add("$Date", dt.Value.ToString("yyyy/MM/dd")); |
|
|
dic.Add("$Date", dt.Value.ToString("yyyy/MM/dd")); |
|
|
if (string.IsNullOrEmpty(customerDefine)) |
|
|
if (string.IsNullOrEmpty(customerDefine)) |
|
|
customerDefine = "GB/T9959.2-2008"; |
|
|
|
|
|
|
|
|
customerDefine = CustomerDefine; |
|
|
dic.Add("$CustomerDefine", customerDefine); |
|
|
dic.Add("$CustomerDefine", customerDefine); |
|
|
var code = entity.BarCode; |
|
|
var code = entity.BarCode; |
|
|
if (code.Length > 17) |
|
|
if (code.Length > 17) |
|
|
|