From e275919555d3dce1cf6639c437d50e077f68f138 Mon Sep 17 00:00:00 2001 From: gongxh Date: Sat, 29 May 2021 10:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=BC=93=E5=86=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Store/STVoucherBase.cs | 97 +++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 15 deletions(-) diff --git a/NX.ERP.U8/Store/STVoucherBase.cs b/NX.ERP.U8/Store/STVoucherBase.cs index bc0b218..b20aa11 100644 --- a/NX.ERP.U8/Store/STVoucherBase.cs +++ b/NX.ERP.U8/Store/STVoucherBase.cs @@ -110,26 +110,92 @@ namespace NX.ERP.U8.Store } } + + private static object lockHeadobj = new object(); + private static string strTemlateHead = ""; + + /// + /// + /// + /// private string GetHeadTemplate() { - var strTemlate = FileHelp.ReadFile(HeadFile); - if (strTemlate == string.Empty) + + if (!string.IsNullOrEmpty(strTemlateHead)) { - this.LoadTemplate(); - strTemlate = GetHeadTemplate(); + return strTemlateHead; } - return strTemlate; + else + { + lock (lockHeadobj) + { + + if (!string.IsNullOrEmpty(strTemlateHead)) + { + return strTemlateHead; + } + else + { + strTemlateHead = FileHelp.ReadFile(HeadFile); + if (string.IsNullOrEmpty(strTemlateHead)) + { + this.LoadTemplate(); + strTemlateHead = GetHeadTemplate(); + } + return strTemlateHead; + + } + + + } + + + } + + } + + + private static object lockBodyobj = new object(); + private static string strTemlateBody = ""; + /// + /// + /// + /// private string GetBodyTemplate() { - var strTemlate = FileHelp.ReadFile(BodyFile); - if (strTemlate == string.Empty) + + if (!string.IsNullOrEmpty(strTemlateBody)) { - this.LoadTemplate(); - strTemlate = GetBodyTemplate(); + return strTemlateBody; + } + else + { + lock (lockBodyobj) + { + + if (!string.IsNullOrEmpty(strTemlateBody)) + { + return strTemlateHead; + } + else + { + strTemlateBody = FileHelp.ReadFile(BodyFile); + if (string.IsNullOrEmpty(strTemlateBody)) + { + this.LoadTemplate(); + strTemlateBody = GetHeadTemplate(); + } + return strTemlateBody; + + } + + + } + + } - return strTemlate; } @@ -306,14 +372,15 @@ namespace NX.ERP.U8.Store { u8ApiBroker.AssignNormalValue("domPosition", para.DomPosition); } - if (para.cnnFrom!=null) + if (para.cnnFrom != null) { u8ApiBroker.AssignNormalValue("cnnFrom", para.cnnFrom); - } else - { - u8ApiBroker.AssignNormalValue("cnnFrom",null); } - + else + { + u8ApiBroker.AssignNormalValue("cnnFrom", null); + } + if (para.DOMMsg != null) { u8ApiBroker.AssignNormalValue("domMsg", para.DOMMsg);