From 1dfedb748cc48d61ecde6d3696c833d9fc2e4596 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Mon, 14 May 2018 18:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeighAndGrading/WeightGradePrint.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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);