SVN-Revision: r443
This commit is contained in:
tdx
2025-04-03 07:46:31 +00:00
parent 61da6228a6
commit eed569b9e3
2 changed files with 77 additions and 28 deletions
+43 -4
View File
@@ -274,10 +274,31 @@ namespace Lskj.Control
{ {
DataRow gridRow = view.GetDataRow(e.RowHandle); DataRow gridRow = view.GetDataRow(e.RowHandle);
// 获取行的最大日期值 // 获取行的最大日期值
DateTime? maxDateForRow = GetMaxDateFromColumnNames(gridRow); DateTime? maxDateForRow = null;
if (gridRow.Table.Columns.Contains("PrecomputedMaxDate") && gridRow["PrecomputedMaxDate"] != null && gridRow["PrecomputedMaxDate"].ToString() != "")
{
if (DateTime.TryParse(gridRow["PrecomputedMaxDate"].ToString(), out DateTime parsedDate))
{
maxDateForRow = parsedDate;
}
}
//DateTime? maxDateForRow = GetMaxDateFromColumnNames(gridRow);
foreach (DataRow item in this.GridRowColorsTable.Rows) foreach (DataRow item in this.GridRowColorsTable.Rows)
{ {
string cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + ""); string condition = item["condition"] + "";
string cond = condition;
// 检查是否条件字符串包含 'COLUMN_NAME'
if (condition.Contains("COLUMN_NAME"))
{
// 解析期望的列名
string expectedColumnName = condition.Split('=').Last().Trim('\'');
// 构建直接的列名比较
cond = $"'{e.Column.Name}'='{expectedColumnName}'";
}
else
{
cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
}
bool isLaterDatePresent = false; bool isLaterDatePresent = false;
// 检查当前列是否为日期类型并获取日期 // 检查当前列是否为日期类型并获取日期
DateTime currentDate; DateTime currentDate;
@@ -1347,6 +1368,24 @@ namespace Lskj.Control
{ {
try try
{ {
GridView gridView = this.gridControl.MainView as GridView;
DataTable dataTable = this.gridControl.DataSourceTable();
if (dataTable != null&& dataTable.Columns.Contains("PrecomputedMaxDate"))
{
DataRow HandleRow = this.bandedGridView.GetDataRow(e.RowHandle);
DateTime? maxDate = null; // 初始化为 null,表示尚未找到有效日期
if (DateTime.TryParse(e.Column.FieldName, out DateTime tempDate) && DateTime.TryParse(HandleRow["PrecomputedMaxDate"] + "", out DateTime newDate))
{
if (tempDate > maxDate) // 只有在找到更大的日期时才更新
{
HandleRow["PrecomputedMaxDate"] = tempDate;
}
} else if (string.IsNullOrEmpty(HandleRow["PrecomputedMaxDate"]+""))
{
HandleRow["PrecomputedMaxDate"] = tempDate;
}
}
if (e.Column.Tag == null) return; if (e.Column.Tag == null) return;
GridColumnModel model = e.Column.Tag as GridColumnModel; GridColumnModel model = e.Column.Tag as GridColumnModel;
if (model == null) return; if (model == null) return;
@@ -1363,9 +1402,9 @@ namespace Lskj.Control
} }
} }
} }
GridView gridView = this.gridControl.MainView as GridView;
int rowHandle = gridView.GetDataSourceRowIndex(e.RowHandle); int rowHandle = gridView.GetDataSourceRowIndex(e.RowHandle);
DataTable dataTable = this.gridControl.DataSourceTable();
//根据某一列的值自动填充对应值 //根据某一列的值自动填充对应值
if (this.AutoPadDataReleColList.Count > 0) if (this.AutoPadDataReleColList.Count > 0)
{ {
+16 -6
View File
@@ -47,11 +47,11 @@ namespace Lskj.Control.Model
/// Initializes a new instance of the <see cref="CommonMenu"/> class. /// Initializes a new instance of the <see cref="CommonMenu"/> class.
/// </summary> /// </summary>
/// <param name="rowItem">常用工具数据行.</param> /// <param name="rowItem">常用工具数据行.</param>
public CommonMenu(DynamicModel model, MyControl control, System.Windows.Forms.Control view=null) public CommonMenu(DynamicModel model, MyControl control, System.Windows.Forms.Control view = null)
{ {
this._model = model; this._model = model;
this._controlObj = control; this._controlObj = control;
if(view!=null) this.GridControlObj = view as GridControlEx; if (view != null) this.GridControlObj = view as GridControlEx;
if (this.GridControlObj != null) if (this.GridControlObj != null)
{ {
this.BaseGridView = this.GridControlObj.GridView; this.BaseGridView = this.GridControlObj.GridView;
@@ -107,6 +107,7 @@ namespace Lskj.Control.Model
if (applyArgs.CancelFlag) return false; if (applyArgs.CancelFlag) return false;
List<string> paramList = HandleRightMenuParams(model.ParamList); List<string> paramList = HandleRightMenuParams(model.ParamList);
string dllName = this._controlObj.ReplaceControlValue(model.DllName).Trim(); string dllName = this._controlObj.ReplaceControlValue(model.DllName).Trim();
switch (model.ActionType) switch (model.ActionType)
@@ -115,7 +116,7 @@ namespace Lskj.Control.Model
resultValue = ExecProcedure(model.Action, paramList); resultValue = ExecProcedure(model.Action, paramList);
break; break;
case 2: // 调用dll程序 case 2: // 调用dll程序
resultValue = ExecDynamicLinkLibary(model, paramList); resultValue = ExecDynamicLinkLibary(model, paramList, rowItem);
break; break;
case 3: //调用delphi程序 case 3: //调用delphi程序
resultValue = ExecDelphiLibary(model.DllName, paramList); resultValue = ExecDelphiLibary(model.DllName, paramList);
@@ -332,7 +333,7 @@ namespace Lskj.Control.Model
/// <para>版本:1.0</para> /// <para>版本:1.0</para>
/// </summary> /// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool ExecDynamicLinkLibary(GridRightMenuModel model, List<string> paramList) private bool ExecDynamicLinkLibary(GridRightMenuModel model, List<string> paramList, DataRow rowItem)
{ {
issuccess = true; issuccess = true;
if (string.IsNullOrWhiteSpace(model.DllName)) if (string.IsNullOrWhiteSpace(model.DllName))
@@ -364,7 +365,8 @@ namespace Lskj.Control.Model
} }
break; break;
default: default:
string[] str = { List<string> str = new List<string>
{
_model.FormText, _model.FormText,
ERPInfo.Instance.UserId, ERPInfo.Instance.UserId,
ERPInfo.Instance.UserName, ERPInfo.Instance.UserName,
@@ -381,7 +383,15 @@ namespace Lskj.Control.Model
paramList[8], paramList[8],
paramList[9] paramList[9]
}; };
IForm form = FormHelper.LoadDllForm(model.DllName, str); string maintabFocusedRowJson = "";
if (BaseGridView.GetFocusedDataRow() != null)
{
maintabFocusedRowJson = BaseGridView.GetFocusedDataRow().ToJsonObject(); // 假设 ToJsonObject() 是将对象转换为 JSON 字符串的方法
}
str.Add(maintabFocusedRowJson); // 现在可以添加元素了,因为 str 是 List<string>
// 假设你需要将 List<string> 转回字符串数组,可以这样操作
string[] strArray = str.ToArray();
IForm form = FormHelper.LoadDllForm(model.DllName, strArray);
if (form == null) if (form == null)
{ {
MessageUtil.Show(ResourceKeys.DyncmicDllNotFount); MessageUtil.Show(ResourceKeys.DyncmicDllNotFount);