diff --git a/插件库/Lskj.PubModuleDetail3/DllBaseClass.cs b/插件库/Lskj.PubModuleDetail3/DllBaseClass.cs index 04fa8a3..671abc7 100644 --- a/插件库/Lskj.PubModuleDetail3/DllBaseClass.cs +++ b/插件库/Lskj.PubModuleDetail3/DllBaseClass.cs @@ -9,6 +9,7 @@ using Lskj.Util; using Lskj.Model; using Lskj.Business.Impl; using Lskj.Business; +using System.Collections; namespace Lskj.PubModuleDetail3 { @@ -29,25 +30,4 @@ namespace Lskj.PubModuleDetail3 FrmMain main = new FrmMain(); this.SubForm = main; - DynamicModuleDetailModel moduleModel = new DynamicModuleDetailModel(obj); - - int formType = ReportImpl.GetBaseType(moduleModel.ModuleCode); - - GridEnum gridEnum = GridEnum.GridView; - if (formType == 1) gridEnum = GridEnum.BandedGridView; - if (formType == 2) gridEnum = GridEnum.GridView; // 基础档案暂时注释GridEnum.TreeListGridView此类型,TrcReport和手机端显示卡片冲突. - - main.Model = moduleModel; - main.Model.GridEnumObj = gridEnum; - } - catch (Exception ex) - { - LogUtil.WriteError("Lskj.PubModuleDetail2.dll--参数错误-->" + obj.ToString(), ex); - } - } - /// - /// 窗口 - /// - public Form SubForm { get; set; } - } -} + DynamicModuleDetailModel moduleM \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail3/FrmMain.cs b/插件库/Lskj.PubModuleDetail3/FrmMain.cs index 9dcff17..98f94d4 100644 --- a/插件库/Lskj.PubModuleDetail3/FrmMain.cs +++ b/插件库/Lskj.PubModuleDetail3/FrmMain.cs @@ -19,6 +19,8 @@ using DevExpress.Utils; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraGrid.Views.Base; +using System.Collections; +using System.Threading.Tasks; namespace Lskj.PubModuleDetail3 { @@ -60,18 +62,4 @@ namespace Lskj.PubModuleDetail3 } } - catch (Exception ex) - { - LogHelper.Instance.WriteError(ex); - //MessageUtil.Show(ex); - string Message = ErrorMessage.PromptErrorMessage(ex); - MessageUtil.Show(Message,ex.Message); - } - finally - { - Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this); - WaitForm.HideForm(); - } - } - } -} + catch (E \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail3/ProductionMain.Designer.cs b/插件库/Lskj.PubModuleDetail3/ProductionMain.Designer.cs index 39a87bd..7ac29d4 100644 --- a/插件库/Lskj.PubModuleDetail3/ProductionMain.Designer.cs +++ b/插件库/Lskj.PubModuleDetail3/ProductionMain.Designer.cs @@ -30,6 +30,7 @@ { this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl(); this.splitLeftControl = new DevExpress.XtraEditors.SplitContainerControl(); + this.gridleftTop = new Lskj.Control.GridControlEx(); this.panelControl1 = new DevExpress.XtraEditors.PanelControl(); this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton(); this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); @@ -44,7 +45,6 @@ this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage(); this.tcButtom = new Lskj.PubModuleDetail3.TabIntoControl(); this.pl_bottom = new DevExpress.XtraEditors.PanelControl(); - this.gridleftTop = new Lskj.Control.GridControlEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit(); this.splitContainerControl1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitLeftControl)).BeginInit(); @@ -95,6 +95,17 @@ this.splitLeftControl.Text = "splitContainerControl3"; this.splitLeftControl.SplitterPositionChanged += new System.EventHandler(this.splitContainerTop_SplitterPositionChanged); // + // gridleftTop + // + this.gridleftTop.AdapterObj = null; + this.gridleftTop.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridleftTop.Location = new System.Drawing.Point(0, 30); + this.gridleftTop.Margin = new System.Windows.Forms.Padding(5); + this.gridleftTop.Name = "gridleftTop"; + this.gridleftTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum; + this.gridleftTop.Size = new System.Drawing.Size(438, 374); + this.gridleftTop.TabIndex = 11; + // // panelControl1 // this.panelControl1.Controls.Add(this.simpleButton1); @@ -169,8 +180,9 @@ this.mg_control.Location = new System.Drawing.Point(0, 0); this.mg_control.Name = "mg_control"; this.mg_control.OperShortMode = true; - this.mg_control.Size = new System.Drawing.Size(800, 375); + this.mg_control.Size = new System.Drawing.Size(533, 250); this.mg_control.TabIndex = 1; + this.mg_control.VisibleMrpSearchPanel = false; this.mg_control.VisibleOperPanel = true; this.mg_control.VisibleSearchPanel = true; // @@ -225,7 +237,8 @@ this.tcButtom.Location = new System.Drawing.Point(0, 0); this.tcButtom.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.tcButtom.Name = "tcButtom"; - this.tcButtom.Size = new System.Drawing.Size(801, 205); + this.tcButtom.Size = new System.Drawing.Size(534, 137); + this.tcButtom.splitContainer = null; this.tcButtom.TabIndex = 4; // // pl_bottom @@ -239,17 +252,6 @@ this.pl_bottom.TabIndex = 2; this.pl_bottom.Visible = false; // - // gridleftTop - // - this.gridleftTop.AdapterObj = null; - this.gridleftTop.Dock = System.Windows.Forms.DockStyle.Fill; - this.gridleftTop.Location = new System.Drawing.Point(0, 30); - this.gridleftTop.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); - this.gridleftTop.Name = "gridleftTop"; - this.gridleftTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum; - this.gridleftTop.Size = new System.Drawing.Size(438, 374); - this.gridleftTop.TabIndex = 11; - // // ProductionMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -279,22 +281,4 @@ #endregion - private DevExpress.XtraEditors.SplitContainerControl splitContainerControl1; - private DevExpress.XtraEditors.SplitContainerControl splitBottomControl; - private Control.GridControlEx gridLeftButtom; - private DevExpress.XtraEditors.PanelControl pl_bottom; - private DevExpress.XtraEditors.SplitContainerControl splitLeftControl; - private DevExpress.XtraEditors.PanelControl panelControl1; - private DevExpress.XtraEditors.SimpleButton simpleButton1; - private DevExpress.XtraEditors.LabelControl labelControl1; - private System.Windows.Forms.ComboBox comboBox1; - private System.Windows.Forms.TextBox textBox1; - private DevExpress.XtraTab.XtraTabControl Tab_additional; - private DevExpress.XtraTab.XtraTabPage xtraTabPage1; - private Control.ModuleGridEx mg_control; - private DevExpress.XtraTab.XtraTabControl Tab_Bottom; - private DevExpress.XtraTab.XtraTabPage xtraTabPage2; - private TabIntoControl tcButtom; - private Control.GridControlEx gridleftTop; - } -} + private DevExpress.XtraEditors.SplitContainerControl splitCon \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail3/ProductionMain.cs b/插件库/Lskj.PubModuleDetail3/ProductionMain.cs index 0ff4e2c..c05ca64 100644 --- a/插件库/Lskj.PubModuleDetail3/ProductionMain.cs +++ b/插件库/Lskj.PubModuleDetail3/ProductionMain.cs @@ -19,6 +19,8 @@ using DevExpress.XtraEditors; using Lskj.Core; using DevExpress.XtraGrid.Views.Base; using Lskj.Business; +using System.Collections; +using System.Threading.Tasks; namespace Lskj.PubModuleDetail3 { @@ -50,7 +52,7 @@ namespace Lskj.PubModuleDetail3 /// 系统模块实体对象 /// /// The system model. - public ModuleModel SysModel { get; private set; } + public ModuleModel SysModel; /// ///左上方查询条件控件 /// @@ -116,13 +118,23 @@ namespace Lskj.PubModuleDetail3 { this._isInitFinish = false; this.Model = Model; - DataRow modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode); + Dictionary dataCaches = Model != null ? Model.DataCaches : null; + if (!dataCaches.GetValue(this, "MainInfo", out DataRow modelRow)) + { + modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode); + } if (modelRow == null) { MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); return; } - this.SysModel = new ModuleModel(modelRow); + + if (!dataCaches.GetValue(this, "ProductionMainModel", out this.SysModel)) + { + this.SysModel = new ModuleModel(modelRow); + } + + if (this.SysModel.ModuleDetailClickMode) { this.gridleftTop.GridView.RowClick += GridViewLeft_DoubleClick; @@ -147,14 +159,26 @@ namespace Lskj.PubModuleDetail3 this.gridleftTop.GridView.BestFitColumns(); this.gridLeftButtom.GridView.BestFitColumns(); - this.GridDetailModelObjs = GetDetails(Model.ModuleCode); - - DataRow menuCondRow = BaseImpl.GetMenuConfigTab(this.Model.ModuleId); + if (!dataCaches.GetValue(this, "Details", out this.GridDetailModelObjs)) + { + this.GridDetailModelObjs = GetDetails(Model.ModuleCode); + } + + if (!dataCaches.GetValue(this, "GetMenuConfigTab", out DataRow menuCondRow)) + { + menuCondRow = BaseImpl.GetMenuConfigTab(this.Model.ModuleId); + } + + if(this.SysModel.AssociateLeft) this.ModuleGridObj.SpecialLeftTable = this.gridleftTop; + if (menuCondRow["DllFileName"].Equals("Lskj.PubModuleDetailSearch3.dll")) Model.IsDetailSearch = true; this.mg_control.InitializeControl(SysModel, Model); this.mg_control.SearchObj.SearchGrid(); //初始化左下角数据 this.InitializeLeft(); + + + if (this.SearchLeftObj != null) { this.SearchLeftObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack); @@ -222,6 +246,55 @@ namespace Lskj.PubModuleDetail3 WaitForm.HideForm(); } + /// + /// 获取数据源缓存 + /// + /// + public void GetDataCaches(Dictionary cachesDic) + { + + Task dynamicModelTask = cachesDic.GetTask(this, "DynamicModel"); + DynamicModuleDetailModel dynamicModel = (DynamicModuleDetailModel)dynamicModelTask.Result; + + Task MainInfoTask = cachesDic.AddTask(this, "MainInfo", new Task(() => + { + return MainImpl.GetSystemdllTab(dynamicModel.ModuleCode);//获取单个模块信息 + })); + Task ProductionMainModelTask = cachesDic.AddTask(this, "ProductionMainModel", new Task(() => + { + return new ModuleModel(MainInfoTask.Result); ; + })); + Task> detailTask = cachesDic.AddTask(this, "Details", new Task>(() => + { + DataTable detailPages = BaseModuleImpl.GetBaseDetailPages(dynamicModel.ModuleCode);//根据传入的模块编号获得基础档案底部标签的数据 + List details = new List();//表格明细对象的集合 + foreach (DataRow item in detailPages.Rows) + { + GridDetailModel gridDetailModel = new GridDetailModel(item, null, GridCustomColumnStruct.BaseDetailGridView); + details.Add(gridDetailModel); + Task addGridColumnsTask = cachesDic.AddTask(gridDetailModel, "GridColumns", new Task(() => + { + DataTable gridColumns = ReportImpl.GetReportDetailColumns(dynamicModel.ModuleCode, item["id"] + "");//获取报表明细列 + gridDetailModel.GridColumns = gridColumns; + return gridColumns; + })); + } + return details; + })); + Task GetMenuConfigTabTask = cachesDic.AddTask(this, "GetMenuConfigTab", new Task(() => + { + return BaseImpl.GetMenuConfigTab(dynamicModel.ModuleId); + })); + //右上方主表 + cachesDic.AddTask(mg_control, "DynamicModel", dynamicModelTask); + cachesDic.AddTask(mg_control, "SysModel", ProductionMainModelTask); + mg_control.GetDataCaches(cachesDic); + + + } + + + #region 初始化分割条位置 /// @@ -1041,6 +1114,9 @@ namespace Lskj.PubModuleDetail3 XtraTabPage page = new XtraTabPage(); page.Text = item["AttachName"] + ""; ModuleGridEx modegridEx = new ModuleGridEx(); + + if (addModel.AssociateLeft) modegridEx.SpecialLeftTable = this.gridleftTop; + modegridEx.Name = "modegridEx"; modegridEx.Dock = DockStyle.Fill; DynamicModel dyncModel = new DynamicModuleModel(new string[] { "0", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", item["unionModule"] + "", "0" }); @@ -1446,27 +1522,4 @@ namespace Lskj.PubModuleDetail3 string parentValue = this.SearchLeftObj.GetControlValue(model.UnionValue); if (!string.IsNullOrEmpty(model.UnionValue) && !string.IsNullOrEmpty(parentValue)) this.ModuleGridObj.SearchObj.WhereCond = string.Format(" and {0}='{1}'", model.UnionValue, parentValue); - if (dataRow != null) - { - this._keyValue = dataRow[this._primaryLeftKey] + ""; - //左侧上下结构刷新 - gridleftTop.LastSearchSql = this.SearchLeftObj.SetSearchSqlValue(this.MoudleLeftObj.MenuSql); - gridleftTop.SetGridViewDataSource(MainImpl.GetDataTableResult(gridleftTop.LastSearchSql)); - OnGridViewLeftFocusedRowChanged(this.gridleftTop.GridView, null);//手动行改变事件 - //gridleftBottom.LastSearchSql = this.SearchLeftObj.SetSearchSqlValue(this.MoudleLeftObj.MenuSql); - //gridleftBottom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridleftBottom.LastSearchSql)); - } - } - catch (Exception ex) - { - string Message = ErrorMessage.PromptErrorMessage(ex); - MessageUtil.Show(Message, ex.Message); - } - } - #endregion - - - } -} - - + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail3/TabIntoAddControl.cs b/插件库/Lskj.PubModuleDetail3/TabIntoAddControl.cs index 92b8208..8587f6b 100644 --- a/插件库/Lskj.PubModuleDetail3/TabIntoAddControl.cs +++ b/插件库/Lskj.PubModuleDetail3/TabIntoAddControl.cs @@ -432,34 +432,4 @@ namespace Lskj.PubModuleDetail3 private void InitSpliterPosition() { string spliterPosition = IniHelper.Read(string.Format("PubModuleDetail3RightLowerRight_SplitterPositionMain_{0}", ModuleNumber)); - if (!string.IsNullOrEmpty(spliterPosition)) this.splitMainControl.SplitterPosition = Convert.ToInt32(spliterPosition); - - } - /// - /// 说明:分割条位置改变事件 - /// 创建人:王一帆 - /// 创建日期:2020-06-19 - /// 修改人: - /// 修改日期: - /// 修改备注: - /// 版本:1.0 - /// - private void splitContainer_SplitterPositionChanged(object sender, EventArgs e) - { - try - { - if (_isInitFinish) - { - IniHelper.Write(string.Format("PubModuleDetail3RightLowerRight_SplitterPositionMain_{0}", ModuleNumber), this.splitMainControl.SplitterPosition + ""); - } - } - catch (Exception ex) - { - string Message = ErrorMessage.PromptErrorMessage(ex); - MessageUtil.Show(Message, ex.Message); - } - } - - - } -} \ No newline at end of file + if (!string.IsNullOrEmpty(spliterPosition)) this.splitMainControl.SplitterPosition = Conv \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail3/TabIntoControl.cs b/插件库/Lskj.PubModuleDetail3/TabIntoControl.cs index 0d7e2f1..3ce0a77 100644 --- a/插件库/Lskj.PubModuleDetail3/TabIntoControl.cs +++ b/插件库/Lskj.PubModuleDetail3/TabIntoControl.cs @@ -163,6 +163,9 @@ namespace Lskj.PubModuleDetail3 gridEx.SetReadOnlyColumns(model.GridColumns, model.GridCustomColumnKey); gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + + if (model.IsCheck == 1) GridDragGrid.GridAddCheckBox(gridEx.GridView); + if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) { // 拖拽模式,绑定拖拽对象 @@ -207,6 +210,19 @@ namespace Lskj.PubModuleDetail3 gridEx.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.SystemModel.ParmaryKey : model.UnionParentField; gridEx.DetailKeyField = model.UnionValue; gridEx.OnSaveGridCallBack += new EventHandler(OnGridViewAllCallBack); + + + if (model.IsCheck == 1) + { + GridDragGrid.GridAddCheckBox(gridEx.GridControlObj.GridView); + //if (model.RecordDetailsCheckbox && + // ParentGridEx?.GridView.OptionsSelection.MultiSelect == true) + //{ + // gridEx.TagName = model.DetailName; + // gridEx.GridControlObj.GridView.SelectionChanged += GridView_SelectionChanged; + //} + } + if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) { // 拖拽模式,绑定拖拽对象 @@ -228,6 +244,7 @@ namespace Lskj.PubModuleDetail3 splitLeftControl.SplitterPositionChanged += SplitLeftControl_SplitterMoved; TabIntoAddControl tabAdd = new TabIntoAddControl(); + tabAdd.Model = dyncModel; //tabAdd.splitContainerControl.Horizontal = false;//上下结构 tabAdd.InitTabPages(_gridIntoDetail); tabAdd.Dock = DockStyle.Fill; @@ -881,35 +898,4 @@ namespace Lskj.PubModuleDetail3 } - /// - /// 说明:分割条位置改变事件 - /// 创建人:王一帆 - /// 创建日期:2020-06-19 - /// 修改人: - /// 修改日期: - /// 修改备注: - /// 版本:1.0 - /// - private void SplitLeftControl_SplitterMoved(object sender, EventArgs e) - { - try - { - if (_isInitFinish && this.splitContainer != null) - { - IniHelper.Write(string.Format("PubModuleDetail3RightLower_SplitterPositionMain_{0}", this.splitContainer.Tag + ""), this.splitContainer.SplitterPosition + ""); - } - } - catch (Exception ex) - { - string Message = ErrorMessage.PromptErrorMessage(ex); - MessageUtil.Show(Message, ex.Message); - } - } - - - - - - - } -} + /// \ No newline at end of file