SVN-Revision: r889
This commit is contained in:
wyf
2025-07-24 02:44:06 +00:00
parent 1efec78228
commit 2da11181e4
3 changed files with 723 additions and 70 deletions
@@ -94,6 +94,15 @@ namespace Lskj.PubAccraditation
public GridColumn SumGridColumn = new GridColumn();
#region
/// <summary>
/// 数量名称
/// </summary>
public string NumberMc;
/// <summary>
/// 主键字段
/// </summary>
private string mRecordPrimaryField;
private string guidField = "xxxxx_guid";
/// <summary>
/// id(推送记录)
/// </summary>
private int _beforeId;
@@ -1035,20 +1044,28 @@ namespace Lskj.PubAccraditation
// }
//}
this.AuthorityTable = PowerImpl.GetModuleAuthorityEnable(this.SysModel.ModuleCode);
this.AuthorityTable = PowerImpl.GetModuleAuthorityEnable(this.SysModel.ModuleCode);
if (this.AuditModelObj.DetailModifyFields != "-1")
{
this.gridBillInfo.SetReadOnlyAllColumn();
this.dbpFP.Enabled = false;
}
//设置必填和修改字段
this.gridBillInfo.SetFieldStatus(this.AuditModelObj.DetailModifyFields, this.AuditModelObj.RequiredDetailFields, this.AuthorityTable);
this.SetBillControl(this.AuditModelObj.BillModifyFields, this.AuditModelObj.RequiredFields);
this.InitPrint();
//加载分配
this.dbpFP.Click += new System.EventHandler(this.OnBtnFPOldClick);
BarButtonItem itemFPBatch = new BarButtonItem();
itemFPBatch.Caption = "批量分配";
itemFPBatch.ItemClick += new ItemClickEventHandler(OnBtnFPNewClick);
//分配
this.pmFP.AddItems(new BarItem[] { itemFPBatch });
this.dbpFP.Visible = !string.IsNullOrWhiteSpace(this.BillModelObj.PopupUnionCode);
}
/// <summary>
@@ -3035,7 +3052,7 @@ namespace Lskj.PubAccraditation
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
if (this.BillModelObj.SaveSuccessfullyRefresh && !save) return save;//保存成功才刷新
// 刷新主表
@@ -3134,9 +3151,10 @@ namespace Lskj.PubAccraditation
{
detailTable = ((this.gridBillInfo as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows();
}
if (detailTable.Rows.Count > 0)
{
DataTable BillColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", BillModelObj.DetailTable));
IEnumerable<DataColumn> detailColumns = BillColumns.Columns.Cast<DataColumn>();
DataTable BillTempColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", BillModelObj.DetailTable + "_temp"));
foreach (DataRow dataRow in detailTable.Rows)
{
@@ -3148,6 +3166,11 @@ namespace Lskj.PubAccraditation
values.Append("'" + guid + "',");
foreach (DataColumn item in detailTable.Columns)
{
var selectColumn = detailColumns.Where(n => n.ColumnName.Equals(item.ColumnName, StringComparison.OrdinalIgnoreCase));
if (selectColumn.Count() == 0)
{
continue;
}
fields.Append(item.ColumnName + ",");
string fieldValue = (dataRow[item] + "").Replace("'", "''");
if (!BillTempColumns.Columns.Contains(item.ColumnName))
@@ -3310,4 +3333,560 @@ namespace Lskj.PubAccraditation
/// <summary>
/// <para>说明:检查可用条件</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11
/// <para>创建日期:2017-11-09 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cond">The cond.</param>
/// <param name="dataRow">The data row.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool ValidateCond(string cond, DataRow dataRow)
{
bool result = false;
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!"))
{
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
}
else if (dataRow == null)
{
result = ReplaceHelper.EvalCond(cond);
}
else
{
result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond);
}
return result;
}
/// <summary>
/// <para>说明:分配明细</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2020-01-15 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnBtnFPOldClick(object sender, EventArgs e)
{
this.gridBillInfo.GridView.PostEditor();
FPOld();
}
private void OnBtnFPNewClick(object sender, EventArgs e)
{
this.gridBillInfo.GridView.PostEditor();
FPNew();
}
/// <summary>
/// 新版分配
/// </summary>
private void FPNew(int rowHandle = 0)
{
try
{
this.gridBillInfo.GridView.FocusedRowHandle = rowHandle;
DataTable table = this.gridBillInfo.GridControl.DataSource as DataTable;
if (!table.Columns.Contains(guidField))
{
table.Columns.Add(guidField, typeof(string));
}
#region
string[] args = { this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode, this.SysModel.ModuleId + "", this.BillModelObj.PopupUnionCode, "1000" };
DynamicBaseSelectModel baseModel = new DynamicBaseSelectModel(args);
using (FrmBaseSelectBatch frmSelect = new FrmBaseSelectBatch(baseModel, this.ControlObj, this.gridBillInfo))
{
frmSelect.Text = this.BillModelObj.TypeName;
frmSelect.InitControl();
frmSelect.OnAfterFPCallback += OnAfterFPCallback;
#region
DataRow rowItem = this.gridBillInfo.GridView.GetFocusedDataRow();
if (rowItem == null)
{
return;
}
rowItem[guidField] = Guid.NewGuid().ToString();
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
if (this.gridBillInfo.GridView.FocusedRowHandle + 1 <= this.gridBillInfo.GridView.RowCount - 1)
{
int focusedRowHandle = this.gridBillInfo.GridView.FocusedRowHandle + 1;
this.gridBillInfo.GridView.FocusedRowHandle = focusedRowHandle;
if (this.gridBillInfo.GridView.FocusedRowHandle == focusedRowHandle)
{
FPNew(focusedRowHandle);
}
else
{
MessageUtil.Show("全部分配完毕");
}
}
return;
}
}
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
if (frmSelect.FpRows != null && frmSelect.FpRows.Length > 0)
{
List<DataRow> rows = frmSelect.FpRows.ToList();
rows.Remove(rowItem);
frmSelect.FpRows = rows.ToArray();
}
if (table.Columns.Contains(mRecordPrimaryField))
{
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
frmSelect.InitData(rowItem);
frmSelect.OnBtnFPClick(null, null);
#endregion
//frmSelect.ShowDialog();
#endregion
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 分配完成后回调
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnAfterFPCallback(object sender, EventArgs e)
{
WaitForm.ShowForm();
try
{
// 临时禁用新增行(空白行)
if (this.BillModelObj.DefaultAddEmptyRow) this.gridBillInfo.GridView.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
DataRow rowItem = this.gridBillInfo.GridView.GetFocusedDataRow();
if (rowItem == null)
{
return;
}
DataTable table = this.gridBillInfo.GridControl.DataSource as DataTable;
FrmBaseSelectBatch frmSelect = (FrmBaseSelectBatch)sender;
rowItem[guidField] = Guid.NewGuid().ToString();
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
if (this.gridBillInfo.GridView.FocusedRowHandle + 1 <= this.gridBillInfo.GridView.RowCount - 1)
{
this.gridBillInfo.GridView.FocusedRowHandle += 1;
OnAfterFPCallback(sender, e);
}
return;
}
}
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
if (frmSelect.FpRows != null && frmSelect.FpRows.Length > 0)
{
List<DataRow> rows = frmSelect.FpRows.ToList();
rows.Remove(rowItem);
frmSelect.FpRows = rows.ToArray();
}
if (table.Columns.Contains(mRecordPrimaryField))
{
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
frmSelect.InitData(rowItem);
bool success = frmSelect.FP();
if (success)
{
if (frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
{
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{
this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
table.Columns.Add(this.mRecordPrimaryField, typeof(String));
}
foreach (DataRow item in frmSelect.SelectedRows)
{
DataRow newRow = table.NewRow();
newRow.ItemArray = rowItem.ItemArray;
newRow[guidField] = rowItem[guidField];
DataColumn IsIdentCol = newRow.Table.Columns.Cast<DataColumn>().FirstOrDefault(x => x.ColumnName == BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", BillModelObj.DetailTable)) + "");
//自增长列分配按空值取
if (IsIdentCol != null)
{
if (IsIdentCol.DataType == typeof(Decimal) ||
IsIdentCol.DataType == typeof(Double) ||
IsIdentCol.DataType == typeof(Int16) ||
IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{
newRow[IsIdentCol.ColumnName] = 0;
}
}
foreach (DataColumn col in item.Table.Columns)
{
if (table.Columns.Contains(col.ColumnName))
{
//newRow[col.ColumnName] = item[col.ColumnName];
newRow[col.ColumnName] = item[col.ColumnName];
GridColumn column = this.gridBillInfo.GridView.Columns[col.ColumnName];
if (column != null)
{
GridColumnModel model = column.Tag as GridColumnModel;
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, rowItem[column.FieldName] + "", newRow);
}
SetCalcValue(model, rowItem[column.FieldName] + "", newRow);
}
}
}
newRow[frmSelect.AmountField] = item[frmSelect.AmountField];
newRow[frmSelect.RecordPrimaryField] = item[frmSelect.RecordPrimaryField];
table.Rows.Add(newRow);
}
NumberMc = frmSelect.AmountField;
table.Rows.Remove(rowItem);
// 重排顺序
table.OrderBy(this.BillModelObj.DetailOrderField);
this.gridBillInfo.GridView.UpdateCurrentRow();
this.gridBillInfo.GridView.ShowEditor();
if (frmSelect.isNextOne)
{
int SourceRowIndex = this.gridBillInfo.GridView.GetFocusedDataSourceRowIndex();
DataRow[] a = table.Rows.Cast<DataRow>().Where(x => string.IsNullOrEmpty(x[guidField].ToString())).ToArray();
if (a.Length != 0)
{
this.gridBillInfo.GridView.FocusedRowHandle = SourceRowIndex;
OnAfterFPCallback(sender, e);
}
else
{
MessageUtil.Show("全部分配完毕");
// frmSelect.SelectRowItem = null;
}
}
}
}
else
{
if (this.gridBillInfo.GridView.FocusedRowHandle + 1 <= this.gridBillInfo.GridView.RowCount - 1)
{
this.gridBillInfo.GridView.FocusedRowHandle += 1;
OnAfterFPCallback(sender, e);
}
else
{
MessageUtil.Show("全部分配完毕");
}
}
}
catch (Exception)
{
throw;
}
finally
{
// 重新开启新增行(空白行)
if (this.BillModelObj.DefaultAddEmptyRow) this.gridBillInfo.GridView.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
WaitForm.HideForm();
}
}
/// <summary>
/// 老版分配
/// </summary>
private void FPOld()
{
try
{
DataRow rowItem = this.gridBillInfo.GridView.GetFocusedDataRow();
if (rowItem == null)
{
MessageUtil.Show("请先选择一条明细在进行分配!");
return;
}
DataTable table = this.gridBillInfo.GridControl.DataSource as DataTable;
if (!table.Columns.Contains(guidField))
{
table.Columns.Add(guidField, typeof(string));
}
rowItem[guidField] = Guid.NewGuid().ToString(); ;
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
MessageUtil.Show("该行数据为已分配后的数据,无需分配!");
return;
}
}
string[] args = { this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode, this.SysModel.ModuleId + "", this.BillModelObj.PopupUnionCode, "1000" };
DynamicBaseSelectModel baseModel = new DynamicBaseSelectModel(args);
using (FrmBaseSelect frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gridBillInfo))
{
//if (frmSelect.SelectRowItem == null)
//{
// frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gcMain);
//}
frmSelect.Text = this.BillModelObj.TypeName;
frmSelect.SelectRowItem = rowItem;
bool isNextOne = false;
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
if (frmSelect.FpRows != null && frmSelect.FpRows.Length > 0)
{
List<DataRow> rows = frmSelect.FpRows.ToList();
rows.Remove(rowItem);
frmSelect.FpRows = rows.ToArray();
}
if (table.Columns.Contains(mRecordPrimaryField))
{
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
if (frmSelect.ShowDialog() == DialogResult.OK)
{
if (frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
{
//if (frmSelect.isNextOne)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{
this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
table.Columns.Add(this.mRecordPrimaryField, typeof(String));
}
foreach (DataRow item in frmSelect.SelectedRows)
{
DataRow newRow = table.NewRow();
newRow.ItemArray = rowItem.ItemArray;
newRow[guidField] = rowItem[guidField];
DataColumn IsIdentCol = newRow.Table.Columns.Cast<DataColumn>().FirstOrDefault(x => x.ColumnName == BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", BillModelObj.DetailTable)) + "");
//自增长列分配按空值取
if (IsIdentCol != null)
{
if (IsIdentCol.DataType == typeof(Decimal) ||
IsIdentCol.DataType == typeof(Double) ||
IsIdentCol.DataType == typeof(Int16) ||
IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{
newRow[IsIdentCol.ColumnName] = 0;
}
}
foreach (DataColumn col in item.Table.Columns)
{
if (table.Columns.Contains(col.ColumnName))
{
//newRow[col.ColumnName] = item[col.ColumnName];
newRow[col.ColumnName] = item[col.ColumnName];
GridColumn column = this.gridBillInfo.GridView.Columns[col.ColumnName];
if (column != null)
{
GridColumnModel model = column.Tag as GridColumnModel;
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, rowItem[column.FieldName] + "", newRow);
}
SetCalcValue(model, rowItem[column.FieldName] + "", newRow);
}
}
}
newRow[frmSelect.AmountField] = item[frmSelect.AmountField];
newRow[frmSelect.RecordPrimaryField] = item[frmSelect.RecordPrimaryField];
table.Rows.Add(newRow);
}
NumberMc = frmSelect.AmountField;
//double syAmount = frmSelect.GetSyAmount();
//if (syAmount > 0)
//{
// rowItem[frmSelect.AmountField] = frmSelect.GetSyAmount();
//}
//else
//{
// table.Rows.Remove(rowItem);
//}
table.Rows.Remove(rowItem);
// 重排顺序
table.OrderBy(this.BillModelObj.DetailOrderField);
this.gridBillInfo.GridView.UpdateCurrentRow();
this.gridBillInfo.GridView.ShowEditor();
}
}
if (frmSelect.isNextOne)
{
int SourceRowIndex = this.gridBillInfo.GridView.GetFocusedDataSourceRowIndex();
DataRow[] a = table.Rows.Cast<DataRow>().Where(x => string.IsNullOrEmpty(x[guidField].ToString())).ToArray();
if (a.Length != 0)
{
this.gridBillInfo.GridView.FocusedRowHandle = SourceRowIndex;
OnBtnFPOldClick(null, null);
}
else
{
MessageUtil.Show("全部分配完毕");
// frmSelect.SelectRowItem = null;
}
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex);
}
}
/// <summary>
/// <para>说明:计算列关联字段</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-18 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fieldValue">The field value.</param>
protected virtual void SetUnionValue(GridColumnModel model, string fieldValue, DataRow rowItem)
{
DataTable table = this.gridBillInfo.gridControl.DataSourceTable();
//DataRow rowItem = this.gridView.GetFocusedDataRow();
string unionValues = model.UnionValues;
if (rowItem != null && model != null)
{
unionValues = ReplaceHelper.ReplaceRowParam(rowItem, unionValues.Replace("{" + model.FieldName + "}", fieldValue));
if (this.ControlObj != null)
{
unionValues = ControlObj.ReplaceParentControlValue(unionValues);
}
try
{
string[] fields = model.UnionFields.Trim(',').Split(',');
DataRow rowResult = BaseImpl.GetDataRowResult(unionValues);
if (rowResult != null)
{
for (int i = 0; i < fields.Length; i++)
{
string field = fields[i];
string value = rowResult.Table.Columns.Contains(field) ? rowResult[field] + "" : null;
rowItem[field] = value;
}
}
else
{
// 设置为空
for (int i = 0; i < fields.Length; i++)
{
string field = fields[i];
rowItem[field] = DBNull.Value;
}
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex);
LogUtil.WriteError("计算列关联字段--错误-->" + unionValues, ex);
}
}
}
/// <summary>
/// <para>说明:计算列计算公式</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-18 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="model">The model.</param>
/// <param name="fieldValue">The field value.</param>
protected virtual void SetCalcValue(GridColumnModel model, string fieldValue, DataRow rowItem)
{
try
{
DataTable table = this.gridBillInfo.gridControl.DataSourceTable();
if (rowItem != null && model != null)
{
List<GridColumnModel> calcModels = this.gridBillInfo.ObjmControlList.FindAll(x => !string.IsNullOrEmpty(x.CalcExpr)).OrderBy(y => y.CalcOrder).ToList();
foreach (GridColumnModel gridModel in calcModels)
{
// 计算顺序小于当前控件则不计算
if (gridModel.CalcOrder < model.CalcOrder) continue;
if (!gridModel.FieldName.Equals(model.FieldName, StringComparison.OrdinalIgnoreCase))
{
bool isTruncate = false;
string calcExpr = gridModel.CalcExpr;
if (calcExpr.StartsWith("@truncate:"))
{
calcExpr = calcExpr.Substring(10);
isTruncate = true;
}
try
{
if (this.ControlObj != null)
calcExpr = ControlObj.ReplaceParentControlValue(calcExpr);
calcExpr = ReplaceHelper.ReplaceRowParam(rowItem, calcExpr);
//EvalHelper.Eval2(ReplaceHelper.ReplaceEvalCond(calcExpr)) + ""
string result = EvalHelper.Eval2(ReplaceHelper.ReplaceEvalCond(calcExpr)) + "";
if (isTruncate)
{
result += result.Contains(".") ? "0000000000" : ".0000000000";
rowItem[gridModel.FieldName] = result.Substring(0, result.IndexOf(".")) + result.Substring(result.IndexOf("."), model.Decimals + 1);
//this.gridView.SetRowCellValue(this.gridView.FocusedRowHandle, this.gridView.Columns[gridModel.FieldName], result.Substring(0, result.IndexOf(".")) + result.Substring(result.IndexOf("."), model.Decimals + 1));
}
else
{
try
{
double d = 0;
if (!string.IsNullOrEmpty(result) &&
!"NaN".Equals(result, StringComparison.OrdinalIgnoreCase) &&
!"非数字".Equals(result, StringComparison.OrdinalIgnoreCase) &&
!"undefined".Equals(result, StringComparison.OrdinalIgnoreCase) &&
result != "∞" && result != "-∞" &&
!"正无穷大".Equals(result, StringComparison.OrdinalIgnoreCase) &&
!"负无穷大".Equals(result, StringComparison.OrdinalIgnoreCase) &&
double.TryParse(result, out d))
{
if (string.IsNullOrEmpty(gridModel.DataFormat))
{
result = Math.Round(Convert.ToDouble(d), model.Decimals, MidpointRounding.AwayFromZero) + "";
}
else
{
//计算后先执行保存小数位数
result = string.Format("{0:" + gridModel.DataFormat + "}", Convert.ToDecimal(result));
}
if (model.FieldType == 7 && result.Contains('%'))
{
result = (double.Parse(result.Replace("%", "")) * 0.01).ToString();
}
rowItem[gridModel.FieldName] = result;
// 判断计算列有无关联值
GridColumnModel UnionModel = calcModels.FirstOrDefault(x => x.FieldName == gridModel.FieldName);
if (!string.IsNullOrEmpty(UnionModel.UnionFields))
{
this.SetUnionValue(UnionModel, rowItem[gridModel.FieldName] + "", rowItem);
}
//this.gridView.SetRowCellValue(this.gri