基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubModuleDynamic
|
||||
{
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.splitMain.SplitterPositionChanged += OnSplitterPositionChanged;
|
||||
this.Load += OnFrmMainLoad;
|
||||
}
|
||||
#region 变量
|
||||
/// <summary>
|
||||
/// 系统模块
|
||||
/// </summary>
|
||||
public DynamicModuleDetailModel SysModel;
|
||||
/// <summary>
|
||||
/// 主程序的基础模型
|
||||
/// </summary>
|
||||
public ModuleModel MoudleMainObj;
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string ParmaryKey;
|
||||
/// <summary>
|
||||
/// 所有菜单
|
||||
/// </summary>
|
||||
public DataTable AllMenus;
|
||||
/// <summary>
|
||||
/// 查询条件
|
||||
/// </summary>
|
||||
private DataTable _queryTable = new DataTable();
|
||||
/// <summary>
|
||||
/// 自定义查询条件
|
||||
/// </summary>
|
||||
public MyControl SearchObj { get; private set; }
|
||||
#endregion
|
||||
#region 事件
|
||||
/// <summary>
|
||||
/// 初始化界面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnFrmMainLoad(object sender, EventArgs e)
|
||||
{
|
||||
this.AllMenus = MainImpl.GetMenusByMenuType(out string menuSql);
|
||||
this.InitializeLeftTable();
|
||||
this.InitSpliterPosition();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:初始化分割条位置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-15</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitSpliterPosition()
|
||||
{
|
||||
string spliterPosition = IniHelper.Read(string.Format("PubModuleDynamic_splitMain{0}", this.SysModel.ModuleCode));
|
||||
if (!string.IsNullOrEmpty(spliterPosition)) this.splitMain.SplitterPosition = Convert.ToInt32(spliterPosition);
|
||||
}
|
||||
/// <summary>
|
||||
/// 分割条改变时
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSplitterPositionChanged(object sender, EventArgs e)
|
||||
{
|
||||
IniHelper.Write(string.Format("PubModuleDynamic_splitMain{0}", this.SysModel.ModuleCode), this.splitMain.SplitterPosition + "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 左侧表双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnGridViewDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
modulePanel.Controls.Clear();
|
||||
DataRow rowItem = this.gridLeft.GetViewFocusedDataRow();
|
||||
if (rowItem != null)
|
||||
{
|
||||
string modid = rowItem["modid"] + "";
|
||||
// 验证参数
|
||||
if (string.IsNullOrWhiteSpace(modid))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.NotFoundMenu);
|
||||
return;
|
||||
}
|
||||
DataRow modelRow = null;
|
||||
modelRow = MainImpl.GetSystemdllTab(modid);//获取单个模块信息
|
||||
if (modelRow == null)
|
||||
{
|
||||
MessageUtil.Show("模块编号[" + modid + "],配置错误!\r\n该模块信息未找到!");
|
||||
return;
|
||||
}
|
||||
string[] args = new string[] { "", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", modid, "" };
|
||||
DynamicModuleDetailModel moduleModel = new DynamicModuleDetailModel(args);// 基础档案上下结构动态链接库参数
|
||||
ModuleEx moduleEx = new ModuleEx();
|
||||
moduleEx.ModuleGridDetailObj.ModuleGridObj.ParentControlObj = this.SearchObj;
|
||||
moduleEx.LeftCond = moduleModel.LeftCond;//用户控件的左侧条件=动态链接库对象左侧树结构
|
||||
moduleEx.Details = GetDetails(modid);//拿到底部表格数据
|
||||
moduleEx.InitControls(moduleModel);//创建界面
|
||||
moduleEx.Dock = DockStyle.Fill;
|
||||
modulePanel.Controls.Add(moduleEx);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 方法
|
||||
/// <summary>
|
||||
/// 初始化左侧表
|
||||
/// </summary>
|
||||
private void InitializeLeftTable()
|
||||
{
|
||||
//获得模块属性
|
||||
this.MoudleMainObj = new ModuleModel(MainImpl.GetSystemdllTab(this.SysModel.ModuleCode));//获取主模块构建类
|
||||
//获取主键
|
||||
this.ParmaryKey = BaseImpl.GetBasePrimaryKey(this.SysModel.ModuleCode);
|
||||
//获取查询控件
|
||||
this.SearchObj = new MyControl(this.MoudleMainObj.MenuSql, gridLeft, null, null, null);
|
||||
//获取设置左侧表列数据
|
||||
DataTable leftGridColumns = BaseModuleImpl.GetBaseGridColumns(this.SysModel.ModuleCode);
|
||||
this.gridLeft.SetReadOnlyColumns(leftGridColumns);
|
||||
//设置左侧数据源
|
||||
this.gridLeft.gridControl.DataSource = BaseImpl.GetDataTableResult(this.MoudleMainObj.MenuSql);
|
||||
//左侧表格行改变,刷新右侧表格列
|
||||
this.gridLeft.GridView.DoubleClick += OnGridViewDoubleClick;
|
||||
//加载条件
|
||||
this._queryTable = BaseModuleImpl.GetCustomQueryFields(this.MoudleMainObj.CondKey);//加载自定义配置字段
|
||||
bool fixedQuery = _queryTable == null || _queryTable.Rows.Count == 0;
|
||||
if (fixedQuery)
|
||||
{
|
||||
// 加载固定查询条件
|
||||
DataTable table = new DataTable();
|
||||
table = BaseModuleImpl.GetFixedQueryFields(this.SysModel.ModuleCode);//加载固定查询条件
|
||||
this.cbField.DisplayMember = "fieldText";
|
||||
this.cbField.ValueMember = "fieldName";
|
||||
this.cbField.DataSource = table;
|
||||
this.SearchObj.InitDefaultSearchControl(table, this.pl_top_search);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 加载配置查询条件
|
||||
this.pl_top_search.Controls.Clear();
|
||||
this.SearchObj.OtherParams = SysModel.OtherParams();
|
||||
this.pl_top_search.Height = this.SearchObj.InitSearchControl(_queryTable, this.pl_top_search, null, SysModel);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:拿到底部表格数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>List<GridDetailModel>.</returns>
|
||||
private List<GridDetailModel> GetDetails(string moduleCode)
|
||||
{
|
||||
List<GridDetailModel> details = new List<GridDetailModel>();//表格明细对象的集合
|
||||
DataTable table = new DataTable();// 根据传入的模块编号获得基础档案底部标签的数据
|
||||
bool ProcessExists = (Lskj.Data.Caches.CacheSYSConfig.Instance().JudgeProcessExists() && SystemInfo.Instance.isExecload);
|
||||
if (ProcessExists)
|
||||
{
|
||||
table = Lskj.Data.Caches.CacheSYSConfig.Instance().GetBaseDetailPages();
|
||||
}
|
||||
else
|
||||
{
|
||||
table = BaseModuleImpl.GetBaseDetailPages(moduleCode);// 根据传入的模块编号获得基础档案底部标签的数据
|
||||
}
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
DataTable gridColumns = new DataTable();
|
||||
if (ProcessExists)
|
||||
{
|
||||
gridColumns = Lskj.Data.Caches.CacheSYSConfig.Instance().GetReportDetailColumns(item["id"] + "");//获取报表明细列
|
||||
}
|
||||
else
|
||||
{
|
||||
gridColumns = ReportImpl.GetReportDetailColumns(moduleCode, item["id"] + "");//获取报表明细列
|
||||
}
|
||||
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView));
|
||||
}
|
||||
return details;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user