diff --git a/插件库/Lskj.Util/PubUtil.cs b/插件库/Lskj.Util/PubUtil.cs index f5f4519..8c37414 100644 --- a/插件库/Lskj.Util/PubUtil.cs +++ b/插件库/Lskj.Util/PubUtil.cs @@ -123,6 +123,24 @@ namespace Lskj.Util } + /// + /// 签章打印临时文件 + /// + public static string SignatureFilePath + { + get + { + string path = AbsolutelyPath + "TempFiles\\SignatureFile/"; + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + return path; + } + } + + + public static void ClearFilesInDirectory(string targetDir) { // 校验目录是否存在 diff --git a/插件库/Lskj.Util/ReplaceHelper.cs b/插件库/Lskj.Util/ReplaceHelper.cs index 50c1957..074a0c1 100644 --- a/插件库/Lskj.Util/ReplaceHelper.cs +++ b/插件库/Lskj.Util/ReplaceHelper.cs @@ -193,8 +193,26 @@ namespace Lskj.Util /// true if the specified default value is select; otherwise, false. public static bool IsSelect(string defaultValue) { - return defaultValue.ToLower().Trim().Trim(new char[] { '\r', '\t', '\n' }).StartsWith(_selectFlag); + //return defaultValue.ToLower().Trim().Trim(new char[] { '\r', '\t', '\n' }).StartsWith(_selectFlag); + //2026-4-17 之前判断不了开头有注释的情况 + if (string.IsNullOrWhiteSpace(defaultValue))return false; + // 清理:开头所有空白 + 所有单行注释 + 所有多行注释 + string cleaned = Regex.Replace( + defaultValue, + @"^\s*(/\*.*?\*/|\s|--.*?$)*", + "", + RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline + ); + return cleaned.StartsWith("select", StringComparison.OrdinalIgnoreCase); + + } + + + + + + /// /// 说明:替换userid、username、groupid /// 创建人:龚宇超 @@ -226,6 +244,16 @@ namespace Lskj.Util /// System.String. public static string ReplaceUserInfo(string defaultValue, string userId, string userName, string groupId, string password) { + if (string.IsNullOrEmpty(defaultValue)) + { + return defaultValue; + } + + if (defaultValue.IndexOf('{') < 0) + { + return defaultValue; + } + return defaultValue = defaultValue.Replace(_loginid_key, userId, true) .Replace(_loginname_key, userName, true) .Replace(_groupid_key, groupId, true) @@ -241,8 +269,8 @@ namespace Lskj.Util .Replace(_loginaccount_key, ERPInfo.Instance.LoginAccount + "", true) .Replace(_accountBook, ERPInfo.Instance.AccountBook + "", true) .Replace(_loginUserLinkPhone_key, ERPInfo.Instance.UserLinkPhone + "", true) - .Replace(_mrpTag_key, ERPInfo.Instance.MrpTag + "", true) - .Replace(_macAddressy, ERPInfo.Instance.MacAddress + "", true); + .Replace(_mrpTag_key, ERPInfo.Instance.MrpTag + "", true); + //.Replace(_macAddressy, ERPInfo.Instance.MacAddress + "", true); } /// diff --git a/插件库/Lskj.Util/extend/StringExtend.cs b/插件库/Lskj.Util/extend/StringExtend.cs index 47ab8dd..d1d8cd0 100644 --- a/插件库/Lskj.Util/extend/StringExtend.cs +++ b/插件库/Lskj.Util/extend/StringExtend.cs @@ -91,30 +91,15 @@ namespace Lskj.Util /// System.String. public static string Replace(this string str, string key, string value, bool ignoreCase) { - if (string.IsNullOrEmpty(str)) return str; + //if (string.IsNullOrEmpty(str)) return str; - return Regex.IsMatch(str, key, RegexOptions.IgnoreCase) ? - System.Text.RegularExpressions.Regex.Replace(str, key, value, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None) - : str; - } - /// - /// 说明: - /// 创建人:龚宇超 - /// 创建日期: - /// 修改人: - /// 修改日期: - /// 修改备注: - /// 版本:1.0 - /// - /// The text. - public static bool IsChinese(this string text) - { - for (int i = 0; i < text.Length; i++) + //return Regex.IsMatch(str, key, RegexOptions.IgnoreCase) ? + // System.Text.RegularExpressions.Regex.Replace(str, key, value, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None) + // : str; + if (string.IsNullOrEmpty(str) || string.IsNullOrEmpty(key)) { - if ((int)text[i] > 127) - return true; + return str; } - return false; - } - } -} + + var comparison = ignoreCase + ? StringComparison.Ordinal \ No newline at end of file