diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index 01eb94c..29869c6 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -62,6 +62,10 @@ namespace ButcherFactory.BO [ReferenceTo(typeof(Goods), "GoodsType")] [Join("Goods_ID", "ID")] public short? GoodsType { get; set; } + + [ReferenceTo(typeof(Goods), "CustomerDefine")] + [Join("Goods_ID", "ID")] + public string Goods_CustomerDefine { get; set; } [DbColumn(DefaultValue = 0)] public bool NoTotalCode { get; set; } diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 12290b6..b6281ca 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -40,7 +40,8 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("CreateTime")); query.Columns.Add(DQSelectColumn.Field("GoodsType")); query.Columns.Add(DQSelectColumn.Field("NoTotalCode")); - query.Columns.Add(DQSelectColumn.Field("Identify")); + query.Columns.Add(DQSelectColumn.Field("Identify")); + query.Columns.Add(DQSelectColumn.Field("Goods_CustomerDefine")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("InStored", false), DQCondition.EQ("Delete", false), DQCondition.EQ("Submited", submited))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); if (submited) @@ -76,6 +77,7 @@ namespace ButcherFactory.BO.LocalBL entity.GoodsType = (short?)reader[16]; entity.NoTotalCode = (bool)reader[17]; entity.Identify = (string)reader[18]; + entity.Goods_CustomerDefine = (string)reader[19]; list.Add(entity); } } diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index bbf4981..2d10d82 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -457,6 +457,7 @@ namespace ButcherFactory.SegmentProductionAuto_ entity.Goods_Spec = detail.Goods_Spec; entity.MainUnit = detail.MainUnit; entity.ShotPrintName = detail.ShotPrintName; + entity.Goods_CustomerDefine = detail.Goods_CustomerDefine; if (rebuild) { BindflowLayoutPanel(thisPanel, thisTotal); @@ -474,18 +475,14 @@ namespace ButcherFactory.SegmentProductionAuto_ if (barPrintCheck.Checked) { var template = config.Template; - string cd = null; if (detail.GoodsType.HasValue) { if (detail.GoodsType == 0) template = "SegmentProductionPrint.html"; else - { - cd = detail.Goods_CustomerDefine; template = "SegmentProductionPrint1.html"; - } } - NotAuto.SegmentProductionPrint.Print(entity, batchDate, template, cd); + NotAuto.SegmentProductionPrint.Print(entity, batchDate, template); var log = new SegmentLog(entity.BarCode, "打印"); log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); SegmentProductionBL.InsertLog(log); @@ -779,18 +776,14 @@ namespace ButcherFactory.SegmentProductionAuto_ item = historyList.First(); var template = config.Template; var goodsInfo = SegmentProductionBL.GetGoodsInfo(item.Goods_ID); - string cd = null; if (goodsInfo != null && goodsInfo.Item1.HasValue) { if (goodsInfo.Item1 == 0) template = "SegmentProductionPrint.html"; else - { - cd = goodsInfo.Item2; - template = "SegmentProductionPrint1.html"; - } + template = "SegmentProductionPrint1.html"; } - NotAuto.SegmentProductionPrint.Print(item, batchDate, template, cd); + NotAuto.SegmentProductionPrint.Print(item, batchDate, template); var log = new SegmentLog(item.BarCode, "补打"); log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", item.Goods_Name, item.Weight); SegmentProductionBL.InsertLog(log); diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs index 4a97a7b..940d09f 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs @@ -16,15 +16,11 @@ namespace ButcherFactory.SegmentProduction_ const string PRINTFILE = @"PrintTemplate\"; const string ENDFILE = @"PrintTemplate\SegmentProductionPrintEnd.html"; const string IMGFILE = @"TempImg\_img{0}.png"; - static string CustomerDefine =null; - public static void Print(SegmentProduction entity, DateTime? dt, string template, string customerDefine) + static string CustomerDefine = "GB/T9959.2-2008"; + public static void Print(SegmentProduction entity, DateTime? dt, string template) { if (AppContext.ConnectInfo.TraceBackUrl == "default") throw new Exception("请先配置追溯服务器地址"); - if (string.IsNullOrEmpty(CustomerDefine) && File.Exists(@"PrintTemplate\CustomerDefine.txt")) - { - CustomerDefine = File.ReadAllText(@"PrintTemplate\CustomerDefine.txt"); - } if (dt == null) dt = DateTime.Today; var dic = new Dictionary(); @@ -37,6 +33,7 @@ namespace ButcherFactory.SegmentProduction_ info = string.Format("重量:{0:#0.##}{1}", entity.Weight, entity.MainUnit); dic.Add("$Info", info); dic.Add("$Date", dt.Value.ToString("yyyy/MM/dd")); + var customerDefine = entity.Goods_CustomerDefine; if (string.IsNullOrEmpty(customerDefine)) customerDefine = CustomerDefine; dic.Add("$CustomerDefine", customerDefine); diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html index 5a9bee0..4c4d9dd 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html @@ -18,7 +18,7 @@
品名:$Goods_Name
$Info  生产日期:$Date
- + diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html index 0d7c962..67c2579 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html @@ -18,7 +18,7 @@
品名:$Goods_Name
$Info  生产日期:$Date
执行标准:GB/T9959.2-2008
执行标准:$CustomerDefine
储存条件:0~4℃保存
保 质 期:7天
生产厂家:青岛万福集团股份有限公司
- +
执行标准:GB/T9959.2-2008
执行标准:$CustomerDefine
储存条件:-18℃以下保存
保 质 期:18个月
生产厂家:青岛万福集团股份有限公司