SVN r1113
SVN-Revision: r1113
This commit is contained in:
@@ -300,6 +300,7 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
if (dataTable == null || dataTable.Rows.Count == 0)
|
if (dataTable == null || dataTable.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
this.pld_Bottom.Visible = false;
|
this.pld_Bottom.Visible = false;
|
||||||
|
this.splitLeftTopControl.PanelVisibility = SplitPanelVisibility.Panel1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dataTable.Rows.Count > 0)
|
if (dataTable.Rows.Count > 0)
|
||||||
@@ -344,58 +345,7 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// <para>说明:初始化表格拖拽</para>
|
|
||||||
/// <para>创建人:王一帆</para>
|
|
||||||
/// <para>创建日期:2022-12-06 </para>
|
|
||||||
/// <para>修改人:</para>
|
|
||||||
/// <para>修改日期:</para>
|
|
||||||
/// <para>修改备注:</para>
|
|
||||||
/// <para>版本:1.0</para>
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeGridDragGrid()
|
|
||||||
{
|
|
||||||
Object moduleObject = this.tcMain.TabControlObj.TabPages[0].Controls.Cast<Object>().FirstOrDefault();
|
|
||||||
ModuleGridEx moduleGridEx = null;
|
|
||||||
if (moduleObject != null && moduleObject is ModuleGridEx)
|
|
||||||
{
|
|
||||||
moduleGridEx = moduleObject as ModuleGridEx;
|
|
||||||
}
|
|
||||||
if (moduleGridEx != null)
|
|
||||||
{
|
|
||||||
GridDragGrid dragDetailGrid = new GridDragGrid(this.gd_LeftTop.GridView, moduleGridEx.GridControlObj.GridView);
|
|
||||||
dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
|
|
||||||
GridDragGrid dragDetailBottomGrid = new GridDragGrid(this.gd_LeftBottom.GridView, moduleGridEx.GridControlObj.GridView);
|
|
||||||
dragDetailBottomGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void InitializeDeleteRightMenu()
|
|
||||||
{
|
|
||||||
Object moduleObject = this.tcMain.TabControlObj.TabPages[0].Controls.Cast<Object>().FirstOrDefault();
|
|
||||||
ModuleGridEx moduleGridEx = null;
|
|
||||||
if (moduleObject != null && moduleObject is ModuleGridEx)
|
|
||||||
{
|
|
||||||
moduleGridEx = moduleObject as ModuleGridEx;
|
|
||||||
}
|
|
||||||
if (moduleGridEx != null)
|
|
||||||
{
|
|
||||||
//添加固定删除右键
|
|
||||||
ContextMenuStrip menuStrip = moduleGridEx.GridControlObj.GridControl.ContextMenuStrip;
|
|
||||||
ToolStripMenuItem menuItem = new ToolStripMenuItem();
|
|
||||||
menuItem.Text = "删除";
|
|
||||||
//menuItem.Tag = menuModel;
|
|
||||||
menuItem.Click += new EventHandler(OnDeleteMenuStripItemClick);
|
|
||||||
if (menuStrip != null)
|
|
||||||
{
|
|
||||||
menuStrip.Items.Add(menuItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moduleGridEx.GridControlObj.GridControl.ContextMenuStrip = new ContextMenuStrip();
|
|
||||||
moduleGridEx.GridControlObj.GridControl.ContextMenuStrip.Items.Add(menuItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:初始化底部多标签数据</para>
|
/// <para>说明:初始化底部多标签数据</para>
|
||||||
/// <para>创建人:王一帆</para>
|
/// <para>创建人:王一帆</para>
|
||||||
@@ -652,87 +602,6 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
}
|
}
|
||||||
return sqlValue;
|
return sqlValue;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 根据拖拽缓存刷新数据源
|
|
||||||
/// </summary>
|
|
||||||
private void RefreshDetailDataSource()
|
|
||||||
{
|
|
||||||
string mainSelectStr = "{0} not in ({1})";
|
|
||||||
string cond = "";
|
|
||||||
foreach (DataRow keyRow in this.gridDragRows.Keys)
|
|
||||||
{
|
|
||||||
cond += string.Format("'{0}',", keyRow[_primaryDetailKey] + "");
|
|
||||||
}
|
|
||||||
DataTable sourceTab = Lskj.Core.SqlHelper.ExecuteDataTable(this.MoudleDetailObj.MenuSql);
|
|
||||||
if (!string.IsNullOrEmpty(cond))
|
|
||||||
{
|
|
||||||
DataTable selectTab = sourceTab.Clone();
|
|
||||||
mainSelectStr = string.Format(mainSelectStr, _primaryDetailKey, cond.TrimEnd(','));
|
|
||||||
sourceTab.Select(mainSelectStr).CopyToDataTable(selectTab, LoadOption.PreserveChanges);
|
|
||||||
sourceTab = selectTab;
|
|
||||||
}
|
|
||||||
this.gd_LeftTop.SetGridViewDataSource(sourceTab, true);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 添加多条数据
|
|
||||||
/// </summary>
|
|
||||||
private void AddMultiRowToGridView(DataRow[] rows)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (DataRow row in rows)
|
|
||||||
{
|
|
||||||
Object moduleObject = this.tcMain.TabControlObj.TabPages[0].Controls.Cast<Object>().FirstOrDefault();
|
|
||||||
ModuleGridEx moduleGridEx = null;
|
|
||||||
if (moduleObject != null && moduleObject is ModuleGridEx)
|
|
||||||
{
|
|
||||||
moduleGridEx = moduleObject as ModuleGridEx;
|
|
||||||
}
|
|
||||||
if (moduleGridEx != null)
|
|
||||||
{
|
|
||||||
DataTable sourceTab = moduleGridEx.GridControlObj.GridControl.DataSource as DataTable;
|
|
||||||
DataRow addRow = sourceTab.NewRow();
|
|
||||||
foreach (DataColumn column in addRow.Table.Columns)
|
|
||||||
{
|
|
||||||
if (row.Table.Columns.Contains(column.ColumnName))
|
|
||||||
{
|
|
||||||
addRow[column.ColumnName] = row[column.ColumnName] + "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceTab.Rows.Add(addRow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
||||||
MessageUtil.Show(Message, ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// <para>说明:替换sql语句中的bmp字段</para>
|
|
||||||
/// <para>创建人:龚宇超</para>
|
|
||||||
/// <para>创建日期:2018-03-07 </para>
|
|
||||||
/// <para>修改人:</para>
|
|
||||||
/// <para>修改日期:</para>
|
|
||||||
/// <para>修改备注:</para>
|
|
||||||
/// <para>版本:1.0</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sqlValue">The SQL value.</param>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
private string ReplaceBmpField(string sqlValue, DataTable gridColumns)
|
|
||||||
{
|
|
||||||
if (gridColumns == null || string.IsNullOrEmpty(sqlValue)) return sqlValue;
|
|
||||||
|
|
||||||
foreach (DataRow item in gridColumns.Rows)
|
|
||||||
{
|
|
||||||
string fieldName = item["fieldname"] + "";
|
|
||||||
|
|
||||||
//sqlValue = sqlValue.Replace(" ", "-").Replace("-", "").Replace(", ", ",").Replace(" ,", ",");
|
|
||||||
sqlValue = sqlValue.Replace("," + fieldName + ",", ",").Replace("," + fieldName, " ");
|
|
||||||
}
|
|
||||||
return sqlValue;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 事件
|
#region 事件
|
||||||
@@ -987,27 +856,7 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
MessageUtil.Show(Message, ex.Message);
|
MessageUtil.Show(Message, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnSearchDetailBottomBefore(object sender, SearchArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DataRow dataRow = MainImpl.GetDataRowResult(this.SearchDetailObj.SetSearchSqlValue(this.MoudleDetailBottomObj.MenuSql));
|
|
||||||
//GridDetailModel model = this.gd_LeftBottom.Tag as GridDetailModel;
|
|
||||||
//string parentValue = this.SearchDetailBottomObj.GetControlValue(model.UnionValue);
|
|
||||||
if (dataRow != null)
|
|
||||||
{
|
|
||||||
this._primaryDetailKey = dataRow[this._primaryDetailKey] + "";
|
|
||||||
//左侧上下结构刷新
|
|
||||||
gd_LeftBottom.LastSearchSql = this.SearchDetailBottomObj.SetSearchSqlValue(this.MoudleDetailBottomObj.MenuSql);
|
|
||||||
gd_LeftBottom.SetGridViewDataSource(MainImpl.GetDataTableResult(gd_LeftBottom.LastSearchSql));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
||||||
MessageUtil.Show(Message, ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:刷新明细数据</para>
|
/// <para>说明:刷新明细数据</para>
|
||||||
/// <para>创建人:王一帆</para>
|
/// <para>创建人:王一帆</para>
|
||||||
@@ -1061,137 +910,8 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
MessageUtil.Show(Message);
|
MessageUtil.Show(Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// <para>说明:表格拖拽完成</para>
|
|
||||||
/// <para>创建人:唐德馨</para>
|
|
||||||
/// <para>创建日期:2022-12-06 </para>
|
|
||||||
/// <para>修改人:</para>
|
|
||||||
/// <para>修改日期:</para>
|
|
||||||
/// <para>修改备注:</para>
|
|
||||||
/// <para>版本:1.0</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">The sender.</param>
|
|
||||||
/// <param name="e">The e.</param>
|
|
||||||
private void OnDragMainGridCompleted(object sender, GridDragGridArgs e)
|
|
||||||
{
|
|
||||||
//刷新明细和明细的明细
|
|
||||||
DataRow[] selectRows = e.GridViewSelectRows;
|
|
||||||
if (e.SourceGridViewObj == this.gd_LeftTop.GridView)
|
|
||||||
{
|
|
||||||
foreach (DataRow selectRow in selectRows)
|
|
||||||
{
|
|
||||||
DataRow mainRow = selectRow;
|
|
||||||
if (this.gridDragRows.ContainsKey(mainRow))
|
|
||||||
{
|
|
||||||
List<DataRow> detailRows = this.gridDragRows[mainRow];
|
|
||||||
detailRows.AddRange(this.gd_LeftBottom.gridControl.DataSourceTable().Select().ToList());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<DataRow> detailRows = this.gd_LeftBottom.gridControl.DataSourceTable().Select().ToList();
|
|
||||||
this.gridDragRows.Add(mainRow, detailRows);
|
|
||||||
}
|
|
||||||
this.mainNotInRows.Add(mainRow);
|
|
||||||
}
|
|
||||||
if (this.MoudleDetailBottomObj != null)
|
|
||||||
{
|
|
||||||
AddMultiRowToGridView(this.gd_LeftBottom.gridControl.DataSourceTable().Select().ToArray());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddMultiRowToGridView(selectRows);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e.SourceGridViewObj == this.gd_LeftBottom.GridView)
|
|
||||||
{
|
|
||||||
DataRow mainRow = this.gd_LeftTop.GridView.GetFocusedDataRow();
|
|
||||||
if (this.gridDragRows.ContainsKey(mainRow))
|
|
||||||
{
|
|
||||||
List<DataRow> detailRows = this.gridDragRows[mainRow];
|
|
||||||
detailRows.AddRange(selectRows.ToList());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.gridDragRows.Add(mainRow, selectRows.ToList());
|
|
||||||
}
|
|
||||||
if (selectRows.Count() == this.gd_LeftBottom.gridControl.DataSourceTable().Rows.Count)
|
|
||||||
{
|
|
||||||
this.mainNotInRows.Add(mainRow);
|
|
||||||
}
|
|
||||||
AddMultiRowToGridView(selectRows);
|
|
||||||
}
|
|
||||||
RefreshDetailDataSource();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 删除数据时刷新明细
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void OnDeleteMenuStripItemClick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Object moduleObject = this.tcMain.TabControlObj.TabPages[0].Controls.Cast<Object>().FirstOrDefault();
|
|
||||||
ModuleGridEx moduleGridEx = null;
|
|
||||||
if (moduleObject != null && moduleObject is ModuleGridEx)
|
|
||||||
{
|
|
||||||
moduleGridEx = moduleObject as ModuleGridEx;
|
|
||||||
}
|
|
||||||
if (moduleGridEx != null)
|
|
||||||
{
|
|
||||||
int[] selectRows = moduleGridEx.GridControlObj.GridView.GetSelectedRows();
|
|
||||||
foreach (int selectIndex in selectRows)
|
|
||||||
{
|
|
||||||
DataRow selectRow = moduleGridEx.GridControlObj.GridView.GetDataRow(selectIndex);
|
|
||||||
string value = selectRow[moduleGridEx.ParmaryKey] + "";
|
|
||||||
if (this.MoudleDetailBottomObj != null)
|
|
||||||
{
|
|
||||||
foreach (DataRow keyRow in this.gridDragRows.Keys)
|
|
||||||
{
|
|
||||||
bool isContain = false;
|
|
||||||
DataRow row = null;
|
|
||||||
foreach (DataRow detailRow in this.gridDragRows[keyRow])
|
|
||||||
{
|
|
||||||
if ((detailRow[_primaryDetailBottomKey] + "").Equals(value))
|
|
||||||
{
|
|
||||||
isContain = true;
|
|
||||||
row = detailRow;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (row != null && isContain)
|
|
||||||
{
|
|
||||||
this.gridDragRows[keyRow].Remove(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isContain = false;
|
|
||||||
DataRow row = null;
|
|
||||||
foreach (DataRow keyRow in this.gridDragRows.Keys)
|
|
||||||
{
|
|
||||||
if ((keyRow[_primaryDetailKey] + "").Equals(value))
|
|
||||||
{
|
|
||||||
isContain = true;
|
|
||||||
row = keyRow;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (row != null && isContain)
|
|
||||||
{
|
|
||||||
this.gridDragRows.Remove(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (int selectIndex in selectRows)
|
|
||||||
{
|
|
||||||
int sourceIndex = moduleGridEx.GridControlObj.GridView.GetDataSourceRowIndex(selectIndex);
|
|
||||||
moduleGridEx.GridControlObj.gridControl.DataSourceTable().Rows.RemoveAt(sourceIndex);
|
|
||||||
}
|
|
||||||
//moduleGridEx.GridControlObj.GridView.DeleteSelectedRows();
|
|
||||||
}
|
|
||||||
RefreshDetailDataSource();
|
|
||||||
//OnSearchAfterRefreshDetail(null, null);
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 明细行切换刷新明细
|
/// 明细行切换刷新明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1215,11 +935,15 @@ namespace Lskj.PubMrpAnalyze
|
|||||||
// this.gd_LeftBottom.LastSearchSql = searchSql;
|
// this.gd_LeftBottom.LastSearchSql = searchSql;
|
||||||
// this.gd_LeftBottom.SetGridViewDataSource(sourceTab);
|
// this.gd_LeftBottom.SetGridViewDataSource(sourceTab);
|
||||||
//}
|
//}
|
||||||
|
if (SearchDetailBottomObj!=null)
|
||||||
|
{
|
||||||
string searchSql = this.GetSearchSql(GridDetailBottomModel, mainRow);
|
string searchSql = this.GetSearchSql(GridDetailBottomModel, mainRow);
|
||||||
DataTable sourceTab = Lskj.Core.SqlHelper.ExecuteDataTable(searchSql);
|
DataTable sourceTab = Lskj.Core.SqlHelper.ExecuteDataTable(searchSql);
|
||||||
this.gd_LeftBottom.LastSearchSql = searchSql;
|
this.gd_LeftBottom.LastSearchSql = searchSql;
|
||||||
this.gd_LeftBottom.SetGridViewDataSource(sourceTab);
|
this.gd_LeftBottom.SetGridViewDataSource(sourceTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.Instance.WriteError(ex);
|
LogHelper.Instance.WriteError(ex);
|
||||||
|
|||||||
Reference in New Issue
Block a user