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);
// 获取行的最大日期值
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)
{
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;
// 检查当前列是否为日期类型并获取日期
DateTime currentDate;
@@ -1347,6 +1368,24 @@ namespace Lskj.Control
{
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;
GridColumnModel model = e.Column.Tag as GridColumnModel;
if (model == null) return;
@@ -1363,9 +1402,9 @@ namespace Lskj.Control
}
}
}
GridView gridView = this.gridControl.MainView as GridView;
int rowHandle = gridView.GetDataSourceRowIndex(e.RowHandle);
DataTable dataTable = this.gridControl.DataSourceTable();
//根据某一列的值自动填充对应值
if (this.AutoPadDataReleColList.Count > 0)
{
+14 -4
View File
@@ -107,6 +107,7 @@ namespace Lskj.Control.Model
if (applyArgs.CancelFlag) return false;
List<string> paramList = HandleRightMenuParams(model.ParamList);
string dllName = this._controlObj.ReplaceControlValue(model.DllName).Trim();
switch (model.ActionType)
@@ -115,7 +116,7 @@ namespace Lskj.Control.Model
resultValue = ExecProcedure(model.Action, paramList);
break;
case 2: // 调用dll程序
resultValue = ExecDynamicLinkLibary(model, paramList);
resultValue = ExecDynamicLinkLibary(model, paramList, rowItem);
break;
case 3: //调用delphi程序
resultValue = ExecDelphiLibary(model.DllName, paramList);
@@ -332,7 +333,7 @@ namespace Lskj.Control.Model
/// <para>版本:1.0</para>
/// </summary>
/// <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;
if (string.IsNullOrWhiteSpace(model.DllName))
@@ -364,7 +365,8 @@ namespace Lskj.Control.Model
}
break;
default:
string[] str = {
List<string> str = new List<string>
{
_model.FormText,
ERPInfo.Instance.UserId,
ERPInfo.Instance.UserName,
@@ -381,7 +383,15 @@ namespace Lskj.Control.Model
paramList[8],
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)
{
MessageUtil.Show(ResourceKeys.DyncmicDllNotFount);