SVN-Revision: r924
This commit is contained in:
cyf
2025-08-07 09:29:22 +00:00
parent f7a53010be
commit e6ec3e4886
27 changed files with 4288 additions and 277 deletions
+84 -41
View File
@@ -556,30 +556,31 @@ namespace Lskj.Control
item.GridControlObj.SetReadOnlyColumns(dtColumns, modelkeyName + key);
// 追加复选框用于批量审批
if (item.GridControlObj.GridView.Columns.FirstOrDefault(x => "_check".Equals(x.Name)) == null && (BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
if ( BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag)
{
GridColumn checkColumn = new GridColumn();
checkColumn.Name = checkColumn.FieldName = "_check";
checkColumn.Caption = "选";
checkColumn.Width = 30;
checkColumn.Visible = true;
checkColumn.VisibleIndex = 0;
checkColumn.OptionsColumn.AllowEdit = false;
item.GridControlObj.GridView.Columns.Insert(0, checkColumn);
item.GridControlObj.GridView.RowCellClick += new RowCellClickEventHandler(OnGridViewRowCellClick);
GridDragGrid.GridAddCheckBox(item.GridControlObj.GridView);
//GridColumn checkColumn = new GridColumn();
//checkColumn.Name = checkColumn.FieldName = "_check";
//checkColumn.Caption = "选";
//checkColumn.Width = 30;
//checkColumn.Visible = true;
//checkColumn.VisibleIndex = 0;
//checkColumn.OptionsColumn.AllowEdit = false;
//item.GridControlObj.GridView.Columns.Insert(0, checkColumn);
//item.GridControlObj.GridView.RowCellClick += new RowCellClickEventHandler(OnGridViewRowCellClick);
}
item.GridControlObj.SetGridViewDataSource(BaseImpl.GetDataTableResult(item.AuditModel.StepSql));
item.GridControlObj.GridView.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(OnPcgridRowCellClick);
// 为表格增加一列复选框列
DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
if (table != null && !table.Columns.Contains("_check") && (BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
{
table.Columns.Add("_check", typeof(bool));
foreach (DataRow row in table.Rows)
{
row["_check"] = 0;
}
}
//if (table != null && !table.Columns.Contains("_check") && (BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
//{
// table.Columns.Add("_check", typeof(bool));
// foreach (DataRow row in table.Rows)
// {
// row["_check"] = 0;
// }
//}
//item.GridControlObj.GridView.DataSourceChanged += new EventHandler(OnPcgridRowFocusedRowChanged);
cnt += item.GridControlObj.GridView.RowCount;
Application.DoEvents();
@@ -1421,16 +1422,41 @@ namespace Lskj.Control
this.ControlObj.SetRequiredControl(fieldName, RequiredFields.Split(',').Contains(fieldName), false);
}
}
//判断操作字段和字段的权限(没测试,先不开放)
//DataTable AuthorityTable = PowerImpl.GetModuleAuthorityEnable(this.SysModel.ModuleCode);
//foreach (DataRow dr in this._dtBillInfoFiled.Rows)
//{
// string fieldName = dr["fieldName"] + "";
// BaseUserControl control = this.ControlObj.FindControl(fieldName);
// if (string.IsNullOrWhiteSpace(control.Model.PrivilegeOper))
// {
// //没有人员权限,转成可编辑
// this.ControlObj.SetReadOnlyControl(fieldName, !billFields.Split(',').Contains(fieldName), false);
// }
// else
// {
// List<int> targetPrivTypeIds = new List<int>();
// foreach (string permission in control.Model.PrivilegeOper.Split(','))
// {
// targetPrivTypeIds.Add(int.Parse(permission));
// }
// //获取权限对应的人员名称
// string userString = string.Join(",", AuthorityTable.AsEnumerable()
// .Where(row => targetPrivTypeIds.Contains(row.Field<int>("privTypeId")))
// .Select(row => row.Field<string>("userList"))
// .Where(value => value != null)
// .ToList()) + ",";
// //有权限的字段,转成可编辑
// if (userString.Contains(ERPInfo.Instance.UserName + ",") || ERPInfo.Instance.UserName.Equals("管理员")) this.ControlObj.SetReadOnlyControl(fieldName, !billFields.Split(',').Contains(fieldName), false); ;
// }
//}
//操作字段
foreach (DataRow dr in this._dtBillInfoFiled.Rows)
{
string fieldName = dr["fieldName"] + "";
this.ControlObj.SetReadOnlyControl(fieldName, !billFields.Split(',').Contains(fieldName), false);
}
}
}
#endregion
@@ -1656,14 +1682,20 @@ namespace Lskj.Control
{
foreach (TabPageItemObj item in tab.TabPageItemObjs)
{
DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
foreach (DataRow row in table.Rows)
int[] mSelectRows = item.GridControlObj.GridView.GetSelectedRows();
foreach (int itemIndex in mSelectRows)
{
if ("1".Equals(row["_check"] + "") || "true".Equals(row["_check"] + "", StringComparison.OrdinalIgnoreCase))
{
rowItems.Add(row);
}
DataRow selectRow = item.GridControlObj.GridView.GetDataRow(itemIndex);
rowItems.Add(selectRow);
}
//DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
//foreach (DataRow row in table.Rows)
//{
// if ("1".Equals(row["_check"] + "") || "true".Equals(row["_check"] + "", StringComparison.OrdinalIgnoreCase))
// {
// rowItems.Add(row);
// }
//}
}
}
}
@@ -2170,14 +2202,20 @@ namespace Lskj.Control
{
foreach (TabPageItemObj item in tab.TabPageItemObjs)
{
DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
foreach (DataRow row in table.Rows)
int[] mSelectRows = item.GridControlObj.GridView.GetSelectedRows();
foreach (int itemIndex in mSelectRows)
{
if ("1".Equals(row["_check"] + "") || "true".Equals(row["_check"] + "", StringComparison.OrdinalIgnoreCase))
{
rowItems.Add(row);
}
DataRow selectRow = item.GridControlObj.GridView.GetDataRow(itemIndex);
rowItems.Add(selectRow);
}
//DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
//foreach (DataRow row in table.Rows)
//{
// if ("1".Equals(row["_check"] + "") || "true".Equals(row["_check"] + "", StringComparison.OrdinalIgnoreCase))
// {
// rowItems.Add(row);
// }
//}
}
}
}
@@ -2737,17 +2775,22 @@ namespace Lskj.Control
int cnt = 0;
foreach (TabPageItemObj item in tab.TabPageItemObjs)
{
int oldRowHandle = item.GridControlObj.GridView.FocusedRowHandle;
item.GridControlObj.SetGridViewDataSource(BaseImpl.GetDataTableResult(item.AuditModel.StepSql));
cnt += item.GridControlObj.GridView.RowCount;
// 为表格增加一列复选框列
DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
if (table != null && !table.Columns.Contains("_check"))
//DataTable table = item.GridControlObj.gridControl.DataSource as DataTable;
//if (table != null && !table.Columns.Contains("_check"))
//{
// table.Columns.Add("_check", typeof(bool));
// foreach (DataRow row in table.Rows)
// {
// row["_check"] = 0;
// }
//}
if (!(BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
{
table.Columns.Add("_check", typeof(bool));
foreach (DataRow row in table.Rows)
{
row["_check"] = 0;
}
item.GridControlObj.GridView.SelectRowHandler(oldRowHandle);
}
Application.DoEvents();
}
@@ -3104,7 +3147,7 @@ namespace Lskj.Control
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + "") && !this.BillModelObj.IgnoreAllocated)
{
MessageUtil.Show("该行数据为已分配后的数据,无需分配!");
return;
+8 -34
View File
@@ -398,8 +398,8 @@ namespace Lskj.Control
dtCustomQueryFields = BaseModuleImpl.GetCustomQueryFields(this.BaseAccraditModelObj.OverBackKey);
}
string tmpsql = this.BaseAccraditModelObj.OverBackSql;
if (!string.IsNullOrWhiteSpace(BaseAccraditModelObj.OverBackOper))
tmpsql = tmpsql + " and charindex('" + ERPInfo.Instance.UserName + ",','" + BaseAccraditModelObj.OverBackOper + ",')>0";
//if (!string.IsNullOrWhiteSpace(BaseAccraditModelObj.OverBackOper))
// tmpsql = tmpsql + " and charindex('" + ERPInfo.Instance.UserName + ",','" + BaseAccraditModelObj.OverBackOper + ",')>0";
this._searchContrl = new MyControl(tmpsql, this.gridFinish);
this.pl_top.Height = this._searchContrl.InitSearchControl(dtCustomQueryFields, this.pl_top);
}
@@ -581,7 +581,7 @@ namespace Lskj.Control
{
accrModel = new AccraditationModel(flowList.Rows[i - 1]);
}
string key = "FLOWSTEP_" + this.SysModel.ModuleCode + "_" + model.StepCode + "_" + accrModel.Id + "";
string key = "FLOWSTEP_" + this.SysModel.ModuleCode + "_" + accrModel.StepCode + "_" + accrModel.Id + "";
gridPanel.Padding = new System.Windows.Forms.Padding(2);
gridPanel.Dock = DockStyle.Right;
gridPanel.BorderStyle = BorderStyles.NoBorder;
@@ -719,7 +719,11 @@ namespace Lskj.Control
DataTable dataSourceTable = BaseImpl.GetDataTableResult(item.AuditModel.StepSql);
item.GridControlObj.SetGridViewDataSource(dataSourceTable);
item.LabelObj.Text = item.AuditModel.CurstepName + " (" + string.Format(ResourceKeys.RowCountRecond, item.GridControlObj.GridView.RowCount) + " )";
if (!(BaseAccraditModelObj.MuitlAuditFlag || BaseAccraditModelObj.MuitlAuditBackFlag))
{
item.GridControlObj.GridView.SelectRowHandler(oldRowHandle);
}
cnt += item.GridControlObj.GridView.RowCount;
}
tab.TabPage.Text = tab.FlowStepModel.StepGroup + "(" + cnt + ")";
@@ -1780,34 +1784,4 @@ namespace Lskj.Control
/// <summary>
/// <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);
}
}
}
}
/// <para>创建日期
-25
View File
@@ -130,29 +130,4 @@ namespace Lskj.Control
/// <param name="panel"></param>
protected void GetCharWidthMultilingual(Label label, string text, Panel panel)
{
//之前只对非中文模式生效,后发现GetCharWidth()方法计算不准确,就改成通用设置
//Business.Impl.LanguageTranslation.Translatable &&
if (text.Length > 0)
{
using (Graphics graphics = label.CreateGraphics())
{
// 使用TextRenderer而不是Graphics.MeasureString,以匹配Label的文本渲染方式
Size textSize = TextRenderer.MeasureText(graphics, text, label.Font);
panel.Width= textSize.Width;
}
}
}
public BaseUserControl()
{
InitializeComponent();
}
public void ModifyDefaultColors(Color color)
{
DefaultLabelForceColor = color;
}
}
}
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Xilium.CefGlue;
namespace Lskj.Control.BrowserSetting
@@ -90,4 +91,9 @@ namespace Lskj.Control.BrowserSetting
}
else
{
BsOpenModuleHandler.OpenRightModule(arg0, ar
BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
}
}
else if (message.Name.Equals("CloseWin"))
{
@@ -87,6 +87,11 @@ namespace Lskj.Control
this.combox_returnStep.TextField = "stepName";
this.combox_returnStep.ValueField = "stepCode";
this.combox_returnStep.SetDataSource(dt);
if (SystemInfo.Instance.FallbackDefaultSelection)
{
this.combox_returnStep.EditText = "0";
}
}
/// <summary>
/// <para>说明:确定操作/para>
+82
View File
@@ -0,0 +1,82 @@
namespace Lskj.Control
{
partial class FrmPositioningColumn
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
DevExpress.XtraGrid.GridLevelNode gridLevelNode2 = new DevExpress.XtraGrid.GridLevelNode();
this.gridControl = new DevExpress.XtraGrid.GridControl();
this.gridView = new DevExpress.XtraGrid.Views.Grid.GridView();
((System.ComponentModel.ISupportInitialize)(this.gridControl)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView)).BeginInit();
this.SuspendLayout();
//
// gridControl
//
this.gridControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridControl.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(4);
gridLevelNode2.RelationName = "Level1";
this.gridControl.LevelTree.Nodes.AddRange(new DevExpress.XtraGrid.GridLevelNode[] {
gridLevelNode2});
this.gridControl.Location = new System.Drawing.Point(0, 0);
this.gridControl.MainView = this.gridView;
this.gridControl.Margin = new System.Windows.Forms.Padding(4);
this.gridControl.Name = "gridControl";
this.gridControl.Size = new System.Drawing.Size(535, 309);
this.gridControl.TabIndex = 5;
this.gridControl.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView});
//
// gridView
//
this.gridView.Appearance.HeaderPanel.Font = new System.Drawing.Font("宋体", 9F);
this.gridView.Appearance.HeaderPanel.Options.UseFont = true;
this.gridView.Appearance.HeaderPanel.Options.UseTextOptions = true;
this.gridView.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridView.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.gridView.Appearance.Preview.Font = new System.Drawing.Font("宋体", 9F);
this.gridView.Appearance.Preview.Options.UseFont = true;
this.gridView.Appearance.Row.Font = new System.Drawing.Font("宋体", 9F);
this.gridView.Appearance.Row.Options.UseBackColor = true;
this.gridView.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
this.gridView.GridControl = this.gridControl;
this.gridView.IndicatorWidth = 40;
this.gridView.Name = "gridView";
this.gridView.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True;
this.gridView.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.False;
this.gridView.OptionsFilter.ShowAllTableValuesInCheckedFilterPopup = false;
this.gridView.OptionsFilter.ShowAllTableValuesInFilterPopup = true;
this.gridView.OptionsFind.FindNullPrompt = "";
this.gridView.OptionsSelection.MultiSelect = true;
this.gridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect;
this.gridView.OptionsView.AllowHtmlDrawHeaders = true;
this.gridView.OptionsView.ColumnAutoWidth = false;
this.gridView.OptionsView.ColumnHeaderAutoHeight = DevExpress.Utils.DefaultBoolean.True;
this.gridView.OptionsView.RowAutoHeight = true;
this.gridView.OptionsView.ShowGroupPanel = false;
this.gridView.PaintStyleNam
@@ -0,0 +1,65 @@
using DevExpress.XtraGrid.Columns;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.Control
{
public partial class FrmPositioningColumn : BaseForm
{
/// <summary>
/// 显示列的列名和对应名称
/// </summary>
public Dictionary<string, string> ColumnInformation = new Dictionary<string, string>();
/// <summary>
/// 查找列名称
/// </summary>
public string FindName;
public FrmPositioningColumn()
{
InitializeComponent();
}
public FrmPositioningColumn(Dictionary<string, string> columnInformation)
{
InitializeComponent();
this.ColumnInformation = columnInformation;
this.CreateColumn();
this.gridView.DoubleClick += GridView_DoubleClick;
}
private void CreateColumn()
{
GridColumn Caption = new GridColumn();
Caption.Caption = "用户名称";
Caption.FieldName = "Caption";
Caption.MinWidth = 38;
Caption.Visible = true;
Caption.VisibleIndex = 1;
Caption.Width = 100;
Caption.OptionsColumn.AllowEdit = false;
GridColumn FieldName = new GridColumn();
FieldName.Caption = "系统名称";
FieldName.FieldName = "FieldName";
FieldName.MinWidth = 38;
FieldName.Visible = true;
FieldName.VisibleIndex = 0;
FieldName.Width = 150;
FieldName.OptionsColumn.AllowEdit = false;
this.gridView.Columns.AddRange(new GridColumn[] {
FieldName,
Caption,
});
// 初始
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+218
View File
@@ -0,0 +1,218 @@
namespace Lskj.Control
{
partial class FrmProductSched
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pl_main = new DevExpress.XtraEditors.PanelControl();
this.splitMainControl = new DevExpress.XtraEditors.SplitContainerControl();
this.splitLeftControl = new DevExpress.XtraEditors.SplitContainerControl();
this.pltopmain = new DevExpress.XtraEditors.PanelControl();
this.bandGcTop = new Lskj.Control.BandedGridControlEx();
this.treebandGcTop = new Lskj.Control.TreeBandedGridControlEx();
this.pl_mainSearch = new DevExpress.XtraEditors.PanelControl();
this.pl_search = new DevExpress.XtraEditors.PanelControl();
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
this.gcRight = new Lskj.Control.ModuleGridEx();
this.tabBottom = new Lskj.Control.TabControlEx();
((System.ComponentModel.ISupportInitialize)(this.pl_main)).BeginInit();
this.pl_main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitMainControl)).BeginInit();
this.splitMainControl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitLeftControl)).BeginInit();
this.splitLeftControl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pltopmain)).BeginInit();
this.pltopmain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_mainSearch)).BeginInit();
this.pl_mainSearch.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_search)).BeginInit();
this.flowLayoutPanel.SuspendLayout();
this.SuspendLayout();
//
// pl_main
//
this.pl_main.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main.Appearance.Options.UseBackColor = true;
this.pl_main.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main.Controls.Add(this.splitMainControl);
this.pl_main.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_main.Location = new System.Drawing.Point(0, 0);
this.pl_main.LookAndFeel.UseDefaultLookAndFeel = false;
this.pl_main.Name = "pl_main";
this.pl_main.Size = new System.Drawing.Size(1317, 679);
this.pl_main.TabIndex = 11;
//
// splitMainControl
//
this.splitMainControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitMainControl.Location = new System.Drawing.Point(0, 0);
this.splitMainControl.Margin = new System.Windows.Forms.Padding(2);
this.splitMainControl.Name = "splitMainControl";
this.splitMainControl.Panel1.Controls.Add(this.splitLeftControl);
this.splitMainControl.Panel1.Text = "Panel1";
this.splitMainControl.Panel2.Controls.Add(this.gcRight);
this.splitMainControl.Panel2.Text = "Panel2";
this.splitMainControl.Size = new System.Drawing.Size(1317, 679);
this.splitMainControl.SplitterPosition = 997;
this.splitMainControl.TabIndex = 1;
this.splitMainControl.Text = "splitContainerControl1";
//
// splitLeftControl
//
this.splitLeftControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitLeftControl.Horizontal = false;
this.splitLeftControl.Location = new System.Drawing.Point(0, 0);
this.splitLeftControl.Margin = new System.Windows.Forms.Padding(2);
this.splitLeftControl.Name = "splitLeftControl";
this.splitLeftControl.Panel1.Controls.Add(this.pltopmain);
this.splitLeftControl.Panel1.Controls.Add(this.pl_mainSearch);
this.splitLeftControl.Panel1.Text = "Panel1";
this.splitLeftControl.Panel2.Controls.Add(this.tabBottom);
this.splitLeftControl.Panel2.Text = "Panel2";
this.splitLeftControl.Size = new System.Drawing.Size(997, 679);
this.splitLeftControl.SplitterPosition = 353;
this.splitLeftControl.TabIndex = 7;
this.splitLeftControl.Text = "splitContainerControl2";
//
// pltopmain
//
this.pltopmain.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pltopmain.Controls.Add(this.bandGcTop);
this.pltopmain.Controls.Add(this.treebandGcTop);
this.pltopmain.Dock = System.Windows.Forms.DockStyle.Fill;
this.pltopmain.Location = new System.Drawing.Point(0, 0);
this.pltopmain.Name = "pltopmain";
this.pltopmain.Size = new System.Drawing.Size(997, 320);
this.pltopmain.TabIndex = 22;
//
// bandGcTop
//
this.bandGcTop.AdapterObj = null;
this.bandGcTop.Dock = System.Windows.Forms.DockStyle.Fill;
this.bandGcTop.Location = new System.Drawing.Point(0, 0);
this.bandGcTop.Margin = new System.Windows.Forms.Padding(4);
this.bandGcTop.Name = "bandGcTop";
this.bandGcTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.bandGcTop.Size = new System.Drawing.Size(997, 320);
this.bandGcTop.TabIndex = 17;
//
// treebandGcTop
//
this.treebandGcTop.AdapterObj = null;
this.treebandGcTop.Dock = System.Windows.Forms.DockStyle.Fill;
this.treebandGcTop.Location = new System.Drawing.Point(0, 0);
this.treebandGcTop.Margin = new System.Windows.Forms.Padding(4);
this.treebandGcTop.Name = "treebandGcTop";
this.treebandGcTop.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.treebandGcTop.Size = new System.Drawing.Size(997, 320);
this.treebandGcTop.TabIndex = 19;
//
// pl_mainSearch
//
this.pl_mainSearch.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_mainSearch.Appearance.Options.UseBackColor = true;
this.pl_mainSearch.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_mainSearch.Controls.Add(this.pl_search);
this.pl_mainSearch.Controls.Add(this.flowLayoutPanel);
this.pl_mainSearch.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_mainSearch.Location = new System.Drawing.Point(0, 320);
this.pl_mainSearch.LookAndFeel.UseDefaultLookAndFeel = false;
this.pl_mainSearch.Name = "pl_mainSearch";
this.pl_mainSearch.Size = new System.Drawing.Size(997, 33);
this.pl_mainSearch.TabIndex = 12;
//
// pl_search
//
this.pl_search.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_search.Appearance.Options.UseBackColor = true;
this.pl_search.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_search.Dock = System.Windows.Forms.DockStyle.Left;
this.pl_search.Location = new System.Drawing.Point(0, 0);
this.pl_search.LookAndFeel.UseDefaultLookAndFeel = false;
this.pl_search.Name = "pl_search";
this.pl_search.Size = new System.Drawing.Size(221, 33);
this.pl_search.TabIndex = 14;
//
// flowLayoutPanel
//
this.flowLayoutPanel.Controls.Add(this.btnSave);
this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Right;
this.flowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this.flowLayoutPanel.Location = new System.Drawing.Point(825, 0);
this.flowLayoutPanel.Name = "flowLayoutPanel";
this.flowLayoutPanel.Size = new System.Drawing.Size(172, 33);
this.flowLayoutPanel.TabIndex = 13;
this.flowLayoutPanel.WrapContents = false;
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSave.Appearance.Options.UseFont = true;
this.btnSave.Location = new System.Drawing.Point(97, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(72, 26);
this.btnSave.TabIndex = 40;
this.btnSave.Text = "保存(&S)";
//
// gcRight
//
this.gcRight.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcRight.Location = new System.Drawing.Point(0, 0);
this.gcRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.gcRight.Name = "gcRight";
this.gcRight.Size = new System.Drawing.Size(315, 679);
this.gcRight.TabIndex = 11;
//
// tabBottom
//
this.tabBottom.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabBottom.Location = new System.Drawing.Point(0, 0);
this.tabBottom.Name = "tabBottom";
this.tabBottom.Size = new System.Drawing.Size(997, 321);
this.tabBottom.TabIndex = 14;
//
// FrmProductSched
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pl_main);
this.Name = "FrmProductSched";
this.Size = new System.Drawing.Size(1317, 679);
((System.ComponentModel.ISupportInitialize)(this.pl_main)).EndInit();
this.pl_main.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitMainControl)).EndInit();
this.splitMainControl.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitLeftControl)).EndInit();
this.splitLeftControl.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pltopmain)).EndInit();
this.pltopmain.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_mainSearch)).EndInit();
this.pl_
File diff suppressed because it is too large Load Diff
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+336 -14
View File
@@ -394,6 +394,19 @@ namespace Lskj.Control
/// 创建动态分组列控件回调
/// </summary>
public event EventHandler OnBuildGroupedColumnCallBack;
/// <summary>
/// 记录上一次分组状态,避免重复排序
/// </summary>
private int _lastGroupCount = 0;
/// <summary>
/// 分组后根据汇总排序是否完成
/// </summary>
private bool Completed = true;
/// <summary>
/// 进度条类型的列名称
/// </summary>
private List<string> ProgressBarColumn = new List<string>();
public GridControlEx()
{
@@ -444,8 +457,16 @@ namespace Lskj.Control
this.gridView.CustomUnboundColumnData += OnGridViewCustomUnboundColumnData;
this.gridView.DoubleClick += OnShowImageDoubleClick; ;
#endregion
if (SystemInfo.Instance.GroupSpecialMode) this.gridView.EndGrouping += GridView_EndGrouping;
}
/// <summary>
/// 保存前反写多表头数据源
/// </summary>
@@ -1002,7 +1023,6 @@ namespace Lskj.Control
protected virtual void SetColumnFormat(GridColumn gridColumn, GridColumnModel model)
{
if (gridColumn == null || model == null) return;
// 格式化数字
if (!string.IsNullOrEmpty(model.DataFormat))
{
@@ -1761,9 +1781,49 @@ namespace Lskj.Control
try
{
this.AdapterObj = adapter;
DataSet dataSet = new DataSet();
// 重连配置
int maxRetryCount = 2; // 次数
int retryDelay = 1000; // 等待时间
for (int i = 0; i < maxRetryCount; i++)
{
try
{
adapter.Fill(dataSet, "SetGridViewDataSource");
break;//连接成功
}
catch (SqlException ex)
{
// 判断是否是连接相关错误
if (IsConnectionError(ex.Number) ||
ex.Message.Contains("物理连接不可用") ||
ex.Message.Contains("传输级错误"))
{
if (i < maxRetryCount - 1)
{
SqlConnection.ClearAllPools();
System.Threading.Thread.Sleep(retryDelay);
continue; // 重试
}
else
{
// 最后一次重试失败,抛出错误
throw new Exception($"经过 {maxRetryCount} 次重试后仍无法连接到数据库: {ex.Message}", ex);
}
}
else
{
// 其他SQL错误直接抛出
throw;
}
}
}
if (this.ColumnList == null || this.ColumnList.Count == 0)
{
@@ -1815,6 +1875,8 @@ namespace Lskj.Control
this.ClearImage();
this.GridControl.DataSource = dt;
this.AdjustIndicatorWidthSmart();
//modifyThePosition.Clear();
// 动态列处理
@@ -1829,6 +1891,23 @@ namespace Lskj.Control
}
return 0;
}
/// <summary>
/// 判断是否是连接相关的错误代码
/// </summary>
protected virtual bool IsConnectionError(int errorNumber)
{
// 常见的连接相关错误代码
int[] connectionErrorNumbers = {
10053, 10054, 10060, 10061, // 网络相关错误
4060, 18456, // 登录相关错误
2, 53 // 服务器不存在或无法访问
};
return Array.IndexOf(connectionErrorNumbers, errorNumber) >= 0;
}
/// <summary>
/// <para>说明:计算列关联字段</para>
/// <para>创建人:龚宇超</para>
@@ -2000,7 +2079,16 @@ namespace Lskj.Control
{
result = (double.Parse(result.Replace("%", "")) * 0.01).ToString();
}
if (string.IsNullOrEmpty(result))
{
rowItem[gridModel.FieldName] = DBNull.Value;
}
else
{
rowItem[gridModel.FieldName] = result;
}
// 判断计算列有无关联值
GridColumnModel UnionModel = calcModels.FirstOrDefault(x => x.FieldName == gridModel.FieldName);
if (!string.IsNullOrEmpty(UnionModel.UnionFields))
@@ -3251,6 +3339,45 @@ namespace Lskj.Control
}
}
/// <summary>
/// 查找指定列(定位到弹窗选中列)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected virtual void LookUpColumn(object sender, EventArgs e)
{
Dictionary<string, string> columnInformation = new Dictionary<string, string>();
foreach (GridColumn column in this.gridView.Columns)
{
if (column.Visible)
{
columnInformation.Add(column.FieldName, column.Caption);
}
}
FrmPositioningColumn frmPositioningColumn = new FrmPositioningColumn(columnInformation);
if (frmPositioningColumn.ShowDialog() == DialogResult.OK)
{
string columnNameToFind = frmPositioningColumn.FindName;
GridColumn column = this.gridView.Columns.ColumnByFieldName(columnNameToFind);
if (column != null)
{
this.gridView.FocusedColumn = column; // 让指定列获得焦点
if (this.gridView.FocusedRowHandle >= 0)
{
this.gridView.MakeRowVisible(this.gridView.FocusedRowHandle);
//this.gridView.ClearSelection();
//this.gridView.SelectCell(this.gridView.FocusedRowHandle, column);
}
this.gridView.MakeColumnVisible(column);
this.gridView.Invalidate(); // 重绘视图
}
}
}
/// <summary>
/// <para>说明:根据显示值获取隐藏Value</para>
/// <para>创建人:龚宇超</para>
@@ -3265,7 +3392,7 @@ namespace Lskj.Control
protected virtual object GetValueByCaption(GridColumnModel model, RepositoryItem columnEdit, object text, out bool result)
{
DataTable table = new DataTable();
bool moduleReturnCheck = false;//模块选择框复选
if (string.IsNullOrEmpty(text + ""))
{
result = false;
@@ -3290,11 +3417,13 @@ namespace Lskj.Control
else if (columnEdit is RepositoryItemCheckedComboBoxEdit)
{
RepositoryItemCheckedComboBoxEdit rccbe = columnEdit as RepositoryItemCheckedComboBoxEdit;
FrmModelLookUp modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp;
if (!modelLookUp.SingleChoiceMode) moduleReturnCheck = true;
table = rccbe.DataSource as DataTable;
}
if (table != null && table.Rows.Count > 0 && table.Columns.Count > 0)
{
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam))
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam || moduleReturnCheck))
{
string[] values = (text + "").Trim(',').Split(',');
string textNew = string.Empty;
@@ -3316,6 +3445,70 @@ namespace Lskj.Control
result = false;
return text;
}
/// <summary>
/// 模块返回框验证(外部粘贴时验证值是否正确)
/// </summary>
/// <param name="model"></param>
/// <param name="columnEdit"></param>
/// <param name="text"></param>
/// <param name="result"></param>
/// <returns></returns>
protected virtual object ModuleReturnVerify(GridColumnModel model, RepositoryItem columnEdit, object text, out bool result)
{
DataTable table = new DataTable();
bool moduleReturnCheck = false;//多选模式
if (string.IsNullOrEmpty(text + ""))
{
result = false;
return text;
}
if (columnEdit is RepositoryItemCheckedComboBoxEdit)
{
RepositoryItemCheckedComboBoxEdit rccbe = columnEdit as RepositoryItemCheckedComboBoxEdit;
if (rccbe.Buttons[1].Tag is FrmModelLookUp)
{
FrmModelLookUp modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp;
if (!modelLookUp.SingleChoiceMode) moduleReturnCheck = true;
table = rccbe.DataSource as DataTable;
}
if (rccbe.Buttons[1].Tag is FrmModelLookUp2)
{
FrmModelLookUp2 modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp2;
if (!modelLookUp.SingleChoiceMode) moduleReturnCheck = true;
table = rccbe.DataSource as DataTable;
}
}
if (table != null && table.Rows.Count > 0 && table.Columns.Count > 0)
{
if (moduleReturnCheck)
{
string[] values = (text + "").Trim(',').Split(',');
string textNew = string.Empty;
foreach (string value in values)
{
DataRow rowItemNew = table.Select("1=1").FirstOrDefault(x => (value + "").Equals(x[model.TextMember] + ""));
if (rowItemNew != null)
{
textNew += rowItemNew[model.ValueMember] + ",";
}
}
result = !string.IsNullOrEmpty(textNew) ? textNew == text + "" : false;
return !string.IsNullOrEmpty(textNew) ? textNew : text;
}
DataRow rowItem = table.Select("1=1").FirstOrDefault(x => (text + "").Equals(x[model.TextMember] + ""));
result = rowItem != null ? rowItem[model.ValueMember] + "" == text + "" : false;
return rowItem != null ? rowItem[model.ValueMember] + "" : text;
}
result = false;
return text;
}
/// <summary>
/// 去除多选框中的空格
/// </summary>
@@ -3492,9 +3685,13 @@ namespace Lskj.Control
RepositoryItemProgressBar progressEdit = new RepositoryItemProgressBar();
progressEdit.ShowTitle = true;
this.ProgressBarColumn.Add(gridColumn.FieldName);
gridControl.RepositoryItems.Add(progressEdit);
gridColumn.ColumnEdit = progressEdit;
}
/// <summary>
/// <para>说明:创建CheckBoxEdit</para>
/// <para>创建人:龚宇超</para>
@@ -3925,12 +4122,15 @@ 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);
@@ -4507,9 +4707,14 @@ namespace Lskj.Control
btnEdit.DisplayMember = model.TextMember;
btnEdit.SeparatorChar = ',';
btnEdit.ValueMember = model.FieldType == ControlType.LabSelectReturnIdNew ? model.ValueMember : model.TextMember;
//DataTable dataTable = MainImpl.GetDataTableResult(modelLookUp.SingleChoiceMode ? modelLookUp.SysModel.MenuSql : model.SqlSource);
////ModuleEnclosure.Add(model.FieldName, dataTable);
//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) });
@@ -5348,6 +5553,18 @@ namespace Lskj.Control
GridColumn col = gridView.VisibleColumns[_colNumber];
GridColumnModel model = col.Tag as GridColumnModel;
if (!string.IsNullOrWhiteSpace(model.DisableCond))
{
DataRow FocusedRow = newRow == null? this.gridView.GetFocusedDataRow(): newRow;
string UpdateCond = model.DisableCond;
if (this.ParentControl != null) UpdateCond = this.ParentControl.ReplaceParentControlValue(model.DisableCond);
UpdateCond = ReplaceHelper.ReplaceRowParam(FocusedRow, UpdateCond);
if (!ReplaceHelper.EvalCond(UpdateCond))
{
_colNumber += 1;
continue;
}
}
if (model != null && !model.ProhibitPaste && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit))))
{
// 返回ID类型特殊处理
@@ -5366,13 +5583,11 @@ namespace Lskj.Control
continue;
}
}
if (model.FieldType == 116)
if (model.FieldType == 116 || model.FieldType == 117)
{
RepositoryItemCheckedComboBoxEdit rccbe = col.ColumnEdit as RepositoryItemCheckedComboBoxEdit;
FrmModelLookUp modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp;
if (modelLookUp.SingleChoiceMode)
{
value = GetValueByCaption(model, col.ColumnEdit, cellValue, out IsTextEqualValue);
value = ModuleReturnVerify(model, col.ColumnEdit, cellValue, out IsTextEqualValue);
//// 避免下拉框值替换失败提示错误
if (model != null && !IsTextEqualValue && cellValue == value + "")
{
@@ -5380,8 +5595,19 @@ namespace Lskj.Control
continue;
}
}
if (model.FieldType == 160 || model.FieldType == 161)
{
RepositoryItemCheckedComboBoxEdit rccbe = col.ColumnEdit as RepositoryItemCheckedComboBoxEdit;
FrmModelLookUp2 modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp2;
value = ModuleReturnVerify(model, col.ColumnEdit, cellValue, out IsTextEqualValue);
//// 避免下拉框值替换失败提示错误
if (model != null && !IsTextEqualValue && cellValue == value + "")
{
_colNumber += 1;
continue;
}
}
DateTime dateValue = new DateTime();
@@ -5562,6 +5788,19 @@ namespace Lskj.Control
GridColumn col = gridView.VisibleColumns[_colNumber];
GridColumnModel model = col.Tag as GridColumnModel;
if (!string.IsNullOrWhiteSpace(model.DisableCond))
{
DataRow FocusedRow = this.gridView.GetFocusedDataRow();
string UpdateCond = model.DisableCond;
if (this.ParentControl != null) UpdateCond = this.ParentControl.ReplaceParentControlValue(model.DisableCond);
UpdateCond = ReplaceHelper.ReplaceRowParam(FocusedRow, UpdateCond);
if (!ReplaceHelper.EvalCond(UpdateCond))
{
_colNumber += 1;
continue;
}
}
if (model != null && !model.ProhibitPaste && (model.CanCopy || ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit)))) //if ((gridView.OptionsBehavior.Editable) && (gridView.VisibleColumns[_colNumber].OptionsColumn.AllowEdit))
{
// 返回ID类型特殊处理
@@ -5579,6 +5818,35 @@ namespace Lskj.Control
continue;
}
}
if (model.FieldType == 116 || model.FieldType == 117)
{
RepositoryItemCheckedComboBoxEdit rccbe = col.ColumnEdit as RepositoryItemCheckedComboBoxEdit;
FrmModelLookUp modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp;
value = ModuleReturnVerify(model, col.ColumnEdit, cellValue, out IsTextEqualValue);
//// 避免下拉框值替换失败提示错误
if (model != null && !IsTextEqualValue && cellValue == value + "")
{
_colNumber += 1;
continue;
}
}
if (model.FieldType == 160 || model.FieldType == 161)
{
RepositoryItemCheckedComboBoxEdit rccbe = col.ColumnEdit as RepositoryItemCheckedComboBoxEdit;
FrmModelLookUp2 modelLookUp = rccbe.Buttons[1].Tag as FrmModelLookUp2;
value = ModuleReturnVerify(model, col.ColumnEdit, cellValue, out IsTextEqualValue);
//// 避免下拉框值替换失败提示错误
if (model != null && !IsTextEqualValue && cellValue == value + "")
{
_colNumber += 1;
continue;
}
}
DateTime dateValue = new DateTime();
// 避免下拉框值替换失败提示错误
@@ -5823,13 +6091,13 @@ namespace Lskj.Control
// }
//}
if (gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect)
{
int[] selectRows = gridView.GetSelectedRows();
foreach (int selectRow in selectRows)
{//#9feb6a
if (e.RowHandle == selectRow)
{
e.Appearance.BackColor = ColorTranslator.FromHtml(SystemInfo.Instance.SelectRowBackColor);
if (!string.IsNullOrWhiteSpace(SystemInfo.Instance.SelectRowForeColor))
{
@@ -5837,6 +6105,7 @@ namespace Lskj.Control
}
}
}
}
else if (e.RowHandle == gridView.FocusedRowHandle)//|| mergedRowHandle.Contains(e.RowHandle)
{
e.Appearance.BackColor = ColorTranslator.FromHtml(SystemInfo.Instance.SelectRowBackColor);
@@ -5928,6 +6197,7 @@ namespace Lskj.Control
if (model == null) return;
DataRow rowHandleRow = this.GridView.GetDataRow(e.RowHandle);
//值改变时,如果是验证是否重复的列报错就清除
if (RepeatedVerificationNames.Count > 0)
{
@@ -6233,6 +6503,7 @@ namespace Lskj.Control
DXMenuItem itemPrintColumn = new DXMenuItem("打印表格数据", PrintItemClick);
DXMenuItem itemSortColumn = new DXMenuItem("清除全部列排序", ClearSortItemClick);
DXMenuItem itemMultifunction = new DXMenuItem("多功能设置分组", Multifunction);
DXMenuItem itemLookUpColumn = new DXMenuItem("查找列", LookUpColumn);
DXMenuItem itemColumnSift = new DXMenuItem("一键设置列筛选条件", InstColumnSift);
DXMenuItem itemChartColumn = new DXMenuItem("一键图表展示", ChartShowClick);
DXMenuItem itemBsChartColumn = new DXMenuItem("一键Bs图表展示", BsChartShowClick);
@@ -6244,7 +6515,7 @@ namespace Lskj.Control
itemSaveColumn.BeginGroup = itemFixLeft.BeginGroup = true;
itemUnFixAll.Tag = itemFixLeft.Tag = itemFixLeftAll.Tag = itemUnFix.Tag = itemColumnSift.Tag = e.HitInfo.Column;
itemSaveColumn.Tag = itemResetColumn.Tag = itemExportColumn.Tag = itemPrintColumn.Tag = itemSortColumn.Tag = itemChartColumn.Tag = itemBsChartColumn.Tag = itemBsChartShowClick.Tag = itemSetExportColumn.Tag = e.HitInfo.Column;
columnMenu.Items.AddRange(new DXMenuItem[] { itemFixLeft, itemFixLeftAll, itemUnFix, itemUnFixAll });
columnMenu.Items.AddRange(new DXMenuItem[] { itemFixLeft, itemFixLeftAll, itemUnFix, itemUnFixAll, itemLookUpColumn });
if (!string.IsNullOrEmpty(CustomColumKey)) columnMenu.Items.AddRange(new DXMenuItem[] { itemSaveColumn, itemResetColumn, itemSetExportColumn });
if (ExportPermission) columnMenu.Items.Add(itemExportColumn);
columnMenu.Items.AddRange(new DXMenuItem[] { itemPrintColumn, itemMultifunction, itemSortColumn, itemColumnSift, itemChartColumn, itemBsChartColumn, itemBsChartShowClick });
@@ -6257,6 +6528,9 @@ namespace Lskj.Control
}
}
/// <summary>
/// <para>说明:带参数自动搜索框</para>
/// <para>创建人:龚宇超</para>
@@ -8880,4 +9154,52 @@ namespace Lskj.Control
{
// 只处理列名可解析成日期的列
if (!DateTime.TryParse(col.FieldName, out _))
continue;
// 取 “Sum” 合计
var sumItem = col.Summary
.OfType<GridColumnSummaryItem>()
.FirstOrDefault(s => s.SummaryType == SummaryItemType.Sum);
bool needRed = false;
if (sumItem?.SummaryValue != null &&
decimal.TryParse(sumItem.SummaryValue.ToString(), out var colSum) &&
jhrowitem.Table.Columns.Contains(col.FieldName) &&
decimal.TryParse(jhrowitem[col.FieldName].ToString(), out var planVal))
{
needRed = (colSum != planVal);
}
// 只改表头文字颜色
col.AppearanceHeader.ForeColor = needRed ? Color.Red : Color.Black;
col.AppearanceHeader.Options.UseForeColor = true;
}
// 立刻刷新表头
gridView.Invalidate();
}
/// <summary>
/// 分组后根据汇总排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GridView_EndGrouping(object sender, EventArgs e)
{
int currentGroupCount = gridView.GroupedColumns.Count;
// 仅在分组状态变化(新增分组)时执行
if (SystemInfo.Instance.GroupSpecialMode && +currentGroupCount != _lastGroupCount && currentGroupCount > 0 && Completed)
{
Completed = false;
try
{
// 清除现有排序规则
gridView.GroupSummarySortInfo.Clear();
// 遍历多目标汇总列,按优先级添加排序
foreach (GridColumn gridColumn in gridView.Columns)
+13 -37
View File
@@ -52,6 +52,10 @@ namespace Lskj.Control
private bool _working = false;
private List<string> _queryQueue = new List<string>();
/// <summary>
/// 是否点击弹出框中的行
/// </summary>
private bool PopupBoxSelection = false;
/// <summary>
/// 显示值字段
/// </summary>
public string TextField
@@ -236,7 +240,8 @@ namespace Lskj.Control
if (this.Model != null && (this.Model.FieldType == ControlType.LabAutoGridValue || this.Model.FieldType == ControlType.LabAutoGridValueParam))
{
// 存在名称并且没有value值则
if (control != null && !string.IsNullOrEmpty(control.EditText) && (string.IsNullOrEmpty(_value) || !control.EditText.Equals(this._textVlaue)))
//PopupBoxSelection为ture时代表在弹出框中选中行,就不根据当前输入值判断了(可能输入一半查询到后就直接选中,或者输入123,选中1234,但是control.EditText值还是123导致出错)
if (control != null && !string.IsNullOrEmpty(control.EditText) && (string.IsNullOrEmpty(_value) || !control.EditText.Equals(this._textVlaue))&& !PopupBoxSelection)
{
if (this.DataSource != null && this.DataSource is DataTable)
{
@@ -761,6 +766,8 @@ namespace Lskj.Control
}
return maxWidth;
}
/// <summary>
/// 实际值发生改变触发
/// </summary>
@@ -770,6 +777,7 @@ namespace Lskj.Control
{
try
{
this.PopupBoxSelection = true;
GridView gridView = sender as GridView;
DataRow rowItem = gridView.GetFocusedDataRow();
if (rowItem != null && rowItem.Table.Columns.Contains(ValueMember))
@@ -782,6 +790,10 @@ namespace Lskj.Control
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
finally
{
this.PopupBoxSelection = false;
}
}
@@ -797,40 +809,4 @@ namespace Lskj.Control
{
this.EditValue = rowItem[ValueMember] + "";
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
/// <summary>
/// <para>说明:释放时清理数据源</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
private void OnLabelAutoGridLook_Disposed(object sender, EventArgs e)
{
if (this.DataSourceTable != null)
{
this.DataSourceTable.Clear();
this.DataSourceTable.Dispose();
}
if (this.DataSource != null)
{
this.DataSource = null;
}
GC.Collect();
}
}
}
@@ -27,7 +27,7 @@ namespace Lskj.Control
/// <summary>
/// The _look up form
/// </summary>
private FrmModelLookUp2 _lookUpForm = null;
public FrmModelLookUp2 _lookUpForm = null;
/// <summary>
/// 绑定ValueMember
/// </summary>
@@ -82,6 +82,15 @@ namespace Lskj.Control
///模块选择返回框,配置列加载模式(默认根据sql动态加载列)
/// </summary>
public bool ConfigureColumnMode { get; set; }
/// <summary>
/// 数据源
/// </summary>
public DataTable DataSource;
/// <summary>
/// 显示text值(保存id,显示text值)
/// </summary>
public bool ModuleFrameDisplayText;
private string editValue;
@@ -167,6 +176,31 @@ namespace Lskj.Control
set
{
this.EditValue = value;
if (ModuleFrameDisplayText)
{
if (!string.IsNullOrEmpty(value) && this.DataSource != null)
{
string[] values = value.Trim(',').Split(',');
string text = string.Empty;
foreach (string item in values)
{
DataRow rowItem = this.DataSource.Rows.Cast<DataRow>().FirstOrDefault(x => x[ValueMember] + "" == item);
if (rowItem != null)
{
text += rowItem[TextField] + ",";
}
}
this.txtEdit.Text = text.TrimEnd(',');
}
else
{
this.txtEdit.Text = "";
}
}
else
{
this.TextEdit.Text = value.TrimEnd(',');
}
}
}
@@ -181,18 +215,9 @@ namespace Lskj.Control
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
public string EditValue
{
get
{
return this.TextEdit.Text;
}
set
{
this.TextEdit.Text = value.TrimEnd(',');
this.editValue = value.TrimEnd(',');
}
}
public string EditValue;
/// <summary>
/// <para>说明:设置控件提示文本</para>
/// <para>创建人:龚宇超</para>
@@ -351,5 +376,6 @@ namespace Lskj.Control
if (result == DialogResult.OK)
{
string value = Model.FieldType == ControlType.LabSelectReturnIdNew ? _lookUpForm.EditValue : _lookUpForm.EditText;
this.EditValue = value;
this.EditText = value;
//this.EditValue = value;
+9 -1
View File
@@ -321,4 +321,12 @@ namespace Lskj.Control.Model
/// </summary>
public bool ScanAfterEmpty { get; set; }
/// <summary>
///是否为 导入返
///是否为 导入返回值控件(每次导入前刷新默认值并带入)
/// </summary>
public bool ImportReturnValue { get; set; }
/// <summary>
///是否为 导入控件(每次导入前把当前控件值带入)
/// </summary>
public bool ImportCurrentValue { get; set; }
/// <summary>
///是否为
@@ -108,6 +108,11 @@ namespace Lskj.Control.Model
/// <value><c>true</c> if this instance is web view; otherwise, <c>false</c>.</value>
public bool IsDetailView { get { return this._detailType == 4; } }
/// <summary>
/// 明细页签(带虚拟日期)
/// </summary>
/// <value><c>true</c> if this instance is web view; otherwise, <c>false</c>.</value>
public bool IsSched { get { return this._detailType == 7; } }
/// <summary>
/// sql配置明细是否可以保存
/// </summary>
public bool DetailIsSave;
@@ -273,7 +278,10 @@ namespace Lskj.Control.Model
///mrp条件页签(根据页签选中行去设置别的页签中对应的条件)
/// </summary>
public bool MrpConditionTab;
/// <summary>
/// 刷新明细的序号(排产模块)
/// </summary>
public string PlanLetfControl;
/// <summary>
/// 主模块编号
@@ -332,4 +340,5 @@ namespace Lskj.Control.Model
this.Enablecond = item.Table.Columns.Contains("Enablecond") ? (item["Enablecond"] + "") : string.Empty;
this.DBClickEvent = item.Table.Columns.Contains("DBClickEvent") ? "1".Equals(item["DBClickEvent"] + "") : false;
this.ProhibitRefresh = item.Table.Columns.Contains("ProhibitRefresh") ? "1".Equals(item["ProhibitRefresh"] + "") : false;
this.DragExecuteSql = item.Ta
this.DragExecuteSql = item.Table.Columns.Contains("DragExecuteSql") ? item["DragExecuteSql"] + "" : "";
this.QueryAgain = item.Table.Col
+75 -15
View File
@@ -19,6 +19,10 @@ using DevExpress.Utils;
using System.Data;
using DevExpress.XtraGrid;
using Lskj.Util;
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Columns;
using DevExpress.Data;
namespace Lskj.Control.Model
{
@@ -450,27 +454,83 @@ namespace Lskj.Control.Model
}
#endregion
/// <summary>
/// 拖拽时判断条件
/// </summary>
/// <returns></returns>
protected bool JudgingConditions()
#region
public static void TreeListAddCheckBox(TreeList treeList)
{
if (!string.IsNullOrWhiteSpace(DragConditions))
treeList.OptionsView.ShowCheckBoxes = true;
treeList.OptionsSelection.MultiSelect = true;
treeList.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.RowSelect;
treeList.OptionsSelection.InvertSelection = true;
treeList.OptionsSelection.UseIndicatorForSelection = true;
treeList.OptionsSelection.EnableAppearanceFocusedCell = false;
// 绑定节点勾选状态变更事件
treeList.AfterCheckNode += OnTreeListAfterCheckNode;
// 遍历所有列,设置需要自定义汇总的列
foreach (TreeListColumn column in treeList.Columns)
{
string DragCond = ReplaceHelper.ReplaceRowParam(this._targetGridView.GetDataRow(this._targetGridView.FocusedRowHandle), DragConditions);
DataRow[] rows = GetGridSelectRows(DragHander.Count > 1 && this._sourceGridView.GetSelectedRows().Length == DragHander.Count ? DragHander.ToArray() : this._sourceGridView.GetSelectedRows());
foreach (DataRow row in rows)
GridColumnModel columnModel = (GridColumnModel)column.Tag;
if (treeList.Columns.IndexOf(column) > 0 && columnModel != null && columnModel.CanSum)
{
if (!ReplaceHelper.ReplaceRowParamCond(row, DragCond))
{
return false;
column.SummaryFooter = DevExpress.XtraTreeList.SummaryItemType.Custom;
column.RowFooterSummary = DevExpress.XtraTreeList.SummaryItemType.Custom;
//SummaryItem groupSummaryItem = treeList.GroupSummary.FirstOrDefault(n => n.FieldName == column.FieldName);
//if (groupSummaryItem != null)
//{
// groupSummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Custom;
//}
}
}
}
return true;
}
// 节点勾选状态变更事件处理方法
private static void OnTreeListAfterCheckNode(object sender, NodeEventArgs e)
{
TreeList treeList = sender as TreeList;
if (treeList == null) return;
// 更新子节点状态
UpdateChildNodes(e.Node, e.Node.Checked);
// 更新父节点状态
UpdateParentNode(e.Node);
}
}
// 递归更新子节点的选中状态
private static void UpdateChildNodes(TreeListNode node, bool check)
{
foreach (TreeListNode childNode in node.Nodes)
{
childNode.Checked = check;
UpdateChildNodes(childNode, check);
}
}
// 更新父节点的选中状态
private static void UpdateParentNode(TreeListNode node)
{
TreeListNode parentNode = node.ParentNode;
if (parentNode == null) return;
bool allChecked = true;
bool allUnchecked = true;
// 检查所有兄弟节点的状态
foreach (TreeListNode siblingNode in parentNode.Nodes)
{
if (siblingNode.Checked)
allUnchecked = false;
else
allChecked = false;
if (!allChecked && !allUnchecked)
break;
}
// 根据兄弟节点状态设置父节点状态
parentNode.Checked = allChecked;
parentNode.CheckState = allChecked ? CheckState.Checked :
(allUnchecked ? CheckState.Unchecked : CheckState.Indeterminate);
// 递
+4 -4
View File
@@ -1282,8 +1282,8 @@ namespace Lskj.Control.Model
{
try
{
string sqlstr = "select fieldName,userName from {0} where {1}='{2}' and isExport='1' and OperatorName='{3}'";
sqlstr = string.Format(sqlstr, ResourceKeys.SettingExportTableName, "formkey", CustomColumKey, ERPInfo.Instance.UserName);
string sqlstr = "select fieldName,userName from {0} where {1}='{2}' and isExport='1' and OperatorId='{3}'";
sqlstr = string.Format(sqlstr, ResourceKeys.SettingExportTableName, "formkey", CustomColumKey, ERPInfo.Instance.UserId);
isExportTab = SqlHelper.ExecuteDataTable(sqlstr);
}
catch (Exception)
@@ -1508,8 +1508,8 @@ namespace Lskj.Control.Model
{
try
{
string sqlstr = "select fieldName,userName from {0} where {1}='{2}' and isExport='1' and OperatorName='{3}'";
sqlstr = string.Format(sqlstr, ResourceKeys.SettingExportTableName, "formkey", CustomColumKey, ERPInfo.Instance.UserName);
string sqlstr = "select fieldName,userName from {0} where {1}='{2}' and isExport='1' and OperatorId='{3}'";
sqlstr = string.Format(sqlstr, ResourceKeys.SettingExportTableName, "formkey", CustomColumKey, ERPInfo.Instance.UserId);
isExportTab = SqlHelper.ExecuteDataTable(sqlstr);
}
catch (Exception)
@@ -513,8 +513,24 @@ namespace Lskj.Control.Model
// 特殊处理程序
else if (dllName.Contains(".exe") && !model.WipeExes.Contains(dllName.ToString()) && (dllName.ToLower() != "lstest.exe"))
{
//删除选中行的json信息
if(!string.IsNullOrWhiteSpace(maintabFocusedRowJson))paramList.Remove(maintabFocusedRowJson);
// 创建进程启动信息对象
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName; // 指定要启动的 EXE 路径
// 将参数数组拼接为命令行字符串(注意空格处理)
// 若参数包含空格,需要用双引号包裹,避免被解析为多个参数
startInfo.Arguments = string.Join(" ", paramList.Select(arg =>
arg.Contains(" ") ? $"\"{arg}\"" : arg
));
// 可选:设置进程启动选项
startInfo.UseShellExecute = false; // 不使用系统外壳程序(建议为 false,便于重定向输入输出)
startInfo.CreateNoWindow = false; // 是否在新窗口中启动(false 为显示窗口)
// 启动进程
Process process = Process.Start(startInfo);
// 执行exe程序
WinHelper.WinExec(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, 1);
//WinHelper.WinExec(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, 1);
}
else if (dllName.StartsWith("www.") ||
+52 -3
View File
@@ -148,7 +148,10 @@ namespace Lskj.Control.Model
/// 如果主表刷新后还要选中之前的明细,就要存主表主键值(目前没用传进来)
/// </summary>
public Dictionary<string, Dictionary<DataRow, string>> DetailSelection = new Dictionary<string, Dictionary<DataRow, string>>();
/// <summary>
/// 是否为审核界面主表
/// </summary>
public bool isAuditMain = false;
/// <summary>
@@ -496,6 +499,10 @@ namespace Lskj.Control.Model
{
baseControl.ModifyDefaultColors(ColorTranslator.FromHtml(model.ControlTitleColor));
}
if (this.isAuditMain && !string.IsNullOrWhiteSpace(model.AuditControlTitleColor))
{
baseControl.ModifyAuditDefaultColors(ColorTranslator.FromHtml(model.AuditControlTitleColor));
}
baseControl.Required = model.IsEmpty;
baseControl.ReadOnly = model.ReadOnly;
@@ -1443,7 +1450,8 @@ namespace Lskj.Control.Model
model.SourceSql += "and 1<>1";
}
DataTable table = new DataTable();
if (!ControlType.IsNotLoadData(model.FieldType) && model.FieldType != ControlType.LabTreeType)
if ((!ControlType.IsNotLoadData(model.FieldType)|| model.ModuleFrameDisplayText && (model.FieldType == 160|| model.FieldType == 161)) && model.FieldType != ControlType.LabTreeType)
{
if (mControlSourceDic.ContainsKey(model))
{
@@ -1554,6 +1562,11 @@ namespace Lskj.Control.Model
LabelMultiAutoTextEdit2 moduleReturnsId = ctr as LabelMultiAutoTextEdit2;
moduleReturnsId.SetDataSource(table);
break;
case ControlType.LabSelectReturnIdNew:
case ControlType.LabSelectReturnTextNew:
LabelMultiAutoTextEdit4 moduleReturnsIdnew = ctr as LabelMultiAutoTextEdit4;
moduleReturnsIdnew.DataSource=table;
break;
case ControlType.DynamicallyGeneratedSql:
LabelMultiAutoTextEdit3 moduleSqlGenerated = ctr as LabelMultiAutoTextEdit3;
//moduleSqlGenerated.SetDataSource(table);
@@ -4008,6 +4021,8 @@ namespace Lskj.Control.Model
model.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : "";
model.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : "";
model.AdditionalAssociations = item.Table.Columns.Contains("AdditionalAssociations") && !string.IsNullOrWhiteSpace(item["AdditionalAssociations"] + "") ? "1".Equals(item["AdditionalAssociations"] + "") : false;
model.AuditControlTitleColor = item.Table.Columns.Contains("AuditControlTitleColor") ? item["AuditControlTitleColor"] + "" : "";
model.ModuleFrameDisplayText = item.Table.Columns.Contains("ModuleFrameDisplayText") ? "1".Equals(item["ModuleFrameDisplayText"] + "") : false;
//为了和工具里和bs里统一
if (model.FieldType == 42)
{
@@ -4539,6 +4554,14 @@ namespace Lskj.Control.Model
moduleReturnsIdNew.ConfigureColumnMode = model.ConfigureColumnMode;
moduleReturnsIdNew.InitialFrame();
model.SourceSql = "";
//设置了ModuleFrameDisplayText(显示text值),就把配置的模块sql传给model.SourceSql
if (model.ModuleFrameDisplayText)
{
moduleReturnsIdNew.ModuleFrameDisplayText = true;
model.SourceSql = moduleReturnsIdNew._lookUpForm.SysModel.MenuSql;
}
// DataTable dataSource = new DataTable();
//moduleReturnsIdNew.SetDataSource(dataSource);
moduleReturnsIdNew.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
@@ -6036,4 +6059,30 @@ namespace Lskj.Control.Model
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
}
else if
else if (controlObj is LabelCheckEdit)
{
LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
value = checkEdit.EditText;
}
else if (controlObj is LabelComboxEdit)
{
LabelComboxEdit autoEdit = controlObj as LabelComboxEdit;
value = autoEdit.EditValue;
}
else if (controlObj is LabelTextEdit)
{
LabelTextEdit textIntEdit = controlObj as LabelTextEdit;
if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText;
}
defaultValue = defaultValue.Replace(item, value);
}
}
}
return defaultValue;
}
}
}
+38 -24
View File
@@ -500,10 +500,11 @@ namespace Lskj.Control
}
else
{
this.TabObj.TabPages.Clear();
DataRow rowItem = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow();
if (rowItem == null) return;
string mainModuleCode = (rowItem[SysModel.MainModuleCodeField] + "").ToLower();
//mainModuleCode = String.Empty;
this.TabObj.TabPages.Clear();
//if (string.IsNullOrWhiteSpace(mainModuleCode)) return;
if (!string.IsNullOrWhiteSpace(mainModuleCode) && this.tcButtom.DetailTabPagesDic.ContainsKey(mainModuleCode))
{
@@ -820,29 +821,6 @@ namespace Lskj.Control
{
moduleGridEx.ParentButtonState(rowItem);
moduleGridEx.SelectTheSpecifiedRow();
//主表,页签中的表格都设置了复选框,并且为第一个页签
//if (this.ModuleGridObj.GridControlObj.GridView.OptionsSelection.MultiSelect == true && moduleGridEx.GridControlObj.GridView.OptionsSelection.MultiSelect == true && this.TabObj.TabPages[0] == tabPage)
//{
// if (this.SearchObj.DetailSelection.ContainsKey(model.DetailName))
// {
// Dictionary<DataRow, string> dictionary = this.SearchObj.DetailSelection[model.DetailName];
// if (dictionary.ContainsKey(rowItem))
// {
// DataTable dataTable = moduleGridEx.GridControlObj.GridControl.DataSource as DataTable;
// string value = dictionary[rowItem];
// for (int rowHandle = 0; rowHandle < moduleGridEx.GridControlObj.GridView.RowCount; rowHandle++)
// {
// string cellValue = moduleGridEx.GridControlObj.GridView.GetRowCellValue(rowHandle, moduleGridEx.ParmaryKey) + "";
// if (value.Split(',').Contains(cellValue))
// {
// moduleGridEx.GridControlObj.GridView.SelectRow(rowHandle); // 勾选
// }
// }
// }
// }
//}
}
}
@@ -1352,4 +1330,40 @@ namespace Lskj.Control
}
}
}
/// <summary>
/// 判断是否有未保存的数据,并保存
/// </summary>
/// <returns></returns>
public bool VerificationInterface()
{
if (SystemInfo.Instance.EfficientVerification)
{
//页签验证
if (!this.TcButtom.CheckIfSaved())
{
return false;
}
//主表验证
if (this.ModuleGridObj.GridControlObj.IsDataNotSaved())
{
DialogResult dialog = MessageUtil.Show("主表有数据未保存,是否保存", MessageBoxButtons.YesNo);
if (dialog == DialogResult.Yes)
{
bool SaveResults = this.ModuleGridObj.SaveWhenSwitching();
if (!SaveResults) return false;
}
}
}
return true;
}
}
}
+71 -5
View File
@@ -498,6 +498,7 @@ namespace Lskj.Control
//this.SearchObj.preSearchVerification += new PreSearchVerification(OnPreSearchVerification);// 查询条件执行前
this.SearchObj.OnSearchBeforeCallBack += new SearchEventHandler(OnSearchBeforeCallBack);// 查询条件执行前
this.SearchObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfterCallBack);// 查询条件执行后
this.SearchObj.TreeExactQuery = this.TreeExactQuery;
// 明细表格默认不查询
this.SearchObj.OnDataSourceBindCallBack += new EventHandler(OnMainSearchDataSourceBindCallBack);// 数据源绑定完成触发
@@ -891,6 +892,12 @@ namespace Lskj.Control
//父节点编号
(this.gcMain as TreeBandedGridControlEx).TreeListObj.ParentFieldName = SysModel.TreeParentFieldName;
}
if (this.SysModel.GridObjIsCheck == 1)//主表加载复选框
{
GridDragGrid.TreeListAddCheckBox((this.gcMain as TreeBandedGridControlEx).TreeListObj);
}
this.panelControl1.Controls.Add(this.gcMain);
}
else if (this.Model.GridEnumObj == GridEnum.BandedGridView || SysModel.AutoMultiHeader == 1)
@@ -924,6 +931,14 @@ namespace Lskj.Control
//父节点编号
(this.gcMain as TreeGridControlEx).TreeListObj.ParentFieldName = SysModel.TreeParentFieldName;
}
if (this.SysModel.GridObjIsCheck == 1)//主表加载复选框
{
GridDragGrid.TreeListAddCheckBox((this.gcMain as TreeGridControlEx).TreeListObj);
}
this.panelControl1.Controls.Add(this.gcMain);
}
@@ -3451,13 +3466,17 @@ namespace Lskj.Control
if (isContains)
{
this.btnAdd.Enabled = this.SysModel.AddEnable && this.ValidateCond(this.SysModel.AddCond, rowItem, "P_SystemDllTab", "addCond"); // 判断添加权限
this.btnDel.Enabled = this.SysModel.DeleteEnable && this.ValidateCond(this.SysModel.DeleteCond, rowItem, "P_SystemDllTab", "deleteCond"); // 判断删除权限
this.btnSave.Enabled = this.SysModel.ModifyEnable && this.ValidateCond(this.SysModel.ModifyCond, rowItem, "P_SystemDllTab", "modifyCond"); // 判断修改权限
this.btnImport.Enabled = this.SysModel.ImportEnable && this.ValidateCond(this.SysModel.ImportCond, rowItem, "P_SystemDllTab", "importCond"); // 判断导入权限
this.btnExport.Enabled = this.SysModel.ExportEnable && this.ValidateCond(this.SysModel.ExportCond, rowItem, "P_SystemDllTab", "exportCond") && this.SysModel.ExportPermission; // 判断导出权限
DataRow currentRow = this.gcMain.GridView.GetFocusedDataRow();
//把父表选中行和当前行都替换后在判断,避免传入行为null时,默认为true的情况
this.btnAdd.Enabled = this.SysModel.AddEnable && this.ValidateCond(ReplaceHelper.ReplaceRowParam(currentRow, ReplaceHelper.ReplaceRowParam(rowItem, this.SysModel.AddCond)), null, "P_SystemDllTab", "addCond"); // 判断添加权限
this.btnDel.Enabled = this.SysModel.DeleteEnable && this.ValidateCond(ReplaceHelper.ReplaceRowParam(currentRow, ReplaceHelper.ReplaceRowParam(rowItem, this.SysModel.DeleteCond)), null, "P_SystemDllTab", "deleteCond"); // 判断删除权限
this.btnSave.Enabled = this.SysModel.ModifyEnable && this.ValidateCond(ReplaceHelper.ReplaceRowParam(currentRow, ReplaceHelper.ReplaceRowParam(rowItem, this.SysModel.ModifyCond)), null, "P_SystemDllTab", "modifyCond"); // 判断修改权限
this.btnImport.Enabled = this.SysModel.ImportEnable && this.ValidateCond(ReplaceHelper.ReplaceRowParam(currentRow, ReplaceHelper.ReplaceRowParam(rowItem, this.SysModel.ImportCond)), null, "P_SystemDllTab", "importCond"); // 判断导入权限
this.btnExport.Enabled = this.SysModel.ExportEnable && this.ValidateCond(ReplaceHelper.ReplaceRowParam(currentRow, ReplaceHelper.ReplaceRowParam(rowItem, this.SysModel.ExportCond)), null, "P_SystemDllTab", "exportCond") && this.SysModel.ExportPermission; // 判断导出权限
}
}
}
catch (Exception)
{
@@ -3569,6 +3588,8 @@ namespace Lskj.Control
this.gcMain.IgnoreTab = this.SysModel.IgnoreTab;
}
//判断是否隐藏数据导入按钮
string[] authorizedPersonnel = SysModel.ImportPermissions.Split(',');//有导入权限的人员
this.btnImport.Enabled = false;
@@ -5060,6 +5081,7 @@ namespace Lskj.Control
}
}
}
catch (Exception ex)
{
@@ -5068,6 +5090,9 @@ namespace Lskj.Control
}
}
/// <summary>
/// <para>说明:粘贴表格后更新树结构关联字段</para>
/// <para>创建人:龚宇超</para>
@@ -5173,7 +5198,17 @@ namespace Lskj.Control
{
List<SimpleButton> buttons = new List<SimpleButton>();//没有隐藏的按钮集合
//刷新按钮
//刷新按钮
if (SystemInfo.Instance.FoundationHideTableRefresh)
{
this.btnRefresh.Visible = false;
pl_top_right.Width = pl_top_right.Width - this.btnRefresh.Width;
}
else
{
buttons.Add(this.btnRefresh);
}
//帮助文档按钮
if (SystemInfo.Instance.HideHelpDocument)
{
@@ -5572,10 +5607,41 @@ namespace Lskj.Control
MessageUtil.Show(Message, ex.Message);
}
}
public int GetFirstThreeLinesHeight(RichEditControl richEdit)
{
if (string.IsNullOrEmpty(richEdit.Text)) return 0;
// 获取字体和最大宽度
Document document = richEdit.Document;
Font font = richEdit.Font;
int maxWidth = richEdit.ClientSize.Width - richEdit.Padding.Horizontal;
// 获取前3行文本
string[] lines = richEdit.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
int lineCount = Math.Min(4, lines.Length);
string firstThreeLines = string.Join(Environment.NewLine, lines.Take(lineCount));
// 创建StringFormat
StringFormat format = new StringFormat(StringFormat.GenericTypographic);
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
// 测量文本高度
using (Graphics g = richEdit.CreateGraphics())
{
SizeF textSize = g.MeasureString(
firstThreeLines,
font,
maxWidth,
format
);
return (int)Math.Ceiling(textSize.Height);
}
}
}
}
+5
View File
@@ -2552,6 +2552,11 @@ namespace Lskj.Control
else
{
string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1");
if (!string.IsNullOrWhiteSpace(this.ParentKey)&& this.SysModel.AttachmentSelectNode)
{
url= string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&specno={4}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1", this.ParentKey);
}
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.Model.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, this.Model.ModuleCode).Split('~');
string[] menuArgs = SystemInfo.Instance.BsAttachFlag.Equals("1") ? new string[] { "", "", url } : new string[] { string.Format(ModuleArgs.PubPhotoViewArgs, this.PrimaryValue), "0", this.SysModel.MenuDirId + "", "" };
+57 -2
View File
@@ -144,6 +144,10 @@ namespace Lskj.Control
/// 页签控件集合
/// </summary>
public Dictionary<GridDetailModel, object> PageControlsDic = new Dictionary<GridDetailModel, object>();
/// <summary>
/// 页签名(判断是否有重复的左右结构)
/// </summary>
public string DetaiName = string.Empty;
public TabControlEx()
{
InitializeComponent();
@@ -408,11 +412,16 @@ namespace Lskj.Control
Dictionary<object, Hashtable> dataCaches = Model?.DataCaches;
this.DetaiName = string.Empty;
foreach (GridDetailModel model in gridDetail)
{
// 子明细交给父明细右侧页签生成
if (model.Rightdockid > 0) continue;
if (this.DetaiName.Equals(model.DetailName) && isGridmerge) continue;
bool hasRight = rightGroups.TryGetValue(model.Orderid, out var rightChildren);
XtraTabPage page = new XtraTabPage
@@ -487,7 +496,7 @@ namespace Lskj.Control
this.xtc_container.TabPages.Add(page);
var dtp = new DetailTabPageModel
{
TabPageIndex = this._gridDetail.IndexOf(model),
TabPageIndex = this.xtc_container.TabPages.IndexOf(page),//this._gridDetail.IndexOf(model), 如果是有左右结构,会跳过1个序号(右侧模块不会存序号),导致报错
DetailTabPage = page,
DetailModel = model
};
@@ -535,6 +544,9 @@ namespace Lskj.Control
Dictionary<object, Hashtable> dataCaches,
bool isGridmerge = true)
{
GridDetailModel[] isMeage = _gridDetail.Cast<GridDetailModel>().Where(x => x.DetailName.Equals(model.DetailName)).ToArray();
// ① 取缓存的已生成控件
object control = PageControlsDic.ContainsKey(model) ? PageControlsDic[model] : null;
bool hasControl = control != null;
@@ -621,6 +633,33 @@ namespace Lskj.Control
}
}
/* ───── AddPanel ───────────────────────────────────── */
if (model.IsSched)
{
DynamicFrmProductSchedModel mainModel = new DynamicFrmProductSchedModel(new string[]
{
model.DetailName,
ERPInfo.Instance.UserId,
ERPInfo.Instance.UserName,
this.Model.Privilege,
model.UnionModule,
"0"
});
DataRow systemdllTab = MainImpl.GetSystemdllTab(model.UnionModule);
model.SystemModel = new ModuleModel(systemdllTab);
if (this.Model != null)
{
model.SystemModel.ParmaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode);
}
FrmProductSched frmProductSched = new FrmProductSched();
frmProductSched.Dock = DockStyle.Fill;
frmProductSched.Tag = model;
frmProductSched.InitializeControl(mainModel);
frmProductSched.DataModel.TopSearchObj.ButtonObj.Visible = false;
return frmProductSched;
}
/* ───── 4. AddPanel ───────────────────────────────────── */
if (model.IsAddPanel && isGridmerge)
{
@@ -776,7 +815,21 @@ namespace Lskj.Control
parent.Controls.Add(plBottom);
return parent;
}
else if (isMeage.Count() > 1 && isGridmerge)
{
this.DetaiName = model.DetailName;
TabMultipledetails tabMultipledetails = hasControl && control is TabMultipledetails ? (TabMultipledetails)control : new TabMultipledetails();
tabMultipledetails.Model = this.Model;
tabMultipledetails.ParentGridEx = this.ParentGridEx;
tabMultipledetails.ParentControlEx = this.ParentControlEx;
tabMultipledetails.IsDragDetail = this.IsDragDetail;
tabMultipledetails.Model = this.Model;
tabMultipledetails.DrgaParentPrimaryKey = this.DrgaParentPrimaryKey;
tabMultipledetails.InitTabPages(isMeage);
tabMultipledetails.Dock = DockStyle.Fill;
tabMultipledetails.Tag = model;
return tabMultipledetails;
}
/* ───── 7. 普通 ModuleGridEx 明细 ──────────────────────── */
{
ModuleGridEx gridEx = hasControl && control is ModuleGridEx
@@ -1900,6 +1953,8 @@ namespace Lskj.Control
return (tabPage.Tag as FrmMiniBlink).Tag as GridDetailModel;
if (tabPage.Tag is TabMultipledetails)
return (tabPage.Tag as TabMultipledetails).Tag as GridDetailModel;
if (tabPage.Tag is FrmProductSched)
return (tabPage.Tag as FrmProductSched).Tag as GridDetailModel;
return null;
}
/// <summary>
+10 -26
View File
@@ -170,6 +170,14 @@ namespace Lskj.Control
dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
}
//左侧表设置后,添加事件。行改变时刷新右侧表
if (model.IsUnioDetail)
{
gridEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
gridEx.GridView.RowCellClick += new RowCellClickEventHandler(OnRowCellClick);
UnioDetail = true;
}
if (i == 0)
{
gridEx1.GridControlObj = gridEx;
@@ -188,6 +196,7 @@ namespace Lskj.Control
}
else
{
gridEx2.GridControlObj = gridEx;// 加载配置查询条件
if (Model != null && Model.IsDetailSearch)
{
@@ -761,29 +770,4 @@ namespace Lskj.Control
//重新根据主表数据查询
private void SearchObj_OnSearchAfterCallBack(object sender, EventArgs e)
{
DataRow rowItem = this.ParentGridEx.GetViewFocusedDataRow();
int i = 0;
foreach (GridDetailModel model in this._gridDetail)
{
if (model.QueryAgain)
{
if (i == 0)
{
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
gridEx1.SearchObj.SearchGrid(sqlValue, true, false);
}
else if (1 == 1)
{
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
gridEx2.SearchObj.SearchGrid(sqlValue, true, false);
}
}
i++;
}
}
}
}
DataRow rowItem = th
@@ -93,6 +93,7 @@ namespace Lskj.Control
{
this.SetGridRowHeightAndFont();
}
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
//InitializeTreeMethod();
//this.gcMain.OptionsBehavior.EnableFiltering = true;
//this.gcMain.OptionsFind.AlwaysVisible = true;
@@ -336,7 +337,7 @@ namespace Lskj.Control
{
if (table == null) return;
this.CustomColumKey = customColumKey;
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
//设置列头自动高度
this.gcMain.OptionsView.ColumnHeaderAutoHeight = DefaultBoolean.True;
@@ -1302,14 +1303,17 @@ namespace Lskj.Control
DXMenuItem itemPrintColumn = new DXMenuItem("打印表格数据", PrintItemClick);
DXMenuItem itemSortColumn = new DXMenuItem("清除全部列排序", ClearSortItemClick);
DXMenuItem itemBsChartShowClick = new DXMenuItem("一键所有列属性设置", InstAllColumn);
itemSaveColumn.BeginGroup = itemFixLeft.BeginGroup = true;
itemBsChartShowClick.Visible = ERPInfo.Instance.UserName == "管理员" && Model != null;
itemFixLeft.Tag = itemFixLeftAll.Tag = itemUnFix.Tag = hitInfo.Column;
itemSaveColumn.Tag = itemResetColumn.Tag = itemExportColumn.Tag = itemPrintColumn.Tag = itemSortColumn.Tag = hitInfo.Column;
itemSaveColumn.Tag = itemResetColumn.Tag = itemExportColumn.Tag = itemPrintColumn.Tag = itemSortColumn.Tag = itemBsChartShowClick.Tag = hitInfo.Column;
columnMenu.Items.AddRange(new DXMenuItem[] { itemFixLeft, itemFixLeftAll, itemUnFix });
if (!string.IsNullOrEmpty(CustomColumKey)) columnMenu.Items.AddRange(new DXMenuItem[] { itemSaveColumn, itemResetColumn });
columnMenu.Items.AddRange(new DXMenuItem[] { itemExportColumn, itemPrintColumn, itemSortColumn });
columnMenu.Items.AddRange(new DXMenuItem[] { itemExportColumn, itemPrintColumn, itemSortColumn, itemBsChartShowClick });
}
}
catch (Exception ex)
@@ -1636,6 +1640,58 @@ namespace Lskj.Control
}
}
/// <summary>
/// <para>说明:导出表格数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-02-01 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected override void ExportItemClick(object sender, EventArgs e)
{
try
{
this.TreeListObj.ToExcelTreeList(this.Model.FormText);
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:清除全部列排序</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-02-01 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected override void ClearSortItemClick(object sender, EventArgs e)
{
try
{
this.TreeListObj.ClearSorting();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:设置列格式化</para>
/// <para>创建人:龚宇超</para>
@@ -2004,7 +2060,46 @@ namespace Lskj.Control
TreeListNode lastNode = this.TreeListObj.FocusedNode;
this.AdapterObj = adapter;
DataSet dataSet = new DataSet();
//adapter.Fill(dataSet, "SetGridViewDataSource");
// 重连配置
int maxRetryCount = 2; // 次数
int retryDelay = 1000; // 等待时间
for (int i = 0; i < maxRetryCount; i++)
{
try
{
adapter.Fill(dataSet, "SetGridViewDataSource");
break;//连接成功
}
catch (SqlException ex)
{
// 判断是否是连接相关错误
if (IsConnectionError(ex.Number) ||
ex.Message.Contains("物理连接不可用") ||
ex.Message.Contains("传输级错误"))
{
if (i < maxRetryCount - 1)
{
SqlConnection.ClearAllPools();
System.Threading.Thread.Sleep(retryDelay);
continue; // 重试
}
else
{
// 最后一次重试失败,抛出错误
throw new Exception($"经过 {maxRetryCount} 次重试后仍无法连接到数据库: {ex.Message}", ex);
}
}
else
{
// 其他SQL错误直接抛出
throw;
}
}
}
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
GetTreeExpanded();
+85 -3
View File
@@ -105,6 +105,8 @@ namespace Lskj.Control
this.gcMain.CustomDrawNodeButton += OnCustomDrawNodeButton;//绘制按钮
}
}
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
//InitializeTreeMethod();
//this.gcMain.OptionsBehavior.EnableFiltering = true;
//this.gcMain.OptionsFind.AlwaysVisible = true;
@@ -390,7 +392,6 @@ namespace Lskj.Control
if (table == null) return;
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
this.CustomColumKey = customColumKey;
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
for (int i = 0; i < table.Rows.Count; i++)
{
@@ -1246,14 +1247,17 @@ namespace Lskj.Control
DXMenuItem itemPrintColumn = new DXMenuItem("打印表格数据", PrintItemClick);
DXMenuItem itemSortColumn = new DXMenuItem("清除全部列排序", ClearSortItemClick);
DXMenuItem itemBsChartShowClick = new DXMenuItem("一键所有列属性设置", InstAllColumn);
itemSaveColumn.BeginGroup = itemFixLeft.BeginGroup = true;
itemBsChartShowClick.Visible = ERPInfo.Instance.UserName == "管理员" && Model != null;
itemFixLeft.Tag = itemFixLeftAll.Tag = itemUnFix.Tag = hitInfo.Column;
itemSaveColumn.Tag = itemResetColumn.Tag = itemExportColumn.Tag = itemPrintColumn.Tag = itemSortColumn.Tag = hitInfo.Column;
itemSaveColumn.Tag = itemResetColumn.Tag = itemExportColumn.Tag = itemPrintColumn.Tag = itemSortColumn.Tag= itemBsChartShowClick.Tag = hitInfo.Column;
columnMenu.Items.AddRange(new DXMenuItem[] { itemFixLeft, itemFixLeftAll, itemUnFix });
if (!string.IsNullOrEmpty(CustomColumKey)) columnMenu.Items.AddRange(new DXMenuItem[] { itemSaveColumn, itemResetColumn });
columnMenu.Items.AddRange(new DXMenuItem[] { itemExportColumn, itemPrintColumn, itemSortColumn });
columnMenu.Items.AddRange(new DXMenuItem[] { itemExportColumn, itemPrintColumn, itemSortColumn,itemBsChartShowClick });
}
}
catch (Exception ex)
@@ -1376,6 +1380,32 @@ namespace Lskj.Control
}
/// <summary>
/// <para>说明:清除全部列排序</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-02-01 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected override void ClearSortItemClick(object sender, EventArgs e)
{
try
{
this.TreeListObj.ClearSorting();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:设置编辑列</para>
/// <para>创建人:龚宇超</para>
@@ -2236,6 +2266,21 @@ namespace Lskj.Control
DataRowView dataRowView = this.gcMain.GetDataRecordByNode(treeNode) as DataRowView;
dataRows[i] = dataRowView != null ? dataRowView.Row : null;
}
//设置了复选框这个获取所有选中的节点行
if (this.gcMain.OptionsView.ShowCheckBoxes == true&& this.gcMain.OptionsSelection.MultiSelect == true && this.gcMain.OptionsSelection.MultiSelectMode == TreeListMultiSelectMode.RowSelect)
{
List<TreeListNode> TreeListNodeList = this.TreeListObj.GetAllCheckedNodes();
dataRows = new DataRow[TreeListNodeList.Count];
for (int i = 0; i < TreeListNodeList.Count; i++)
{
TreeListNode treeNode = TreeListNodeList[i];
DataRowView dataRowView = this.gcMain.GetDataRecordByNode(treeNode) as DataRowView;
dataRows[i] = dataRowView != null ? dataRowView.Row : null;
}
}
return dataRows;
}
/// <summary>
@@ -2288,7 +2333,44 @@ namespace Lskj.Control
if (selectRowHandler) lastNodeIndex = this.TreeListObj.GetVisibleIndexByNode(this.TreeListObj.FocusedNode);
this.AdapterObj = adapter;
DataSet dataSet = new DataSet();
//adapter.Fill(dataSet, "SetGridViewDataSource");
// 重连配置
int maxRetryCount = 2; // 次数
int retryDelay = 1000; // 等待时间
for (int i = 0; i < maxRetryCount; i++)
{
try
{
adapter.Fill(dataSet, "SetGridViewDataSource");
break;//连接成功
}
catch (SqlException ex)
{
// 判断是否是连接相关错误
if (IsConnectionError(ex.Number) ||
ex.Message.Contains("物理连接不可用") ||
ex.Message.Contains("传输级错误"))
{
if (i < maxRetryCount - 1)
{
SqlConnection.ClearAllPools();
System.Threading.Thread.Sleep(retryDelay);
continue; // 重试
}
else
{
// 最后一次重试失败,抛出错误
throw new Exception($"经过 {maxRetryCount} 次重试后仍无法连接到数据库: {ex.Message}", ex);
}
}
else
{
// 其他SQL错误直接抛出
throw;
}
}
}
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);