SVN-Revision: r847
This commit is contained in:
tdx
2025-07-09 02:34:54 +00:00
parent 458cded6d5
commit 16c8b9e19f
2 changed files with 70 additions and 12 deletions
+2 -4
View File
@@ -39,7 +39,7 @@ namespace Lskj.ProductiSched
this.pl_search = new DevExpress.XtraEditors.PanelControl();
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
this.gcRight = new Lskj.Control.GridControlEx();
this.gcRight = new Lskj.Control.ModuleGridEx();
this.tabBottom = new Lskj.Control.TabControlEx();
((System.ComponentModel.ISupportInitialize)(this.pl_main)).BeginInit();
this.pl_main.SuspendLayout();
@@ -184,12 +184,10 @@ namespace Lskj.ProductiSched
//
// gcRight
//
this.gcRight.AdapterObj = null;
this.gcRight.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcRight.Location = new System.Drawing.Point(0, 0);
this.gcRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.gcRight.Name = "gcRight";
this.gcRight.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcRight.Size = new System.Drawing.Size(315, 679);
this.gcRight.TabIndex = 11;
//
@@ -217,4 +215,4 @@ namespace Lskj.ProductiSched
((System.ComponentModel.ISupportInitialize)(this.pltopmain)).EndInit();
this.pltopmain.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_mainSearch)).EndInit();
this.pl_m
this.pl_
+68 -8
View File
@@ -236,12 +236,38 @@ namespace Lskj.ProductiSched
//右侧表格
if (!string.IsNullOrEmpty(DataModel.RightSysModel.ModuleCode))
{
gcRight.Model = DataModel.RightSysModel;
gcRight.SetEditColumns(DataModel.RightGridColumns, GridCustomColumnStruct.BaseMainGridView + DataModel.RightModuleModel.FormKey);
gcRight.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(DataModel.RightModuleModel.ModeCode), DataModel.RightSysModel, this.OnGridViewRightCallBack);
gcRight.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(DataModel.RightModuleModel.ModeCode));
DataRow moduleInformation = MainImpl.GetSystemdllTab(DataModel.RightSysModel.ModuleCode);
if (moduleInformation == null)
{
MessageUtil.Show("没有找到编号为" + DataModel.RightSysModel.ModuleCode + "的模块信息");
return;
}
DataModel.RightDetailModel.SystemModel = new ModuleModel(moduleInformation);
gcRight.OnSaveGridCallBack += OnDetailSaveGridCallBack;
gcRight.Name = "gridEx";
gcRight.IsDetail = true;
gcRight.Dock = DockStyle.Fill;
gcRight.OperShortMode =false; // 不显示简短模式
gcRight.VisibleSearchPanel = false;
DataTable rightDt = BaseModuleImpl.GetBaseGridRightMenus(DataModel.RightSysModel.ModuleCode, ModuleType.MrpClickBtn);
gcRight.VisibleOperPanel = !DataModel.RightDetailModel.IsReadOnly;
gcRight.InitializeControl(DataModel.RightDetailModel.SystemModel, DataModel.RightSysModel);
gcRight.GridControlObj.Tag = DataModel.RightDetailModel;
if (DataModel.RightDetailModel.IsCheck == 1)//加载复选框
{
GridDragGrid.GridAddCheckBox(gcRight.GridControlObj.GridView);
}
}
}
/// <summary>
/// 右侧表格保存回调
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnDetailSaveGridCallBack(object sender, EventArgs e)
{
DataModel.TopSearchObj.ButtonObj.PerformClick();
}
@@ -287,6 +313,35 @@ namespace Lskj.ProductiSched
}
btnSave.Click += OnBtnSaveClick;
}
/// <summary>
/// 判断单元格是否可以编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnRightShowingEditor(object sender, CancelEventArgs e)
{
var view = sender as GridView;
if (view == null) return;
DataRow row = gcRight.GridControlObj.GetViewFocusedDataRow();
if (row == null) { e.Cancel = true; return; } // 没有行也不让编辑
// —— 1. 解析 day 字段 ——
if (!DateTime.TryParse(row["day"]?.ToString(), out DateTime dayDate))
{
e.Cancel = true; // 无法解析日期 → 禁止编辑
return;
}
// —— 2. 超过 7 天的行不可编辑 ——
if (dayDate.AddDays(7) <= DateTime.Today)
{
e.Cancel = true;
return;
}
}
/// <summary>
/// 判断单元格是否可以编辑
/// </summary>
@@ -708,14 +763,17 @@ namespace Lskj.ProductiSched
string searchSql = this.GetSearchSql(model, rowItem, false);
string isweekcond = DataModel.TopModuleModel.HasReport ? "" : $"and isWeek='{typeDate}'";
searchSql = $"{ReplaceHelper.ReplaceWhereCond(searchSql)} and day >= '{labelDateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd")}' {isweekcond}";
gcRight.SetGridViewDataSource(BaseImpl.GetDataTableResult(searchSql));
gcRight.GridControlObj.LastSearchSql = searchSql;
// 4) 让 Grid 用这张表,并把 adapter 存起来
gcRight.GridControlObj.SetGridViewDataSource(BaseImpl.GetDataTableResult(searchSql));
if (e != null)
{
if (labelDateEdit != null)
{
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
DataRow focusedRow = bandGcTop.BandedView.GetFocusedDataRow();
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
DataTable dataDayPlan = gcRight.GridControlObj.GridControl.DataSourceTable().Copy();
if (DataModel.TopModuleModel.HasReport) UpdateRowWithDayPlan(focusedRow, dataDayPlan, dateTime);
}
}
@@ -763,11 +821,11 @@ namespace Lskj.ProductiSched
string isweekcond = DataModel.TopModuleModel.HasReport ? "" : $"and isWeek='{typeDate}'";
searchSql = $"{ReplaceHelper.ReplaceWhereCond(searchSql)} and day >= '{labelDateEdit.TextEdit.DateTime:yyyy-MM-dd}' {isweekcond}";
gcRight.SetGridViewDataSource(BaseImpl.GetDataTableResult(searchSql));
gcRight.GridControlObj.SetGridViewDataSource(BaseImpl.GetDataTableResult(searchSql));
// 更新行数据逻辑
DateTime dateTime = labelDateEdit.TextEdit.DateTime;
DataTable dataDayPlan = gcRight.GridControl.DataSourceTable().Copy();
DataTable dataDayPlan = gcRight.GridControlObj.GridControl.DataSourceTable().Copy();
if (DataModel.TopModuleModel.HasReport) UpdateRowWithDayPlan(rowItem, dataDayPlan, dateTime);
this.SetDetailGridDataSource(rowItem);
}
@@ -1162,6 +1220,7 @@ namespace Lskj.ProductiSched
if (isAddBottom) UpdateDynamicColumns(bandGcBottom, dateTime, typeDate);
DataTable dataMain = null;
DataTable dataDetail = null;
int hander = bandGcTop.BandedView.FocusedRowHandle;
if (TreeMultiHeader)
{
dataMain = treebandGcTop.GetGridViewDataSource().Copy();
@@ -1188,6 +1247,7 @@ namespace Lskj.ProductiSched
if (!TreeMultiHeader)
{
bandGcTop.BandedView.GridControl.DataSource = dataMain;
bandGcTop.BandedView.FocusedRowHandle = hander;
OnBandedViewRowCellClick(bandGcTop.BandedView, null);
bandGcTop.BandedView.LeftCoord = DataModel.MainLeftCoord;
}