From 8fac982e19b8246c52a0a635f2ee924c59002fa7 Mon Sep 17 00:00:00 2001 From: cyf Date: Wed, 12 Feb 2025 02:13:27 +0000 Subject: [PATCH] SVN r262 SVN-Revision: r262 --- 插件库/Lskj.PubAccraditation/DllBaseClass.cs | 25 +- .../Lskj.PubAccraditation/FrmAccraditation.cs | 565 +++++++++++------- 插件库/Lskj.PubAccraditation/FrmMain.cs | 25 +- 3 files changed, 363 insertions(+), 252 deletions(-) diff --git a/插件库/Lskj.PubAccraditation/DllBaseClass.cs b/插件库/Lskj.PubAccraditation/DllBaseClass.cs index 5db2e88..260e2db 100644 --- a/插件库/Lskj.PubAccraditation/DllBaseClass.cs +++ b/插件库/Lskj.PubAccraditation/DllBaseClass.cs @@ -37,27 +37,4 @@ namespace Lskj.PubAccraditation if (obj.Length >= 8 && !string.IsNullOrEmpty(obj[7]) && !string.IsNullOrEmpty(obj[8]) && !string.IsNullOrEmpty(obj[9])) { FrmAccraditation popupForm = new FrmAccraditation(); - popupForm.SysModel = new DynamicPubAccraditionPopModel(obj); - popupForm.SysModel.DataCaches = new Dictionary(); - this.SubForm = popupForm; - - } - else - { - FrmMain main = new FrmMain(); - this.SubForm = main; - main.SysModel = new DynamicPubAccraditionModel(obj); - main.SysModel.DataCaches = new Dictionary(); - if(SystemInfo.Instance.OptimizationSpeed) main.GetDataCaches(main.SysModel.DataCaches); - } - } - catch (Exception ex) - { - LogUtil.WriteError("Lskj.PubAccraditation.dll--参数错误-->" + obj.ToString(), ex); - } - - } - - public Form SubForm { get; set; } - } -} + popupFor \ No newline at end of file diff --git a/插件库/Lskj.PubAccraditation/FrmAccraditation.cs b/插件库/Lskj.PubAccraditation/FrmAccraditation.cs index 2c00a41..03f4775 100644 --- a/插件库/Lskj.PubAccraditation/FrmAccraditation.cs +++ b/插件库/Lskj.PubAccraditation/FrmAccraditation.cs @@ -29,6 +29,7 @@ using Lskj.Business; using DevExpress.XtraBars; using System.Collections; using Lskj.Core; +using System.Threading.Tasks; namespace Lskj.PubAccraditation { @@ -193,16 +194,6 @@ namespace Lskj.PubAccraditation finally { Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this); - //默认一开始不加载明细数据 - //if (string.IsNullOrEmpty(this.BillModelObj.AuditLoadDetailFlag) || this.BillModelObj.AuditLoadDetailFlag == "0") - //{ - // //this.gridBillInfo.GridView.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(gridBillInfo_SelectionChanged); - // this.gridBillInfo.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged; - //} - //else - //{ - // this.gridBillInfo.GridView.DoubleClick += new EventHandler(gridView_DoubleClick); - //} //2023-10-13 丁哥规定在明细的附加信息中配置双击参数(DBClickEvent),上方的AuditLoadDetailFlag失效 if (this.BillModelObj.DetailTreeTable) { @@ -222,7 +213,251 @@ namespace Lskj.PubAccraditation } } - + #region 获取数据源缓存 + /// + /// 获取数据源缓存 + /// + /// + public void GetDataCaches(Dictionary cachesDic) + { + //全局数据 + Task dynamicModelTask = cachesDic.AddTask(this, "DynamicModel", new Task(() => + { + return SysModel;//动态链接库对象 + })); + DynamicPubAccraditionPopModel dynamicModel = (DynamicPubAccraditionPopModel)dynamicModelTask.Result; + #region InitializeSetting + Task accraditationModelRowTask = cachesDic.AddTask(this, "AccraditationModelRow", new Task(() => + { + return BillAuditImpl.GetBillFlowData(dynamicModel.ModuleCode, dynamicModel.StepCode); + })); + Task accraditationModelTask = cachesDic.AddTask(this, "AccraditationModel", new Task(() => + { + return new AccraditationModel(accraditationModelRowTask.Result); + })); + Task billInfoTask = cachesDic.AddTask(this, "BillInfo", new Task(() => + { + return BillImpl.GetBillInfo(dynamicModel.ModuleCode);//获取单个模块信息 + })); + Task billAuditModelTask = cachesDic.AddTask(this, "BillAuditModel", new Task(() => + { + BillAuditModel billAuditModel = new BillAuditModel(billInfoTask.Result); + Task masterPreFixTask = cachesDic.AddTask(this, "MasterPreFix", new Task(() => + { + return BaseImpl.GetColumnPrefix(billAuditModel.MasterTable); + })); + Task detailPreFixTask = cachesDic.AddTask(this, "DetailPreFix", new Task(() => + { + return BaseImpl.GetColumnPrefix(billAuditModel.DetailTable);// 明细表列前缀 + })); + billAuditModel.MasterPreFix = masterPreFixTask.Result; + billAuditModel.DetailPreFix = detailPreFixTask.Result; + billAuditModel.DetailOrderField = detailPreFixTask.Result + "lsidx_id";// 单据来源id + return billAuditModel; + })); + Task billAuditCommonModelTask = cachesDic.AddTask(this, "BillAuditCommonModel", new Task(() => + { + return new BillAuditCommonModel(); + })); + Task menuConfigTabTask = cachesDic.AddTask(this, "MenuConfigTab", new Task(() => + { + return BaseImpl.GetMenuConfigTab(dynamicModel.ModuleId); //获取菜单其他配置 + })); + Task fileCountTask = cachesDic.AddTask(this, "FileCount", new Task(() => + { + return AttachImpl.GetFileCount(billAuditModelTask.Result.DirId + "", dynamicModel.BillDocumentId); + })); + //记录推送用户 + Task pushedOpersTask = cachesDic.AddTask(this, "PushedOpers", new Task(() => + { + return BillAuditImpl.GetPushedOpers(dynamicModel.BillDocumentId, dynamicModel.StepCode); + })); + Task billInfoDataTask = cachesDic.AddTask(this, "BillInfoData", new Task(() => + { + return BillAuditImpl.GetBillInfoData(dynamicModel.ModuleCode); + })); + #endregion + #region InitializeControl + Task readOnlyColumnsTask = cachesDic.AddTask(gridFlow, "ReadOnlyColumns", new Task(() => + { + return BaseAuditImpl.GetFlowRecordColumn(); + })); + string customColumKey = GridCustomColumnStruct.AuditPopupAttachGridView + billAuditModelTask.Result.FormKey; + cachesDic.AddTask(gridFlow, "DynamicModel", dynamicModelTask); + gridFlow.GetDataCaches(cachesDic, customColumKey); + Task gridViewDataSourceTask = cachesDic.AddTask(gridFlow, "GridViewDataSource", new Task(() => + { + return BaseAuditImpl.GetFlowRecordData(billAuditCommonModelTask.Result.SystemTabFlowStep, dynamicModel.BillDocumentId, dynamicModel.ModuleCode); + })); + //BindTab + Task> detailTask = cachesDic.AddTask(gridFlow, "Details", new Task>(() => + { + List details = new List(); + DataTable table = BaseAuditImpl.GetAttachTabs(dynamicModel.ModuleCode, dynamicModel.StepCode); + foreach (DataRow item in table.Rows) + { + if (table.Columns.Contains("privilegeoper")) + { + string privilegeoper = item["privilegeoper"] + "";//配置的权限人员 + if (string.IsNullOrWhiteSpace(privilegeoper) || privilegeoper.Split(',').Contains(ERPInfo.Instance.UserName)) + { + GridDetailModel gridDetailModel = new GridDetailModel(item, null, GridCustomColumnStruct.AuditPopupBasicInfoGridView + item["formKey"] + ""); + details.Add(gridDetailModel); + Task addGridColumnsTask = cachesDic.AddTask(gridDetailModel, "GridColumns", new Task(() => + { + DataTable gridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + ""); + gridDetailModel.GridColumns = gridColumns; + return gridColumns; + })); + } + } + else + { + GridDetailModel gridDetailModel = new GridDetailModel(item, null, GridCustomColumnStruct.AuditPopupBasicInfoGridView + item["formKey"] + ""); + details.Add(gridDetailModel); + Task addGridColumnsTask = cachesDic.AddTask(gridDetailModel, "GridColumns", new Task(() => + { + DataTable gridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + ""); + gridDetailModel.GridColumns = gridColumns; + return gridColumns; + })); + } + } + return details; + })); + cachesDic.AddTask(tab_basicInfo, "DynamicModel", dynamicModelTask); + cachesDic.AddTask(tab_basicInfo, "Details", detailTask); + tab_basicInfo.GetDataCaches(cachesDic); + //BindBill + Task controlLocationTask = cachesDic.AddTask(this, "ControlLocation", new Task(() => + { + return BaseModuleImpl.GetControlLocation(billAuditModelTask.Result.FormKey, dynamicModel.ModuleCode); + })); + Task controlObjTask = cachesDic.AddTask(this, "ControlObj", new Task(() => + { + MyControl myControl = new MyControl(); + myControl.Model = SysModel; + myControl.PrimaryValue = dynamicModel.BillDocumentId; + cachesDic.AddTask(myControl, "DynamicModel", dynamicModelTask); + cachesDic.AddTask(myControl, "ControlsTable", controlLocationTask); + myControl.GetControlDataCaches(cachesDic); + return myControl; + })); + Task detailColumnsTask = cachesDic.AddTask(gridBillInfo, "DetailColumns", new Task(() => + { + return BillImpl.GetDetailColumns(dynamicModel.ModuleCode); + })); + string gridBillCustomColumKey = GridCustomColumnStruct.AuditPopupDetailGridView + billAuditModelTask.Result.FormKey; + cachesDic.AddTask(gridBillInfo, "DynamicModel", dynamicModelTask); + gridBillInfo.GetDataCaches(cachesDic, gridBillCustomColumKey); + Task baseGridRightMenusTask = cachesDic.AddTask(gridBillInfo, "BaseGridRightMenus", new Task(() => + { + return BaseModuleImpl.GetBaseGridRightMenus(accraditationModelTask.Result.BillGridMenuFlag + dynamicModel.ModuleCode, ModuleType.BillAuditDetail); + })); + Task baseGridRowColorsTask = cachesDic.AddTask(gridBillInfo, "BaseGridRowColors", new Task(() => + { + return BaseModuleImpl.GetBaseGridRowColors("BILLDETAIL_" + billAuditModelTask.Result.FormKey); + })); + //设置必填和修改字段 + Task currentFlowRowDataTask = cachesDic.AddTask(this, "CurrentFlowRowData", new Task(() => + { + DataRow currentFlowRowData = BaseAuditImpl.GetCurrentFlowRowData(billAuditModelTask.Result.MasterTable, billAuditModelTask.Result.PrimaryKey, dynamicModel.BillDocumentId); + if (currentFlowRowData != null) + { + string mainBillTypeValue = currentFlowRowData[billAuditModelTask.Result.BillType] + ""; + if (!string.IsNullOrEmpty(mainBillTypeValue) && mainBillTypeValue != "0") + { + //SetButtonsStatus + Task billFlowStepTask = cachesDic.AddTask(this, "BillFlowStep", new Task(() => + { + DataRow billFlowStep = BillAuditImpl.GetBillFlowStep(dynamicModel.ModuleCode, mainBillTypeValue, dynamicModel.StepCode); + if (billFlowStep != null) + { + Task flowTypeStepModelTask = cachesDic.AddTask(this, "FlowTypeStepModel", new Task(() => + { + FlowTypeStepModel flowTypeStepModel = new FlowTypeStepModel(billFlowStep); + //LoadRemindRecord + if (flowTypeStepModel != null && !string.IsNullOrEmpty(flowTypeStepModel.RemindSelect)) + { + Task remindinRecordTask = cachesDic.AddTask(gridRemind, "RemindinRecord", new Task(() => + { + DataTable dt = BaseAuditImpl.GetRemindinRecord(billAuditCommonModelTask.Result.FlowStepTable, billAuditCommonModelTask.Result.ComfrimTable, dynamicModel.BillDocumentId, dynamicModel.ModuleCode); + if (dt != null && dt.Rows.Count > 0) + { + Task gridRemindReadOnlyColumnsTask = cachesDic.AddTask(gridRemind, "ReadOnlyColumns", new Task(() => + { + return BaseAuditImpl.GetRemindColumn(); + })); + cachesDic.AddTask(gridRemind, "DynamicModel", dynamicModelTask); + gridRemind.GetDataCaches(cachesDic); + } + return dt; + })); + } + return new FlowTypeStepModel(billFlowStep); + })); + string operUser = flowTypeStepModelTask.Result.OperUser; + Task operatorsTask = cachesDic.AddTask(this, "Operators", new Task(() => + { + DataRow operators = BillAuditImpl.GetOperators(dynamicModel.ModuleCode, dynamicModel.BillDocumentId, dynamicModel.StepCode); + operUser = operators != null ? operators["operators"] + "" : operUser; + if (operUser.StartsWith("@")) + { + string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_drBillInfoMsg, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId); + Task numberTask = cachesDic.AddTask(this, "Number", new Task(() => + { + return BaseImpl.GetResult(sql) + ""; + })); + } + return operators; + })); + Task billComfirmTask = cachesDic.AddTask(this, "BillComfirm", new Task(() => + { + return BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0; + })); + //代理权限 + Task agencyAuthorityTask = cachesDic.AddTask(this, "AgencyAuthority", new Task(() => + { + return BillAuditImpl.GetAgencyAuthority(dynamicModel.ModuleCode); + })); + } + return billFlowStep; + })); + } + } + return currentFlowRowData; + })); + //LoadSignRecord + if (billAuditCommonModelTask.Result != null) + { + Task signRecordTask = cachesDic.AddTask(gridSign, "SignRecord", new Task(() => + { + DataTable dt = BaseAuditImpl.GetSignRecord(billAuditCommonModelTask.Result.ComfrimTable, dynamicModel.BillDocumentId, dynamicModel.ModuleCode); + if (dt != null && dt.Rows.Count > 0) + { + Task gridSignReadOnlyColumnsTask = cachesDic.AddTask(gridSign, "ReadOnlyColumns", new Task(() => + { + return BaseAuditImpl.GetSignRecordCoulumn(); + })); + cachesDic.AddTask(gridSign, "DynamicModel", dynamicModelTask); + gridSign.GetDataCaches(cachesDic); + } + return dt; + })); + } + //InitCommonMenu + Task tableCommonTask = cachesDic.AddTask(this, "TableCommon", new Task(() => + { + return BaseModuleImpl.GetBaseGridRightMenus(dynamicModel.ModuleCode, ModuleType.BillDetail); + })); + //InitOtherParms + Task checkSuggestionDataSourceTask = cachesDic.AddTask(this, "CheckSuggestionDataSource", new Task(() => + { + return BaseImpl.GetDataTableResult(accraditationModelTask.Result.SuggestionSql); + })); + #endregion + } + #endregion @@ -238,30 +473,34 @@ namespace Lskj.PubAccraditation /// private void InitializeSetting() { - if (ProcessExists) - { - this.AuditModelObj = new AccraditationModel(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow()); - this.BillModelObj = new BillAuditModel(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow()); - this.BillModelObj.MasterPreFix = Lskj.Data.Caches.CacheSYSConfig.Instance().GetColumnPrefix(); - } - else + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "AccraditationModel", out this.AuditModelObj)) { this.AuditModelObj = new AccraditationModel(BillAuditImpl.GetBillFlowData(this.SysModel.ModuleCode, this.SysModel.StepCode)); - DataRow modelRow = BillImpl.GetBillInfo(this.SysModel.ModuleCode);//获取单个模块信息 - if (modelRow == null) - { - throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); - } + } + if (!dataCaches.GetValue(this, "BillInfo", out DataRow modelRow)) + { + modelRow = BillImpl.GetBillInfo(this.SysModel.ModuleCode);//获取单个模块信息 + } + if (modelRow == null) + { + throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); + } + if (!dataCaches.GetValue(this, "BillAuditModel", out this.BillModelObj)) + { this.BillModelObj = new BillAuditModel(modelRow); this.BillModelObj.MasterPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.MasterTable); + this.BillModelObj.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);// 明细表列前缀 + this.BillModelObj.DetailOrderField = this.BillModelObj.DetailPreFix + "lsidx_id";// 单据来源id } - - this.BillModelObj.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);// 明细表列前缀 - this.BillModelObj.DetailOrderField = this.BillModelObj.DetailPreFix + "lsidx_id";// 单据来源id if (SystemInfo.Instance.IsNotBillDetailOrder)//禁用排序 + { this.BillModelObj.DetailOrderField = string.Empty; - - this.BillAuditComObj = new BillAuditCommonModel(); + } + if (!dataCaches.GetValue(this, "BillAuditCommonModel", out this.BillAuditComObj)) + { + this.BillAuditComObj = new BillAuditCommonModel(); + } this.Text = this.SysModel.FormText + "—" + this.AuditModelObj.CurstepName + " " + string.Format(ResourceKeys.BillNoTitle, this.SysModel.BillDocumentId); this.btnAccradit.Text = this.AuditModelObj.StepApplyText; this.btnBack.Text = this.AuditModelObj.StepBackText; @@ -270,23 +509,19 @@ namespace Lskj.PubAccraditation this.label_auditPerson.Text = this.label_managerAudit.LabelText = this.AuditModelObj.CurstepName; this.label_managerAudit.EditText = this.SysModel.UserName; this.pl_right_bottom.Tag = this.p_right_bottom.Tag = "NotChangeLocation"; - DataRow menuCondRow = null; - if (ProcessExists) - { - menuCondRow = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); - this.btnAttach.Text += "(" + Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRowCount() + ")"; - } - else + if (!dataCaches.GetValue(this, "MenuConfigTab", out DataRow menuCondRow)) { menuCondRow = BaseImpl.GetMenuConfigTab(this.SysModel.ModuleId); //获取菜单其他配置 - this.btnAttach.Text += "(" + AttachImpl.GetFileCount(this.BillModelObj.DirId + "", this.SysModel.BillDocumentId) + ")"; } - + if (!dataCaches.GetValue(this, "FileCount", out int fileCount)) + { + fileCount = AttachImpl.GetFileCount(this.BillModelObj.DirId + "", this.SysModel.BillDocumentId); + } + this.btnAttach.Text += "(" + fileCount + ")"; if (menuCondRow != null) { if (menuCondRow["DllFileName"].Equals("Lskj.PubAccraditationBrp.dll")) this.isBrpAccrad = true;// 是否是Brp模式加载 } - //树表格 if (this.BillModelObj.DetailTreeTable) { @@ -301,11 +536,8 @@ namespace Lskj.PubAccraditation //父节点编号 (this.gridBillInfo as TreeGridControlEx).TreeListObj.ParentFieldName = "tap_pid"; (this.gridBillInfo as TreeGridControlEx).SortField = this.BillModelObj.DetailOrderField; - (this.gridBillInfo as TreeGridControlEx).InitializedragState(); } - - //记录推送用户 this.GetPushOpers(); this.gridFlow.GridView.RowStyle += new RowStyleEventHandler(gridFlowInfo_RowStyle); @@ -319,17 +551,10 @@ namespace Lskj.PubAccraditation this.gridBillInfo.gridControl.Paint += new PaintEventHandler(gridBillInfo_Panint); this.gridBillInfo.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor); } - - if (ProcessExists) - { - this._dtBillInfoFiled = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(); - } - else + if (!dataCaches.GetValue(this, "BillInfoData", out this._dtBillInfoFiled)) { this._dtBillInfoFiled = BillAuditImpl.GetBillInfoData(this.SysModel.ModuleCode); } - - } #endregion @@ -413,16 +638,18 @@ namespace Lskj.PubAccraditation /// private void InitializeControl() { - if (ProcessExists) + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(gridFlow, "ReadOnlyColumns", out DataTable dtReadOnlyColumns)) { - this.gridFlow.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey); - this.gridFlow.SetGridViewDataSource(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent()); + dtReadOnlyColumns = BaseAuditImpl.GetFlowRecordColumn(); } - else + if (!dataCaches.GetValue(gridFlow, "GridViewDataSource", out DataTable dtridViewDataSource)) { - this.gridFlow.SetReadOnlyColumns(BaseAuditImpl.GetFlowRecordColumn(), GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey); - this.gridFlow.SetGridViewDataSource(BaseAuditImpl.GetFlowRecordData(this.BillAuditComObj.SystemTabFlowStep, this.SysModel.BillDocumentId, this.SysModel.ModuleCode)); + dtridViewDataSource = BaseAuditImpl.GetFlowRecordData(this.BillAuditComObj.SystemTabFlowStep, this.SysModel.BillDocumentId, this.SysModel.ModuleCode); } + this.gridFlow.Model = SysModel; + this.gridFlow.SetReadOnlyColumns(dtReadOnlyColumns, GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey); + this.gridFlow.SetGridViewDataSource(dtridViewDataSource); this.SetFormSize(); this.BindTab(); @@ -503,12 +730,8 @@ namespace Lskj.PubAccraditation /// private void InitCommonMenu() { - DataTable tableCommon = new DataTable(); - if (ProcessExists) - { - tableCommon = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(); - } - else + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "TableCommon", out DataTable tableCommon)) { tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.SysModel.ModuleCode, ModuleType.BillDetail); } @@ -624,13 +847,18 @@ namespace Lskj.PubAccraditation /// private void BindTab() { + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; this.tab_basicInfo.Model = this.SysModel; this.tab_basicInfo.ParentGridEx = this.gridBillInfo; if (this.BillModelObj.SaveRefresh) { this.tab_basicInfo.OnDetailSaveGridCallBack += Tab_basicInfo_OnDetailSaveGridCallBack; } - this.tab_basicInfo.InitTabPages(GetTabDetails()); + if (!dataCaches.GetValue(tab_basicInfo, "Details", out List details)) + { + details = GetTabDetails(); + } + this.tab_basicInfo.InitTabPages(details); this.splitLeft.PanelVisibility = tab_basicInfo.TabControlObj.TabPages.Count == 0 ? SplitPanelVisibility.Panel1 : SplitPanelVisibility.Both; this.tab_basicInfo.OnRightCallback += new EventHandler(AuditTab_OnRightCallback); @@ -700,23 +928,24 @@ namespace Lskj.PubAccraditation /// private void BindBill() { + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; // 初始化表头 - this.ControlObj = new MyControl(); + if (!dataCaches.GetValue(this, "ControlObj", out this.ControlObj)) + { + this.ControlObj = new MyControl(); + } + if (!dataCaches.GetValue(this, "ControlLocation", out DataTable dtControlLocation)) + { + dtControlLocation = BaseModuleImpl.GetControlLocation(this.BillModelObj.FormKey, this.SysModel.ModuleCode); + } this.ControlObj.PrimaryValue = this.SysModel.BillDocumentId; - if (ProcessExists) + this.ControlObj.InitControl(dtControlLocation, this.pl_left_top); + if (SystemInfo.Instance.AuditAutoScroll) { - this.ControlObj.InitControl(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.pl_left_top); + this.pl_left_top.AutoScroll = true; } - else - { - this.ControlObj.InitControl(BaseModuleImpl.GetControlLocation(this.BillModelObj.FormKey, this.SysModel.ModuleCode), this.pl_left_top); - } - if (SystemInfo.Instance.AuditAutoScroll) this.pl_left_top.AutoScroll = true; - this.ControlObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack); this.pl_left_top.Height = this.BillModelObj.ParentHeight - 36 > this.pl_left_top.Height ? this.pl_left_top.Height : this.BillModelObj.ParentHeight; - - //初始明细数据 this.gridBillInfo.Model = this.SysModel; this.gridBillInfo.ParentControl = this.ControlObj; @@ -728,35 +957,28 @@ namespace Lskj.PubAccraditation { this.gridBillInfo.OnDataSourceBindCallBack += new EventHandler(OnGridBillInfoOnDataSourceBindCallBack); } - - if (ProcessExists) + if (!dataCaches.GetValue(gridBillInfo, "DetailColumns", out DataTable dtDetailColumns)) { - this.gridBillInfo.SetEditColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey); - if (this.BillModelObj.DetailTreeTable) - { - (this.gridBillInfo as TreeGridControlEx).SetGridRightMenus(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.SysModel, OnGridViewRightCallBack); - } - else - { - this.gridBillInfo.SetGridRightMenus(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.SysModel, OnGridViewRightCallBack); - } - this.gridBillInfo.SetGridRowColors(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent()); + dtDetailColumns = BillImpl.GetDetailColumns(this.SysModel.ModuleCode); + } + this.gridBillInfo.SetEditColumns(dtDetailColumns, GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey); + if (!dataCaches.GetValue(gridBillInfo, "BaseGridRightMenus", out DataTable dtGridRightMenu)) + { + dtGridRightMenu = BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail); + } + if (this.BillModelObj.DetailTreeTable) + { + (this.gridBillInfo as TreeGridControlEx).SetGridRightMenus(dtGridRightMenu, this.SysModel, OnGridViewRightCallBack); } else { - this.gridBillInfo.SetEditColumns(BillImpl.GetDetailColumns(this.SysModel.ModuleCode), GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey); - if (this.BillModelObj.DetailTreeTable) - { - (this.gridBillInfo as TreeGridControlEx).SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail), this.SysModel, OnGridViewRightCallBack); - } - else - { - this.gridBillInfo.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail), this.SysModel, OnGridViewRightCallBack); - } - - this.gridBillInfo.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("BILLDETAIL_" + this.BillModelObj.FormKey)); + this.gridBillInfo.SetGridRightMenus(dtGridRightMenu, this.SysModel, OnGridViewRightCallBack); } - + if (!dataCaches.GetValue(gridBillInfo, "BaseGridRowColors", out DataTable dtBaseGridRowColors)) + { + dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("BILLDETAIL_" + this.BillModelObj.FormKey); + } + this.gridBillInfo.SetGridRowColors(dtBaseGridRowColors); ////修改字段 //if (!string.IsNullOrEmpty(this.AuditModelObj.DetailModifyFields) && this.AuditModelObj.DetailModifyFields != "-1") @@ -1133,15 +1355,11 @@ namespace Lskj.PubAccraditation /// private void SetBillControl(string billFields, string RequiredFields) { - if (ProcessExists) - { - this._drBillInfoMsg = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); - } - else + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "CurrentFlowRowData", out this._drBillInfoMsg)) { this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId); } - if (this._drBillInfoMsg == null) { MessageUtil.Show(ResourceKeys.NotFindAuditRecord); @@ -1194,46 +1412,34 @@ namespace Lskj.PubAccraditation /// private void SetButtonsStatus() { - DataRow dr = null; - DataRow drOper = null; - if (ProcessExists) - { - dr = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); - } - else + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "BillFlowStep", out DataRow dr)) { dr = BillAuditImpl.GetBillFlowStep(this.SysModel.ModuleCode, this._mainBillTypeValue, this.SysModel.StepCode); } - - if (dr == null) { MessageUtil.Show(ResourceKeys.FlowStepConfigError); return; } - this._flowTypeStepModel = new FlowTypeStepModel(dr); - string operUser = this._flowTypeStepModel.OperUser; - if (ProcessExists) + if (!dataCaches.GetValue(this, "FlowTypeStepModel", out this._flowTypeStepModel)) { - drOper = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); - this.btnAccradit.Visible = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRowCount() < 0; - this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0; + this._flowTypeStepModel = new FlowTypeStepModel(dr); } - else + string operUser = this._flowTypeStepModel.OperUser; + if (!dataCaches.GetValue(this, "Operators", out DataRow drOper)) { drOper = BillAuditImpl.GetOperators(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.SysModel.StepCode); - this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0; } - + this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0; operUser = drOper != null ? drOper["operators"] + "" : operUser; - - - if (operUser.StartsWith("@")) { - string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_drBillInfoMsg, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId); - object number = MainImpl.GetResult(sql);// MainImpl.GetDataTableResult(sql); - + if (!dataCaches.GetValue(this, "Number", out string number)) + { + string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_drBillInfoMsg, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId); + number = BaseImpl.GetResult(sql) + ""; + } this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = int.Parse(string.IsNullOrWhiteSpace(number + "") ? "0" : number + "") > 0; } else @@ -1241,7 +1447,10 @@ namespace Lskj.PubAccraditation this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = operUser.Contains(this.SysModel.UserName); } //代理权限 - DataRow agency = BillAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode); + if (!dataCaches.GetValue(this, "AgencyAuthority", out DataRow agency)) + { + agency = BillAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode); + } if (agency != null) { string sourceuser = agency["sourceuser"] + ""; @@ -1253,12 +1462,7 @@ namespace Lskj.PubAccraditation break; } } - } - - - - this.btnClose.Visible = this._flowTypeStepModel.StepClosed == 1; this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this._flowTypeStepModel.RemindSelect == "1"; //终审 @@ -1272,14 +1476,12 @@ namespace Lskj.PubAccraditation this.btnPrint.Top = 20; this.btnPrint.Height = 30; this.btnPrint.Width = (this.p_right_bottom.Width - 55) / 2; - this.btnAttach.Parent = this.p_right_bottom; this.btnAttach.Visible = true; this.btnAttach.Left = this.btnPrint.Left + this.btnPrint.Width + 15; this.btnAttach.Top = 20; this.btnAttach.Height = 30; this.btnAttach.Width = (this.p_right_bottom.Width - 55) / 2; - } } #endregion @@ -1296,29 +1498,20 @@ namespace Lskj.PubAccraditation /// private void LoadRemindRecord() { + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (this._flowTypeStepModel != null && !string.IsNullOrEmpty(this._flowTypeStepModel.RemindSelect)) { - DataTable dt = new DataTable(); - if (ProcessExists) - { - dt = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(); - } - else + if (!dataCaches.GetValue(gridRemind, "RemindinRecord", out DataTable dt)) { dt = BaseAuditImpl.GetRemindinRecord(this.BillAuditComObj.FlowStepTable, this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode); } - if (dt != null && dt.Rows.Count > 0) { - if (ProcessExists) + if (!dataCaches.GetValue(gridRemind, "ReadOnlyColumns", out DataTable dtReadOnlyColumns)) { - this.gridRemind.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent()); + dtReadOnlyColumns = BaseAuditImpl.GetRemindColumn(); } - else - { - this.gridRemind.SetReadOnlyColumns(BaseAuditImpl.GetRemindColumn()); - } - + this.gridRemind.SetReadOnlyColumns(dtReadOnlyColumns); this.gridRemind.SetGridViewDataSource(dt); this.tabpage_remind.Text = this.tabpage_remind.Text + "(" + dt.Rows.Count + ")"; } @@ -1342,27 +1535,19 @@ namespace Lskj.PubAccraditation /// private void LoadSignRecord() { + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; if (this.BillAuditComObj == null) return; - DataTable dt = new DataTable(); - if (ProcessExists) - { - dt = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(); - } - else + if (!dataCaches.GetValue(gridSign, "SignRecord", out DataTable dt)) { dt = BaseAuditImpl.GetSignRecord(this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode); } - if (dt != null && dt.Rows.Count > 0) { - if (ProcessExists) + if (!dataCaches.GetValue(gridSign, "ReadOnlyColumns", out DataTable dtReadOnlyColumns)) { - this.gridSign.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent()); - } - else - { - this.gridSign.SetReadOnlyColumns(BaseAuditImpl.GetSignRecordCoulumn()); + dtReadOnlyColumns = BaseAuditImpl.GetSignRecordCoulumn(); } + this.gridSign.SetReadOnlyColumns(dtReadOnlyColumns); this.gridSign.SetGridViewDataSource(dt); this.tabpage_sign.Text = this.tabpage_sign.Text + "(" + dt.Rows.Count + ")"; } @@ -1385,16 +1570,21 @@ namespace Lskj.PubAccraditation /// private void InitOtherParms() { + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "CheckSuggestionDataSource", out DataTable dt)) + { + dt = BaseImpl.GetDataTableResult(this.AuditModelObj.SuggestionSql); + } this.CheckSuggestion.ValueField = this.CheckSuggestion.TextField = "Mix_apellation"; - this.CheckSuggestion.SetDataSource(BaseImpl.GetDataTableResult(this.AuditModelObj.SuggestionSql)); + this.CheckSuggestion.SetDataSource(dt); this.CheckSuggestion.TextEdit.SelectedIndex = 0; this.CheckSuggestion.TextEdit.SelectedValueChanged += new EventHandler(CheckSuggestion_Click); this.txt_billDocumentId.EditText = this.SysModel.BillDocumentId; this.label_date.EditText = DateTime.Now.ToString(); - - if (!string.IsNullOrWhiteSpace(this.AuditModelObj.StepApplyContent)) this.txtRemark.Text = this.AuditModelObj.StepApplyContent; - - + if (!string.IsNullOrWhiteSpace(this.AuditModelObj.StepApplyContent)) + { + this.txtRemark.Text = this.AuditModelObj.StepApplyContent; + } } #endregion @@ -2388,16 +2578,11 @@ namespace Lskj.PubAccraditation /// private void GetPushOpers() { - DataRow beforeOpers = null; - if (ProcessExists) - { - beforeOpers = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow(); - } - else + Dictionary dataCaches = SysModel != null ? SysModel.DataCaches : null; + if (!dataCaches.GetValue(this, "PushedOpers", out DataRow beforeOpers)) { beforeOpers = BillAuditImpl.GetPushedOpers(this.SysModel.BillDocumentId, this.SysModel.StepCode); } - if (beforeOpers != null) { //记录本次操作信息 @@ -2768,34 +2953,4 @@ namespace Lskj.PubAccraditation /// /// 说明:检查可用条件 /// 创建人:龚宇超 - /// 创建日期:2017-11-09 - /// 修改人: - /// 修改日期: - /// 修改备注: - /// 版本:1.0 - /// - /// The cond. - /// The data row. - /// true if XXXX, false otherwise. - private bool ValidateCond(string cond, DataRow dataRow) - { - bool result = false; - cond = ReplaceHelper.ReplaceRowParam(dataRow, cond); - if (cond.StartsWith("@") || cond.StartsWith("!")) - { - result = "1".Equals(BaseImpl.GetDefaultValue(cond)); - } - else if (dataRow == null) - { - result = ReplaceHelper.EvalCond(cond); - } - else - { - result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond); - } - return result; - } - - - } -} + /// 创建日期:2017-11 \ No newline at end of file diff --git a/插件库/Lskj.PubAccraditation/FrmMain.cs b/插件库/Lskj.PubAccraditation/FrmMain.cs index 37c164b..caf6377 100644 --- a/插件库/Lskj.PubAccraditation/FrmMain.cs +++ b/插件库/Lskj.PubAccraditation/FrmMain.cs @@ -251,6 +251,7 @@ namespace Lskj.PubAccraditation string[] args = defaultArgs.Concat(menuArgs).ToArray(); FrmAccraditation frm = new FrmAccraditation(); frm.SysModel = new DynamicPubAccraditionPopModel(args); + if (SystemInfo.Instance.OptimizationSpeed) frm.GetDataCaches(frm.SysModel.DataCaches); frm.Text = this.Text; if (SystemInfo.Instance.PageOpen) @@ -402,26 +403,4 @@ namespace Lskj.PubAccraditation /// 修改人: /// 修改日期: /// 修改备注: - /// 版本:1.0 - /// - private void refreshThePage(string promptInformation, string id) - { - //刷新界面 - this.auditPanelEx.RefreshTabPage(); - if (!string.IsNullOrWhiteSpace(promptInformation)) MessageUtil.Show(promptInformation); - //上一次点开page - XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage; - //要删除的page - XtraTabPage removePage = new XtraTabPage(); - ERPInfo.Instance.ModuleForms.Remove(id); - foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages) - { - if (tablepage.Tag == null) continue; - if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage; - if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage; - } - ERPInfo.Instance.PageControl.TabPages.Remove(removePage); - - } - } -} + ///