SVN-Revision: r460
This commit is contained in:
wyf
2025-04-08 08:05:56 +00:00
parent f6d4e3dfcb
commit 2b60b09ed5
+44 -17
View File
@@ -294,22 +294,35 @@ namespace Lskj.ProductiSched
{
BandedGridView view = sender as BandedGridView;
if (view == null) return;
string billDocumentId = view.GetRowCellValue(view.FocusedRowHandle, DataModel.TopModuleModel.ParmaryKey) + "";
// 新方式 (精准替代原有取值方式)
DateTime date;
if (DataModel.columnDateMapping.TryGetValue(view.FocusedColumn, out date))
if (DataModel.TopModuleModel.HasReport)//报表所有的都不能编辑
{
string columnName = date.ToString("yyyy-MM-dd");
// 检查该行的 billdocument_id 是否在字典中
if (DataModel.nonEditableCells.ContainsKey(billDocumentId))
e.Cancel = true; // 取消编辑,单元格变灰
}
DataRow dataRow = view.GetFocusedDataRow();
if (dataRow == null) return;
string bj_tig = dataRow["bj_tig"]?.ToString() ?? "";
if (bj_tig == "0")
{
e.Cancel = true; // 取消编辑,单元格变灰
}
else
{
string billDocumentId = view.GetRowCellValue(view.FocusedRowHandle, DataModel.TopModuleModel.ParmaryKey) + "";
// 新方式 (精准替代原有取值方式)
DateTime date;
if (DataModel.columnDateMapping.TryGetValue(view.FocusedColumn, out date))
{
HashSet<string> showDays = DataModel.nonEditableCells[billDocumentId];
// 如果列名(日期)在 showday_list 里,则禁用编辑
if (showDays.Contains(columnName))
string columnName = date.ToString("yyyy-MM-dd");
// 检查该行的 billdocument_id 是否在字典中
if (DataModel.nonEditableCells.ContainsKey(billDocumentId))
{
e.Cancel = true; // 取消编辑,单元格变灰
HashSet<string> showDays = DataModel.nonEditableCells[billDocumentId];
// 如果列名(日期)在 showday_list 里,则禁用编辑
if (showDays.Contains(columnName))
{
e.Cancel = true; // 取消编辑,单元格变灰
}
}
}
}
@@ -2009,7 +2022,7 @@ namespace Lskj.ProductiSched
var cellValue = col.Value;
row[column] = cellValue;
// 检查列可解析为日期格式
if (cellValue > 0 && DateTime.TryParse(column.ToString(), out DateTime newDate))
if (DateTime.TryParse(column.ToString(), out DateTime newDate))
{
if (!validDateColumns.Contains(newDate))
{
@@ -2066,9 +2079,12 @@ namespace Lskj.ProductiSched
{
if (!mvalidDateColumns.Contains(tempDate))
{
mvalidDateColumns.Add(tempDate);
if (decimal.TryParse(value + "", out decimal dValue) && dValue > 0)
{
mvalidDateColumns.Add(tempDate);
e.Row["PrecomputedMaxDate"] = tempDate.ToString("yyyy-MM-dd");
}
}
e.Row["PrecomputedMaxDate"] = tempDate.ToString("yyyy-MM-dd");
}
}
else if (decimal.TryParse(value + "", out decimal dValue) && dValue > 0)
@@ -2294,6 +2310,13 @@ namespace Lskj.ProductiSched
/// <param name="e"></param>
private void OnBandedViewKeyDown(object sender, KeyEventArgs e)
{
BaseUserControl dataTypeControl = DataModel.TopSearchObj.ParentPanel.Controls.Cast<System.Windows.Forms.Control>().Where(n => n is LabelComboxEdit).Cast<BaseUserControl>().FirstOrDefault(); // 获取第一个符合条件的控件
string typeDate = "0";
if (dataTypeControl != null)
{
LabelComboxEdit labelAutoTextEdit = dataTypeControl as LabelComboxEdit;
typeDate = labelAutoTextEdit.EditValue;
}
BandedGridView bandedGridView = (BandedGridView)sender;
if (e.KeyCode == Keys.F7)
{
@@ -2303,7 +2326,7 @@ namespace Lskj.ProductiSched
{
// 允许操作
GridCell[] SelectCells = bandedGridView.GetSelectedCells();
if (SelectCells.Length > 0)
if (SelectCells.Length > 1)
{
object obj = bandedGridView.GetRowCellValue(SelectCells[0].RowHandle, SelectCells[0].Column);
if (MessageUtil.Show("是否替换所选单元格值?", MessageBoxButtons.YesNo) == DialogResult.Yes)
@@ -2319,6 +2342,10 @@ namespace Lskj.ProductiSched
DateTime dateTime;
if (DataModel.columnDateMapping.TryGetValue(gridCell.Column, out dateTime))
{
if (typeDate.Equals("1"))
{
dateTime = dateTime.AddDays(7);
}
string bj_tig = bandedGridView.GetRowCellValue(gridCell.RowHandle, "bj_tig")?.ToString() ?? "";
if (!DataModel.TopModuleModel.HasReport && bj_tig != "0" && dateTime.Date >= DateTime.Now.Date)
{