SVN r390
SVN-Revision: r390
This commit is contained in:
+12
-12
@@ -33,8 +33,8 @@ namespace Lskj.ProductiSched
|
|||||||
this.splitMainControl = new DevExpress.XtraEditors.SplitContainerControl();
|
this.splitMainControl = new DevExpress.XtraEditors.SplitContainerControl();
|
||||||
this.splitLeftControl = new DevExpress.XtraEditors.SplitContainerControl();
|
this.splitLeftControl = new DevExpress.XtraEditors.SplitContainerControl();
|
||||||
this.pltopmain = new DevExpress.XtraEditors.PanelControl();
|
this.pltopmain = new DevExpress.XtraEditors.PanelControl();
|
||||||
this.treebandGcTop = new Lskj.Control.TreeBandedGridControlEx();
|
|
||||||
this.bandGcTop = new Lskj.Control.BandedGridControlEx();
|
this.bandGcTop = new Lskj.Control.BandedGridControlEx();
|
||||||
|
this.treebandGcTop = new Lskj.Control.TreeBandedGridControlEx();
|
||||||
this.pl_mainSearch = new DevExpress.XtraEditors.PanelControl();
|
this.pl_mainSearch = new DevExpress.XtraEditors.PanelControl();
|
||||||
this.pl_search = new DevExpress.XtraEditors.PanelControl();
|
this.pl_search = new DevExpress.XtraEditors.PanelControl();
|
||||||
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
@@ -111,17 +111,6 @@ namespace Lskj.ProductiSched
|
|||||||
this.pltopmain.Size = new System.Drawing.Size(997, 320);
|
this.pltopmain.Size = new System.Drawing.Size(997, 320);
|
||||||
this.pltopmain.TabIndex = 22;
|
this.pltopmain.TabIndex = 22;
|
||||||
//
|
//
|
||||||
// treebandGcTop
|
|
||||||
//
|
|
||||||
this.treebandGcTop.AdapterObj = null;
|
|
||||||
this.treebandGcTop.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.treebandGcTop.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.treebandGcTop.Margin = new System.Windows.Forms.Padding(4);
|
|
||||||
this.treebandGcTop.Name = "treebandGcTop";
|
|
||||||
this.treebandGcTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
|
||||||
this.treebandGcTop.Size = new System.Drawing.Size(997, 320);
|
|
||||||
this.treebandGcTop.TabIndex = 19;
|
|
||||||
//
|
|
||||||
// bandGcTop
|
// bandGcTop
|
||||||
//
|
//
|
||||||
this.bandGcTop.AdapterObj = null;
|
this.bandGcTop.AdapterObj = null;
|
||||||
@@ -133,6 +122,17 @@ namespace Lskj.ProductiSched
|
|||||||
this.bandGcTop.Size = new System.Drawing.Size(997, 320);
|
this.bandGcTop.Size = new System.Drawing.Size(997, 320);
|
||||||
this.bandGcTop.TabIndex = 17;
|
this.bandGcTop.TabIndex = 17;
|
||||||
//
|
//
|
||||||
|
// treebandGcTop
|
||||||
|
//
|
||||||
|
this.treebandGcTop.AdapterObj = null;
|
||||||
|
this.treebandGcTop.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.treebandGcTop.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.treebandGcTop.Margin = new System.Windows.Forms.Padding(4);
|
||||||
|
this.treebandGcTop.Name = "treebandGcTop";
|
||||||
|
this.treebandGcTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||||
|
this.treebandGcTop.Size = new System.Drawing.Size(997, 320);
|
||||||
|
this.treebandGcTop.TabIndex = 19;
|
||||||
|
//
|
||||||
// pl_mainSearch
|
// pl_mainSearch
|
||||||
//
|
//
|
||||||
this.pl_mainSearch.Appearance.BackColor = System.Drawing.Color.Transparent;
|
this.pl_mainSearch.Appearance.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ namespace Lskj.ProductiSched
|
|||||||
//构建树表格
|
//构建树表格
|
||||||
if (TreeMultiHeader)//若为多表头树表格模式
|
if (TreeMultiHeader)//若为多表头树表格模式
|
||||||
{
|
{
|
||||||
|
treebandGcTop.Expansion = "3";
|
||||||
treebandGcTop.Model = DataModel.TopSysModel;
|
treebandGcTop.Model = DataModel.TopSysModel;
|
||||||
treebandGcTop.moduleModel = DataModel.TopModuleModel;
|
treebandGcTop.moduleModel = DataModel.TopModuleModel;
|
||||||
treebandGcTop.SetEditColumns(DataModel.TopGridColumns, GridCustomColumnStruct.BaseMainGridView + DataModel.TopModuleModel.FormKey);
|
treebandGcTop.SetEditColumns(DataModel.TopGridColumns, GridCustomColumnStruct.BaseMainGridView + DataModel.TopModuleModel.FormKey);
|
||||||
@@ -282,25 +283,33 @@ namespace Lskj.ProductiSched
|
|||||||
private void OnTreeListShowingEditor(object sender, CancelEventArgs e)
|
private void OnTreeListShowingEditor(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
TreeList treeList = sender as TreeList;
|
TreeList treeList = sender as TreeList;
|
||||||
|
string bj_tig = treeList.FocusedNode.GetValue("bj_tig")?.ToString() ?? "";
|
||||||
if (treeList == null || treeList.FocusedNode == null) return;
|
if (treeList == null || treeList.FocusedNode == null) return;
|
||||||
|
if (bj_tig == "0")
|
||||||
string billDocumentId = treeList.FocusedNode.GetValue(DataModel.TopModuleModel.ParmaryKey)?.ToString() ?? "";
|
|
||||||
DateTime date;
|
|
||||||
if (DataModel.columnDateMapping.TryGetValue(treeList.FocusedColumn, out date))
|
|
||||||
{
|
{
|
||||||
string columnName = date.ToString("yyyy-MM-dd");
|
e.Cancel = true; // 取消编辑,单元格变灰
|
||||||
// 检查该行的 billdocument_id 是否在字典中
|
}
|
||||||
if (DataModel.nonEditableCells.ContainsKey(billDocumentId))
|
else
|
||||||
|
{
|
||||||
|
string billDocumentId = treeList.FocusedNode.GetValue(DataModel.TopModuleModel.ParmaryKey)?.ToString() ?? "";
|
||||||
|
DateTime date;
|
||||||
|
if (DataModel.columnDateMapping.TryGetValue(treeList.FocusedColumn, out date))
|
||||||
{
|
{
|
||||||
HashSet<string> showDays = DataModel.nonEditableCells[billDocumentId];
|
string columnName = date.ToString("yyyy-MM-dd");
|
||||||
|
// 检查该行的 billdocument_id 是否在字典中
|
||||||
// 如果列名(日期)在 showday_list 里,则禁用编辑
|
if (DataModel.nonEditableCells.ContainsKey(billDocumentId))
|
||||||
if (showDays.Contains(columnName))
|
|
||||||
{
|
{
|
||||||
e.Cancel = true; // 取消编辑,单元格变灰
|
HashSet<string> showDays = DataModel.nonEditableCells[billDocumentId];
|
||||||
|
|
||||||
|
// 如果列名(日期)在 showday_list 里,则禁用编辑
|
||||||
|
if (showDays.Contains(columnName))
|
||||||
|
{
|
||||||
|
e.Cancel = true; // 取消编辑,单元格变灰
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -310,12 +319,13 @@ namespace Lskj.ProductiSched
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void OnBtnSaveClick(object sender, EventArgs e)
|
private void OnBtnSaveClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (SaveGridRecord())
|
if (!string.IsNullOrEmpty(DataModel.TopModuleModel.MenuTable))
|
||||||
{
|
{
|
||||||
if (SaveDatePlanRecord())
|
SaveGridRecord();
|
||||||
{
|
}
|
||||||
DataModel.TopSearchObj.ButtonObj.PerformClick();
|
if (SaveDatePlanRecord())
|
||||||
}
|
{
|
||||||
|
DataModel.TopSearchObj.ButtonObj.PerformClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -642,7 +652,7 @@ namespace Lskj.ProductiSched
|
|||||||
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
|
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
|
||||||
DataRow focusedRow = bandGcTop.BandedView.GetFocusedDataRow();
|
DataRow focusedRow = bandGcTop.BandedView.GetFocusedDataRow();
|
||||||
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
|
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
|
||||||
UpdateRowWithDayPlan(focusedRow, dataDayPlan, dateTime);
|
if (DataModel.TopModuleModel.HasReport)UpdateRowWithDayPlan(focusedRow, dataDayPlan, dateTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -694,7 +704,7 @@ namespace Lskj.ProductiSched
|
|||||||
// 更新行数据逻辑
|
// 更新行数据逻辑
|
||||||
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
|
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
|
||||||
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
|
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
|
||||||
UpdateRowWithDayPlan(rowItem, dataDayPlan, dateTime);
|
if (DataModel.TopModuleModel.HasReport) UpdateRowWithDayPlan(rowItem, dataDayPlan, dateTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -773,7 +783,7 @@ namespace Lskj.ProductiSched
|
|||||||
{
|
{
|
||||||
foreach (TreeListColumn treeListColumn in band.Columns)
|
foreach (TreeListColumn treeListColumn in band.Columns)
|
||||||
{
|
{
|
||||||
allWidth += treeListColumn.Width;
|
if(treeListColumn.Visible) allWidth += treeListColumn.Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -842,7 +852,30 @@ namespace Lskj.ProductiSched
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 记录展开的节点
|
||||||
|
/// </summary>
|
||||||
|
public void GetTreeExpanded()
|
||||||
|
{
|
||||||
|
DataModel.treeListNodes.Clear();
|
||||||
|
foreach (TreeListNode n in this.treebandGcTop.TreeListObj.Nodes)
|
||||||
|
{
|
||||||
|
setRecursive(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 递归进行遍历节点
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="treeNode"></param>
|
||||||
|
public void setRecursive(TreeListNode treeNode)
|
||||||
|
{
|
||||||
|
if (treeNode.Expanded) DataModel.treeListNodes.Add(treeNode);
|
||||||
|
// Visit each node recursively.
|
||||||
|
foreach (TreeListNode tn in treeNode.Nodes)
|
||||||
|
{
|
||||||
|
setRecursive(tn);
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 搜索条件绑定完成后
|
/// 搜索条件绑定完成后
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -915,7 +948,7 @@ namespace Lskj.ProductiSched
|
|||||||
{
|
{
|
||||||
dataMain = treebandGcTop.GetGridViewDataSource().Copy();
|
dataMain = treebandGcTop.GetGridViewDataSource().Copy();
|
||||||
dataDetail = treebandGcTop.GetGridViewDataSource().Copy();
|
dataDetail = treebandGcTop.GetGridViewDataSource().Copy();
|
||||||
treebandGcTop.TreeListObj.DataSource = null;
|
//treebandGcTop.TreeListObj.DataSource = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -933,15 +966,15 @@ namespace Lskj.ProductiSched
|
|||||||
DataTable bottomTab = BuildCTable(dataDetail, dataDayPlan, dateTime, 93);
|
DataTable bottomTab = BuildCTable(dataDetail, dataDayPlan, dateTime, 93);
|
||||||
bandGcBottom.BandedView.GridControl.DataSource = bottomTab;
|
bandGcBottom.BandedView.GridControl.DataSource = bottomTab;
|
||||||
}
|
}
|
||||||
|
MergeMainDataWithDayPlan(dataMain, dataDayPlan, dateTime, typeDate);
|
||||||
if (!TreeMultiHeader)
|
if (!TreeMultiHeader)
|
||||||
{
|
{
|
||||||
MergeMainDataWithDayPlan(dataMain, dataDayPlan, dateTime, typeDate);
|
|
||||||
bandGcTop.SetGridViewDataSource(dataMain);
|
bandGcTop.SetGridViewDataSource(dataMain);
|
||||||
OnBandedViewRowCellClick(bandGcTop.BandedView, null);
|
OnBandedViewRowCellClick(bandGcTop.BandedView, null);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
treebandGcTop.SetGridViewDataSource(dataMain);
|
treebandGcTop.SetGridViewDataSource(dataMain);
|
||||||
|
//treebandGcTop.TreeListObj.DataSource = dataMain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string query = @"
|
string query = @"
|
||||||
@@ -2031,24 +2064,30 @@ namespace Lskj.ProductiSched
|
|||||||
|
|
||||||
if (e.KeyCode == Keys.F7)
|
if (e.KeyCode == Keys.F7)
|
||||||
{
|
{
|
||||||
TreeListColumn column = treeList.FocusedColumn;
|
// 使用你框架中定义的精准方法来获取选中的单元格集合
|
||||||
if (column != null && column.OptionsColumn.AllowEdit && treeList.AllNodesCount > 0)
|
List<TreeListCell> selectedCells = treeList.GetSelectedCells();
|
||||||
{
|
|
||||||
// 获取当前聚焦单元格的值
|
|
||||||
object focusedValue = treeList.FocusedNode?.GetValue(column);
|
|
||||||
|
|
||||||
if (focusedValue != null && MessageUtil.Show("是否替换所选单元格值?", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
if (selectedCells != null && selectedCells.Count > 0)
|
||||||
|
{
|
||||||
|
// 以第一个选中单元格作为赋值基准值
|
||||||
|
TreeListCell firstCell = selectedCells[0];
|
||||||
|
object valueToSet = firstCell.Node.GetValue(firstCell.Column);
|
||||||
|
|
||||||
|
if (valueToSet != null && MessageUtil.Show("是否替换所选单元格值?", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
WaitForm.ShowForm("数据填充中");
|
WaitForm.ShowForm("数据填充中");
|
||||||
|
|
||||||
foreach (TreeListNode node in treeList.Selection)
|
foreach (TreeListCell cell in selectedCells)
|
||||||
{
|
{
|
||||||
DateTime dateTime;
|
if (cell.Column.OptionsColumn.AllowEdit)
|
||||||
if (DataModel.columnDateMapping.TryGetValue(column, out dateTime))
|
|
||||||
{
|
{
|
||||||
if (dateTime.Date >= DateTime.Now.Date)
|
if (DataModel.columnDateMapping.TryGetValue(cell.Column, out DateTime dateTime))
|
||||||
{
|
{
|
||||||
node.SetValue(column, focusedValue);
|
// 日期必须大于等于今天才允许赋值
|
||||||
|
if (dateTime.Date >= DateTime.Now.Date)
|
||||||
|
{
|
||||||
|
cell.Node.SetValue(cell.Column, valueToSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2060,7 +2099,6 @@ namespace Lskj.ProductiSched
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建下方数据
|
/// 构建下方数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DevExpress.XtraTreeList.Columns;
|
using DevExpress.XtraTreeList.Columns;
|
||||||
|
using DevExpress.XtraTreeList.Nodes;
|
||||||
using Lskj.Control.Model;
|
using Lskj.Control.Model;
|
||||||
using Lskj.Model;
|
using Lskj.Model;
|
||||||
using System;
|
using System;
|
||||||
@@ -11,5 +12,7 @@ namespace Lskj.ProductiSched
|
|||||||
{
|
{
|
||||||
public class ProductDataModel
|
public class ProductDataModel
|
||||||
{
|
{
|
||||||
|
//treeList树展开的节点块
|
||||||
|
public List<TreeListNode> treeListNodes = new List<TreeListNode>();
|
||||||
// 在你的类内部定义此字典(一次定义,长期复用)
|
// 在你的类内部定义此字典(一次定义,长期复用)
|
||||||
public Dictionary<object, DateTime> columnDateMapping = new Dictionar
|
public Dictionary<object, DateTime> columnDateMapping = new Dictionar
|
||||||
Reference in New Issue
Block a user