From b33c847b276b86ff9d311c1d3cac347d1637b053 Mon Sep 17 00:00:00 2001 From: cyf Date: Thu, 27 Aug 2026 11:46:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=BF=81=E7=A7=BB=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=8F=82=E6=95=B0=E7=BC=93=E5=AD=98=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AD=89=E5=BE=85=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 插件库/Lskj.Business/Impl/MainImpl.cs | 1 + 插件库/Lskj.Business/Lskj.Business.csproj | 3 +- 插件库/Lskj.Control/AuditPanel2.cs | 113 ++++++++++++------ 插件库/Lskj.Control/FrmSplashScreen.cs | 2 +- 插件库/Lskj.Control/FrmWait.cs | 2 +- .../Model/MenuStrip/BaseMenuStrip.cs | 32 ++++- 插件库/Lskj.Control/Model/SplashForm.cs | 74 ++++++++++-- 插件库/Lskj.Control/ModulePanelEx.cs | 4 +- 插件库/Lskj.Core/DBConfig.cs | 1 + 插件库/Lskj.PubModule/FrmMain.cs | 13 ++ 插件库/Lskj.PubModule/Lskj.PubModule.csproj | 4 + 插件库/Lskj.PubModuleDetail/FrmMain.cs | 10 ++ .../Lskj.PubModuleDetail.csproj | 4 + .../AuditPermissionControls/StepPage1.cs | 2 +- .../Impl => Lskj.Util}/InitialParamCache.cs | 2 +- 插件库/Lskj.Util/Lskj.Util.csproj | 3 +- 16 files changed, 209 insertions(+), 61 deletions(-) rename 插件库/{Lskj.Business/Impl => Lskj.Util}/InitialParamCache.cs (99%) diff --git a/插件库/Lskj.Business/Impl/MainImpl.cs b/插件库/Lskj.Business/Impl/MainImpl.cs index 04a3dd1..5da3ab3 100644 --- a/插件库/Lskj.Business/Impl/MainImpl.cs +++ b/插件库/Lskj.Business/Impl/MainImpl.cs @@ -869,6 +869,7 @@ namespace Lskj.Business.Impl + ")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); + return SqlHelper.ExecuteDataTable(sqlValue); } diff --git a/插件库/Lskj.Business/Lskj.Business.csproj b/插件库/Lskj.Business/Lskj.Business.csproj index 4ba5d0a..dc78189 100644 --- a/插件库/Lskj.Business/Lskj.Business.csproj +++ b/插件库/Lskj.Business/Lskj.Business.csproj @@ -87,7 +87,6 @@ - @@ -155,4 +154,4 @@ --> - \ No newline at end of file + diff --git a/插件库/Lskj.Control/AuditPanel2.cs b/插件库/Lskj.Control/AuditPanel2.cs index d6e5360..bbe977b 100644 --- a/插件库/Lskj.Control/AuditPanel2.cs +++ b/插件库/Lskj.Control/AuditPanel2.cs @@ -1371,56 +1371,91 @@ namespace Lskj.Control { try { - string billNo = this.SysModel.BillDocumentId; + List billNoItems = new List(); + 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 printFile = e.Item.Tag + ""; - if (!string.IsNullOrEmpty(billNo)) + + foreach (string billNo in billNoItems) { - DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo)); - if (masterRow == null) + //string billNo = this.SysModel.BillDocumentId; + + if (!string.IsNullOrEmpty(billNo)) { - MessageUtil.Show(ResourceKeys.DataNotFount); - return; - } - if (!ReplaceHelper.ReplaceRowParamCond(masterRow, this.BillModelObj.PrintCond)) - { - MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond); - return; - } - - string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql); - string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql1); - string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql2); - - - if (printFile.Contains(PrintUtil.TemplateFlag)) - { - string mainSql = string.Empty; - List tmpSqls = new List(); - if (_printSaveParams != null && _printSaveParams.Count > 0) + DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo)); + if (masterRow == null) { - _printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(masterRow, _mainPrintSql); - _printSaveParams[3] = masterRow.Table.Columns.Contains(_printSaveParams[2] + "") ? masterRow[_printSaveParams[2]] + "" : masterRow[BillModelObj.PrimaryKey] + ""; - tmpSqls.Add(mainSql); - tmpSqls.Add(tmpSql1); - tmpSqls.AddRange(tmpSql2.Split(';').ToList()); + MessageUtil.Show(ResourceKeys.DataNotFount); + return; + } + if (!ReplaceHelper.ReplaceRowParamCond(masterRow, this.BillModelObj.PrintCond)) + { + MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond); + return; + } + + string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql); + string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql1); + string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql2); + + + if (printFile.Contains(PrintUtil.TemplateFlag)) + { + string mainSql = string.Empty; + List tmpSqls = new List(); + if (_printSaveParams != null && _printSaveParams.Count > 0) + { + _printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(masterRow, _mainPrintSql); + _printSaveParams[3] = masterRow.Table.Columns.Contains(_printSaveParams[2] + "") ? masterRow[_printSaveParams[2]] + "" : masterRow[BillModelObj.PrimaryKey] + ""; + tmpSqls.Add(mainSql); + tmpSqls.Add(tmpSql1); + tmpSqls.AddRange(tmpSql2.Split(';').ToList()); + } + else + { + if (!string.IsNullOrWhiteSpace(tmpSql)) tmpSqls.Add(tmpSql); + if (!string.IsNullOrWhiteSpace(tmpSql1)) tmpSqls.Add(tmpSql1); + if (!string.IsNullOrWhiteSpace(tmpSql2)) tmpSqls.AddRange(tmpSql2.Split(';').ToList()); + } + PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter); + PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter); + PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint); } else { - if (!string.IsNullOrWhiteSpace(tmpSql)) tmpSqls.Add(tmpSql); - if (!string.IsNullOrWhiteSpace(tmpSql1)) tmpSqls.Add(tmpSql1); - if (!string.IsNullOrWhiteSpace(tmpSql2)) tmpSqls.AddRange(tmpSql2.Split(';').ToList()); + DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2); } - PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter); - PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter); - PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint); - } - else - { - DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2); - } + } } + + } catch (Exception ex) { diff --git a/插件库/Lskj.Control/FrmSplashScreen.cs b/插件库/Lskj.Control/FrmSplashScreen.cs index 9c2a61a..6591606 100644 --- a/插件库/Lskj.Control/FrmSplashScreen.cs +++ b/插件库/Lskj.Control/FrmSplashScreen.cs @@ -30,4 +30,4 @@ namespace Lskj.Control { } } -} \ No newline at end of file +} diff --git a/插件库/Lskj.Control/FrmWait.cs b/插件库/Lskj.Control/FrmWait.cs index 4774ef7..0f92a83 100644 --- a/插件库/Lskj.Control/FrmWait.cs +++ b/插件库/Lskj.Control/FrmWait.cs @@ -41,4 +41,4 @@ namespace Lskj.Control { } } -} \ No newline at end of file +} diff --git a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs index a1a232b..2757d80 100644 --- a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs +++ b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs @@ -520,10 +520,9 @@ namespace Lskj.Control.Model { // 只执行一次,则后续不再执行. if (execOnlyOne && i > 0) continue; - - LogUtil.WriteDebug(model.MenuTabName, "执行右键", model.MenuName, "右键id:" + model.Id); - DataRow rowData = rows[i]; + + if (!string.IsNullOrWhiteSpace(model.BeforeMsg) && tipOnlyOne) { tipOnlyOne = false; @@ -561,6 +560,33 @@ namespace Lskj.Control.Model } 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 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 = ""; if (rowData != null) { diff --git a/插件库/Lskj.Control/Model/SplashForm.cs b/插件库/Lskj.Control/Model/SplashForm.cs index 73e6fb9..366177f 100644 --- a/插件库/Lskj.Control/Model/SplashForm.cs +++ b/插件库/Lskj.Control/Model/SplashForm.cs @@ -20,6 +20,9 @@ namespace Lskj.Control.Model public static class SplashForm { private static SplashScreenManager _loadForm; + private static readonly object _syncRoot = new object(); + // FrmSplashScreen 继承 SplashScreen,创建 SplashScreenManager 时会自动显示。 + private static bool _isShown; /// /// 等待窗口对象 @@ -28,12 +31,15 @@ namespace Lskj.Control.Model { get { - if (_loadForm == null) + lock (_syncRoot) { - SplashFormProperties properties = new SplashFormProperties(); - _loadForm = new SplashScreenManager(typeof(FrmSplashScreen), properties); + if (_loadForm == null) + { + SplashFormProperties properties = new SplashFormProperties(); + _loadForm = new SplashScreenManager(typeof(FrmSplashScreen), properties); + } + return _loadForm; } - return _loadForm; } } /// @@ -47,10 +53,24 @@ namespace Lskj.Control.Model /// public static void ShowForm() { - bool flag = !LoadForm.IsSplashFormVisible; - if (flag) + try { - _loadForm.ShowWaitForm(); + lock (_syncRoot) + { + if (!_isShown || _loadForm == null) + { + SplashScreenManager manager = LoadForm; + _isShown = manager != null; + } + } + } + catch (Exception) + { + lock (_syncRoot) + { + _isShown = false; + } + throw; } } /// @@ -64,10 +84,44 @@ namespace Lskj.Control.Model /// public static void HideForm() { - bool isSplashFormVisible = LoadForm.IsSplashFormVisible; - if (isSplashFormVisible) + try { - _loadForm.CloseWaitForm(); + lock (_syncRoot) + { + if (_loadForm == null || !_isShown) + { + return; + } + + _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) + { + } + } + } } } } diff --git a/插件库/Lskj.Control/ModulePanelEx.cs b/插件库/Lskj.Control/ModulePanelEx.cs index c6c6c63..bd55415 100644 --- a/插件库/Lskj.Control/ModulePanelEx.cs +++ b/插件库/Lskj.Control/ModulePanelEx.cs @@ -786,7 +786,7 @@ namespace Lskj.Control { try { - this.pl_main.Visible = false; + //this.pl_main.Visible = false; if (sysModel != null && dyncModel != null) { this.SysModel = sysModel; @@ -1446,7 +1446,7 @@ namespace Lskj.Control } finally { - this.pl_main.Visible = true; + //this.pl_main.Visible = true; } } diff --git a/插件库/Lskj.Core/DBConfig.cs b/插件库/Lskj.Core/DBConfig.cs index 88de576..95bc863 100644 --- a/插件库/Lskj.Core/DBConfig.cs +++ b/插件库/Lskj.Core/DBConfig.cs @@ -402,6 +402,7 @@ namespace Lskj.Core /// true if XXXX, false otherwise. public bool CreateConnection(string Connection = "", ConnectionType connectionType = ConnectionType.SqlServer) { + InitialParamCache.Clear(); bool isConnect = false; try { diff --git a/插件库/Lskj.PubModule/FrmMain.cs b/插件库/Lskj.PubModule/FrmMain.cs index be7d681..4231168 100644 --- a/插件库/Lskj.PubModule/FrmMain.cs +++ b/插件库/Lskj.PubModule/FrmMain.cs @@ -25,6 +25,7 @@ using Lskj.Main.Model; using Lskj.Business; using System.Collections; using System.Threading.Tasks; +using Lskj.Core; 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 设置窗口大小 diff --git a/插件库/Lskj.PubModule/Lskj.PubModule.csproj b/插件库/Lskj.PubModule/Lskj.PubModule.csproj index cd62aac..89ce344 100644 --- a/插件库/Lskj.PubModule/Lskj.PubModule.csproj +++ b/插件库/Lskj.PubModule/Lskj.PubModule.csproj @@ -110,6 +110,10 @@ {447CDC40-659F-4CCA-9ED6-8E818B4CF8BF} Lskj.Control + + {2A1BE6AC-1077-491B-A754-C5822FE8121E} + Lskj.Core + {308B9B18-9BE2-495C-9C64-EED81D567813} Lskj.Data diff --git a/插件库/Lskj.PubModuleDetail/FrmMain.cs b/插件库/Lskj.PubModuleDetail/FrmMain.cs index 54d173b..2a1e38a 100644 --- a/插件库/Lskj.PubModuleDetail/FrmMain.cs +++ b/插件库/Lskj.PubModuleDetail/FrmMain.cs @@ -26,6 +26,7 @@ using Lskj.Business; using Lskj.Main.Model; using System.Collections; using System.Threading.Tasks; +using Lskj.Core; namespace Lskj.PubModuleDetail { @@ -186,6 +187,15 @@ namespace Lskj.PubModuleDetail // between module cycles. 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(); } } diff --git a/插件库/Lskj.PubModuleDetail/Lskj.PubModuleDetail.csproj b/插件库/Lskj.PubModuleDetail/Lskj.PubModuleDetail.csproj index a0f2be3..4220a52 100644 --- a/插件库/Lskj.PubModuleDetail/Lskj.PubModuleDetail.csproj +++ b/插件库/Lskj.PubModuleDetail/Lskj.PubModuleDetail.csproj @@ -102,6 +102,10 @@ {447CDC40-659F-4CCA-9ED6-8E818B4CF8BF} Lskj.Control + + {2A1BE6AC-1077-491B-A754-C5822FE8121E} + Lskj.Core + {308B9B18-9BE2-495C-9C64-EED81D567813} Lskj.Data diff --git a/插件库/Lskj.PubUserTomodule/AuditPermissionControls/StepPage1.cs b/插件库/Lskj.PubUserTomodule/AuditPermissionControls/StepPage1.cs index 756012d..aeadcc6 100644 --- a/插件库/Lskj.PubUserTomodule/AuditPermissionControls/StepPage1.cs +++ b/插件库/Lskj.PubUserTomodule/AuditPermissionControls/StepPage1.cs @@ -195,7 +195,7 @@ namespace Lskj.PubUserTomodule.AuditPermissionControls this.PlStep1Container.Controls.Clear(); DataTable table = isBasis ? WorkFlowBaseImpl.GetBaseFlowData(mMenuCode) : WorkFlowBillImpl.GetBillFlowData(mMenuCode); BillflowModelList.Clear(); - BillflowModelList.Clear(); + BaseflowModelList.Clear(); if (table.Rows.Count == 0) { this.panelControl1.Visible = false; diff --git a/插件库/Lskj.Business/Impl/InitialParamCache.cs b/插件库/Lskj.Util/InitialParamCache.cs similarity index 99% rename from 插件库/Lskj.Business/Impl/InitialParamCache.cs rename to 插件库/Lskj.Util/InitialParamCache.cs index 2e1c106..83c3743 100644 --- a/插件库/Lskj.Business/Impl/InitialParamCache.cs +++ b/插件库/Lskj.Util/InitialParamCache.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Data; -namespace Lskj.Business.Impl +namespace Lskj.Util { /// /// 单次模块初始化期间复用的参数缓存。 diff --git a/插件库/Lskj.Util/Lskj.Util.csproj b/插件库/Lskj.Util/Lskj.Util.csproj index 696e62b..95ec72d 100644 --- a/插件库/Lskj.Util/Lskj.Util.csproj +++ b/插件库/Lskj.Util/Lskj.Util.csproj @@ -172,6 +172,7 @@ + @@ -216,4 +217,4 @@ --> - \ No newline at end of file +