refactor: 迁移初始化参数缓存并优化等待界面

This commit is contained in:
cyf
2026-08-27 11:46:06 +08:00
parent 8472004711
commit b33c847b27
16 changed files with 209 additions and 61 deletions
+1
View File
@@ -869,6 +869,7 @@ namespace Lskj.Business.Impl
+ ")a join p_formmenuconfigtab b on a.LMenuId=b.MenuId" + + ")a join p_formmenuconfigtab b on a.LMenuId=b.MenuId" +
" left join P_SubSystemTab z on a.LSubSysId=z.SubSysId where LinkModeTag=1 order by grouptagid,ItemTagId", ERPInfo.Instance.UserId); " left join P_SubSystemTab z on a.LSubSysId=z.SubSysId where LinkModeTag=1 order by grouptagid,ItemTagId", ERPInfo.Instance.UserId);
return SqlHelper.ExecuteDataTable(sqlValue); return SqlHelper.ExecuteDataTable(sqlValue);
} }
@@ -87,7 +87,6 @@
<Compile Include="Impl\BillImpl.cs" /> <Compile Include="Impl\BillImpl.cs" />
<Compile Include="Impl\ConditionalCaching.cs" /> <Compile Include="Impl\ConditionalCaching.cs" />
<Compile Include="Impl\ErrorMessage.cs" /> <Compile Include="Impl\ErrorMessage.cs" />
<Compile Include="Impl\InitialParamCache.cs" />
<Compile Include="Impl\LanguageTranslation.cs" /> <Compile Include="Impl\LanguageTranslation.cs" />
<Compile Include="Impl\MainImpl.cs" /> <Compile Include="Impl\MainImpl.cs" />
<Compile Include="Impl\BillAuditImpl.cs" /> <Compile Include="Impl\BillAuditImpl.cs" />
+36 -1
View File
@@ -1371,9 +1371,41 @@ namespace Lskj.Control
{ {
try try
{ {
string billNo = this.SysModel.BillDocumentId; List<string> billNoItems = new List<string>();
if (BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag)
{
foreach (TabPageObj tab in this._tabPageObjs)
{
if (tab.TabPage == this.tabMain.SelectedTabPage)
{
foreach (TabPageItemObj item in tab.TabPageItemObjs)
{
int[] mSelectRows = item.GridControlObj.GridView.GetSelectedRows();
foreach (int itemIndex in mSelectRows)
{
DataRow selectRow = item.GridControlObj.GridView.GetDataRow(itemIndex);
if (selectRow.Table.Columns.Contains(this.BillModelObj.PrimaryKey))
{
billNoItems.Add(selectRow[this.BillModelObj.PrimaryKey] + "");
}
}
}
}
}
}
else
{
billNoItems.Add(this.SysModel.BillDocumentId);
}
string printPath = PubUtil.PrintFileAbsolutelyPath; string printPath = PubUtil.PrintFileAbsolutelyPath;
string printFile = e.Item.Tag + ""; string printFile = e.Item.Tag + "";
foreach (string billNo in billNoItems)
{
//string billNo = this.SysModel.BillDocumentId;
if (!string.IsNullOrEmpty(billNo)) if (!string.IsNullOrEmpty(billNo))
{ {
DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo)); DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo));
@@ -1422,6 +1454,9 @@ namespace Lskj.Control
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
string Message = ErrorMessage.PromptErrorMessage(ex); string Message = ErrorMessage.PromptErrorMessage(ex);
@@ -520,10 +520,9 @@ namespace Lskj.Control.Model
{ {
// 只执行一次,则后续不再执行. // 只执行一次,则后续不再执行.
if (execOnlyOne && i > 0) continue; if (execOnlyOne && i > 0) continue;
LogUtil.WriteDebug(model.MenuTabName, "执行右键", model.MenuName, "右键id" + model.Id);
DataRow rowData = rows[i]; DataRow rowData = rows[i];
if (!string.IsNullOrWhiteSpace(model.BeforeMsg) && tipOnlyOne) if (!string.IsNullOrWhiteSpace(model.BeforeMsg) && tipOnlyOne)
{ {
tipOnlyOne = false; tipOnlyOne = false;
@@ -561,6 +560,33 @@ namespace Lskj.Control.Model
} }
paramList = this.HandleRightMenuParams(paramListEx, rowData, model.Mergeexec ? rows : null, model.ActionType); paramList = this.HandleRightMenuParams(paramListEx, rowData, model.Mergeexec ? rows : null, model.ActionType);
string parameterText = string.Empty;//"{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_{10}_{11}_{12}_{13}";
if (model.ActionType == 0 || model.ActionType == 1)
{
string newSql = string.Empty;
if (model.ActionType == 0)
{
newSql = !string.IsNullOrEmpty(actionSql) ? actionSql : model.Action;
newSql=ReplaceHelper.ReplaceRowParam(rowData, newSql);
}
if (model.ActionType == 1)
{
List<string> procParams = ReplaceHelper.GetParamFields(model.Action);
newSql = model.Action.Replace(procParams[0], "").Trim();
}
parameterText += newSql;
foreach (string item in paramList)
{
parameterText += "_" + item;
}
}
string LogText = string.Format("【{0}】执行模块【{1}】的右键【{2}】参数:{3}", ERPInfo.Instance.UserName, model.MenuTabName, model.MenuName, parameterText);
LogUtil.WriteDebug(model.MenuTabName, "执行右键", "右键id" + model.Id, LogText);
string maintabFocusedRowJson = ""; string maintabFocusedRowJson = "";
if (rowData != null) if (rowData != null)
{ {
+59 -5
View File
@@ -20,6 +20,9 @@ namespace Lskj.Control.Model
public static class SplashForm public static class SplashForm
{ {
private static SplashScreenManager _loadForm; private static SplashScreenManager _loadForm;
private static readonly object _syncRoot = new object();
// FrmSplashScreen 继承 SplashScreen,创建 SplashScreenManager 时会自动显示。
private static bool _isShown;
/// <summary> /// <summary>
/// 等待窗口对象 /// 等待窗口对象
@@ -27,6 +30,8 @@ namespace Lskj.Control.Model
public static SplashScreenManager LoadForm public static SplashScreenManager LoadForm
{ {
get get
{
lock (_syncRoot)
{ {
if (_loadForm == null) if (_loadForm == null)
{ {
@@ -36,6 +41,7 @@ namespace Lskj.Control.Model
return _loadForm; return _loadForm;
} }
} }
}
/// <summary> /// <summary>
/// <para>说明:显示等待窗体</para> /// <para>说明:显示等待窗体</para>
/// <para>创建人:龚宇超</para> /// <para>创建人:龚宇超</para>
@@ -47,10 +53,24 @@ namespace Lskj.Control.Model
/// </summary> /// </summary>
public static void ShowForm() public static void ShowForm()
{ {
bool flag = !LoadForm.IsSplashFormVisible; try
if (flag)
{ {
_loadForm.ShowWaitForm(); lock (_syncRoot)
{
if (!_isShown || _loadForm == null)
{
SplashScreenManager manager = LoadForm;
_isShown = manager != null;
}
}
}
catch (Exception)
{
lock (_syncRoot)
{
_isShown = false;
}
throw;
} }
} }
/// <summary> /// <summary>
@@ -64,10 +84,44 @@ namespace Lskj.Control.Model
/// </summary> /// </summary>
public static void HideForm() public static void HideForm()
{ {
bool isSplashFormVisible = LoadForm.IsSplashFormVisible; try
if (isSplashFormVisible)
{ {
lock (_syncRoot)
{
if (_loadForm == null || !_isShown)
{
return;
}
_loadForm.CloseWaitForm(); _loadForm.CloseWaitForm();
_loadForm.WaitForSplashFormClose();
_isShown = false;
}
}
catch (Exception ex)
{
lock (_syncRoot)
{
_isShown = false;
}
}
finally
{
lock (_syncRoot)
{
SplashScreenManager manager = _loadForm;
_loadForm = null;
if (manager != null)
{
try
{
manager.Dispose();
}
catch (Exception)
{
}
}
}
} }
} }
} }
+2 -2
View File
@@ -786,7 +786,7 @@ namespace Lskj.Control
{ {
try try
{ {
this.pl_main.Visible = false; //this.pl_main.Visible = false;
if (sysModel != null && dyncModel != null) if (sysModel != null && dyncModel != null)
{ {
this.SysModel = sysModel; this.SysModel = sysModel;
@@ -1446,7 +1446,7 @@ namespace Lskj.Control
} }
finally finally
{ {
this.pl_main.Visible = true; //this.pl_main.Visible = true;
} }
} }
+1
View File
@@ -402,6 +402,7 @@ namespace Lskj.Core
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool CreateConnection(string Connection = "", ConnectionType connectionType = ConnectionType.SqlServer) public bool CreateConnection(string Connection = "", ConnectionType connectionType = ConnectionType.SqlServer)
{ {
InitialParamCache.Clear();
bool isConnect = false; bool isConnect = false;
try try
{ {
+13
View File
@@ -25,6 +25,7 @@ using Lskj.Main.Model;
using Lskj.Business; using Lskj.Business;
using System.Collections; using System.Collections;
using System.Threading.Tasks; using System.Threading.Tasks;
using Lskj.Core;
namespace Lskj.PubModule namespace Lskj.PubModule
{ {
@@ -173,6 +174,18 @@ namespace Lskj.PubModule
} }
if (!e.Cancel)
{
if (!string.IsNullOrEmpty(this.mControl.SysModel.FrmCloseStored))
{
string sql = this.mControl.SysModel.FrmCloseStored;
if (this.mControl.SearchObj != null) sql = this.mControl.SearchObj.ReplaceControlValue(sql);
sql = ReplaceHelper.ReplaceUserInfo(sql);
string result = SqlHelper.ExecuteScalar(sql) + "";
if (!string.IsNullOrEmpty(result)) MessageUtil.Show(result);
}
}
} }
#region #region
@@ -110,6 +110,10 @@
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project> <Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name> <Name>Lskj.Control</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj"> <ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj">
<Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project> <Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project>
<Name>Lskj.Data</Name> <Name>Lskj.Data</Name>
+10
View File
@@ -26,6 +26,7 @@ using Lskj.Business;
using Lskj.Main.Model; using Lskj.Main.Model;
using System.Collections; using System.Collections;
using System.Threading.Tasks; using System.Threading.Tasks;
using Lskj.Core;
namespace Lskj.PubModuleDetail namespace Lskj.PubModuleDetail
{ {
@@ -186,6 +187,15 @@ namespace Lskj.PubModuleDetail
// between module cycles. // between module cycles.
if (!e.Cancel) if (!e.Cancel)
{ {
if (!string.IsNullOrEmpty(this.mControl.SysModel.FrmCloseStored))
{
string sql = this.mControl.SysModel.FrmCloseStored;
if (this.mControl.SearchObj!=null) sql=this.mControl.SearchObj.ReplaceControlValue(sql);
sql = ReplaceHelper.ReplaceUserInfo(sql);
string result = SqlHelper.ExecuteScalar(sql) + "";
if (!string.IsNullOrEmpty(result)) MessageUtil.Show(result);
}
this.mControl.ReleaseResourcesForDispose(); this.mControl.ReleaseResourcesForDispose();
} }
} }
@@ -102,6 +102,10 @@
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project> <Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name> <Name>Lskj.Control</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj"> <ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj">
<Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project> <Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project>
<Name>Lskj.Data</Name> <Name>Lskj.Data</Name>
@@ -195,7 +195,7 @@ namespace Lskj.PubUserTomodule.AuditPermissionControls
this.PlStep1Container.Controls.Clear(); this.PlStep1Container.Controls.Clear();
DataTable table = isBasis ? WorkFlowBaseImpl.GetBaseFlowData(mMenuCode) : WorkFlowBillImpl.GetBillFlowData(mMenuCode); DataTable table = isBasis ? WorkFlowBaseImpl.GetBaseFlowData(mMenuCode) : WorkFlowBillImpl.GetBillFlowData(mMenuCode);
BillflowModelList.Clear(); BillflowModelList.Clear();
BillflowModelList.Clear(); BaseflowModelList.Clear();
if (table.Rows.Count == 0) if (table.Rows.Count == 0)
{ {
this.panelControl1.Visible = false; this.panelControl1.Visible = false;
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
namespace Lskj.Business.Impl namespace Lskj.Util
{ {
/// <summary> /// <summary>
/// 单次模块初始化期间复用的参数缓存。 /// 单次模块初始化期间复用的参数缓存。
+1
View File
@@ -172,6 +172,7 @@
<Compile Include="HttpUtil\NewEmp.cs" /> <Compile Include="HttpUtil\NewEmp.cs" />
<Compile Include="HttpUtil\PostUtil.cs" /> <Compile Include="HttpUtil\PostUtil.cs" />
<Compile Include="HttpUtil\RequestUtil.cs" /> <Compile Include="HttpUtil\RequestUtil.cs" />
<Compile Include="InitialParamCache.cs" />
<Compile Include="IForm.cs" /> <Compile Include="IForm.cs" />
<Compile Include="ImageHelper.cs" /> <Compile Include="ImageHelper.cs" />
<Compile Include="IniHelper.cs" /> <Compile Include="IniHelper.cs" />