ab56a9bcf7
SVN-Revision: r240
1612 lines
73 KiB
C#
1612 lines
73 KiB
C#
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 DevExpress.XtraGrid.Columns;
|
||
|
||
namespace Lskj.PubModuleDetail4
|
||
{
|
||
public partial class ProductionMain : UserControl
|
||
{
|
||
/// <summary>
|
||
/// 左侧树数据
|
||
/// </summary>
|
||
public DataRow LeftRowObj;
|
||
/// <summary>
|
||
/// 表格明细集合
|
||
/// </summary>
|
||
public List<GridDetailModel> GridDetailModelObjs;
|
||
/// <summary>
|
||
/// 是否为拖拽明细模式
|
||
/// </summary>
|
||
public bool IsDragDetail;
|
||
/// <summary>
|
||
/// 基础模型
|
||
/// </summary>
|
||
public ModuleModel MoudleLeftObj;
|
||
public DynamicModuleDetailModel Model;
|
||
/// <summary>
|
||
/// 表格列
|
||
/// </summary>
|
||
private DataTable _gridColumns = new DataTable();
|
||
|
||
/// <summary>
|
||
/// 系统模块实体对象
|
||
/// </summary>
|
||
/// <value>The system model.</value>
|
||
public ModuleModel SysModel { get; private set; }
|
||
/// <summary>
|
||
///左上方查询条件控件
|
||
/// </summary>
|
||
public MyControl SearchLeftObj;
|
||
/// <summary>
|
||
/// 主键名
|
||
/// </summary>
|
||
private string _primaryLeftKey;
|
||
/// <summary>
|
||
/// 顶部表格控件
|
||
/// </summary>
|
||
public ModuleGridEx ModuleGridObj;
|
||
/// <summary>
|
||
/// 底部多标签控件
|
||
/// </summary>
|
||
public XtraTabControl TabObj;
|
||
/// <summary>
|
||
/// 底部多标签控件
|
||
/// </summary>
|
||
public TabIntoControl TabIntoObj;
|
||
/// <summary>
|
||
/// 初始化完成
|
||
/// </summary>
|
||
private bool _isInitFinish;
|
||
public List<DataRow> DataItem = new List<DataRow>();
|
||
/// <summary>
|
||
/// 主键值
|
||
/// </summary>
|
||
private string _keyValue;
|
||
private bool Leftfirst;
|
||
private string LeftBoottomModel;
|
||
|
||
/// <summary>
|
||
/// 上方刷新
|
||
/// </summary>
|
||
//private bool istop = false;
|
||
/// <summary>
|
||
/// 拖拽模式
|
||
/// </summary>
|
||
private string dragModel = "0";
|
||
|
||
|
||
public ProductionMain()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
/// <summary>
|
||
/// <para>说明:窗口加载</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2019-06-28 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The sender.</param>
|
||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||
public void OnLoad(DynamicModuleDetailModel Model)
|
||
{
|
||
WaitForm.ShowForm();
|
||
try
|
||
{
|
||
this._isInitFinish = false;
|
||
this.Model = Model;
|
||
DataRow modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode);
|
||
if (modelRow == null)
|
||
{
|
||
MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
|
||
return;
|
||
}
|
||
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.GridControlObj.GridView.RowClick += GridViewLeftBottom_DoubleClick;
|
||
//}
|
||
//else {
|
||
// this.gridLeftButtom.GridControlObj.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.GridControlObj.GridView.BestFitColumns();
|
||
|
||
this.GridDetailModelObjs = GetDetails(Model.ModuleCode);
|
||
|
||
DataRow menuCondRow = BaseImpl.GetMenuConfigTab(this.Model.ModuleId);
|
||
if (menuCondRow["DllFileName"].Equals("Lskj.PubModuleDetailSearch4.dll")) Model.IsDetailSearch = true;
|
||
this.mg_control.InitializeControl(SysModel, Model);
|
||
this.mg_control.SearchObj.SearchGrid();
|
||
|
||
this.mg_control.RightGridCallBack += Mg_control_RightGridCallBack;
|
||
|
||
//初始化左下角数据
|
||
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.GridControlObj.GridView);
|
||
dragGrid.isDropColorVisble = true;
|
||
//dragGrid.sequentialReturn = true;
|
||
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.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
||
|
||
GridDragGrid dragGridUpperLeftToLowerRight = new GridDragGrid(this.gridleftTop.GridView, (tabPage.Tag as GridControlEx).GridView);
|
||
dragGridUpperLeftToLowerRight.isDropColorVisble = true;
|
||
dragGridUpperLeftToLowerRight.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragLeftToLowerRight);
|
||
}
|
||
}
|
||
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;
|
||
//}
|
||
|
||
//添加左上表格对下方2个表的拖拽
|
||
GridDragGrid dragGridUpperLeftToLeft = new GridDragGrid(this.gridleftTop.GridView, this.gridLeftButtom.GridControlObj.GridView);
|
||
dragGridUpperLeftToLeft.isDropColorVisble = true;
|
||
dragGridUpperLeftToLeft.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragLeftToLeft);
|
||
|
||
|
||
|
||
}
|
||
}
|
||
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();
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#region 初始化分割条位置
|
||
/// <summary>
|
||
/// <para>说明:初始化分割条位置</para>
|
||
/// <para>创建人:王一帆</para>
|
||
/// <para>创建日期:2020-06-19</para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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 分割条位置改变
|
||
/// <summary>
|
||
/// <para>说明:分割条位置改变事件</para>
|
||
/// <para>创建人:王一帆</para>
|
||
/// <para>创建日期:2020-06-19 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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
|
||
/// <summary>
|
||
/// <para>说明:数据绑定完成后加载数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期: </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The source of the event.</param>
|
||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||
void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
SearchLeftObj_OnSearchBefore(null, null);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
MessageUtil.Show(Message, ex.Message);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:设置左侧表格数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-10-25 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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的样式
|
||
/// <summary>
|
||
/// 刷新所有表格
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
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.GridControlObj.GridView.FocusedRowHandle;
|
||
this.gridLeftButtom.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.GridControlObj.LastSearchSql));
|
||
this.gridLeftButtom.GridControlObj.GridView.SelectRowHandler(rowHandle);
|
||
//this.GridView_RowCellClick(this.gridLeftButtom.GridView, null);
|
||
this.ModuleGridObj.SearchObj.SearchLastGrid();
|
||
|
||
this.GridView_FocusedRowChanged(this.ModuleGridObj.GridControlObj.GridView, null);//刷新上方明细
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
MessageUtil.Show(Message, ex.Message);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// <para>说明:设置动态的TabPage的样式隐藏页签标题</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2018-02-27</para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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)
|
||
{
|
||
//DataRow modelRow = MainImpl.GetSystemdllTab(item["UnionModule"] + "");
|
||
//if (modelRow == null)
|
||
//{
|
||
// MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
|
||
// return;
|
||
//}
|
||
//ModuleModel moduleModel = new ModuleModel(modelRow);
|
||
|
||
|
||
DataTable gridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + "");
|
||
this.MoudleLeftObj = new ModuleModel(MainImpl.GetSystemdllTab(item["UnionModule"] + ""));
|
||
this._gridColumns = BaseModuleImpl.GetBaseGridColumns(item["UnionModule"] + "");
|
||
|
||
DynamicModel dyncModel = new DynamicModuleModel(new string[] { item["DetailName"] + "", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, item["UnionModule"] + "", "0" });
|
||
this.gridLeftButtom.InitializeControl(this.MoudleLeftObj, dyncModel);
|
||
GridDetailModel model = new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView);
|
||
model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule));
|
||
gridLeftButtom.Tag = model;
|
||
this.LeftBoottomModel = item["UnionModule"] + "";
|
||
gridLeftButtom.VisibleSearchPanel = Model.IsDetailSearch;//this.mg_control.
|
||
gridLeftButtom.ParentGridEx = this.mg_control.GridControlObj;//绑定父表格
|
||
string UnionParentField = (item["UnionParentField"] + "").Replace("{", "").Replace("}", "").Replace("{", "").Replace("}", "");
|
||
gridLeftButtom.ParentKeyField = string.IsNullOrEmpty(UnionParentField) ? this.MoudleLeftObj.ParmaryKey : UnionParentField;
|
||
gridLeftButtom.DetailKeyField = (item["unionValue"] + "").Replace("{", "").Replace("}", "").Replace("{", "").Replace("}", "");
|
||
|
||
|
||
}
|
||
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;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// <para>说明:初始化底部多标签数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-21 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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);
|
||
|
||
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-02 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The sender.</param>
|
||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||
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);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 左上方右键刷新
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
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);
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// <para>说明:绑定事件</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-22 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:双击加载明细</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-22 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The source of the event.</param>
|
||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||
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();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// <para>说明:加载明细数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-22 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The source of the event.</param>
|
||
/// <param name="e">The <see cref="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
|
||
//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.GridControlObj.LastSearchSql = searchSql;
|
||
// //gridLeftButtom.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.GridControlObj.LastSearchSql));
|
||
// if (!string.IsNullOrEmpty(model.SystemModel.SelectHandleCond))
|
||
// {
|
||
// string selectHandleCond = model.SystemModel.SelectHandleCond;
|
||
// selectHandleCond = SearchLeftObj.ReplaceControlValue(selectHandleCond);
|
||
// List<string> 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.GridControlObj.GridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||
// try
|
||
// {
|
||
// selectRow = filterTable.Select(selectHandleCond).FirstOrDefault();
|
||
// }
|
||
// catch (Exception)
|
||
// {
|
||
// }
|
||
// if (selectRow != null)
|
||
// {
|
||
// int selectHandle = filterTable.Rows.IndexOf(selectRow);
|
||
// gridLeftButtom.GridControlObj.GridView.FocusedRowHandle = selectHandle;
|
||
|
||
// this.GridView_FocusedRowChanged(this.ModuleGridObj.GridControlObj.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();
|
||
// }
|
||
//}
|
||
/// <summary>
|
||
/// 更新选中行
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void OnSearchAfterCallBack(object sender, EventArgs e)
|
||
{
|
||
// OnGridViewLeftFocusedRowChanged(null, null);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 焦点行改变
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
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();
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// <para>说明:加载明细数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2018-09-28 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The source of the event.</param>
|
||
/// <param name="e">The <see cref="RowCellClickEventArgs"/> instance containing the event data.</param>
|
||
protected void GridView_DoubleClick(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);
|
||
//MessageUtil.Show("加载明细数据失败!" + ex);
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
MessageUtil.Show(Message, ex.Message);
|
||
}
|
||
finally
|
||
{
|
||
WaitForm.HideForm();
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// <para>说明:获取底部多标签数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-12-19 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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();
|
||
}
|
||
|
||
//刷新左下表格数据
|
||
GridDetailModel gridDetailModel= gridLeftButtom.Tag as GridDetailModel;
|
||
|
||
string searchSql = this.GetSearchSql(gridDetailModel, rowItem);
|
||
gridLeftButtom.GridControlObj.LastSearchSql = searchSql;
|
||
gridLeftButtom.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(searchSql));
|
||
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:设置表格数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2018-01-29 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="tabPage">The tab page.</param>
|
||
/// <param name="gridControl">The grid control.</param>
|
||
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));
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:设置表格数据</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2018-01-29 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="tabPage">The tab page.</param>
|
||
/// <param name="gridControl">The grid control.</param>
|
||
protected void SetRightDataSource(XtraTabPage tabPage)
|
||
{
|
||
|
||
GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage);
|
||
|
||
this.tcButtom.SetGridDataSource(tabPage, MainImpl.GetDataTableResult((tabPage.Tag as GridControlEx).LastSearchSql));
|
||
|
||
}
|
||
/// <summary>
|
||
/// <para>说明:获取查询条件</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-22 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="model">The model.</param>
|
||
/// <param name="rowItem">The row item.</param>
|
||
/// <returns>System.String.</returns>
|
||
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;
|
||
}
|
||
/// <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 = 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;
|
||
}
|
||
/// <summary>
|
||
/// 获取附加模块
|
||
/// </summary>
|
||
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上下和上左
|
||
if (table.Columns.Contains("DragType")&&!string.IsNullOrWhiteSpace(item["DragType"] + ""))
|
||
{
|
||
dragModel = DragType = item["DragType"] + "";
|
||
}
|
||
|
||
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();
|
||
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 (dyncModel.HasOperPrivilege() && dyncModel.IsBaseModule)
|
||
{
|
||
// 有权限则允许拖拽
|
||
if (DragType.Equals("1") || DragType.Equals("2"))
|
||
{
|
||
GridDragGrid dragGrid = new GridDragGrid(modegridEx.GridControlObj.GridView, this.gridLeftButtom.GridControlObj.GridView);
|
||
dragGrid.isDropColorVisble = true;
|
||
//dragGrid.sequentialReturn = true;
|
||
dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
||
}
|
||
|
||
// 有权限则上下结构允许拖拽
|
||
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.sequentialReturn = true;
|
||
dragGridToptoBottom.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
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);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 数据源绑定完成后触发
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void OnDataSourceBindCallBack(object sender, EventArgs e)
|
||
{
|
||
MyControl searchControl = (MyControl)sender;
|
||
searchControl.SearchGrid();
|
||
}
|
||
#region 表格拖拽完成
|
||
/// <summary>
|
||
/// <para>说明:表格拖拽完成</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-11-14 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="sender">The sender.</param>
|
||
/// <param name="e">The e.</param>
|
||
protected void OnDragGridCompleted(object sender, GridDragGridArgs e)
|
||
{
|
||
string sql = string.Empty;
|
||
string msgs = string.Empty;
|
||
int refreshTypes;
|
||
DataRow GridLeftItem = this.gridLeftButtom.GridControlObj.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<ApiHelper> apiHelpers = new List<ApiHelper>();//拖拽前缓存接口调用数据
|
||
|
||
|
||
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.GridControlObj.GridView.FocusedRowHandle;
|
||
gridLeftButtom.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.GridControlObj.LastSearchSql));
|
||
this.gridLeftButtom.GridControlObj.GridView.SelectRowHandler(rowHandle);
|
||
//this.GridView_RowCellClick(this.gridLeftButtom.GridView, null);
|
||
if (!this.SysModel.DisableDragRefresh)
|
||
{
|
||
moduleGridEx.SearchObj.SearchLastGrid();//刷新上方表
|
||
}
|
||
|
||
|
||
this.GridView_FocusedRowChanged(moduleGridEx.GridControlObj.GridView, null);//刷新上方明细
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Instance.WriteError(ex);
|
||
//MessageUtil.Show(ResourceKeys.OperFault);
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
MessageUtil.Show(Message, ex.Message);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
/// <summary>
|
||
/// <para>说明:调用弹出dll</para>
|
||
/// <para>创建人:王一帆</para>
|
||
/// <para>创建日期:2020-04-14 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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<string> paramList = new List<string>();
|
||
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 切换页签
|
||
/// <summary>
|
||
/// 切换附加模块页签
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
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 自定义搜索事件
|
||
/// <summary>
|
||
/// <para>说明:初始化自定义搜索</para>
|
||
/// <para>创建人:王一帆</para>
|
||
/// <para>创建日期:2018-02-27</para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
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);//手动行改变事件
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
MessageUtil.Show(Message, ex.Message);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 左上方表格数据拖拽到左下方表格
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void OnDragLeftToLeft(object sender, GridDragGridArgs e)
|
||
{
|
||
if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
||
this.AddRowData(e.GridViewSelectRows,this.gridLeftButtom.GridControlObj);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 左上方表格数据拖拽到右下方表格
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void OnDragLeftToLowerRight(object sender, GridDragGridArgs e)
|
||
{
|
||
if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
||
this.AddRowData(e.GridViewSelectRows, this.TabObj.SelectedTabPage.Tag as GridControlEx);
|
||
}
|
||
|
||
|
||
private void AddRowData(DataRow[] dataRows, GridControlEx controlEx)
|
||
{
|
||
GridColumnCollection gridColumns = controlEx.GridView.Columns;
|
||
DataTable gridTable = (controlEx.GridControl.DataSource as DataTable).TrimDeleteRows().Copy();
|
||
|
||
|
||
DataRow MainTableRow = this.ModuleGridObj.GridControlObj.GridView.GetFocusedDataRow();
|
||
if (MainTableRow == null) return;
|
||
|
||
foreach (DataRow rowItem in dataRows)
|
||
{
|
||
DataRow newRow = gridTable.NewRow();
|
||
newRow.BeginEdit();
|
||
// 赋值明细字段
|
||
foreach (GridColumn col in gridColumns)
|
||
{
|
||
try
|
||
{
|
||
GridColumnModel model = col.Tag as GridColumnModel;
|
||
if (rowItem.Table.Columns.Contains(col.FieldName)|| MainTableRow.Table.Columns.Contains(col.FieldName))
|
||
{
|
||
// 来源列中是否包含对应字段,包含则使用值(优先使用主表的值,然后才是推拽行的值)
|
||
newRow[col.FieldName] = MainTableRow.Table.Columns.Contains(col.FieldName) ? MainTableRow[col.FieldName] : rowItem[col.FieldName];
|
||
if (!string.IsNullOrEmpty(model.UnionFields))
|
||
{
|
||
this.SetUnionValue(model, rowItem[col.FieldName] + "", newRow, controlEx);
|
||
}
|
||
SetCalcValue(model, rowItem[col.FieldName] + "", newRow, controlEx);
|
||
|
||
}
|
||
else
|
||
{
|
||
// 未包含字段,则使用控件默认值.
|
||
if (col.FieldName.Contains("_Ls"))
|
||
{
|
||
string[] unioFielName = col.FieldName.Split('_');
|
||
string UnioValue = unioFielName[unioFielName.Length - 1];
|
||
DataColumn grid = rowItem.Table.Columns.Cast<DataColumn>().FirstOrDefault(x => x.ColumnName.Split('_')[x.ColumnName.Split('_').Length - 1].Equals(UnioValue));
|
||
if (grid != null && !string.IsNullOrEmpty(model.UnionFields))
|
||
{
|
||
this.SetUnionValue(model, rowItem[col.FieldName] + "", newRow, controlEx);
|
||
}
|
||
SetCalcValue(model, rowItem[col.FieldName] + "", newRow, controlEx);
|
||
|
||
}
|
||
else
|
||
{
|
||
string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
||
//int nowPositon = !isLastRow ? position : gridTable.Rows.Count - 1;
|
||
if (!string.IsNullOrEmpty(model.DefaultValue))
|
||
{
|
||
newRow[col.FieldName] = fieldValue;
|
||
if (!string.IsNullOrEmpty(model.UnionFields))
|
||
{
|
||
this.SetUnionValue(model, fieldValue + "", newRow, controlEx);
|
||
}
|
||
SetCalcValue(model, fieldValue + "", newRow, controlEx);
|
||
|
||
//this.gcMain.GridView.SetFocusedRowCellValue(col, fieldValue);
|
||
}
|
||
}
|
||
}
|
||
//SetDisableColumn(model, newRow[col.FieldName] + "", newRow);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Instance.WriteError(ex);
|
||
//LogUtil.WriteError(col.FieldName + "添加出错!", ex);
|
||
}
|
||
}
|
||
newRow.EndEdit();
|
||
gridTable.Rows.Add(newRow);
|
||
}
|
||
|
||
controlEx.GridControl.DataSource = gridTable;
|
||
}
|
||
|
||
/// <summary>
|
||
/// <para>说明:计算列计算公式</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-12-18 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="model">The model.</param>
|
||
/// <param name="fieldValue">The field value.</param>
|
||
protected virtual void SetCalcValue(GridColumnModel model, string fieldValue, DataRow rowItem, GridControlEx controlEx)
|
||
{
|
||
try
|
||
{
|
||
//DataTable table = controlEx.gridControl.DataSourceTable();
|
||
if (rowItem != null && model != null)
|
||
{
|
||
List<GridColumnModel> calcModels = controlEx.ObjmControlList.FindAll(x => !string.IsNullOrEmpty(x.CalcExpr)).OrderBy(y => y.CalcOrder).ToList();
|
||
foreach (GridColumnModel gridModel in calcModels)
|
||
{
|
||
// 计算顺序小于当前控件则不计算
|
||
if (gridModel.CalcOrder < model.CalcOrder) continue;
|
||
|
||
if (!gridModel.FieldName.Equals(model.FieldName, StringComparison.OrdinalIgnoreCase))
|
||
{
|
||
bool isTruncate = false;
|
||
string calcExpr = gridModel.CalcExpr;
|
||
if (calcExpr.StartsWith("@truncate:"))
|
||
{
|
||
calcExpr = calcExpr.Substring(10);
|
||
isTruncate = true;
|
||
}
|
||
|
||
try
|
||
{
|
||
|
||
|
||
calcExpr = ReplaceHelper.ReplaceRowParam(rowItem, calcExpr);
|
||
//EvalHelper.Eval2(ReplaceHelper.ReplaceEvalCond(calcExpr)) + ""
|
||
string result = EvalHelper.Eval2(ReplaceHelper.ReplaceEvalCond(calcExpr)) + "";
|
||
if (isTruncate)
|
||
{
|
||
result += result.Contains(".") ? "0000000000" : ".0000000000";
|
||
rowItem[gridModel.FieldName] = result.Substring(0, result.IndexOf(".")) + result.Substring(result.IndexOf("."), model.Decimals + 1);
|
||
}
|
||
else
|
||
{
|
||
try
|
||
{
|
||
double d = 0;
|
||
if (!string.IsNullOrEmpty(result) &&
|
||
!"NaN".Equals(result, StringComparison.OrdinalIgnoreCase) &&
|
||
!"非数字".Equals(result, StringComparison.OrdinalIgnoreCase) &&
|
||
!"undefined".Equals(result, StringComparison.OrdinalIgnoreCase) &&
|
||
result != "∞" && result != "-∞" &&
|
||
!"正无穷大".Equals(result, StringComparison.OrdinalIgnoreCase) &&
|
||
!"负无穷大".Equals(result, StringComparison.OrdinalIgnoreCase) &&
|
||
double.TryParse(result, out d))
|
||
{
|
||
if (string.IsNullOrEmpty(gridModel.DataFormat))
|
||
{
|
||
result = Math.Round(Convert.ToDouble(d), model.Decimals, MidpointRounding.AwayFromZero) + "";
|
||
}
|
||
else
|
||
{
|
||
//计算后先执行保存小数位数
|
||
result = string.Format("{0:" + gridModel.DataFormat + "}", Convert.ToDecimal(result));
|
||
}
|
||
if (model.FieldType == 7 && result.Contains('%'))
|
||
{
|
||
result = (double.Parse(result.Replace("%", "")) * 0.01).ToString();
|
||
}
|
||
rowItem[gridModel.FieldName] = result;
|
||
// 判断计算列有无关联值
|
||
GridColumnModel UnionModel = calcModels.FirstOrDefault(x => x.FieldName == gridModel.FieldName);
|
||
if (!string.IsNullOrEmpty(UnionModel.UnionFields))
|
||
{
|
||
this.SetUnionValue(UnionModel, rowItem[gridModel.FieldName] + "", rowItem, controlEx);
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Instance.WriteError(ex);
|
||
LogUtil.WriteError("计算列计算公式--错误-->" + rowItem[gridModel.FieldName], ex);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Instance.WriteError(ex);
|
||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||
// MessageUtil.Show(Message,ex.Message);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// <para>说明:计算列关联字段</para>
|
||
/// <para>创建人:龚宇超</para>
|
||
/// <para>创建日期:2017-12-18 </para>
|
||
/// <para>修改人:</para>
|
||
/// <para>修改日期:</para>
|
||
/// <para>修改备注:</para>
|
||
/// <para>版本:1.0</para>
|
||
/// </summary>
|
||
/// <param name="model">The model.</param>
|
||
/// <param name="fieldValue">The field value.</param>
|
||
protected virtual void SetUnionValue(GridColumnModel model, string fieldValue, DataRow rowItem, GridControlEx controlEx)
|
||
{
|
||
//DataTable table = controlEx.gridControl.DataSourceTable();
|
||
//DataRow rowItem = this.gridView.GetFocusedDataRow();
|
||
string unionValues = model.UnionValues;
|
||
if (rowItem != null && model != null)
|
||
{
|
||
unionValues = ReplaceHelper.ReplaceRowParam(rowItem, unionValues.Replace("{" + model.FieldName + "}", fieldValue));
|
||
|
||
try
|
||
{
|
||
string[] fields = model.UnionFields.Trim(',').Split(',');
|
||
DataRow rowResult = BaseImpl.GetDataRowResult(unionValues);
|
||
if (rowResult != null)
|
||
{
|
||
for (int i = 0; i < fields.Length; i++)
|
||
{
|
||
string field = fields[i];
|
||
string value = rowResult.Table.Columns.Contains(field) ? rowResult[field] + "" : null;
|
||
rowItem[field] = value;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// 设置为空
|
||
for (int i = 0; i < fields.Length; i++)
|
||
{
|
||
string field = fields[i];
|
||
rowItem[field] = DBNull.Value;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Instance.WriteError(ex);
|
||
LogUtil.WriteError("计算列关联字段--错误-->" + unionValues, ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 主表执行右键后刷新数据
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void Mg_control_RightGridCallBack(object sender, EventArgs e)
|
||
{
|
||
this.GridView_FocusedRowChanged(this.ModuleGridObj.GridControlObj.GridView, null);//刷新上方明细
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|