SVN r1047

SVN-Revision: r1047
This commit is contained in:
cyf
2025-11-20 09:01:11 +00:00
parent 6c0f72cb62
commit 2616d5dbad
23 changed files with 741 additions and 202 deletions
+97 -5
View File
@@ -256,6 +256,17 @@ namespace Lskj.Control
AuditCommonModel auditCommonModel = auditCommonModelTask.Result;
BaseAccraditationModel baseAccraditationModel = baseAccraditationModelTask.Result;
#region InitTabPages
Task<bool> TotalExistsTask = cachesDic.AddTask(this, "TotalExists", new Task<bool>(() =>
{
if (BaseImpl.HasExistsColumn(auditCommonModel.SystemTable, "isSum"))
{
return true;
}
return false;
}));
Task<DataTable> billMainInformationTask = cachesDic.AddTask(this, "BillMainInformation", new Task<DataTable>(() =>
{
return isBill ? BillAuditImpl.GetBillMainInformation(dynamicModel.ModuleCode) : BaseModuleImpl.GetBaseGridColumns(dynamicModel.ModuleCode);
@@ -280,7 +291,7 @@ namespace Lskj.Control
Task<DataTable> columnPropertiesTask = cachesDic.AddTask(dataRow, "ColumnProperties", new Task<DataTable>(() =>
{
string StepCode = flowList.Rows.Count > 1 && flowList.Columns.Contains("StepCode") ? dataRow["StepCode"] + "" : flowTypeStepModelTask.Result.StepCode;
DataTable dtColumns = BaseAuditImpl.GetGridColumns(auditCommonModel.SystemTable, dynamicModel.ModuleCode, StepCode, dynamicModel.UserName);
DataTable dtColumns = BaseAuditImpl.GetGridColumns(auditCommonModel.SystemTable, dynamicModel.ModuleCode, StepCode, dynamicModel.UserName, TotalExistsTask.Result);
dtColumns = this.GetTableColumnProperties(dtColumns, billMainInformationTask.Result);
return dtColumns;
}));
@@ -536,6 +547,19 @@ namespace Lskj.Control
{
dt = this.isBill ? BillAuditImpl.GetBillMainInformation(this.SysModel.ModuleCode) : BaseModuleImpl.GetBaseGridColumns(this.SysModel.ModuleCode);
}
if (!dataCaches.GetValue(this, "TotalExists", out bool TotalExists))
{
if (BaseImpl.HasExistsColumn(AuditComModelObj.SystemTable, "isSum"))
{
TotalExists = true;
}
}
tabMain.BeginUpdate();
foreach (DataRow row in tabPages.Rows)
{
@@ -578,7 +602,7 @@ namespace Lskj.Control
string StepCode = flowList.Rows.Count > 1 && flowList.Columns.Contains("StepCode") ? flowList.Rows[i - 1]["StepCode"] + "" : model.StepCode;
if (!dataCaches.GetValue(dataRow, "ColumnProperties", out DataTable dtColumns))
{
dtColumns = BaseAuditImpl.GetGridColumns(AuditComModelObj.SystemTable, this.SysModel.ModuleCode, StepCode, this.SysModel.UserName);
dtColumns = BaseAuditImpl.GetGridColumns(AuditComModelObj.SystemTable, this.SysModel.ModuleCode, StepCode, this.SysModel.UserName, TotalExists);
dtColumns = this.GetTableColumnProperties(dtColumns, dt);
}
if (!dataCaches.GetValue(dataRow, "AccraditationModel", out AccraditationModel accrModel))
@@ -959,7 +983,8 @@ namespace Lskj.Control
}
}
//string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true);
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true);
//string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true);
string result = this.AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true);
string tag = isBack ? "1" : "0";
if (result == "1")
@@ -999,7 +1024,7 @@ namespace Lskj.Control
}
else
{
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText));
if (!"9".Equals(result)) MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText));
}
}
//if (MessageUtil.Show(string.Format(ResourceKeys.ForcedReturnBill, billDocumentId), MessageBoxButtons.YesNo) == DialogResult.Yes)
@@ -1801,4 +1826,71 @@ namespace Lskj.Control
/// <summary>
/// <para>说明:设置分割条位置</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期
/// <para>创建日期2018-02-01 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void InitlizeSpiltLocation()
{
try
{
if (splitBelow.PanelVisibility == SplitPanelVisibility.Both)
{
string width = IniHelper.Read(string.Format("BelowDetai_width_{0}", this.SysModel.ModuleCode));//通过Key获取Value值
if (!string.IsNullOrEmpty(width))
{
this.splitBelow.SplitterPosition = Convert.ToInt32(width);
}
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 审核或反审
/// </summary>
public string AuditMethod(out string nextSelectStepCode,
out string nextSelectStepOper,
out string msgText,
DynamicModel sysModel,
string stepCode,
string billDocumentId,
string message,
string storedName,
string accractFlag,
string remindSelect,
string remarkText = "",
string remindOpers = "",
string confirmOpers = "",
bool ret = false,
int returnd = 0,
int selectConfirmFlag = 0,
bool IsStepOver = false,
int comfirm = 0
)
{
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out msgText, sysModel, stepCode, billDocumentId, message, storedName, accractFlag, remindSelect, remarkText, remindOpers, confirmOpers, ret, returnd, selectConfirmFlag, IsStepOver, comfirm);
if ("9".Equals(result))
{
// 继续执行保存
//if (string.IsNullOrWhiteSpace(msgText)) msgText = "失败";
if (MessageUtil.Show(msgText, MessageBoxButtons.YesNo) == DialogResult.Yes)
result = AuditMethod(out nextSelectStepCode, out nextSelectStepOper, out msgText, sysModel, stepCode, billDocumentId, message, storedName, accractFlag, remindSelect, remarkText, remindOpers, confirmOpers, ret, returnd, selectConfirmFlag, IsStepOver, 1);
}
return result;
}
}
}
@@ -1090,6 +1090,7 @@ namespace Lskj.Control
this._Handed = true;
try
{
if (obj == null) return;
AutoGridPopup popupObj = obj as AutoGridPopup;
string[] columnsWidth = Model != null && Model.LookUpFieldsWidth != null ? Model.LookUpFieldsWidth.Trim().TrimEnd(',').Split(',') : null;
if (Model != null && !string.IsNullOrWhiteSpace(Model.LookUpFieldsWidth) && columnsWidth.Length > 0)
@@ -1215,8 +1216,9 @@ namespace Lskj.Control
}
}
}
catch (Exception)
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
throw;
}
}
+54 -4
View File
@@ -93,6 +93,15 @@ namespace Lskj.Control
/// 滚动条位置改变回调
/// </summary>
public event EventHandler OnLeftCoordCallback;
/// <summary>
/// 虚拟列颜色
/// </summary>
public Dictionary<string, string> ColorDictionary = new Dictionary<string, string>();
/// <summary>
/// 虚拟列关联字段
/// </summary>
public string virtualPrimaryKey;
public BandedGridControlEx()
{
@@ -358,6 +367,19 @@ namespace Lskj.Control
}
}
}
if (e.RowHandle >= 0 && this.ColorDictionary.Count > 0 && !string.IsNullOrWhiteSpace(this.virtualPrimaryKey) && bandedGridView.Columns.ColumnByName(this.virtualPrimaryKey) != null)
{
DataRow gridRow = view.GetDataRow(e.RowHandle);
string key = gridRow[this.virtualPrimaryKey] +"^"+ e.Column.FieldName;
string value;
if (this.ColorDictionary.TryGetValue(key, out value))
{
//DataModel.TopModuleModel.ParmaryKey
e.Appearance.BackColor = ColorTranslator.FromHtml("#"+ value);
}
}
}
/// <summary>
/// 解析列名是否为日期模式
@@ -776,6 +798,10 @@ namespace Lskj.Control
//FixLeftItemClick(gridColumn, new EventArgs());
FrozenColumns.Add(gridColumn);
}
if (!string.IsNullOrWhiteSpace(model.PromptText))
{
PromptMessage.Add(model.FieldName, model.PromptText);
}
}
// 加载数据源
//BindDataSource();
@@ -969,6 +995,25 @@ namespace Lskj.Control
{
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
}
string PromptText = string.Empty;
// 判断单元格值是否为 null 或空
if (PromptMessage.TryGetValue(e.Column.FieldName, out PromptText) && (e.CellValue == null || string.IsNullOrEmpty(e.CellValue.ToString())))
{
// 绘制默认单元格背景
e.DefaultDraw();
// 绘制提示文本(灰色、斜体)
var appearance = e.Appearance;
appearance.ForeColor = Color.Gray;
appearance.FontStyleDelta = FontStyle.Italic;
e.Graphics.DrawString(PromptText, appearance.Font,
new SolidBrush(appearance.ForeColor), e.Bounds,
new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
// 标记事件已处理,避免默认绘制覆盖
e.Handled = true;
}
}
/// <summary>
/// <para>说明:重写绘制序号列</para>
@@ -1032,7 +1077,7 @@ namespace Lskj.Control
{
bandedGridView.OptionsView.ShowFooter = true;
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, "合计: {0:#,###}行") });
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, TotalFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
{
//bandedGridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, gridColumn, "合计: {0:#,###}行"));
@@ -1040,7 +1085,7 @@ namespace Lskj.Control
}
else
{
bandedGridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, "合计: {0:#,###}行") });
bandedGridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, TotalFormat) });
}
}
else
@@ -1273,7 +1318,7 @@ namespace Lskj.Control
}
if (col.VisibleIndex == 0)
{
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, "合计: {0:#,###}行") });
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, TotalFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
{
@@ -1282,7 +1327,7 @@ namespace Lskj.Control
}
else
{
GridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, null, "合计: {0:#,###}行") });
GridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, null, TotalFormat) });
}
}
@@ -3217,4 +3262,9 @@ namespace Lskj.Control
{
if (OnLeftCoordCallback != null)
{
OnLeftCoordCallback(sender, e);
}
}
/// <summary>
+11 -2
View File
@@ -630,11 +630,20 @@ namespace Lskj.Control
string sqlValue = string.Format("update {0} set {1}='0' ", this._tableName, this._importFlag);
sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", this._tableName, this._importFlag);
SqlHelper.ExecuteNonQuery(sqlValue);
DataRow dataRow = datatb.Rows[0];
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0)
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0 && datatb.Rows.Count>0)
{
try
{
DataRow dataRow = datatb.Rows[0];
SqlHelper.ExecuteNonQuery(ReplaceHelper.ReplaceRowParam(dataRow, ReplaceHelper.ReplaceUserInfo(SysModel.afterimportSql2)));
}
catch (Exception e)
{
MessageUtil.Show("导入后执行sql执行失败" + e.Message);
}
}
datatb.Clear();
dt.Clear();
if (failed > 0)
+24 -4
View File
@@ -108,7 +108,7 @@ namespace Lskj.Control
bool hasEn = false;
if (urlParams.Length > 1)
{
string[] queryParams = urlParams[1].Split('&');
string[] queryParams = string.Join("?", urlParams.Skip(1)).Split('&');
List<string> qpLS = new List<string>();
Hashtable pms = new Hashtable();
hasEn = queryParams.Any(str => str.Trim().StartsWith(enKey, StringComparison.OrdinalIgnoreCase));
@@ -119,12 +119,32 @@ namespace Lskj.Control
{
if (hasEn && eqParams[0].ToLower() == enKey)
{
enVal = eqParams[1];
enVal = string.Join("=", eqParams.Skip(1));
continue;
}
if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password")
{
pms.Add(eqParams[0], eqParams[1]);
pms.Add(eqParams[0], string.Join("=", eqParams.Skip(1)));
}
else
{
qpLS.Add(string.Format("{0}={1}", eqParams[0], HttpUtility.UrlEncode(HttpUtility.UrlDecode(string.Join("=", eqParams.Skip(1)))).Replace("%5c", "/").Replace("%2f", "/").Replace("//", "/")));
}
}
else
{
}
}
if (pms.Count > 0)
{
DateTime dateTime = DateTime.Now.AddDays(1);
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long timestamp = (dateTime.Ticks - epoch.Ticks) / TimeSpan.TicksPerSecond;
pms.Add("exp", timestamp);
}
return $"{urlParams[0]}?pms={HttpUtility.UrlEncode(hasEn ? Lskj.Web.Core.Util.safety.AESUtil.Encrypt(JSON.Encode(pms), enVal) : Lskj.Web.Core.Util.safety.AESUtil.MobileEncrypt(JSON.Encode(pms)))}&{qpLS.SJoin("&")}";
}
return url;
}
}
}
+235 -75
View File
@@ -264,6 +264,10 @@ namespace Lskj.Control
/// </summary>
public event ParseGridDataEventHandler OnParseGridDataCallBack;
/// <summary>
/// 所有数据粘贴完成后调用
/// </summary>
public event EventHandler OnAllAfterParseCallBack;
/// <summary>
/// Delegate GridColumnCallDLL
/// </summary>
/// <param name="rowItem">The row item.</param>
@@ -386,6 +390,11 @@ namespace Lskj.Control
/// 聚合多表头控件
/// </summary>
public TreeBandedGridControlEx CustomGroupTreeBandEx;
/// <summary>
/// 聚合界面是否冻结基本信息列
/// </summary>
public bool AggregationFreeze;
/// <summary>
/// 聚合多表头控件选中行
/// </summary>
@@ -431,6 +440,18 @@ namespace Lskj.Control
/// 进度条类型的列名称
/// </summary>
private List<string> ProgressBarColumn = new List<string>();
/// <summary>
/// 提示文本 字段(列名,提示信息)
/// </summary>
public Dictionary<string, string> PromptMessage = new Dictionary<string, string>();
/// <summary>
/// 合计行格式(设置成全局变量,更好的处理语言翻译的情况)
/// </summary>
public string TotalFormat = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("合计") + ": {0:#,###}" + Business.Impl.LanguageTranslation.GetTranslatedText("行") : "合计: {0:#,###}行";
/// <summary>
/// 搜索框 手动添加行
/// </summary>
public Dictionary<string, List<DataRow>> ManuallyAddData = new Dictionary<string, List<DataRow>>();
public GridControlEx()
@@ -689,11 +710,13 @@ namespace Lskj.Control
if (string.IsNullOrEmpty(model.MergeGroup)) return;
string[] fields = model.MergeGroup.Trim(',').Split(',');
bool handled = false;//默认合并
DataTable table = gridView.GridControl.DataSourceTable();
for (int i = 0; i < fields.Length; i++)
{
int row1 = e.RowHandle1;
int row2 = e.RowHandle2;
string McColumn = fields[i] + "";//关联条件列
if (!table.Columns.Contains(McColumn)) break;
string value1 = gridView.GetDataRow(row1)[McColumn].ToString();
string value2 = gridView.GetDataRow(row2)[McColumn].ToString();
if (value1 != value2)
@@ -1176,7 +1199,7 @@ namespace Lskj.Control
if (gridColumn.VisibleIndex >= 0 && this.isFirstVisableCol)
{
gridView.OptionsView.ShowFooter = true;
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, "合计: {0:#,###}行") });
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, TotalFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
{
//gridView.GroupSummary.Add(new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, "合计: {0:#,###}行"));
@@ -1184,7 +1207,7 @@ namespace Lskj.Control
}
else
{
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, "合计: {0:#,###}行") });
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, TotalFormat) });
}
@@ -1291,6 +1314,10 @@ namespace Lskj.Control
{
this.RepeatedVerificationNames.Add(model.FieldName);
}
if (!string.IsNullOrWhiteSpace(model.PromptText))
{
PromptMessage.Add(model.FieldName, model.PromptText);
}
}
@@ -1567,6 +1594,11 @@ namespace Lskj.Control
gridColumn.AppearanceCell.TextOptions.VAlignment = VertAlignment.Center;
gridColumn.AppearanceCell.TextOptions.WordWrap = WordWrap.Wrap;
}
if (!string.IsNullOrWhiteSpace(model.PromptText))
{
PromptMessage.Add(model.FieldName, model.PromptText);
}
}
DataTable customTable = this.gridView.GetCustomColumnByDatabase(this.CustomColumKey);
this.SetCustomColumns(customTable);
@@ -1693,6 +1725,11 @@ namespace Lskj.Control
gridColumn.AppearanceCell.TextOptions.VAlignment = VertAlignment.Center;
gridColumn.AppearanceCell.TextOptions.WordWrap = WordWrap.Wrap;
}
if (!string.IsNullOrWhiteSpace(model.PromptText))
{
PromptMessage.Add(model.FieldName, model.PromptText);
}
}
if (Model != null)
@@ -2541,7 +2578,7 @@ namespace Lskj.Control
if (col.VisibleIndex == 0)
{
isShowFooter = true;
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, "合计: {0:#,###}行") });
col.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, TotalFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
{
@@ -2550,7 +2587,7 @@ namespace Lskj.Control
}
else
{
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, null, "合计: {0:#,###}行") });
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, col.FieldName, null, TotalFormat) });
}
}
else
@@ -2643,8 +2680,13 @@ namespace Lskj.Control
{
if (SystemInfo.Instance.GridRowFontSize > 0)
{
this.gridView.Appearance.Row.Font = new Font("微软雅黑", SystemInfo.Instance.GridRowFontSize);
this.gridView.Appearance.HeaderPanel.Font = new Font("微软雅黑", SystemInfo.Instance.GridRowFontSize);
this.gridView.Appearance.Row.Font = new Font(this.gridView.Appearance.Row.Font.Name, SystemInfo.Instance.GridRowFontSize);
this.gridView.Appearance.HeaderPanel.Font = new Font(this.gridView.Appearance.HeaderPanel.Font.Name, SystemInfo.Instance.GridRowFontSize);
}
if (!string.IsNullOrWhiteSpace(SystemInfo.Instance.GridFontName))
{
this.gridView.Appearance.Row.Font = new Font(SystemInfo.Instance.GridFontName, this.gridView.Appearance.Row.Font.Size);
this.gridView.Appearance.HeaderPanel.Font = new Font(SystemInfo.Instance.GridFontName, this.gridView.Appearance.HeaderPanel.Font.Size);
}
if (SystemInfo.Instance.GridRowHeight > 0)
{
@@ -4102,7 +4144,8 @@ namespace Lskj.Control
gridControl.RepositoryItems.Add(searchEdit);
gridColumn.ColumnEdit = searchEdit;
searchEdit.View.Tag = searchEdit;
if (model.SearchBoxAddition && (ControlType.LabAutoCompleteText == model.FieldType || ControlType.LabAutoGridText == model.FieldType || ControlType.LabAutoGridTextParam == model.FieldType))
if (model.SearchBoxAddition) searchEdit.ProcessNewValue += SearchEdit_ProcessNewValue;
if ((ControlType.LabAutoCompleteText == model.FieldType || ControlType.LabAutoGridText == model.FieldType || ControlType.LabAutoGridTextParam == model.FieldType))
{
searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChangingAdd;
}
@@ -4110,12 +4153,108 @@ namespace Lskj.Control
{
searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChanging;
}
searchEdit.View.CustomDrawFilterPanel += OnCustomDrawFilterPanel;
searchEdit.View.Click += new EventHandler(View_Click);
this.mControlList.Add(model);
}
/// <summary>
/// 添加一个值到数据源中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SearchEdit_ProcessNewValue(object sender, ProcessNewValueEventArgs e)
{
try
{
GridLookUpEdit edit = sender as GridLookUpEdit;
GridColumnModel model = edit.Properties.Tag as GridColumnModel;
//RepositoryItemGridLookUpEdit searchEdit = edit.Properties;
RepositoryItemGridLookUpEdit searchEdit = GridView.Columns[model.FieldName].ColumnEdit as RepositoryItemGridLookUpEdit;
DataTable dt = (searchEdit.DataSource as DataTable);
BeginInvoke(new MethodInvoker(delegate ()
{
FilterLookup(sender, e.DisplayValue + "");
}));
if (true)
{
if (string.IsNullOrWhiteSpace(e.DisplayValue + "")) return;
string ValueName = searchEdit.View.Columns[0].FieldName;
string TextName = searchEdit.View.Columns[1].FieldName;
Type dataType = dt.Columns[ValueName].DataType;
DataRow newRow = dt.NewRow();
if (dataType.Name == "Int32")
{
int maxdm = Convert.ToInt32(searchEdit.View.Columns[ValueName].Tag);
edit.Properties.View.ActiveFilterString = string.Format(ValueName + "< {0}", maxdm);
int maxdmIndex = dt.AsEnumerable().Select(t => t.Field<int>(ValueName)).Max();
newRow[ValueName] = maxdmIndex + 1;
newRow[TextName] = e.DisplayValue + "";
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => (x[ValueName] + "").Equals(e.DisplayValue + "")) == null)
{
if (model.FieldType == ControlType.LabAutoGridValueParam || model.FieldType == ControlType.LabAutoGridTextParam || model.FieldType == ControlType.LabAutoCompleteTextParam || model.FieldType == ControlType.LabAutoCompleteValueParam)
{
if (this.ManuallyAddData.ContainsKey(model.FieldName))
{
List<DataRow> DataRows = this.ManuallyAddData[model.FieldName];
DataRows.Add(newRow);
}
else
{
List<DataRow> DataRows = new List<DataRow>();
DataRows.Add(newRow);
this.ManuallyAddData.Add(model.FieldName, DataRows);
}
}
dt.Rows.Add(newRow.ItemArray);
e.Handled = true;
}
}
else if (dataType.Name == "String")
{
newRow[ValueName] = e.DisplayValue + "";
newRow[TextName] = e.DisplayValue + "";
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => (x[TextName] + "").Equals(e.DisplayValue + "")) == null)
{
if (model.FieldType == ControlType.LabAutoGridValueParam || model.FieldType == ControlType.LabAutoGridTextParam || model.FieldType == ControlType.LabAutoCompleteTextParam || model.FieldType == ControlType.LabAutoCompleteValueParam)
{
if (this.ManuallyAddData.ContainsKey(model.FieldName))
{
List<DataRow> DataRows = this.ManuallyAddData[model.FieldName];
DataRows.Add(newRow);
}
else
{
List<DataRow> DataRows = new List<DataRow>();
DataRows.Add(newRow);
this.ManuallyAddData.Add(model.FieldName, DataRows);
}
}
dt.Rows.Add(newRow.ItemArray);
e.Handled = true;
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
finally
{
}
}
/// <summary>
/// 数据源中点击将数据源更新
/// </summary>
@@ -4192,15 +4331,41 @@ namespace Lskj.Control
{
FilterLookup(sender, e.NewValue + "");
}));
if (string.IsNullOrWhiteSpace(edit.AutoSearchText) && e.NewValue == "")
{
DataRow newRow = dt.NewRow();
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => x == newRow) == null)
{
dt.Rows.Add(newRow.ItemArray);
//if (string.IsNullOrWhiteSpace(edit.AutoSearchText) && e.NewValue == "")
//{
// DataRow newRow = dt.NewRow();
// if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => x == newRow) == null)
// {
// dt.Rows.Add(newRow.ItemArray);
// }
//}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 把输入值添加到数据源中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridLookUpEdit1_EditValueChangingAdd(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
try
{
GridLookUpEdit edit = sender as GridLookUpEdit;
RepositoryItemGridLookUpEdit searchEdit = edit.Properties;
DataTable dt = (searchEdit.DataSource as DataTable);
BeginInvoke(new MethodInvoker(delegate ()
{
FilterLookup(sender, e.NewValue + "");
}));
//if (true)
//{
@@ -4241,62 +4406,6 @@ namespace Lskj.Control
}
/// <summary>
/// 把输入值添加到数据源中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridLookUpEdit1_EditValueChangingAdd(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
try
{
GridLookUpEdit edit = sender as GridLookUpEdit;
RepositoryItemGridLookUpEdit searchEdit = edit.Properties;
DataTable dt = (searchEdit.DataSource as DataTable);
BeginInvoke(new MethodInvoker(delegate ()
{
FilterLookup(sender, e.NewValue + "");
}));
if (true)
{
if (string.IsNullOrWhiteSpace(e.NewValue + "")) return;
string ValueName = searchEdit.View.Columns[0].FieldName;
string TextName = searchEdit.View.Columns[1].FieldName;
Type dataType = dt.Columns[ValueName].DataType;
DataRow newRow = dt.NewRow();
if (dataType.Name == "Int32")
{
int maxdm = Convert.ToInt32(searchEdit.View.Columns[ValueName].Tag);
edit.Properties.View.ActiveFilterString = string.Format(ValueName + "< {0}", maxdm);
int maxdmIndex = dt.AsEnumerable().Select(t => t.Field<int>(ValueName)).Max();
newRow[ValueName] = maxdmIndex + 1;
newRow[TextName] = e.NewValue + "";
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => (x[ValueName] + "").Equals(e.NewValue + "")) == null)
{
dt.Rows.Add(newRow.ItemArray);
}
}
else if (dataType.Name == "String")
{
newRow[ValueName] = e.NewValue + "";
newRow[TextName] = e.NewValue + "";
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => (x[TextName] + "").Equals(e.NewValue + "")) == null)
{
dt.Rows.Add(newRow.ItemArray);
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:创建多选框</para>
@@ -5563,15 +5672,26 @@ namespace Lskj.Control
//OldPasteMethod(e, _objData);
NewPasteMethod(e, _objData);
}
if (OnAllAfterParseCallBack != null)
{
OnAllAfterParseCallBack(null, null);
}
}
// 向下复制整行
if (e.Control && e.Shift && e.KeyCode == Keys.C)
{
DataRow rt = this.gridView.GetDataRow(gridView.FocusedRowHandle);
if (rt != null)
{
DataTable dt = (DataTable)this.GridControl.DataSource;
dt.Rows.Add(rt.ItemArray);
//dt.Rows.Add(rt.ItemArray);
DataRow newRow = dt.NewRow();
newRow.ItemArray = rt.ItemArray;
dt.Rows.InsertAt(newRow, gridView.FocusedRowHandle + 1);
GridControl.DataSource = dt;
}
}
// 复制单元格
if (e.Control && e.KeyCode == Keys.C)
{
@@ -6328,6 +6448,25 @@ namespace Lskj.Control
e.Appearance.BackColor = ColorTranslator.FromHtml(SystemInfo.Instance.SelectRowBackColor);
}
}
string PromptText = string.Empty;
// 判断单元格值是否为 null 或空
if (PromptMessage.TryGetValue(e.Column.FieldName, out PromptText) && (e.CellValue == null || string.IsNullOrEmpty(e.CellValue.ToString())))
{
// 绘制默认单元格背景
e.DefaultDraw();
// 绘制提示文本(灰色、斜体)
var appearance = e.Appearance;
appearance.ForeColor = Color.Gray;
appearance.FontStyleDelta = FontStyle.Italic;
e.Graphics.DrawString(PromptText, appearance.Font,
new SolidBrush(appearance.ForeColor), e.Bounds,
new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
// 标记事件已处理,避免默认绘制覆盖
e.Handled = true;
}
}
catch (Exception ex)
{
@@ -6730,11 +6869,26 @@ namespace Lskj.Control
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
}
DataTable table = MainImpl.GetDataTableResult(sqlValue);
if (model.SearchBoxAddition && (model.FieldType == ControlType.LabAutoGridValueParam || model.FieldType == ControlType.LabAutoGridTextParam || model.FieldType == ControlType.LabAutoCompleteTextParam || model.FieldType == ControlType.LabAutoCompleteValueParam))
{
if (this.ManuallyAddData.ContainsKey(model.FieldName))
{
List<DataRow> DataRows = this.ManuallyAddData[model.FieldName];
foreach (DataRow row in DataRows)
{
DataRow newrow = table.NewRow();
newrow.ItemArray = row.ItemArray;
table.Rows.Add(newrow);
}
}
}
edit.Properties.DataSource = table;
string[] columnsWidth = model != null ? model.LookUpFieldsWidth.Trim().TrimEnd(',').Split(',') : null;
if (model != null && !string.IsNullOrWhiteSpace(model.LookUpFieldsWidth) && columnsWidth.Length > 0)
{
@@ -7556,7 +7710,11 @@ namespace Lskj.Control
/* ========= 2. 创建“基本信息”Band ========= */
List<GridColumnModel> normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0 || o.IsCustomGroupField == 3).ToList();
GridBand normalBand = new GridBand { Caption = "基本信息", Fixed = FixedStyle.Left };
GridBand normalBand = new GridBand { Caption = "基本信息" };
if (this.AggregationFreeze) normalBand.Fixed = FixedStyle.Left;
bandedGridControlEx.BandedView.Bands.Add(normalBand);
foreach (var normalCol in normalColumns)
@@ -7689,7 +7847,9 @@ namespace Lskj.Control
/* ========= 2. 创建“基本信息”Band ========= */
List<GridColumnModel> normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0 || o.IsCustomGroupField == 3).ToList();
DevExpress.XtraTreeList.Columns.TreeListBand normalBand = new DevExpress.XtraTreeList.Columns.TreeListBand { Caption = "基本信息", Fixed = DevExpress.XtraTreeList.Columns.FixedStyle.Left };
DevExpress.XtraTreeList.Columns.TreeListBand normalBand = new DevExpress.XtraTreeList.Columns.TreeListBand { Caption = "基本信息" };
if (this.AggregationFreeze) normalBand.Fixed = DevExpress.XtraTreeList.Columns.FixedStyle.Left;
normalBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
normalBand.AppearanceHeader.Options.UseTextOptions = true;
TreeBandedGridControlEx.TreeListObj.Bands.Add(normalBand);
@@ -453,6 +453,10 @@ namespace Lskj.Control.Model
///单据来源控件(弹出控件根据下拉框中的单据来源id加载数据)
/// </summary>
public const int LabBillSource = -11;
/// <summary>
///提示框
/// </summary>
public const int LabPrompt = 166;
/// <summary>
/// <para>说明:是否为Value类型</para>
@@ -375,7 +375,10 @@ namespace Lskj.Control.Model
/// 编辑框格式化(和显示格式一致)
/// </summary>
public bool FormatEditBox;
/// <summary>
/// 单元格内容为空时的提示信息
/// </summary>
public string PromptText;
#endregion
@@ -470,4 +473,5 @@ namespace Lskj.Control.Model
this.ImportConversionFormat = item.Table.Columns.Contains("ImportConversionFormat") ? item["ImportConversionFormat"]+"" : string.Empty;
this.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : string.Empty;
this.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : string.Empty;
this.AdditionalAssociations = item.Table.Col
this.AdditionalAssociations = item.Table.Columns.Contains("AdditionalAssociations") ? "1".Equals(item["AdditionalAssociations"] + "") : false;
thi
@@ -121,7 +121,7 @@ namespace Lskj.Control.Model
/// </summary>
public bool IsDrag;
/// <summary>
/// 拖拽模式下是否可以拖拽明细
/// 明细替换左侧表格
/// </summary>
public bool IsUnionleft;
/// <summary>
@@ -283,6 +283,7 @@ namespace Lskj.Control.Model
/// </summary>
public string PlanLetfControl;
/// <summary>
/// 主模块编号
/// </summary>
@@ -46,7 +46,7 @@ namespace Lskj.Control.Model
/// </summary>
public bool isAllowDrag = true;
/// <summary>
/// 拖拽是否忽视节点
/// 拖拽是否忽视节点(不忽视必须要推拽到节点上)
/// </summary>
public bool NeglectingNodes = false;
/// <summary>
@@ -269,27 +269,4 @@ namespace Lskj.Control.Model
{
if (treeNode == null) return;
if (treeNode.Nodes.Count() > 0 && !CanDragParentNode)
{
MessageUtil.Show(string.Format(ResourceKeys.UnLastTreeNode, treeNode.GetDisplayText(treeListGrid.KeyFieldName)));
return;
}
}
if (!e.Data.GetDataPresent(typeof(TreeNode)))
{
if (OnDragComplete != null)
{
GridDragTreeGridArgs args = new GridDragTreeGridArgs();
args.GridViewObj = this._gridView;
args.TreeListObj = this._treeListGrid;
args.GridViewSelectRows = this.GetGridSelectRows(this._gridView.GetSelectedRows());
args.SelectTreeNode = treeNode;
args.BeforeTreeNode = this._beforeListNode;
OnDragComplete(sender, args);
}
}
}
}
}
}
if (treeNode.Nod
+35 -2
View File
@@ -1189,6 +1189,23 @@ namespace Lskj.Control.Model
opxls.ExportType = DevExpress.Export.ExportType.WYSIWYG;
BandedGridControlEx NewBandedGridControlEx = export.ReplaceBitColumn(bandedGridControlEx);
BandedGridView gridView = NewBandedGridControlEx.GridView as BandedGridView;
if (SystemInfo.Instance.ExportClearItemSource)
{
foreach (GridColumn column in gridView.Columns)//取消表格列下拉控件
{
if (column.ColumnEdit != null && column.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit)
{
column.ColumnEdit = null;
}
//if (column.ColumnEdit != null && column.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit)
//{
// column.ColumnEdit = null;
//}
}
}
gridView.OptionsPrint.PrintHeader = true;
gridView.OptionsPrint.AutoWidth = false;
DataTable dataTable = gridView.GetGridViewFilteredAndSortedDataToDataTable();//获取数据表
@@ -1329,6 +1346,10 @@ namespace Lskj.Control.Model
{
column.ColumnEdit = null;
}
//if (column.ColumnEdit != null && column.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit)
//{
// column.ColumnEdit = null;
//}
}
}
@@ -1557,6 +1578,10 @@ namespace Lskj.Control.Model
{
column.ColumnEdit = null;
}
//if (column.ColumnEdit != null && column.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit)
//{
// column.ColumnEdit = null;
//}
}
}
@@ -3160,11 +3185,19 @@ namespace Lskj.Control.Model
string sqlValue = string.Format("update {0} set {1}='0' ", SysModel.MenuTable, _importFlag);
sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", SysModel.MenuTable, _importFlag);
SqlHelper.ExecuteNonQuery(sqlValue);
DataRow dataRow = datatb.Rows[0];
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0)
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0 && datatb.Rows.Count > 0)
{
try
{
DataRow dataRow = datatb.Rows[0];
SqlHelper.ExecuteNonQuery(ReplaceHelper.ReplaceRowParam(dataRow, ReplaceHelper.ReplaceUserInfo(SysModel.afterimportSql2)));
}
catch (Exception e)
{
MessageUtil.Show("导入后执行sql执行失败" + e.Message);
}
}
datatb.Clear();
@@ -579,7 +579,7 @@ namespace Lskj.Control.Model
//LogUtil.WriteDebug(model.MenuTabName, "打印", "右键打印:"+ model.MenuName, "打印格式:" + paramList[1]);
break;
case 4://调用主程序右键直接添加到page上
resultValue = ExecDynamicLinkLibary(model, paramList, dllName, true);
resultValue = ExecDynamicLinkLibary(model, paramList, dllName, true, rowData);
break;
case 5://执行存储过程获取下载url集合执行批量下载
resultValue = ExecDownloadFiles(model, paramList, rows);
@@ -587,6 +587,9 @@ namespace Lskj.Control.Model
case 6://下载后打开文件
resultValue = OpenAfterDownloading(model, paramList);
break;
case 7://打开导入覆盖控件
resultValue = OpenFrmcCover(model, paramList);
break;
case 0: // 执行sql语句
resultValue = ExecSqlValue(model, rowData, actionSql);
break;
@@ -613,6 +616,69 @@ namespace Lskj.Control.Model
}
public bool OpenFrmcCover(GridRightMenuModel model, List<string> paramList)
{
if (string.IsNullOrWhiteSpace(paramList[1]) || string.IsNullOrWhiteSpace(paramList[2]))
{
MessageUtil.Show("模块编号或主键名称未配置");
return false;
}
string primaryKey = paramList[2];
FrmCover frmCover = new FrmCover(paramList[1], paramList[2]);
if (frmCover.ShowDialog() == DialogResult.OK)
{
//反写数据源
DataTable ReverseData = frmCover.ReverseData;
//外部数据
DataTable table = GetDataTable();
// 2. 筛选出 ReverseData 和 table 中名称和数据类型都相同的列(排除主键列,避免重复赋值)
var commonColumns = ReverseData.Columns.Cast<DataColumn>()
.Where(col1 => col1.ColumnName != primaryKey // 跳过 id 列(无需更新)
&& table.Columns.Contains(col1.ColumnName) // 列名存在于 table2
)
.Select(col => col.ColumnName)
.ToList();
if (!commonColumns.Any())
{
// 没有可匹配的列,直接返回
return false;
}
// 3. 遍历 导入数据 的每一行,根据主键匹配 外部数据 的行并更新
foreach (DataRow row1 in ReverseData.Rows)
{
// 获取当前行的主键值
var idValue = row1[primaryKey];
if (idValue == DBNull.Value)
continue; // 跳过 id 为空的行
// 在 table2 中查找 id 匹配的行(使用 Select 方法快速定位)
DataRow[] matchedRows = table.Select($""+ primaryKey + " = '"+ idValue + "'");
// 只处理找到唯一匹配行的情况
if (matchedRows.Length == 1)
{
DataRow row2 = matchedRows[0];
// 遍历所有相同列,将 反写数据源 的值赋给 外部数据源
foreach (string colName in commonColumns)
{
// 避免将 DBNull 赋值给不允许为空的列(可选处理)
if (row2[colName] != DBNull.Value || ReverseData.Columns[colName].AllowDBNull)
{
row2[colName] = row1[colName];
}
}
}
}
}
return true;
}
/// <summary>
/// 下载后打开程序
/// </summary>
@@ -753,7 +819,7 @@ namespace Lskj.Control.Model
catch (Exception)
{
result = 0;
if (result==0 && ERPInfo.Instance.UserName.Equals("管理员"))
if (result==0 )
{
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag );
}
@@ -773,7 +839,7 @@ namespace Lskj.Control.Model
switch (rValue)
{
case -1:
if (rValue == -1 && ERPInfo.Instance.UserName.Equals("管理员"))
if (rValue == -1)
{
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
}
@@ -909,7 +975,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, string dllName, bool isAddPage = false)
private bool ExecDynamicLinkLibary(GridRightMenuModel model, List<string> paramList, string dllName, bool isAddPage = false,DataRow rowData = null)
{
if (string.IsNullOrWhiteSpace(dllName))
{
@@ -1124,6 +1190,12 @@ namespace Lskj.Control.Model
string guid = Guid.NewGuid().ToString();
XtraTabPage tp = new XtraTabPage();
tp.Text = model.MenuName;
if (!string.IsNullOrWhiteSpace(model.PageName))
{
tp.Text = ReplaceHelper.ReplaceRowParam(rowData, model.PageName).Trim();
}
tp.Tag = guid;
// 这个必须有不然会提示:"不能向tabControl中添加顶级控件"
form.SubForm.TopLevel = false;
@@ -1669,6 +1741,17 @@ namespace Lskj.Control.Model
{
return null;
}
/// <summary>
/// 获取外面的数据源
/// </summary>
/// <returns></returns>
protected virtual DataTable GetDataTable()
{
return null;
}
/// <summary>
/// <para>说明:处理右键菜单10个扩展参数</para>
/// <para>创建人:龚宇超</para>
@@ -191,6 +191,12 @@ namespace Lskj.Control.Model
{
return this.GridControlObj.GetViewFocusedDataRows();
}
protected override DataTable GetDataTable()
{
return this.GridControlObj.GridControl.DataSourceTable();
}
protected override void MenuStripClickBefore(ToolStripMenuItem item, GridRightMenuModel model)
{
this._oldSelectRows = this._gridView.GetSelectedRows();
@@ -323,7 +323,10 @@ namespace Lskj.Control.Model
/// sql执行成功不提示
/// </summary>
public bool DisableSuccessfulPrompt;
/// <summary>
/// 页签名称(审核模块以页签形式打开,可以配置单据id)
/// </summary>
public string PageName;
/// <summary>
/// 需要单独处理的exe程序
@@ -447,4 +450,5 @@ namespace Lskj.Control.Model
this.ExecuteFirstCode = item["ExecuteFirstCode"] + "";
if (item.Table.Columns.Contains("DuringExecutionMinimize"))
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
if
if (item.Table.Columns.Contains("SqlDirectExecution"))
this.SqlDirectExecution = string.IsNullOrWhi
@@ -38,6 +38,13 @@ namespace Lskj.Control.Model.MenuStrip
{
return this.TreeGridControlObj.GetViewFocusedDataRows();
}
protected override DataTable GetDataTable()
{
return this.TreeGridControlObj.GetGridViewDataSource();
}
protected override List<string> HandleRightMenuParams(List<string> paramList, DataRow rowData, DataRow[] rowDatas = null, int actionType = 0)
{
List<string> handleParamList = base.HandleRightMenuParams(paramList, rowData, rowDatas, actionType);
+8 -2
View File
@@ -2897,7 +2897,8 @@ namespace Lskj.Control.Model
leftField.Equals(model.FieldName) ||
"ID".Equals(model.FieldName, StringComparison.CurrentCultureIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx || !tableColumns.Columns.Contains(model.FieldName) ||
model.FieldType == ControlType.LabPicEx ||
model.FieldType == ControlType.LabPrompt || !tableColumns.Columns.Contains(model.FieldName) ||
Autogrowcolumn.ToLower() == model.FieldName.ToLower())
continue;
string fieldValue = this.GetControlValue(model);
@@ -2939,7 +2940,8 @@ namespace Lskj.Control.Model
leftField.Equals(model.FieldName) ||
"ID".Equals(model.FieldName, StringComparison.CurrentCultureIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx || !tableColumns.Columns.Contains(model.FieldName) ||
model.FieldType == ControlType.LabPicEx ||
model.FieldType == ControlType.LabPrompt || !tableColumns.Columns.Contains(model.FieldName) ||
Autogrowcolumn.ToLower() == model.FieldName.ToLower())
continue;
BaseUserControl userControl = this.FindControl(model);
@@ -4644,6 +4646,10 @@ namespace Lskj.Control.Model
if (!isLoadBorder) billSourceComboxEdit.TextEdit.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
baseControl = billSourceComboxEdit;
break;
case ControlType.LabPrompt:
LabelPrompt labelPrompt = new LabelPrompt();
baseControl = labelPrompt;
break;
case ControlType.LabText:
case ControlType.LabTextInt:
default:
+2 -30
View File
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraSplashScreen;
using Lskj.Business.Impl;
using Lskj.Data;
namespace Lskj.Control.Model
@@ -49,33 +50,4 @@ namespace Lskj.Control.Model
public static void ShowForm(string msg = null)
{
_dataMsg = msg ?? ResourceKeys.DataLoading;
bool flag = !LoadForm.IsSplashFormVisible;
if (flag)
{
_loadForm.ShowWaitForm();
_loadForm.SetWaitFormCaption(_dataMsg);
}
else
{
_loadForm.SetWaitFormCaption(_dataMsg);
}
}
/// <summary>
/// <para>说明:关闭等待窗体</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-11 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
public static void HideForm()
{
bool isSplashFormVisible = LoadForm.IsSplashFormVisible;
if (isSplashFormVisible)
{
_loadForm.CloseWaitForm();
}
}
}
}
if (LanguageTrans
+3 -1
View File
@@ -1471,7 +1471,7 @@ namespace Lskj.Control
{
string dragCond = ReplaceHelper.ReplaceRowParam(e.SelectGridRow, this.SysModel.DragCond);
int successCount = 0, faultCount = 0;
string ErrorMessage = string.Empty;
foreach (DataRow item in e.GridViewSelectRows)
{
try
@@ -1500,6 +1500,7 @@ namespace Lskj.Control
{
faultCount++;
LogHelper.Instance.WriteError(ex1);
ErrorMessage += ex1.InnerException.Message + "\r\n";
}
}
@@ -1507,6 +1508,7 @@ namespace Lskj.Control
if (successCount > 0) tip = string.Format(ResourceKeys.DragSuccessCount, successCount);
if (faultCount > 0) tip += (tip == "" ? "" : "\r\n") +
string.Format(ResourceKeys.DragFaultCount, faultCount);
if (!string.IsNullOrWhiteSpace(ErrorMessage)) tip = tip + "\r\n" + ErrorMessage.TrimEnd('\r', '\n');
MessageUtil.Show(tip);
SearchObj.SearchLastGrid();
+33 -3
View File
@@ -136,6 +136,13 @@ namespace Lskj.Control
/// 是否为主表汇总模式
/// </summary>
public bool IsDynamicDetailType = false;
/// <summary>
/// 数量后缀
/// </summary>
public string QuantitySuffix = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("条") + ")" : "条)";
public ModuleGridDetailEx()
{
InitializeComponent();
@@ -780,7 +787,7 @@ namespace Lskj.Control
grdExAdditional.CreateChart(table);
}
tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + "条)";
tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + QuantitySuffix;
tabPage.Appearance.Header.ForeColor = firstTable.Rows.Count > 0 ? Color.Red : Color.FromArgb(0, 0, 0);
}
else
@@ -811,7 +818,7 @@ namespace Lskj.Control
if (model.SystemModel != null && 1 == model.SystemModel.isFirstLoad)
{
(tabPage.Tag as GridControlEx).ParentControl.SearchGrid();
tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)";
tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + QuantitySuffix;
}
}
@@ -878,6 +885,25 @@ namespace Lskj.Control
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
}
//如果有{parent.key},就替换为左侧的主键
//if (sqlValue.Contains("{parent.key}"))
//{
// string parentValue = string.Empty;
// if (this.ModuleGridObj.LeftTreeViewEx != null)
// {
// parentValue= this.ModuleGridObj.LeftTreeViewEx.TreeView.SelectedNode.Name;
// }
// else if (this.ModuleGridObj.LeftGridEx != null)
// {
// DataRow dataRow = this.ModuleGridObj.LeftGridEx.GridView.GetFocusedDataRow();
// if (this.ModuleGridObj.LeftGridEx is TreeGridControlEx) dataRow = this.ModuleGridObj.LeftGridEx.GetViewFocusedDataRow();
// parentValue = dataRow[this.ModuleGridObj.ParentKeyField] + "";
// }
// sqlValue = ReplaceHelper.ReplaceParamToValue(sqlValue, "{parent.key}", parentValue);
//}
//sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
DataRow row = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow();
if (row != null && isLeft)
@@ -1339,7 +1365,11 @@ namespace Lskj.Control
GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage);
if (model != null)
{
if (tabPage.Tag is GridControlEx)
if (tabPage.Tag is TreeGridControlEx)
{
(tabPage.Tag as TreeGridControlEx).RefreshDataSource();
}
else if (tabPage.Tag is GridControlEx)
{
(tabPage.Tag as GridControlEx).RefreshDataSource();
}
+38 -3
View File
@@ -44,6 +44,7 @@ using System.Threading.Tasks;
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraTreeList.Nodes;
namespace Lskj.Control
{
@@ -958,6 +959,7 @@ namespace Lskj.Control
// 明确设置禁止自动调整列宽
bandedGridControlEx.BandedView.OptionsView.ColumnAutoWidth = false;
gcMain.CustomGroupBandEx = bandedGridControlEx;
gcMain.AggregationFreeze = this.SysModel.AggregationFreeze;
this.panelControl1.Controls.Add(bandedGridControlEx);
bandedGridControlEx.BringToFront();
}
@@ -971,6 +973,7 @@ namespace Lskj.Control
// 明确设置禁止自动调整列宽
treeBandedGridControlEx.TreeListObj.OptionsView.AutoWidth = false;
gcMain.CustomGroupTreeBandEx = treeBandedGridControlEx;
gcMain.AggregationFreeze = this.SysModel.AggregationFreeze;
this.panelControl1.Controls.Add(treeBandedGridControlEx);
treeBandedGridControlEx.BringToFront();
}
@@ -1148,7 +1151,8 @@ namespace Lskj.Control
int FontSize = string.IsNullOrEmpty(GridRowFont["FontSize"] + "") ? 0 : Convert.ToInt32(GridRowFont["FontSize"] + "");
if (FontSize > 0)
{
this.gcMain.GridView.Appearance.Row.Font = new Font("微软雅黑", FontSize);
//this.gcMain.GridView.Appearance.Row.Font = new Font("微软雅黑", FontSize);
this.gcMain.GridView.Appearance.Row.Font = new Font(this.gcMain.GridView.Appearance.Row.Font.FontFamily, FontSize);
}
if (SysModel.RowHeight > 0)
{
@@ -1764,7 +1768,17 @@ namespace Lskj.Control
{
// 表格添加
DataRow rowItem = LeftGridEx.GridView.GetFocusedDataRow();
if (LeftGridEx is TreeGridControlEx) rowItem = LeftGridEx.GetViewFocusedDataRow();
if (LeftGridEx is TreeGridControlEx)
{
TreeListNode selectedNode = (LeftGridEx as TreeGridControlEx).TreeListObj.FocusedNode;
if (selectedNode.HasChildren && (!SystemInfo.Instance.AddingARootNode && !this.SysModel.selectLeaf))
{
MessageUtil.Show(ResourceKeys.SelectedNodeContainNode);
return;
}
rowItem = LeftGridEx.GetViewFocusedDataRow();
}
if (rowItem == null)
{
MessageUtil.Show(ResourceKeys.SelectRowIsNull);
@@ -1967,6 +1981,16 @@ namespace Lskj.Control
string unioright = sender + "";
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
DataRow rightrowitem = this.GridControlObj.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x => (x["orderid"] + "").Equals(unioright));
GridRightMenuModel model = new GridRightMenuModel(rightrowitem);
if (!string.IsNullOrWhiteSpace(model.MenuCond))
{
//判断条件
DataRow row = this.gcMain.GridView.GetFocusedDataRow();
string cond = ReplaceHelper.ReplaceRowParam(row, model.MenuCond);
bool condResult = ValidateCond(cond, null);
if (!condResult) return;
}
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj, this.gcMain);
menu.Apply(rightrowitem);
}
@@ -2185,7 +2209,18 @@ namespace Lskj.Control
else if (LeftGridEx != null && !this.SysModel.AnyAdd)
{
DataRow row = LeftGridEx.GridView.GetFocusedDataRow();
if (LeftGridEx is TreeGridControlEx) row = LeftGridEx.GetViewFocusedDataRow();
if (LeftGridEx is TreeGridControlEx)
{
TreeListNode selectedNode = (LeftGridEx as TreeGridControlEx).TreeListObj.FocusedNode;
if (selectedNode.HasChildren && (!SystemInfo.Instance.AddingARootNode && !this.SysModel.selectLeaf))
{
MessageUtil.Show(ResourceKeys.SelectedNodeContainNode);
return;
}
row = LeftGridEx.GetViewFocusedDataRow();
}
if (row != null && _leftGridField != null)
{
mLeftFieldId = row[_leftGridField["fieldsqlid"] + ""] + "";
+5
View File
@@ -1178,6 +1178,11 @@ namespace Lskj.Control
if (!dataCaches.GetValue(detailEx, "SysModel", out model.SystemModel))
model.SystemModel = new ModuleModel(moduleRow);
if (model.SystemModel.GridObjIsCheck == 1)//主表加载复选框
{
GridDragGrid.GridAddCheckBox(detailEx.ModuleGridObj.GridControlObj.GridView);
}
// 子明细集合
if (!dataCaches.GetValue(detailEx, "Details", out List<GridDetailModel> details))
details = GetDetails(model.SystemModel.ModeCode);
+3 -3
View File
@@ -362,7 +362,7 @@ namespace Lskj.Control
}
finally
{
if (this.ParentControlEx != null) this.ParentControlEx.SearchGrid();
if (this.ParentControlEx != null&& this.ParentControlEx.MainGridEx != null) this.ParentControlEx.SearchGrid();
//gridEx1.SearchObj.SearchLastGrid();
//gridEx2.SearchObj.SearchLastGrid();
DataRow rowItem = this.ParentGridEx.GetViewFocusedDataRow();
@@ -388,11 +388,11 @@ namespace Lskj.Control
{
if (i == 0)
{
gridEx1.SearchObj.SearchGrid();
gridEx1.SearchObj.SearchLastGrid();
}
else if (1 == 1)
{
gridEx2.SearchObj.SearchGrid();
gridEx2.SearchObj.SearchLastGrid();
}
}
i++;
+38 -1
View File
@@ -105,6 +105,7 @@ namespace Lskj.Control
this.gcMain.CustomDrawFooterCell += GcMain_CustomDrawFooterCell;
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
this.SetGridRowHeightAndFont();
@@ -115,6 +116,10 @@ namespace Lskj.Control
}
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
#region LabPicUrl控件实现事件
LabPicUrlPreview_TreeList.Attach(this.gcMain); // 必须
LabPicUrlPreview_TreeList.AttachPreview(this.gcMain); // 新增(双击预览)
#endregion
//InitializeTreeMethod();
//this.gcMain.OptionsBehavior.EnableFiltering = true;
//this.gcMain.OptionsFind.AlwaysVisible = true;
@@ -419,6 +424,7 @@ namespace Lskj.Control
{
this.gcMain.CollapseAll();
}
//if (selectRowHandler)
//{
// this.TreeListObj.FocusedNode = this.TreeListObj.GetNodeByVisibleIndex(lastNodeIndex);
@@ -595,6 +601,10 @@ namespace Lskj.Control
case ControlType.LabPic:
InitPicEdit(column);
break;
case ControlType.LabPicUrl:
// 用工具类创建图片列(绑定 Tag、Repository、UnboundType
LabPicUrlPreview_TreeList.InitPicColumn(this.gcMain, column, model);
break;
case ControlType.LabSelectReturnId:
case ControlType.LabSelectReturnText:
InitSelectReturnId(column, model);
@@ -2377,6 +2387,7 @@ namespace Lskj.Control
GetTreeExpanded();
this.gcMain.ClearNodes();
this.gcMain.DataSource = table;
this.AdjustIndicatorWidthSmart();
this.SetAutoColumns();
}
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
@@ -2433,7 +2444,9 @@ namespace Lskj.Control
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
GetTreeExpanded();
this.gcMain.DataSource = dataSet.Tables[0];
this.AdjustIndicatorWidthSmart();
this.SetAutoColumns();
if ((Expansion + "").Equals("1"))
@@ -2449,6 +2462,7 @@ namespace Lskj.Control
this.gcMain.CollapseAll();
}
return dataSet.Tables[0] != null ? dataSet.Tables[0].Rows.Count : 0;
}
@@ -3803,7 +3817,7 @@ namespace Lskj.Control
try
{
TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
tree.IndicatorWidth = 30;
if(tree.IndicatorWidth<30) tree.IndicatorWidth = 30;
DevExpress.Utils.Drawing.IndicatorObjectInfoArgs args = e.ObjectArgs as DevExpress.Utils.Drawing.IndicatorObjectInfoArgs;
args.DisplayText = (tree.GetVisibleIndexByNode(e.Node) + 1).ToString();
@@ -4536,3 +4550,26 @@ namespace Lskj.Control
if (model.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true;
}
//必填
if (Required && RequiredFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
{
item.AppearanceHeader.Options.UseForeColor = true;
item.AppearanceHeader.ForeColor = RequiredForceColor;
}
}
}
/// <summary>
/// <para>说明:刷新数据源</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2023-9-30 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="UpdateColumnRefresh">判断是否只刷新Upd