using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Lskj.Control.Model; using Lskj.Model; using Lskj.Util; using Lskj.Data; using DevExpress.XtraTab; using Lskj.Control; using DevExpress.XtraGrid.Views.Grid; using Lskj.Business.Impl; using DevExpress.Utils; using DevExpress.XtraEditors; using Lskj.Core; using DevExpress.XtraGrid.Views.Base; using Lskj.Business; using System.Collections; using System.Threading.Tasks; namespace Lskj.PubModuleDetail3 { public partial class ProductionMain : UserControl { /// /// 左侧树数据 /// public DataRow LeftRowObj; /// /// 表格明细集合 /// public List GridDetailModelObjs; /// /// 是否为拖拽明细模式 /// public bool IsDragDetail; /// /// 基础模型 /// public ModuleModel MoudleLeftObj; public DynamicModuleDetailModel Model; /// /// 表格列 /// private DataTable _gridColumns = new DataTable(); /// /// 系统模块实体对象 /// /// The system model. public ModuleModel SysModel; /// ///左上方查询条件控件 /// public MyControl SearchLeftObj; /// /// 主键名 /// private string _primaryLeftKey; /// /// 顶部表格控件 /// public ModuleGridEx ModuleGridObj; /// /// 底部多标签控件 /// public XtraTabControl TabObj; /// /// 底部多标签控件 /// public TabIntoControl TabIntoObj; /// /// 初始化完成 /// private bool _isInitFinish; public List DataItem = new List(); /// /// 主键值 /// private string _keyValue; private bool Leftfirst; private string LeftBoottomModel; /// /// 上方刷新 /// private bool istop = false; /// /// 拖拽模式 /// private string dragModel = "0"; public ProductionMain() { InitializeComponent(); } /// /// 说明:窗口加载 /// 创建人:龚宇超 /// 创建日期:2019-06-28 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The instance containing the event data. public void OnLoad(DynamicModuleDetailModel Model) { WaitForm.ShowForm(); try { this._isInitFinish = false; this.Model = Model; 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; } if (!dataCaches.GetValue(this, "ProductionMainModel", out this.SysModel)) { this.SysModel = new ModuleModel(modelRow); } if (this.SysModel.ModuleDetailClickMode) { this.gridleftTop.GridView.RowClick += GridViewLeft_DoubleClick; } else { this.gridleftTop.GridView.DoubleClick += new EventHandler(GridViewLeft_DoubleClick); } if (this.SysModel.ModuleDetailClickMode) { this.gridLeftButtom.GridView.RowClick += GridViewLeftBottom_DoubleClick; } else { this.gridLeftButtom.GridView.DoubleClick += new EventHandler(GridViewLeftBottom_DoubleClick); } this.ModuleGridObj = this.mg_control; this.TabIntoObj = this.tcButtom; this.TabObj = this.TabIntoObj.TabControlObj; this.gridleftTop.GridView.BestFitColumns(); this.gridLeftButtom.GridView.BestFitColumns(); 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); this.SearchLeftObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfterCallBack); } else { this.splitLeftControl.PanelVisibility = SplitPanelVisibility.Panel2; this.splitBottomControl.PanelVisibility = SplitPanelVisibility.Panel2; } //初始化底部多标签 this.InitializePages(this.mg_control); if (Model.HasOperPrivilege() && Model.IsBaseModule) { // 有权限则允许拖拽 GridDragGrid dragGrid = new GridDragGrid(this.ModuleGridObj.GridControlObj.GridView, this.gridLeftButtom.GridView); dragGrid.isDropColorVisble = true; //dragGrid.sequentialReturn = true; dragGrid.TargetTableMultiSelect = false; dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); // 有权限则上下结构允许拖拽 foreach (XtraTabPage tabPage in this.TabObj.TabPages) { if (tabPage.Tag is GridControlEx) { GridDragGrid dragGridToptoBottom = new GridDragGrid(this.ModuleGridObj.GridControlObj.GridView, (tabPage.Tag as GridControlEx).GridView); dragGridToptoBottom.isDropColorVisble = true; //dragGridToptoBottom.sequentialReturn = true; dragGridToptoBottom.TargetTableMultiSelect = false; dragGridToptoBottom.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); } } XtraTabPage page = Tab_additional.TabPages[0]; page.Tag = this.mg_control; XtraTabPage page2 = Tab_Bottom.TabPages[0]; page.Tag = this.mg_control; page2.Tag = this.tcButtom; this.GetBaseAttachPage();//获取附加模块 this.SetTabPageStyle(); //this.TabIntoObj.OnAllGridCallback += new EventHandler(RefreshAllGrid); InitSpliterPosition(); //如果是默认页签,则隐藏左侧 //if (this.SearchLeftObj != null) //{ // this.splitLeftControl.PanelVisibility = SplitPanelVisibility.Panel2; // this.splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1; //} } } catch (Exception ex) { LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule); //MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { this._isInitFinish = true; } 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 初始化分割条位置 /// /// 说明:初始化分割条位置 /// 创建人:王一帆 /// 创建日期:2020-06-19 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void InitSpliterPosition() { string spliterPosition = IniHelper.Read(string.Format("Production_SplitterPositionMain_{0}", this.Model.ModuleCode)); if (!string.IsNullOrEmpty(spliterPosition)) this.splitContainerControl1.SplitterPosition = Convert.ToInt32(spliterPosition); string splitterTopPosition = IniHelper.Read(string.Format("Production_spliterPositionTop_{0}", this.Model.ModuleCode)); if (!string.IsNullOrEmpty(splitterTopPosition)) this.splitLeftControl.SplitterPosition = Convert.ToInt32(splitterTopPosition); string splitterBottonPosition = IniHelper.Read(string.Format("Production_spliterPositionBotton_{0}", this.Model.ModuleCode)); if (!string.IsNullOrEmpty(splitterBottonPosition)) this.splitBottomControl.SplitterPosition = Convert.ToInt32(splitterBottonPosition); } #endregion #region 分割条位置改变 /// /// 说明:分割条位置改变事件 /// 创建人:王一帆 /// 创建日期:2020-06-19 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void splitContainer_SplitterPositionChanged(object sender, EventArgs e) { try { if (_isInitFinish) { IniHelper.Write(string.Format("Production_SplitterPositionMain_{0}", this.Model.ModuleCode), this.splitContainerControl1.SplitterPosition + ""); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } private void splitContainerTop_SplitterPositionChanged(object sender, EventArgs e) { try { if (this._isInitFinish) { IniHelper.Write(string.Format("Production_spliterPositionTop_{0}", this.Model.ModuleCode), this.splitLeftControl.SplitterPosition + ""); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } private void splitContainerBotton_SplitterPositionChanged(object sender, EventArgs e) { try { if (this._isInitFinish) { IniHelper.Write(string.Format("Production_spliterPositionBotton_{0}", this.Model.ModuleCode), this.splitBottomControl.SplitterPosition + ""); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion /// /// 说明:数据绑定完成后加载数据 /// 创建人:龚宇超 /// 创建日期: /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e) { try { SearchLeftObj_OnSearchBefore(null, null); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:设置左侧表格数据 /// 创建人:龚宇超 /// 创建日期:2017-10-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// protected void SetLeftGridView() { this.LeftRowObj = BaseModuleImpl.GetBaseLeftTreeField(this.Model.ModuleCode); if (this.LeftRowObj != null) { this.ModuleGridObj.ParentKeyField = this.LeftRowObj["fieldsqlid"] + ""; this.ModuleGridObj.ParentUnionField = this.LeftRowObj["fieldname"] + ""; this.ModuleGridObj.LeftGridEx = this.gridleftTop; this.ModuleGridObj.ParentGridEx = this.gridleftTop; // 方便右侧添加数据自动带出相同字段 } } #region 设置动态TabPage的样式 /// /// 刷新所有表格 /// /// /// protected void RefreshAllGrid(object sender, EventArgs e) { try { int gridleftTopRowHandle = this.gridleftTop.GridView.FocusedRowHandle; this.gridleftTop.SetGridViewDataSource(MainImpl.GetDataTableResult(gridleftTop.LastSearchSql)); this.gridleftTop.GridView.SelectRowHandler(gridleftTopRowHandle); OnGridViewLeftFocusedRowChanged(this.gridleftTop.GridView, null);//手动行改变事件 int rowHandle = this.gridLeftButtom.GridView.FocusedRowHandle; this.gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); this.gridLeftButtom.GridView.SelectRowHandler(rowHandle); //this.GridView_RowCellClick(this.gridLeftButtom.GridView, null); this.ModuleGridObj.SearchObj.SearchLastGrid(); if (istop) { this.GridView_FocusedRowChanged(this.ModuleGridObj.GridControlObj.GridView, null);//刷新上方明细 } else { this.GridView_FocusedRowChanged(this.gridLeftButtom.GridView, null);//刷新右侧明细 } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:设置动态的TabPage的样式隐藏页签标题 /// 创建人:龚宇超 /// 创建日期:2018-02-27 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SetTabPageStyle() { if (this.SysModel.isHideHomeTAB) { Tab_additional.ShowTabHeader = Tab_additional.TabPages.Count == 2 ? DefaultBoolean.False : DefaultBoolean.Default; } else { Tab_additional.ShowTabHeader = Tab_additional.TabPages.Count == 1 ? DefaultBoolean.False : DefaultBoolean.Default; } Tab_Bottom.ShowTabHeader = DefaultBoolean.False; } #endregion private void InitializeLeft() { DataTable moduleDetailBottomTable = BaseModuleImpl.GetBaseDetailPages(this.Model.ModuleCode); foreach (DataRow item in moduleDetailBottomTable.Rows) { if (int.Parse(item["orderId"] + "") < -9) { DataTable gridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + ""); this.MoudleLeftObj = new ModuleModel(MainImpl.GetSystemdllTab(item["UnionModule"] + "")); this._gridColumns = BaseModuleImpl.GetBaseGridColumns(item["UnionModule"] + ""); this.gridLeftButtom.SetReadOnlyColumns(this._gridColumns, GridCustomColumnStruct.BaseMainGridView + this.MoudleLeftObj.FormKey); gridLeftButtom.Tag = new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView); this.LeftBoottomModel = item["UnionModule"] + ""; this.gridLeftButtom.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(item["UnionModule"] + "")); this.gridLeftButtom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(item["UnionModule"] + ""), this.Model, OnGridLeftRightCallBack, null, null);//右键 } else if (int.Parse(item["orderId"] + "") <= -1 && int.Parse(item["orderId"] + "") >= -9) { if (Leftfirst) continue; DataTable gridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + ""); gridleftTop.Tag = new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView); this.MoudleLeftObj = new ModuleModel(MainImpl.GetSystemdllTab(item["UnionModule"] + "")); this._gridColumns = BaseModuleImpl.GetBaseGridColumns(item["UnionModule"] + ""); this.gridleftTop.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(item["UnionModule"] + "")); this.gridleftTop.SetReadOnlyColumns(this._gridColumns, GridCustomColumnStruct.BaseMainGridView + this.MoudleLeftObj.FormKey); this.SearchLeftObj = new MyControl(this.MoudleLeftObj.MenuSql, this.gridleftTop); DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(this.MoudleLeftObj.CondKey); this.SearchLeftObj.ModuleId = 0; this.SearchLeftObj.RememberRow = true; if (queryTable != null && queryTable.Rows.Count > 0) { _primaryLeftKey = BaseImpl.GetBasePrimaryKey(item["UnionModule"] + ""); // 加载自定义查询条件 this.panelControl1.Controls.Clear(); // this.SearchObj.OtherParams = SysModel.OtherParams(); this.SearchLeftObj.InitSearchControl(queryTable, this.panelControl1, null); this.SearchLeftObj.OnSearchBeforeCallBack += new SearchEventHandler(SearchLeftObj_OnSearchBefore); if (this.SearchLeftObj.ControlModels != null && this.SearchLeftObj.ControlModels.Count > 0) { BaseUserControl mControl = this.SearchLeftObj.FindControl(this.SearchLeftObj.ControlModels[0].FieldName); foreach (ControlModel controlitem in this.SearchLeftObj.ControlModels) { BaseUserControl uControl = this.SearchLeftObj.FindControl(controlitem.FieldName); if (uControl != null) { //this.SysModel.SearchControlEnable uControl.Enabled = true; } } //this.SysModel.SearchControlEnable this.SearchLeftObj.ButtonObj.Enabled = true; } } this.gridleftTop.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(item["UnionModule"] + ""), this.Model, OnGridLeftRightCallBack, this.SearchLeftObj, null);//右键 Leftfirst = true; } } } /// /// 说明:初始化底部多标签数据 /// 创建人:龚宇超 /// 创建日期:2017-11-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// protected void InitializePages(ModuleGridEx gridEx) { this.InitilizeGridViewEvent(); this.tcButtom.Model = gridEx.Model; DataRow modelRow = MainImpl.GetSystemdllTab(gridEx.Model.ModuleCode); ModuleModel SysModel1 = new ModuleModel(modelRow); //if (this.SysModel.RefreshDetails) //{ // tcButtom.OnDetailRightCallback += RefreshAllGrid; //} tcButtom.OnDetailRightCallback += RefreshAllGrid;//刷新所有表格 this.tcButtom.DrgaParentPrimaryKey = SysModel1.ParmaryKey; this.tcButtom.IsDragDetail = this.IsDragDetail; this.tcButtom.ParentGridEx = gridEx.GridControlObj; this.tcButtom.InitTabPages(this.GridDetailModelObjs.Where(o => o.Orderid >= 0).ToList()); this.tcButtom.OnRightCallback += new EventHandler(OnGridViewRightCallBack); } /// /// 说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新 /// 创建人:龚宇超 /// 创建日期:2017-11-02 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The instance containing the event data. protected void OnGridViewRightCallBack(object sender, EventArgs e) { try { DataRow item = this.ModuleGridObj.GridControlObj.GridView.GetFocusedDataRow(); this.SetDetailGridDataSource(this.TabObj.SelectedTabPage, item); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 左上方右键刷新 /// /// /// protected void OnGridLeftRightCallBack(object sender, EventArgs e) { try { this.RefreshAllGrid(null,null); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } /// /// 说明:绑定事件 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// protected void InitilizeGridViewEvent() { if (this.IsDragDetail) { // 拖拽模式 } else { // 非拖拽模式 if (Model.IsBaseModule) { if (this.SysModel.ModuleDetailClickMode) { this.ModuleGridObj.GridControlObj.GridView.RowClick += GridView_DoubleClick; } else { this.ModuleGridObj.GridControlObj.GridView.DoubleClick += new EventHandler(GridView_DoubleClick); } } else { this.ModuleGridObj.GridControlObj.GridView.DoubleClick += new EventHandler(OnGridViewDoubleClick); } } } /// /// 说明:双击加载明细 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewDoubleClick(object sender, EventArgs e) { try { WaitForm.ShowForm(); GridView grid = sender as GridView; DataRow rowItem = grid.GetFocusedDataRow(); this.SetDetailGridDataSource(null, rowItem); } catch (Exception ex) { LogHelper.Instance.WriteError(ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 说明:加载明细数据 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewFocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { WaitForm.ShowForm(); GridView grid = sender as GridView; DataRow rowItem = grid.GetFocusedDataRow(); this.SetDetailGridDataSource(null, rowItem); } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 说明:加载明细数据 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewLeftFocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { WaitForm.ShowForm(); GridDetailModel model = gridLeftButtom.Tag as GridDetailModel; model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); DataRow rowItem = this.gridleftTop.GridView.GetFocusedDataRow(); if (rowItem != null && model != null) { string searchSql = this.GetSearchSql(model, rowItem); this.gridLeftButtom.LastSearchSql = searchSql; gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); if (!string.IsNullOrEmpty(model.SystemModel.SelectHandleCond)) { string selectHandleCond = model.SystemModel.SelectHandleCond; selectHandleCond = SearchLeftObj.ReplaceControlValue(selectHandleCond); List parmars = Util.ReplaceHelper.GetParamFields(selectHandleCond); foreach (string parmar in parmars) { string field = parmar.Replace("{", "").Replace("}", ""); string value = BaseImpl.GetDefaultValue(field); selectHandleCond = selectHandleCond.Replace(parmar, value); } DataRow selectRow = null; DataTable filterTable = gridLeftButtom.GridView.GetGridViewFilteredAndSortedDataToDataTable(); try { selectRow = filterTable.Select(selectHandleCond).FirstOrDefault(); } catch (Exception) { } if (selectRow != null) { int selectHandle = filterTable.Rows.IndexOf(selectRow); gridLeftButtom.GridView.FocusedRowHandle = selectHandle; if (istop) { this.GridView_FocusedRowChanged(this.ModuleGridObj.GridControlObj.GridView, null);//刷新上方明细 } else { this.GridView_FocusedRowChanged(this.gridLeftButtom.GridView, null);//刷新右侧明细 } } } } } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 更新选中行 /// /// /// private void OnSearchAfterCallBack(object sender, EventArgs e) { OnGridViewLeftFocusedRowChanged(null, null); } /// /// 说明:左下方点击 /// 创建人:龚宇超 /// 创建日期:2018-09-28 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void GridViewLeftBottom_DoubleClick(object sender, EventArgs e) { try { WaitForm.ShowForm(); GridView grid = sender as GridView; DataRow rowItem = grid.GetFocusedDataRow(); this.SetDetailGridDataSource(null, rowItem); istop = false; } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 左下方焦点行改变 /// /// /// private void GridView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { try { WaitForm.ShowForm(); GridView grid = sender as GridView; DataRow rowItem = grid.GetFocusedDataRow(); this.SetDetailGridDataSource(null, rowItem); } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 说明:加载明细数据 /// 创建人:龚宇超 /// 创建日期:2018-09-28 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void GridView_DoubleClick(object sender, EventArgs e) { try { WaitForm.ShowForm(); GridView grid = sender as GridView; DataRow rowItem = grid.GetFocusedDataRow(); this.SetDetailGridDataSource(null, rowItem); istop = true; } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 说明:加载左下表数据 /// 创建人:王一帆 /// 创建日期:2018-09-28 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void GridViewLeft_DoubleClick(object sender, EventArgs e) { try { WaitForm.ShowForm(); GridDetailModel model = gridLeftButtom.Tag as GridDetailModel; model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); DataRow rowItem = this.gridleftTop.GridView.GetFocusedDataRow(); if (rowItem != null && model != null) { string searchSql = this.GetSearchSql(model, rowItem); this.gridLeftButtom.LastSearchSql = searchSql; gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); if (!string.IsNullOrEmpty(model.SystemModel.SelectHandleCond)) { string selectHandleCond = model.SystemModel.SelectHandleCond; selectHandleCond = SearchLeftObj.ReplaceControlValue(selectHandleCond); List parmars = Util.ReplaceHelper.GetParamFields(selectHandleCond); foreach (string parmar in parmars) { string field = parmar.Replace("{", "").Replace("}", ""); string value = BaseImpl.GetDefaultValue(field); selectHandleCond = selectHandleCond.Replace(parmar, value); } DataRow selectRow = null; DataTable filterTable = gridLeftButtom.GridView.GetGridViewFilteredAndSortedDataToDataTable(); try { selectRow = filterTable.Select(selectHandleCond).FirstOrDefault(); } catch (Exception) { } if (selectRow != null) { int selectHandle = filterTable.Rows.IndexOf(selectRow); gridLeftButtom.GridView.FocusedRowHandle = selectHandle; this.GridView_FocusedRowChanged(this.gridLeftButtom.GridView, null);//刷新右侧明细 } } } } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("加载明细数据失败!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } finally { WaitForm.HideForm(); } } /// /// 说明:获取底部多标签数据 /// 创建人:龚宇超 /// 创建日期:2017-12-19 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// public void SetDetailGridDataSource(XtraTabPage tabPage = null, DataRow rowItem = null) { if (tabPage != null) { this.SetTabPageDataSource(tabPage, rowItem); this.TabIntoObj.SetGridDetailsDataSource(); } else { foreach (XtraTabPage page in this.TabObj.TabPages) { if (rowItem != null && page != null) { this.SetTabPageDataSource(page, rowItem); } else { SetTabPageDataSource(page, rowItem, true); } } this.TabIntoObj.SetGridDetailsDataSource(); } } /// /// 说明:设置表格数据 /// 创建人:龚宇超 /// 创建日期:2018-01-29 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The tab page. /// The grid control. protected void SetTabPageDataSource(XtraTabPage tabPage, DataRow rowItem = null, bool isNull = false) { if (isNull) { this.TabIntoObj.SetGridDataSource(tabPage, new DataTable()); return; } GridDetailModel model = this.TabIntoObj.GetGridDetailModel(tabPage); if (rowItem != null && model != null) { string searchSql = this.GetSearchSql(model, rowItem); if (tabPage.Tag is GridControlEx) { (tabPage.Tag as GridControlEx).LastSearchSql = searchSql; } this.TabIntoObj.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(searchSql)); } } /// /// 说明:设置表格数据 /// 创建人:龚宇超 /// 创建日期:2018-01-29 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The tab page. /// The grid control. protected void SetRightDataSource(XtraTabPage tabPage) { GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage); this.tcButtom.SetGridDataSource(tabPage, MainImpl.GetDataTableResult((tabPage.Tag as GridControlEx).LastSearchSql)); } /// /// 说明:获取查询条件 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The model. /// The row item. /// System.String. protected string GetSearchSql(GridDetailModel model, DataRow rowItem) { string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ModuleGridObj.ParmaryKey; string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) { string WhereConnect = rowItem.Table.Columns.Contains(fieldName) ? string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + "") : "and 1<>1"; sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + WhereConnect; } return sqlValue; } /// /// 说明: /// 创建人:龚宇超 /// 创建日期:2017-11-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// List<GridDetailModel>. private List GetDetails(string ModuleCode) { List details = new List(); DataTable table = BaseModuleImpl.GetBaseDetailPages(ModuleCode); foreach (DataRow item in table.Rows) { DataTable gridColumns = ReportImpl.GetReportDetailColumns(ModuleCode, item["id"] + ""); details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView)); } return details; } /// /// 获取附加模块 /// private void GetBaseAttachPage() { DataTable table = BaseModuleImpl.GetBaseAttach(this.Model.ModuleCode);//查看是否有附加模块 if (table.Rows.Count > 0) { this.xtraTabPage1.Text = this.SysModel.MenuText; if (this.SysModel.isHideHomeTAB) this.xtraTabPage1.PageVisible = false; foreach (DataRow item in table.Rows) { string DragType = "0";//0默认(上下),1上左,2上下和上左 string DragConditions = string.Empty; if (table.Columns.Contains("DragType")&&!string.IsNullOrWhiteSpace(item["DragType"] + "")) { dragModel = DragType = item["DragType"] + ""; } if (table.Columns.Contains("DragConditions") && !string.IsNullOrWhiteSpace(item["DragConditions"] + "")) { DragConditions = item["DragConditions"] + ""; } DataRow modelRow = MainImpl.GetSystemdllTab(item["unionModule"] + ""); ModuleModel addModel = new ModuleModel(modelRow); if (addModel == null) continue; 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" }); modegridEx.InitializeControl(addModel, dyncModel); modegridEx.SearchObj.OnDataSourceBindCallBack += OnDataSourceBindCallBack; //modegridEx.SearchObj.SearchGrid(); //加载复选框 if (table.Columns.Contains("gridObjCheck") && "1".Equals(item["gridObjCheck"] + "")) { GridDragGrid.GridAddCheckBox(modegridEx.GridControlObj.GridView); } if (dyncModel.HasOperPrivilege() && dyncModel.IsBaseModule) { // 有权限则允许拖拽 if (DragType.Equals("1") || DragType.Equals("2")) { GridDragGrid dragGrid = new GridDragGrid(modegridEx.GridControlObj.GridView, this.gridLeftButtom.GridView); dragGrid.isDropColorVisble = true; dragGrid.TargetTableMultiSelect = false; //dragGrid.sequentialReturn = true; dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); dragGrid.DragConditions = DragConditions; } // 有权限则上下结构允许拖拽 foreach (XtraTabPage tabPage in this.TabObj.TabPages) { if (tabPage.Tag is GridControlEx) { if (DragType.Equals("0") || DragType.Equals("2")) { GridDragGrid dragGridToptoBottom = new GridDragGrid(modegridEx.GridControlObj.GridView, (tabPage.Tag as GridControlEx).GridView); dragGridToptoBottom.isDropColorVisble = true; dragGridToptoBottom.TargetTableMultiSelect = false; //dragGridToptoBottom.sequentialReturn = true; dragGridToptoBottom.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); dragGridToptoBottom.DragConditions = DragConditions; } } } } page.Controls.Add(modegridEx); page.Tag = modegridEx; this.Tab_additional.TabPages.Add(page); if (this.IsDragDetail) { // 拖拽模式 } else { // 非拖拽模式 if (dyncModel.IsBaseModule) { if (this.SysModel.ModuleDetailClickMode) { modegridEx.GridControlObj.GridView.RowClick += GridView_DoubleClick; } else { modegridEx.GridControlObj.GridView.DoubleClick += new EventHandler(GridView_DoubleClick); } } else { modegridEx.GridControlObj.GridView.DoubleClick += new EventHandler(OnGridViewDoubleClick); } } //XtraTabPage page2 = new XtraTabPage(); //TabIntoControl tabintoControl = new TabIntoControl(); //tabintoControl.Model = modegridEx.Model; //tabintoControl.DrgaParentPrimaryKey = SysModel.ParmaryKey; //tabintoControl.IsDragDetail = this.IsDragDetail; //tabintoControl.ParentGridEx = modegridEx.GridControlObj; //this.GridDetailModelObjs = GetDetails(modegridEx.Model.ModuleCode); //tabintoControl.InitTabPages(this.GridDetailModelObjs.Where(o => o.Orderid >= 0).ToList()); //tabintoControl.OnRightCallback += new EventHandler(OnGridViewRightCallBack); //tabintoControl.OnAllGridCallback += new EventHandler(RefreshAllGrid); //tabintoControl.Dock = DockStyle.Fill; //page2.Controls.Add(tabintoControl); //page2.Tag = tabintoControl; //this.Tab_Bottom.TabPages.Add(page2); } } } /// /// 数据源绑定完成后触发 /// /// /// private void OnDataSourceBindCallBack(object sender, EventArgs e) { MyControl searchControl = (MyControl)sender; searchControl.SearchGrid(); } #region 表格拖拽完成 /// /// 说明:表格拖拽完成 /// 创建人:龚宇超 /// 创建日期:2017-11-14 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The e. protected void OnDragGridCompleted(object sender, GridDragGridArgs e) { //e.TargetGridViewObj.OptionsSelection.MultiSelect = true; string sql = string.Empty; string msgs = string.Empty; int refreshTypes; DataRow GridLeftItem = this.gridLeftButtom.GridView.GetFocusedDataRow(); if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0 || GridLeftItem == null) return; XtraTabPage tabPage = this.Tab_additional.SelectedTabPage; foreach (System.Windows.Forms.Control control in tabPage.Controls) { if (control.GetType().Name == "ModuleGridEx") { ModuleGridEx moduleGridEx = control as ModuleGridEx; try { int[] records = new int[e.GridViewSelectRows.Length]; string ParmaryKey = moduleGridEx.ParmaryKey; List apiHelpers = new List();//拖拽前缓存接口调用数据 if (SystemInfo.Instance.ProductionSchedulingVerification) { //拖动行全部主键 string ParmaryValues = string.Empty; DataRow firstLine = null; for (int i = 0; i < e.GridViewSelectRows.Length; i++) { if (i == 0) firstLine = e.GridViewSelectRows[i]; ParmaryValues += e.GridViewSelectRows[i][ParmaryKey] + ","; } int result = ProduceImpl.DragRefresh(moduleGridEx.Model.ModuleCode, ParmaryKey, firstLine[ParmaryKey] + "", LeftBoottomModel, _primaryLeftKey, GridLeftItem[_primaryLeftKey] + "", out refreshTypes, out msgs, ParmaryValues, "0"); switch (result) { case 1: // 继续执行保存 break; case 9: // 根据选择判断是否继续执行保存 if (MessageUtil.Show(msgs, MessageBoxButtons.YesNo) == DialogResult.No) { return; } break; default: // 保存失败 MessageUtil.Show("数据错误" + "\r\n" + msgs); return; } } for (int i = 0; i < e.GridViewSelectRows.Length; i++) { DataRow item = e.GridViewSelectRows[i]; try { records[i] = ProduceImpl.DragRefresh(moduleGridEx.Model.ModuleCode, ParmaryKey, item[ParmaryKey] + "", LeftBoottomModel, _primaryLeftKey, GridLeftItem[_primaryLeftKey] + "", out refreshTypes, out msgs,"","1"); if (records[i] == 1 && ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterGridDragComplete, moduleGridEx.Model.ModuleCode, 0)) { ApiHelper apiHelper = new ApiHelper(moduleGridEx.Model.ModuleCode, item[ParmaryKey] + "", ParmaryKey, this.SysModel.MenuTable, 0); Interface.Api.ActionType actionType = Interface.Api.ActionType.None; apiHelper.OnEvent(Interface.Api.OperateEvent.AfterGridDragComplete, actionType, false); apiHelpers.Add(apiHelper); } } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show("表格拖拽出错!" + ex); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #region 拖拽后调用api接口 string apiMsg = ""; foreach (ApiHelper apiHelper in apiHelpers) { apiHelper.OnEvent(); apiMsg = apiMsg + apiHelper.apiResutMsg; } if (!string.IsNullOrEmpty(apiMsg)) MessageUtil.Show(apiMsg); #endregion int successCount = records.Contains(1) ? records.Where(x => x == 1).Count() : 0; int faultCount = records.Contains(0) ? records.Where(x => x == 0).Count() : 0; string tipMsg = string.Empty; string filepath = string.Empty; string paramstr = string.Empty; if (successCount > 0) tipMsg = string.Format(ResourceKeys.DragSuccessCount, successCount); if (faultCount > 0) tipMsg += successCount > 0 ? "\r\n" : "" + string.Format(ResourceKeys.DragFaultCount, faultCount); //tipMsg = string.IsNullOrWhiteSpace(tipMsg) ? msgs : tipMsg; //MessageUtil.Show(tipMsg); if (!string.IsNullOrEmpty(msgs)) { // 返回Msg值:tipmsg=我是提示信息;filepath=ccc.lsp;params=daskd string[] msgItem = msgs.Split(';'); if (msgItem != null && msgItem.Length > 2) { msgs = msgItem[0].Replace("tipmsg=", ""); filepath = msgItem[1].Replace("filepath=", ""); paramstr = msgItem[2].Replace("params=", ""); } if (!string.IsNullOrEmpty(msgs)) MessageUtil.Show(msgs); if (filepath.Contains(".dll")) { GetMsgParamters(paramstr); } if (filepath.Contains(".lsp")) { DelphiHelper.LoadDelphiDll(PubUtil.AbsolutelyLibPath + filepath, "", "", paramstr, "", 0, ""); } } //DataRow GridNewLeftItem = this.gridLeftButtom.GridView.GetFocusedDataRow(); //this.SetDetailGridDataSource(null, GridNewLeftItem);//禁用多次刷新 int rowHandle = this.gridLeftButtom.GridView.FocusedRowHandle; gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); this.gridLeftButtom.GridView.SelectRowHandler(rowHandle); //this.GridView_RowCellClick(this.gridLeftButtom.GridView, null); if (!this.SysModel.DisableDragRefresh) { moduleGridEx.SearchObj.SearchLastGrid();//刷新上方表 } if (istop) { this.GridView_FocusedRowChanged(moduleGridEx.GridControlObj.GridView, null);//刷新上方明细 } else { this.GridView_FocusedRowChanged(this.gridLeftButtom.GridView, null);//刷新右侧明细 } //this.gridLeftButtom.GridView.SelectRowHandler(num); //moduleGridEx.GridControlObj.GridView.SelectRowHandler(moduleGridEx.GridControlObj.GridView.FocusedRowHandle); } catch (Exception ex) { LogHelper.Instance.WriteError(ex); //MessageUtil.Show(ResourceKeys.OperFault); string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } } } #endregion /// /// 说明:调用弹出dll /// 创建人:王一帆 /// 创建日期:2020-04-14 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void GetMsgParamters(string msgs) { if (msgs.Contains("module=")) { string[] paramters = msgs.Split('='); if (paramters.Length != 2) { MessageUtil.Show(ResourceKeys.ProcNameSettingFault); return; } string[] defaultParams = paramters[1].Split('^'); if (defaultParams.Length < 4) { MessageUtil.Show(ResourceKeys.ExcuteMoudleFail); return; } string dllName = defaultParams[1]; string moduleTitle = defaultParams[2]; string saveState = defaultParams[3]; if ("lskj.pubadd3.dll".Equals(dllName) || "lskj.pubadd2.dll".Equals(dllName) || "lskj.pubadd4.dll".Equals(dllName)) dllName = "Lskj.PubAdd.dll"; List paramList = new List(); for (int i = 4; i < 14; i++) { paramList.Add(defaultParams.Length > i ? defaultParams[i] : ""); } //执行dll string[] str = { moduleTitle, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", ERPInfo.Instance.WorkModid, paramList[0], paramList[1], paramList[2], paramList[3], paramList[4], paramList[5], paramList[6], paramList[7], paramList[8], paramList[9], "", "", saveState }; IForm form = FormHelper.LoadDllForm(dllName, str); if (form == null) { MessageUtil.Show(ResourceKeys.DyncmicDllNotFount); return; } if (form.SubForm == null) { MessageUtil.Show(ResourceKeys.DyncmicDllInitFault); return; } form.SubForm.WindowState = FormWindowState.Normal; form.SubForm.StartPosition = FormStartPosition.CenterScreen; form.SubForm.Text = moduleTitle; DialogResult dr = form.SubForm.ShowDialog(); } } #region 切换页签 /// /// 切换附加模块页签 /// /// /// private void Tab_additional_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { try { //XtraTabPage item = Tab_Bottom.TabPages[Tab_additional.SelectedTabPageIndex]; XtraTabPage tabPage = this.Tab_additional.SelectedTabPage; //Tab_Bottom.SelectedTabPage= item; if (tabPage != null) { this.ModuleGridObj = tabPage.Tag as ModuleGridEx; } //this.TabIntoObj=item.Tag as TabIntoControl; //this.TabObj = TabIntoObj.TabControlObj;} //如果是默认页签,则隐藏左侧 //if (this.SearchLeftObj != null && Tab_additional.SelectedTabPage == xtraTabPage1)//进行tabpage位置判断 //{ // // this.splitLeftControl.Panel1.Visible = false; // //splitLeftControl.SplitterPosition = 0; // this.splitLeftControl.PanelVisibility = SplitPanelVisibility.Panel2; // this.splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1; //} //else //{ // //string splitterTopPosition = IniHelper.Read(string.Format("Production_spliterPositionTop_{0}", this.Model.ModuleCode)); // //if (!string.IsNullOrEmpty(splitterTopPosition)) this.splitLeftControl.SplitterPosition = Convert.ToInt32(splitterTopPosition); // this.splitLeftControl.PanelVisibility = SplitPanelVisibility.Both; // this.splitContainerControl1.PanelVisibility = SplitPanelVisibility.Both; //} } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message, ex.Message); } } #endregion #region 自定义搜索事件 /// /// 说明:初始化自定义搜索 /// 创建人:王一帆 /// 创建日期:2018-02-27 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void SearchLeftObj_OnSearchBefore(object sender, SearchArgs e) { try { DataRow dataRow = MainImpl.GetDataRowResult(this.SearchLeftObj.SetSearchSqlValue(this.MoudleLeftObj.MenuSql)); GridDetailModel model = this.gridleftTop.Tag as GridDetailModel; 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 } }