提交单据管理和修改密码功能

This commit is contained in:
cyf
2026-07-28 10:16:51 +08:00
parent e4b40a32d7
commit b893e8d8e4
75 changed files with 16227 additions and 309 deletions
+26 -16
View File
@@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tabMain = new DevExpress.XtraTab.XtraTabControl();
this.tabpage_finish = new DevExpress.XtraTab.XtraTabPage();
this.gridFinish = new Lskj.Control.GridControlEx();
@@ -51,8 +50,8 @@
this.btnReverseSelection = new DevExpress.XtraEditors.SimpleButton();
this.btnSelectAll = new DevExpress.XtraEditors.SimpleButton();
this.dpb_Tools = new DevExpress.XtraEditors.DropDownButton();
this.p_menu = new DevExpress.XtraBars.PopupMenu(this.components);
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
this.p_menu = new DevExpress.XtraBars.PopupMenu();
this.barManager1 = new DevExpress.XtraBars.BarManager();
this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
@@ -85,7 +84,7 @@
this.tabMain.Location = new System.Drawing.Point(0, 0);
this.tabMain.Name = "tabMain";
this.tabMain.SelectedTabPage = this.tabpage_finish;
this.tabMain.Size = new System.Drawing.Size(1051, 683);
this.tabMain.Size = new System.Drawing.Size(1051, 701);
this.tabMain.TabIndex = 20;
this.tabMain.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.tabpage_finish});
@@ -96,7 +95,7 @@
this.tabpage_finish.Controls.Add(this.splitBelow);
this.tabpage_finish.Controls.Add(this.pl_top);
this.tabpage_finish.Name = "tabpage_finish";
this.tabpage_finish.Size = new System.Drawing.Size(1045, 654);
this.tabpage_finish.Size = new System.Drawing.Size(1045, 672);
this.tabpage_finish.Text = "已完成单据";
//
// gridFinish
@@ -108,13 +107,14 @@
this.gridFinish.Margin = new System.Windows.Forms.Padding(4);
this.gridFinish.Name = "gridFinish";
this.gridFinish.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFinish.Size = new System.Drawing.Size(1045, 322);
this.gridFinish.Size = new System.Drawing.Size(1045, 340);
this.gridFinish.SysModel = null;
this.gridFinish.TabIndex = 29;
//
// splitBelow
//
this.splitBelow.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitBelow.Location = new System.Drawing.Point(0, 361);
this.splitBelow.Location = new System.Drawing.Point(0, 379);
this.splitBelow.Name = "splitBelow";
this.splitBelow.Panel1.Controls.Add(this.gridFlow);
this.splitBelow.Panel1.Text = "Panel1";
@@ -134,6 +134,7 @@
this.gridFlow.Name = "gridFlow";
this.gridFlow.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridFlow.Size = new System.Drawing.Size(453, 293);
this.gridFlow.SysModel = null;
this.gridFlow.TabIndex = 19;
//
// gridDetail
@@ -145,6 +146,7 @@
this.gridDetail.Name = "gridDetail";
this.gridDetail.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridDetail.Size = new System.Drawing.Size(587, 293);
this.gridDetail.SysModel = null;
this.gridDetail.TabIndex = 20;
//
// pl_top
@@ -174,6 +176,8 @@
// labeldate_start
//
this.labeldate_start.BackColor = System.Drawing.Color.Transparent;
this.labeldate_start.BackgroundColor = System.Drawing.Color.Empty;
this.labeldate_start.ContentBold = false;
this.labeldate_start.EditText = null;
this.labeldate_start.FontSize = 0F;
this.labeldate_start.LabelText = "终审时间起";
@@ -190,6 +194,8 @@
// labelcheck_finalAuditor
//
this.labelcheck_finalAuditor.BackColor = System.Drawing.Color.Transparent;
this.labelcheck_finalAuditor.BackgroundColor = System.Drawing.Color.Empty;
this.labelcheck_finalAuditor.ContentBold = false;
this.labelcheck_finalAuditor.EditText = null;
this.labelcheck_finalAuditor.FontSize = 0F;
this.labelcheck_finalAuditor.LabelText = "终审人";
@@ -206,6 +212,8 @@
// labeltxt_dataFlag
//
this.labeltxt_dataFlag.BackColor = System.Drawing.Color.Transparent;
this.labeltxt_dataFlag.BackgroundColor = System.Drawing.Color.Empty;
this.labeltxt_dataFlag.ContentBold = false;
this.labeltxt_dataFlag.EditText = "";
this.labeltxt_dataFlag.FontSize = 0F;
this.labeltxt_dataFlag.LabelText = "数据标识号";
@@ -233,6 +241,8 @@
// labeldate_end
//
this.labeldate_end.BackColor = System.Drawing.Color.Transparent;
this.labeldate_end.BackgroundColor = System.Drawing.Color.Empty;
this.labeldate_end.ContentBold = false;
this.labeldate_end.EditText = null;
this.labeldate_end.FontSize = 0F;
this.labeldate_end.LabelText = "终审时间止";
@@ -313,9 +323,9 @@
this.pl_bottom.Controls.Add(this.label_tips);
this.pl_bottom.Controls.Add(this.label_date);
this.pl_bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_bottom.Location = new System.Drawing.Point(0, 683);
this.pl_bottom.Location = new System.Drawing.Point(0, 693);
this.pl_bottom.Name = "pl_bottom";
this.pl_bottom.Size = new System.Drawing.Size(1051, 32);
this.pl_bottom.Size = new System.Drawing.Size(1051, 21);
this.pl_bottom.TabIndex = 21;
//
// btnReverseSelection
@@ -323,7 +333,7 @@
this.btnReverseSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnReverseSelection.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.btnReverseSelection.Appearance.Options.UseFont = true;
this.btnReverseSelection.Location = new System.Drawing.Point(586, 3);
this.btnReverseSelection.Location = new System.Drawing.Point(586, -8);
this.btnReverseSelection.Name = "btnReverseSelection";
this.btnReverseSelection.Size = new System.Drawing.Size(55, 26);
this.btnReverseSelection.TabIndex = 13;
@@ -336,7 +346,7 @@
this.btnSelectAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSelectAll.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.btnSelectAll.Appearance.Options.UseFont = true;
this.btnSelectAll.Location = new System.Drawing.Point(647, 3);
this.btnSelectAll.Location = new System.Drawing.Point(647, -8);
this.btnSelectAll.Name = "btnSelectAll";
this.btnSelectAll.Size = new System.Drawing.Size(55, 26);
this.btnSelectAll.TabIndex = 12;
@@ -351,7 +361,7 @@
this.dpb_Tools.Appearance.Options.UseFont = true;
this.dpb_Tools.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.dpb_Tools.DropDownControl = this.p_menu;
this.dpb_Tools.Location = new System.Drawing.Point(888, 3);
this.dpb_Tools.Location = new System.Drawing.Point(888, -8);
this.dpb_Tools.Name = "dpb_Tools";
this.dpb_Tools.Size = new System.Drawing.Size(80, 26);
this.dpb_Tools.TabIndex = 11;
@@ -405,7 +415,7 @@
this.btnOkAudit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOkAudit.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.btnOkAudit.Appearance.Options.UseFont = true;
this.btnOkAudit.Location = new System.Drawing.Point(708, 3);
this.btnOkAudit.Location = new System.Drawing.Point(708, -8);
this.btnOkAudit.Name = "btnOkAudit";
this.btnOkAudit.Size = new System.Drawing.Size(82, 26);
this.btnOkAudit.TabIndex = 7;
@@ -418,7 +428,7 @@
this.btnBackAudit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBackAudit.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.btnBackAudit.Appearance.Options.UseFont = true;
this.btnBackAudit.Location = new System.Drawing.Point(796, 3);
this.btnBackAudit.Location = new System.Drawing.Point(796, -8);
this.btnBackAudit.Name = "btnBackAudit";
this.btnBackAudit.Size = new System.Drawing.Size(86, 26);
this.btnBackAudit.TabIndex = 6;
@@ -431,7 +441,7 @@
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRefresh.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.btnRefresh.Appearance.Options.UseFont = true;
this.btnRefresh.Location = new System.Drawing.Point(974, 3);
this.btnRefresh.Location = new System.Drawing.Point(974, -8);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(72, 26);
this.btnRefresh.TabIndex = 5;
@@ -448,7 +458,7 @@
this.Controls.Add(this.barDockControlBottom);
this.Controls.Add(this.barDockControlTop);
this.Name = "AuditPanelEx";
this.Size = new System.Drawing.Size(1051, 715);
this.Size = new System.Drawing.Size(1576, 1072);
((System.ComponentModel.ISupportInitialize)(this.tabMain)).EndInit();
this.tabMain.ResumeLayout(false);
this.tabpage_finish.ResumeLayout(false);
+78 -2
View File
@@ -25,6 +25,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
@@ -36,6 +37,11 @@ namespace Lskj.Control
/// </summary>
public partial class FrmExport : Form
{
/// <summary>
/// 临时导出表无法执行原表的自定义汇总逻辑,保存原表已经计算完成的总计值。
/// </summary>
private readonly Dictionary<string, object> _exportCustomSummaryValues = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
public FrmExport()
{
InitializeComponent();
@@ -45,8 +51,57 @@ namespace Lskj.Control
gridView1.Appearance.Row.Font = new Font("宋体", 9);
gridView1.OptionsView.RowAutoHeight = true;
gridView1.RowCellStyle += new RowCellStyleEventHandler(OnGridViewRowCellStyle);
gridView1.CustomSummaryCalculate += OnExportCustomSummaryCalculate;
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
}
/// <summary>
/// 将原表已经计算完成的自定义总计回填到临时导出表。
/// </summary>
private void OnExportCustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
{
if (!e.IsTotalSummary || e.SummaryProcess != DevExpress.Data.CustomSummaryProcess.Finalize)
{
return;
}
GridSummaryItem summaryItem = e.Item as GridSummaryItem;
object summaryValue;
if (summaryItem != null && !string.IsNullOrEmpty(summaryItem.FieldName) &&
_exportCustomSummaryValues.TryGetValue(summaryItem.FieldName, out summaryValue))
{
e.TotalValue = summaryValue;
e.TotalValueReady = true;
}
}
/// <summary>
/// 百分率自定义汇总在原表中可能已经格式化为字符串,导出前还原为数值。
/// </summary>
private static object GetExportSummaryValue(GridColumn column, GridSummaryItem summaryItem)
{
object summaryValue = summaryItem.SummaryValue;
string valueText = summaryValue as string;
string summaryFormat = summaryItem.DisplayFormat ?? string.Empty;
string columnFormat = column == null ? string.Empty : column.DisplayFormat.FormatString;
if (string.IsNullOrWhiteSpace(valueText) ||
(!summaryFormat.Contains("%") && !columnFormat.Contains("%")))
{
return summaryValue;
}
string percentSymbol = CultureInfo.CurrentCulture.NumberFormat.PercentSymbol;
string numericText = valueText.Replace(percentSymbol, string.Empty).Replace("%", string.Empty).Trim();
decimal percentageValue;
if (decimal.TryParse(numericText, NumberStyles.Any, CultureInfo.CurrentCulture, out percentageValue) ||
decimal.TryParse(numericText, NumberStyles.Any, CultureInfo.InvariantCulture, out percentageValue))
{
return percentageValue / 100m;
}
return summaryValue;
}
/// <summary>
/// DataTable转换成Excel文档流(导出数据量超出65535条,分sheet)
/// </summary>
@@ -105,10 +160,12 @@ namespace Lskj.Control
/// <returns>GridControl.</returns>
public BandedGridControlEx ReplaceBitColumn(BandedGridControlEx bandGridControlEx, bool IsCustomColumn = false)
{
_exportCustomSummaryValues.Clear();
bool hasBoolean = false;
BandedGridView gridView = bandGridControlEx.GridView as BandedGridView;
BandedGridControlEx NewBandedGridControlEx = new BandedGridControlEx();
BandedGridView gridView2 = NewBandedGridControlEx.GridView as BandedGridView;
gridView2.CustomSummaryCalculate += OnExportCustomSummaryCalculate;
gridView2.Columns.Clear();//默认有2个列
List<string> boolList = new List<string>();
List<string> datetimeList = new List<string>();
@@ -164,6 +221,8 @@ namespace Lskj.Control
newCol.Width = col.Width;
newCol.OptionsColumn.AllowEdit = col.OptionsColumn.AllowEdit;
newCol.ColumnEdit = boolList.Contains(col.FieldName) || datetimeList.Contains(col.FieldName) ? null : col.ColumnEdit;
newCol.DisplayFormat.FormatType = col.DisplayFormat.FormatType;
newCol.DisplayFormat.FormatString = col.DisplayFormat.FormatString;
//多表头默认都有1级标题(默认有空白表头)
if (col.OwnerBand != null)
@@ -377,6 +436,7 @@ namespace Lskj.Control
//底部汇总是否导出
if (SystemInfo.Instance.ExportSummary)
{
gridView.UpdateTotalSummary();
for (int i = 1; i < gridView2.Columns.Count; i++)
{
string columnName = gridView2.Columns[i].FieldName;
@@ -384,6 +444,11 @@ namespace Lskj.Control
GridSummaryItem gsi = gridView.Columns[columnName].SummaryItem;
if (gsi.SummaryType != DevExpress.Data.SummaryItemType.None) //gsi.SummaryValue!=null&& !string.IsNullOrEmpty(gsi.SummaryValue.ToString())
{
if (gsi.SummaryType == DevExpress.Data.SummaryItemType.Custom)
{
_exportCustomSummaryValues[columnName] = GetExportSummaryValue(gridView.Columns[columnName], gsi);
}
gridView2.Columns[i].Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(gsi.SummaryType, gridView2.Columns[i].FieldName.ToString(), gsi.DisplayFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
@@ -422,6 +487,7 @@ namespace Lskj.Control
public GridControl ReplaceBitColumn(GridControl control, bool IsCustomColumn = false)
{
GridView gridView = control.FocusedView as GridView;
_exportCustomSummaryValues.Clear();
bool hasBoolean = false;
List<string> boolList = new List<string>();
List<string> datetimeList = new List<string>();
@@ -481,6 +547,8 @@ namespace Lskj.Control
newCol.Width = 100;
newCol.OptionsColumn.AllowEdit = col.OptionsColumn.AllowEdit;
newCol.ColumnEdit = boolList.Contains(col.FieldName) || datetimeList.Contains(col.FieldName) ? null : col.ColumnEdit;
newCol.DisplayFormat.FormatType = col.DisplayFormat.FormatType;
newCol.DisplayFormat.FormatString = col.DisplayFormat.FormatString;
this.gridView1.Columns.Add(newCol);
visibleList.Add(col.FieldName);
if (gridModel != null && !dictionary.ContainsKey(col.FieldName))
@@ -733,7 +801,9 @@ namespace Lskj.Control
if (firstColumn != null)
{
this.gridView1.OptionsView.ShowFooter = true;
firstColumn.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, firstColumn.FieldName.ToString(), "合计: {0:#,###}行") });
string firstFieldName = firstColumn.FieldName.ToString();
_exportCustomSummaryValues[firstFieldName] = string.Format("合计: {0}行", dtTable.Rows.Count);
firstColumn.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Custom, firstFieldName, "{0}") });
if (SystemInfo.Instance.GroupSpecialMode)
{
@@ -748,6 +818,7 @@ namespace Lskj.Control
//底部汇总是否导出
if (SystemInfo.Instance.ExportSummary)
{
gridView.UpdateTotalSummary();
for (int i = 1; i < this.gridView1.Columns.Count; i++)
{
string columnName = this.gridView1.Columns[i].FieldName;
@@ -755,6 +826,11 @@ namespace Lskj.Control
if (gsi.SummaryType != DevExpress.Data.SummaryItemType.None) //gsi.SummaryValue!=null&& !string.IsNullOrEmpty(gsi.SummaryValue.ToString())
{
if (gsi.SummaryType == DevExpress.Data.SummaryItemType.Custom)
{
_exportCustomSummaryValues[columnName] = GetExportSummaryValue(gridView.Columns[columnName], gsi);
}
string originalFormat = gsi.DisplayFormat;
// 匹配 {0:#.##}、{0:0.##} 等格式 避免出现没有小数但是还有小数点的情况,如 0.
try
@@ -763,7 +839,7 @@ namespace Lskj.Control
if (match.Success)
{
string innerFormat = match.Groups[1].Value;
if (innerFormat.Contains("."))
if (innerFormat.Contains(".") && innerFormat.Split(';').Length == 1)
{
// 生成条件格式:正数;负数;零(整数无小数点)
string newInnerFormat = $"{innerFormat};{innerFormat};{innerFormat.Split('.')[0]}";
+74
View File
@@ -1880,6 +1880,71 @@ namespace Lskj.Control
}
}
}
/// <summary>
/// 行转列多表头列合计。动态列创建在独立的BandedGridView里,不能直接复用主表格的SetColumnSumming。
/// </summary>
private void SetDynamicBandedColumnSumming(BandedGridView view, BandedGridColumn gridColumn, GridColumnModel model, ref bool isFirstVisibleColumn, bool useSimpleSum)
{
if (view == null || gridColumn == null || model == null || !gridColumn.Visible) return;
if (isFirstVisibleColumn)
{
view.OptionsView.ShowFooter = true;
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, TotalFormat) });
if (SystemInfo.Instance.GroupSpecialMode)
{
view.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
}
else
{
view.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, null, TotalFormat) });
}
isFirstVisibleColumn = false;
return;
}
if (!model.CanSum) return;
SummaryItemType summaryType = useSimpleSum ? SummaryItemType.Sum : ((!string.IsNullOrEmpty(model.sumCalc) || !string.IsNullOrEmpty(model.SumCond) || model.isSumMerge) ? SummaryItemType.Custom : SummaryItemType.Sum);
string format = model.SumText + "{0:" + model.DataFormat + "}";
view.OptionsView.ShowFooter = true;
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(summaryType, gridColumn.FieldName, format) });
if (SystemInfo.Instance.GroupSpecialMode)
{
view.GroupSummary.Add(new GridGroupSummaryItem(summaryType, gridColumn.FieldName, gridColumn, format));
view.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
}
else
{
view.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(summaryType, gridColumn.FieldName, null, format) });
}
}
/// <summary>
/// 行转列树形多表头列合计。TreeList使用SummaryFooter,需单独设置。
/// </summary>
private void SetDynamicTreeColumnSumming(DevExpress.XtraTreeList.TreeList treeList, DevExpress.XtraTreeList.Columns.TreeListColumn gridColumn, GridColumnModel model, ref bool isFirstVisibleColumn)
{
if (treeList == null || gridColumn == null || model == null || !gridColumn.Visible) return;
if (isFirstVisibleColumn)
{
treeList.OptionsView.ShowSummaryFooter = true;
gridColumn.AllNodesSummary = true;
gridColumn.SummaryFooter = DevExpress.XtraTreeList.SummaryItemType.Count;
gridColumn.RowFooterSummaryStrFormat = TotalFormat;
isFirstVisibleColumn = false;
return;
}
if (!model.CanSum) return;
treeList.OptionsView.ShowSummaryFooter = true;
gridColumn.AllNodesSummary = true;
gridColumn.SummaryFooter = DevExpress.XtraTreeList.SummaryItemType.Sum;
gridColumn.RowFooterSummaryStrFormat = model.SumText + "{0:" + model.DataFormat + "}";
}
/// <summary>
/// <para>说明:创建只读列</para>
/// <para>创建人:龚宇超</para>
@@ -8738,9 +8803,12 @@ namespace Lskj.Control
/* ========= 1. 清空现有列 ========= */
bandedGridControlEx.BandedView.Bands.Clear();
bandedGridControlEx.BandedView.Columns.Clear();
bandedGridControlEx.BandedView.GroupSummary.Clear();
bandedGridControlEx.BandedView.OptionsView.ShowFooter = false;
/* ========= 2. 创建“基本信息”Band ========= */
List<GridColumnModel> normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0 || o.IsCustomGroupField == 3).ToList();
bool bandedFirstVisibleColumn = true;
GridBand normalBand = new GridBand { Caption = "基本信息" };
@@ -8775,6 +8843,7 @@ namespace Lskj.Control
col.AppearanceHeader.ForeColor = RequiredForceColor;
}
bandedGridControlEx.SetColumnFormat(col, normalCol);
SetDynamicBandedColumnSumming(bandedGridControlEx.BandedView, col, normalCol, ref bandedFirstVisibleColumn, false);
normalBand.Columns.Add(col);
bandedGridControlEx.BandedView.Columns.Add(col);
}
@@ -8835,6 +8904,7 @@ namespace Lskj.Control
subColumn.AppearanceHeader.ForeColor = RequiredForceColor;
}
bandedGridControlEx.SetColumnFormat(subColumn, subField);
SetDynamicBandedColumnSumming(bandedGridControlEx.BandedView, subColumn, subField, ref bandedFirstVisibleColumn, true);
dynamicBand.Columns.Add(subColumn);
bandedGridControlEx.BandedView.Columns.Add(subColumn);
}
@@ -8880,9 +8950,11 @@ namespace Lskj.Control
/* ========= 1. 清空现有列 ========= */
TreeBandedGridControlEx.TreeListObj.Bands.Clear();
TreeBandedGridControlEx.TreeListObj.Columns.Clear();
TreeBandedGridControlEx.TreeListObj.OptionsView.ShowSummaryFooter = false;
/* ========= 2. 创建“基本信息”Band ========= */
List<GridColumnModel> normalColumns = ColumnList.Where(o => o.IsCustomGroupField == 0 || o.IsCustomGroupField == 3).ToList();
bool treeFirstVisibleColumn = true;
DevExpress.XtraTreeList.Columns.TreeListBand normalBand = new DevExpress.XtraTreeList.Columns.TreeListBand { Caption = "基本信息" };
if (this.AggregationFreeze) normalBand.Fixed = DevExpress.XtraTreeList.Columns.FixedStyle.Left;
@@ -8920,6 +8992,7 @@ namespace Lskj.Control
col.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
col.AppearanceHeader.Options.UseTextOptions = true;
TreeBandedGridControlEx.SetColumnFormat(col, normalCol);
SetDynamicTreeColumnSumming(TreeBandedGridControlEx.TreeListObj, col, normalCol, ref treeFirstVisibleColumn);
normalBand.Columns.Add(col);
TreeBandedGridControlEx.TreeListObj.Columns.Add(col);
}
@@ -8984,6 +9057,7 @@ namespace Lskj.Control
subColumn.AppearanceHeader.Options.UseTextOptions = true;
TreeBandedGridControlEx.SetColumnFormat(subColumn, subField);
SetDynamicTreeColumnSumming(TreeBandedGridControlEx.TreeListObj, subColumn, subField, ref treeFirstVisibleColumn);
dynamicBand.Columns.Add(subColumn);
TreeBandedGridControlEx.TreeListObj.Columns.Add(subColumn);
}
@@ -75,6 +75,11 @@ namespace Lskj.Control
/// 初始赋值
/// </summary>
public string ControlValue = string.Empty;
/// <summary>
/// 保存表格属性用到的key
/// </summary>
public string CurrentOperColumnKey = string.Empty;
public LabelMultiAutoTextEdit()
@@ -380,6 +385,7 @@ namespace Lskj.Control
_lookUpForm.TextField = TextField;
_lookUpForm.SourceSQL = SourceSQL;
_lookUpForm.DataSource = dataSource;
_lookUpForm.CurrentOperColumnKey = CurrentOperColumnKey;
}
/// <summary>
/// <para>说明:清空选中的值</para>
@@ -419,6 +425,7 @@ namespace Lskj.Control
_lookUpForm.EditValue = this.EditValue;
_lookUpForm.IsType = Model.FieldType;
_lookUpForm.EditText = this.TextEdit.Text;
_lookUpForm.CurrentOperColumnKey = CurrentOperColumnKey;
string sqlValue = string.Empty;
if (this.ControlObj != null)
{
+1 -1
View File
@@ -204,7 +204,7 @@ namespace Lskj.Control.Model
/// <value>The enable cond.</value>
public string RequiredCond { get; set; }
/// <summary>
/// 可以方式
/// 禁用方式(默认禁编,设置为1就禁显)
/// </summary>
/// <value>The type of the enable.</value>
public string DisableType { get; set; }
+6 -3
View File
@@ -2801,7 +2801,9 @@ namespace Lskj.Control.Model
GridColumnModel model = col.Tag as GridColumnModel;
if (cell != null)
{
if (cell.CellType == CellType.Blank)
// DevExpress导出的xlsx空值可能是内容为空的String单元格,也应按空单元格处理。
if (cell.CellType == CellType.Blank ||
(cell.CellType == CellType.String && string.IsNullOrEmpty(cell.StringCellValue)))
{
//isImportRows = false;
continue;
@@ -3564,7 +3566,8 @@ namespace Lskj.Control.Model
{
string field = fields[i];
string value = rowResult.Table.Columns.Contains(field) ? rowResult[field] + "" : null;
rowItem[field] = value;
if(rowItem.Table.Columns.Contains(field)) rowItem[field] = value;
}
}
else
@@ -3573,7 +3576,7 @@ namespace Lskj.Control.Model
for (int i = 0; i < fields.Length; i++)
{
string field = fields[i];
rowItem[field] = DBNull.Value;
if (rowItem.Table.Columns.Contains(field)) rowItem[field] = DBNull.Value;
}
}
}
@@ -173,6 +173,11 @@ namespace Lskj.Control.Model
cmsMenu.Items.Add(menuItem);
RightMenuItems.Add(menuItem);
}
if (menuModel.FontSize != 0)
{
menuItem.Font = new Font(menuItem.Font.FontFamily, menuModel.FontSize);
}
}
if (!string.IsNullOrWhiteSpace(menuModel.ExecuteFirstCode))
{
@@ -304,7 +309,7 @@ namespace Lskj.Control.Model
return;
}
if (model.VerifyUpdate && BaseGridView!=null)
if (model.VerifyUpdate && BaseGridView != null)
{
for (int i = 0; i < BaseGridView.DataRowCount; i++)
{
@@ -502,7 +507,7 @@ namespace Lskj.Control.Model
{
tipOnlyOne = false;
string prompt = ReplaceHelper.ReplaceRowParam(rowData, model.BeforeMsg);
if (model.Mergeexec)
if (model.Mergeexec)
{
//替换[],替换的是多选行中的数据
prompt = ReplaceHelper.ReplaceRowParam(rows, prompt.Replace("[", "{").Replace("]", "}"), "", "");
@@ -977,7 +982,7 @@ namespace Lskj.Control.Model
case -1:
if (rValue == -1)
{
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
{
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
}
@@ -1811,7 +1816,7 @@ namespace Lskj.Control.Model
paramList[2] = ReplaceHelper.ReplaceRowParam(rows, url) + "";
}
}
if (model.DllName.ToLower().Contains("p_PubPrint.lsp".ToLower())&& !model.CancelDefaultReplace)
if (model.DllName.ToLower().Contains("p_PubPrint.lsp".ToLower()) && !model.CancelDefaultReplace)
{
string paramsql1 = paramList[2];
paramList[2] = ReplaceHelper.ReplaceRowParam(rows, paramsql1, "'", "'");
@@ -346,6 +346,10 @@ namespace Lskj.Control.Model
/// 右键多选合并不走默认替换(p_PubPrint.lsp
/// </summary>
public bool CancelDefaultReplace;
/// <summary>
/// 右键字体大小
/// </summary>
public int FontSize;
/// <summary>
@@ -485,6 +489,8 @@ namespace Lskj.Control.Model
this.VerifyUpdate = string.IsNullOrWhiteSpace(item["VerifyUpdate"] + "") ? false : "1".Equals(item["VerifyUpdate"] + "");
if (item.Table.Columns.Contains("CancelDefaultReplace"))
this.CancelDefaultReplace = string.IsNullOrWhiteSpace(item["CancelDefaultReplace"] + "") ? false : "1".Equals(item["CancelDefaultReplace"] + "");
this.FontSize = item.Table.Columns.Contains("FontSize") && !string.IsNullOrEmpty(item["FontSize"] + "") ? Convert.ToInt32(item["FontSize"] + "") : 0;
}
/// <summary>
+49 -9
View File
@@ -27,7 +27,43 @@ namespace Lskj.Control
public sealed class MessageUtil
{
public static string Prompt = string.IsNullOrWhiteSpace(SystemInfo.Instance.DeadlockPrompt) ? "网络连接超时,请稍候再试!" : SystemInfo.Instance.DeadlockPrompt;
public static string Prompt = "网络连接超时,请稍候再试!";
/// <summary>
/// 系统配置尚未初始化时不主动访问数据库,读取失败则使用默认死锁提示。
/// </summary>
private static bool TryGetDeadlockPrompt(string message, out string deadlockPrompt)
{
deadlockPrompt = message;
if (string.IsNullOrEmpty(message) || !message.Contains("与另一个进程被死锁在"))
{
return false;
}
bool promptDeadlock = false;
string configuredPrompt = string.Empty;
try
{
SystemInfo systemInfo = SystemInfo.Instance;
if (systemInfo != null)
{
promptDeadlock = systemInfo.PromptDeadlock;
configuredPrompt = systemInfo.DeadlockPrompt;
}
}
catch
{
// 数据库连接失败或系统参数尚未初始化时,提示框仍使用安全默认值。
}
if (promptDeadlock)
{
return false;
}
deadlockPrompt = string.IsNullOrWhiteSpace(configuredPrompt) ? Prompt : configuredPrompt;
return true;
}
/// <summary>
@@ -54,8 +90,9 @@ namespace Lskj.Control
}
}
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在")&& !SystemInfo.Instance.PromptDeadlock)
msg = Prompt;
string deadlockPrompt;
if (TryGetDeadlockPrompt(msg, out deadlockPrompt))
msg = deadlockPrompt;
if (Business.Impl.LanguageTranslation.Translatable)
{
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
@@ -89,9 +126,10 @@ namespace Lskj.Control
}
}
if (!string.IsNullOrEmpty(errorMessage) && errorMessage.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
string deadlockPrompt;
if (TryGetDeadlockPrompt(errorMessage, out deadlockPrompt))
{
errorMessage = Prompt;
errorMessage = deadlockPrompt;
if (Business.Impl.LanguageTranslation.Translatable)
{
errorMessage = Business.Impl.LanguageTranslation.GetTranslatedText(errorMessage);
@@ -165,8 +203,9 @@ namespace Lskj.Control
if (Debugger.IsAttached)
{
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.StackTrace;
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
msg = Prompt;
string deadlockPrompt;
if (TryGetDeadlockPrompt(msg, out deadlockPrompt))
msg = deadlockPrompt;
if (Business.Impl.LanguageTranslation.Translatable)
{
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
@@ -176,8 +215,9 @@ namespace Lskj.Control
else
{
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.Message; //ResourceKeys.SystemErrorTip + "\r\n" + ex.Message + "\r\n" + ex.StackTrace;
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
msg = Prompt;
string deadlockPrompt;
if (TryGetDeadlockPrompt(msg, out deadlockPrompt))
msg = deadlockPrompt;
if (Business.Impl.LanguageTranslation.Translatable)
{
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
@@ -4615,6 +4615,7 @@ namespace Lskj.Control.Model
multiAutoEdit.ValueField = model.ValueMember;
multiAutoEdit.TextField = model.TextMember;
multiAutoEdit.ControlObj = this;
multiAutoEdit.CurrentOperColumnKey= Model.ModuleCode + "_" + model.FieldName;
//multiAutoEdit.SetDataSource(dataSource);
multiAutoEdit.TextBoxProhibition = model.TextBoxProhibition;
multiAutoEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
+100 -9
View File
@@ -31,7 +31,6 @@ using FastReport;
using DevExpress.XtraGrid.Views.BandedGrid;
using System.Diagnostics;
using Lskj.Core;
using System.Text.RegularExpressions;
using Lskj.Business;
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList;
@@ -680,8 +679,35 @@ namespace Lskj.Control
// this.ModuleGridObj.InitlizeSpiltLocation();
//}
this.ModuleGridObj.SearchObj.SearchGrid(sqlValue);
if (!this.IsDragDetail)
this.ModuleGridDetailObj.SetDetailGridDataSource();
if (!this.IsDragDetail)
{
bool enter = false;
try
{
if (this.ModuleGridObj != null)
{
DataRow rowItem = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow();
if (this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow != null)
{
rowItem = this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow;
}
if (rowItem != null&& !this.SysModel.DoubleClickDetail) enter = true;
}
}
catch (Exception ex)
{
}
//enter判断 2026-7-24 添加 因为主表有行改版后事件,主表赋值后会刷新一次,这里是重复刷新(方法里有判断,主表有值执行的逻辑是相同的)
//如果是主表有数据,并且绑定了行改变事件,就执行了(重复执行)
//如果主表没有数据,就执行(清空明细) 或者绑定的是双击加载明细事件也执行(节点改变后刷新主表,顺便刷新明细)
if (!enter)
{
this.ModuleGridDetailObj.SetDetailGridDataSource();
}
}
if (this.treeGridLeft.Visible && ModuleGridDetailObj.GridDetailList != null && ModuleGridDetailObj.GridDetailList.Count > 0)
{
this.ModuleGridDetailObj.scc_container.PanelVisibility = this.ModuleGridObj.GridControlObj.DataRowCount() == 0 ? SplitPanelVisibility.Panel1 : SplitPanelVisibility.Both;
@@ -1851,16 +1877,81 @@ namespace Lskj.Control
}
/// <summary>
/// 判断是否selete开头(可以处理sql前方有注释和空格的情况
/// 判断有效SQL是否select开头(忽略前方空格、BOM和注释
/// </summary>
/// <param name="sqlText"></param>
/// <returns></returns>
public static bool IsSelectAtStart(string sqlText)
{
// Remove comments and whitespace at the start of the text
string cleanedText = Regex.Replace(sqlText, @"^(\s*--.*?(\r\n|\n)|\s*)*", "");
// Check if the remaining text starts with 'select'
return cleanedText.StartsWith("select", StringComparison.OrdinalIgnoreCase);
if (string.IsNullOrEmpty(sqlText))
{
return false;
}
int index = 0;
while (index < sqlText.Length)
{
while (index < sqlText.Length &&
(char.IsWhiteSpace(sqlText[index]) || sqlText[index] == '\uFEFF'))
{
index++;
}
// 跳过SQL开头连续出现的单行注释。
if (index + 1 < sqlText.Length && sqlText[index] == '-' && sqlText[index + 1] == '-')
{
index += 2;
while (index < sqlText.Length && sqlText[index] != '\r' && sqlText[index] != '\n')
{
index++;
}
continue;
}
// 跳过块注释,同时兼容SQL Server支持的嵌套块注释。
if (index + 1 < sqlText.Length && sqlText[index] == '/' && sqlText[index + 1] == '*')
{
index += 2;
int commentDepth = 1;
while (index < sqlText.Length && commentDepth > 0)
{
if (index + 1 < sqlText.Length && sqlText[index] == '/' && sqlText[index + 1] == '*')
{
commentDepth++;
index += 2;
}
else if (index + 1 < sqlText.Length && sqlText[index] == '*' && sqlText[index + 1] == '/')
{
commentDepth--;
index += 2;
}
else
{
index++;
}
}
if (commentDepth > 0)
{
return false;
}
continue;
}
break;
}
const string selectKeyword = "select";
if (index + selectKeyword.Length > sqlText.Length ||
string.Compare(sqlText, index, selectKeyword, 0, selectKeyword.Length,
StringComparison.OrdinalIgnoreCase) != 0)
{
return false;
}
int nextIndex = index + selectKeyword.Length;
return nextIndex == sqlText.Length ||
(!char.IsLetterOrDigit(sqlText[nextIndex]) && sqlText[nextIndex] != '_');
}
@@ -2000,4 +2091,4 @@ namespace Lskj.Control
}
}
}
}
@@ -186,6 +186,8 @@ namespace Lskj.Control.MultiGridLookUp
this.Location = new Point((SystemInformation.PrimaryMonitorSize.Width - this.Width) / 2,
(SystemInformation.PrimaryMonitorSize.Height - this.Height) / 2);
}
// 自动列宽和弹窗尺寸计算完成后,最后应用个性化列配置,避免配置被覆盖。
this.SetCustomColumns();
}
/// <summary>
/// <para>说明:计算控件Size,只计算一次</para>
@@ -374,7 +376,6 @@ namespace Lskj.Control.MultiGridLookUp
}
}
}
SetCustomColumns();
this.gcDetail.GridControl.DataSource = this.gridControl1.DataSourceTable().Clone();
this.gcMain.BestFitColumns();
//this.gcDetail.SelectAll();
@@ -397,28 +398,53 @@ namespace Lskj.Control.MultiGridLookUp
DataTable customTable = this.gcMain.GetCustomColumnByDatabase(this.CurrentOperColumnKey);
if (customTable != null && customTable.Rows.Count > 0)
{
foreach (DataRow rowItem in customTable.Rows)
this.gcMain.BeginUpdate();
this.gcDetail.BeginUpdate();
try
{
string fieldName = rowItem["fieldName"] + "";
int fieldWidth = Convert.ToInt32(rowItem["fieldWidth"]);
int index = Convert.ToInt32(rowItem["orderid"]);
bool visible = "1".Equals(rowItem["isVisible"] + "") && fieldWidth > 0;
bool isFix = "True".Equals(rowItem["IfFixColumn"] + "", StringComparison.OrdinalIgnoreCase);
GridColumn gridColumn = this.gcMain.Columns.ColumnByName(fieldName);
if (gridColumn != null && gridColumn.Visible && gridColumn.Width > 0)
foreach (DataRow rowItem in customTable.Rows)
{
GridColumn colObj = this.gcMain.Columns[fieldName];
colObj.VisibleIndex = index;
colObj.Width = fieldWidth;
colObj.Visible = visible;
colObj.Fixed = isFix ? FixedStyle.Left : FixedStyle.None;
colObj.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
string fieldName = rowItem["fieldName"] + "";
int fieldWidth = Convert.ToInt32(rowItem["fieldWidth"]);
int index = Convert.ToInt32(rowItem["orderid"]);
bool visible = "1".Equals(rowItem["isVisible"] + "") && fieldWidth > 0;
bool isFix = "True".Equals(rowItem["IfFixColumn"] + "", StringComparison.OrdinalIgnoreCase);
SetCustomColumn(this.gcMain.Columns.ColumnByName(fieldName), fieldWidth, index, visible, isFix);
SetCustomColumn(this.gcDetail.Columns.ColumnByName(fieldName), fieldWidth, index, visible, isFix);
}
}
finally
{
this.gcDetail.EndUpdate();
this.gcMain.EndUpdate();
}
}
}
/// <summary>
/// 应用单列的个性化布局。
/// </summary>
private static void SetCustomColumn(GridColumn column, int width, int visibleIndex, bool visible, bool isFix)
{
if (column == null)
{
return;
}
column.Visible = visible;
if (visible)
{
column.VisibleIndex = visibleIndex;
}
if (width > 0)
{
column.Width = width;
}
column.Fixed = isFix ? FixedStyle.Left : FixedStyle.None;
column.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
}
/// <summary>
/// <para>说明:设置默认选中</para>
/// <para>创建人:龚宇超</para>
@@ -1028,7 +1028,11 @@ namespace Lskj.Control.MultiModelLookUp
this.SysModel = new ModuleModel(modelRow);// 系统模块实体对象
if (this.SysModel != null)
{
if (this.SysModel.ModuleFrameHeight > 0 && this.SysModel.ModuleFrameWidth > 0)
{
this.Height = this.SysModel.ModuleFrameHeight;
this.Width = this.SysModel.ModuleFrameWidth;
}
switch (this.SysModel.MenuType)
{
@@ -1121,6 +1121,12 @@ namespace Lskj.Control.MultiModelLookUp
this.SysModel = new ModuleModel(modelRow);// 系统模块实体对象
if (this.SysModel != null)
{
if (this.SysModel.ModuleFrameHeight > 0 && this.SysModel.ModuleFrameWidth > 0)
{
this.Height = this.SysModel.ModuleFrameHeight;
this.Width = this.SysModel.ModuleFrameWidth;
}
switch (this.SysModel.MenuType)
File diff suppressed because it is too large Load Diff