diff --git a/WeighAndGrading/WeightGradePrint.cs b/WeighAndGrading/WeightGradePrint.cs index 32e70eb..04a6419 100644 --- a/WeighAndGrading/WeightGradePrint.cs +++ b/WeighAndGrading/WeightGradePrint.cs @@ -54,10 +54,21 @@ namespace WeighAndGrading dic.Add("$Goods_Name", entity.Goods_Name); dic.Add("$Date", entity.Date.ToString("yyyy/MM/dd")); var imgUrl = string.Format("TempImg\\_img{0}.png", id); - BwpClientPrint.BwpClientWebPrint.Create2DPic(entity._2DQRCode, imgUrl, 120); + try + { + BwpClientPrint.BwpClientWebPrint.Create2DPic(entity._2DQRCode, imgUrl, 120); + } + catch (Exception ex) + { + var name = string.Format("saveError{0:yyyyMMdd}.log", DateTime.Today); + if (!File.Exists(name)) + File.Create(name); + File.AppendAllText(name, ex.Message); + throw; + } dic.Add("$ImageUrl", imgUrl); BwpClientPrint.BwpClientWebPrint.Print("GradeWeightPrint.html", dic); - if (id == 20) + if (id == 30) id = 0; id++; AfterPrint(); @@ -69,7 +80,7 @@ namespace WeighAndGrading if (TempImage == null) TempImage = new DirectoryInfo("TempImg"); var files = TempImage.GetFiles(); - if (files.Length > 10) + if (files.Length > 20) { var last = files.OrderBy(x => x.CreationTime).First().FullName; File.Delete(last);