SVN r1167

SVN-Revision: r1167
This commit is contained in:
cyf
2026-05-11 02:19:43 +00:00
parent 2e85136fbb
commit 2ed5b7975f
21 changed files with 475 additions and 156 deletions
+134 -1
View File
@@ -465,6 +465,18 @@ namespace Lskj.Control
/// 必填字段
/// </summary>
public string RequiredFields = string.Empty;
/// <summary>
/// 合计显示选中行数
/// </summary>
public bool TotalQuantity;
/// <summary>
///新增行
/// </summary>
/// <param name="sender">The sender.</param>
public event ModuleAddLine OnNewLine;
public delegate void ModuleAddLine(string name, List<string>list);
public GridControlEx()
{
@@ -1151,6 +1163,10 @@ namespace Lskj.Control
//case ControlType.LabGridPopupMutilText:
InitGridPopup(column, model);
break;
case ControlType.LabModuleAddRowsID:
case ControlType.LabModuleAddRowsText:
InitModuleReturnLine(column, model);
break;
default:
break;
}
@@ -5038,7 +5054,55 @@ namespace Lskj.Control
this.mControlList.Add(model);
}
/// <summary>
/// <para>说明:创建 模块返回行 </para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-08-23 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void InitModuleReturnLine(GridColumn gridColumn, GridColumnModel model)
{
FrmModelLookUp2 modelLookUp = new FrmModelLookUp2(model.addModuleld, false);//model.IsRadio 必定多选
modelLookUp.ReturnCollection = true;
modelLookUp.ConfigureColumnMode = model.ConfigureColumnMode;
modelLookUp.ValueField = model.ValueMember;
modelLookUp.TextField = model.TextMember;
modelLookUp.SourceSQL = model.SqlSource;
modelLookUp.IsType = model.FieldType;
modelLookUp.ValueMember = model.FieldType == ControlType.LabModuleAddRowsID ? model.ValueMember : model.TextMember;
modelLookUp.Tag = model;
RepositoryItemCheckedComboBoxEdit btnEdit = new RepositoryItemCheckedComboBoxEdit();
btnEdit.NullText = "";
btnEdit.PopupBorderStyle = PopupBorderStyles.Flat;
btnEdit.AllowNullInput = DefaultBoolean.False;
btnEdit.DisplayMember = model.TextMember;
btnEdit.SeparatorChar = ',';
btnEdit.ValueMember = model.FieldType == ControlType.LabModuleAddRowsText ? model.ValueMember : model.TextMember;
DataTable dataTable = MainImpl.GetDataTableResult(modelLookUp.SysModel.MenuSql);
btnEdit.DataSource = dataTable;
//if (model.ModuleFrameDisplayText)
//{
// DataTable dataTable = MainImpl.GetDataTableResult(modelLookUp.SysModel.MenuSql);
// btnEdit.DataSource = dataTable;
//}
btnEdit.Buttons[0].Visible = false; // 不能移除,移除后事件不起作用.
btnEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis) });
btnEdit.Tag = model;
btnEdit.Buttons[1].Tag = modelLookUp;
btnEdit.ButtonClick += new ButtonPressedEventHandler(OnModuleAddLine);
btnEdit.KeyDown += BtnEdit_KeyDown;
gridControl.RepositoryItems.Add(btnEdit);
gridColumn.OptionsColumn.ReadOnly = true;
gridColumn.ColumnEdit = btnEdit;
this.mControlList.Add(model);
}
/// <summary>
@@ -6647,6 +6711,8 @@ namespace Lskj.Control
//}
if (RefreshTotal) this.gridView.UpdateSummary();//合计列值改变后更新合计计算
}
catch (Exception ex)
{
@@ -6740,6 +6806,7 @@ namespace Lskj.Control
}
}
if (this.TotalQuantity) this.lblTotal.Text = string.Format("已选中 {0} 行", rows.Length);
}
}
@@ -6812,6 +6879,7 @@ namespace Lskj.Control
avg = count == 0 || count == 0 ? 0 : sum / count;
this.lblTotal.Text = string.Format(ResourceKeys.GridTotalDisplayText, count, Math.Round(sum, 2), Math.Round(avg, 2), Math.Round(max, 2), Math.Round(min, 2));
if (this.TotalQuantity) this.lblTotal.Text = string.Format("已选中 {0} 行", rows.Length);
}
}
catch (Exception ex)
@@ -7295,7 +7363,6 @@ namespace Lskj.Control
//多选关联单据头
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "") + model.SplicingConditions;
//SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "");
//单据头关联取值
if (this.ParentControl != null)
{
@@ -7332,6 +7399,72 @@ namespace Lskj.Control
}
}
/// <summary>
/// <para>说明:表格打开模块添加行</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-08-23 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void OnModuleAddLine(object sender, ButtonPressedEventArgs e)
{
try
{
CheckedComboBoxEdit btnEdit = (CheckedComboBoxEdit)sender;
FrmModelLookUp2 modelLookUp = e.Button.Tag as FrmModelLookUp2;
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
modelLookUp.EditText = btnEdit.Text;
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
modelLookUp.EditText = btnEdit.Text;
modelLookUp.EditValue = btnEdit.EditValue + "";
//多选关联单据头
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "") + model.SplicingConditions;
//单据头关联取值
if (this.ParentControl != null)
{
SourceSQL = this.ParentControl.ReplaceControlValue(SourceSQL);
}
modelLookUp.NewSourceSQL = ReplaceHelper.ReplaceRowParam(this.gridView.GetFocusedDataRow(), SourceSQL);
modelLookUp.AddModuleResult = model.addModuleResult;
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
DialogResult result = modelLookUp.ShowDialog();
if (result == DialogResult.OK)
{
btnEdit.EditValue = modelLookUp.EditValue;
this.GridView.SetFocusedRowCellValue(model.FieldName, modelLookUp.EditValue);
if (OnNewLine != null && modelLookUp.EditValueList.Count>0)
{
OnNewLine(model.FieldName, modelLookUp.EditValueList);
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 模块返回框清空
/// </summary>