From bd739496ff65701ae62300877a645f1d6a155b74 Mon Sep 17 00:00:00 2001 From: cyf Date: Mon, 1 Jun 2026 02:14:02 +0000 Subject: [PATCH] SVN r1200 SVN-Revision: r1200 --- 插件库/Lskj.PubModuleDetail5/DllBaseClass.cs | 33 + .../Lskj.PubModuleDetail5/FrmMain.Designer.cs | 37 + 插件库/Lskj.PubModuleDetail5/FrmMain.cs | 65 + 插件库/Lskj.PubModuleDetail5/FrmMain.resx | 120 ++ .../Lskj.PubModuleDetail5.csproj | 167 +++ .../ProductionMain.Designer.cs | 152 ++ .../Lskj.PubModuleDetail5/ProductionMain.cs | 1262 +++++++++++++++++ .../Lskj.PubModuleDetail5/ProductionMain.resx | 120 ++ .../Properties/AssemblyInfo.cs | 11 + .../Properties/Resources.Designer.cs | 39 + .../Properties/Resources.resx | 117 ++ .../Properties/Settings.Designer.cs | 2 + .../Properties/Settings.settings | 7 + .../TabIntoAddControl.Designer.cs | 41 + .../TabIntoAddControl.cs | 435 ++++++ .../TabIntoAddControl.resx | 120 ++ .../TabIntoControl.Designer.cs | 55 + .../Lskj.PubModuleDetail5/TabIntoControl.cs | 884 ++++++++++++ .../Lskj.PubModuleDetail5/TabIntoControl.resx | 120 ++ 19 files changed, 3787 insertions(+) create mode 100644 插件库/Lskj.PubModuleDetail5/DllBaseClass.cs create mode 100644 插件库/Lskj.PubModuleDetail5/FrmMain.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/FrmMain.cs create mode 100644 插件库/Lskj.PubModuleDetail5/FrmMain.resx create mode 100644 插件库/Lskj.PubModuleDetail5/Lskj.PubModuleDetail5.csproj create mode 100644 插件库/Lskj.PubModuleDetail5/ProductionMain.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/ProductionMain.cs create mode 100644 插件库/Lskj.PubModuleDetail5/ProductionMain.resx create mode 100644 插件库/Lskj.PubModuleDetail5/Properties/AssemblyInfo.cs create mode 100644 插件库/Lskj.PubModuleDetail5/Properties/Resources.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/Properties/Resources.resx create mode 100644 插件库/Lskj.PubModuleDetail5/Properties/Settings.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/Properties/Settings.settings create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoAddControl.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoAddControl.cs create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoAddControl.resx create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoControl.Designer.cs create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoControl.cs create mode 100644 插件库/Lskj.PubModuleDetail5/TabIntoControl.resx diff --git a/插件库/Lskj.PubModuleDetail5/DllBaseClass.cs b/插件库/Lskj.PubModuleDetail5/DllBaseClass.cs new file mode 100644 index 0000000..90964a0 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/DllBaseClass.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using DevExpress.UserSkins; +using DevExpress.Skins; +using DevExpress.LookAndFeel; +using Lskj.Util; +using Lskj.Model; +using Lskj.Business.Impl; +using Lskj.Business; +using System.Collections; + +namespace Lskj.PubModuleDetail5 +{ + /// + /// c#库被调用统一接口类 + /// + public sealed class DllBaseClass : IForm + { + public DllBaseClass() + { + + } + + public DllBaseClass(string[] obj) + { + try + { + FrmMain main = new FrmMain(); + this.SubForm = main; + + DynamicModuleDetailModel moduleM \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/FrmMain.Designer.cs b/插件库/Lskj.PubModuleDetail5/FrmMain.Designer.cs new file mode 100644 index 0000000..0734852 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/FrmMain.Designer.cs @@ -0,0 +1,37 @@ +namespace Lskj.PubModuleDetail5 +{ + partial class FrmMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.productionMain1 = new Lskj.PubModuleDetail5.ProductionMain(); + this.SuspendLayout(); + // + // productionMain1 + // + this.productionMain1.Dock = System.Windows.Forms.DockStyle.Fill; + this.productionMain1.Locatio \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/FrmMain.cs b/插件库/Lskj.PubModuleDetail5/FrmMain.cs new file mode 100644 index 0000000..4866148 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/FrmMain.cs @@ -0,0 +1,65 @@ +using DevExpress.XtraGrid.Columns; +using Lskj.Business; +using Lskj.Business.Impl; +using Lskj.Control; +using Lskj.Control.Model; +using Lskj.Data; +using Lskj.Model; +using Lskj.Util; +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; +using DevExpress.XtraTab; +using DevExpress.Utils; +using DevExpress.XtraEditors; +using DevExpress.XtraGrid.Views.Grid; +using DevExpress.XtraGrid.Views.Base; +using System.Collections; +using System.Threading.Tasks; + +namespace Lskj.PubModuleDetail5 +{ + public partial class FrmMain : BaseForm + { + /// + /// 表格明细集合 + /// + public List GridDetailModelObjs; + /// + /// 基础模型 + /// + public ModuleModel MoudleLeftObj; + public DynamicModuleDetailModel Model; + + /// + ///左上方查询条件控件 + /// + public MyControl SearchLeftObj; + + public FrmMain() + { + InitializeComponent(); + } + protected override void OnLoad(EventArgs e) + { + try + { + WaitForm.ShowForm(); + this.Model.Privilege = this.Model.Privilege.Equals("3") ? "1" : Model.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(Model.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(Model.ModuleCode) + ""; + if (!this.Model.HasPrivilege()) + { + MessageUtil.Show(ResourceKeys.UnPurview); + this.Close(); + } + else + { + productionMain1.OnLoad(Model); + + } + } + catch (E \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/FrmMain.resx b/插件库/Lskj.PubModuleDetail5/FrmMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/FrmMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/Lskj.PubModuleDetail5.csproj b/插件库/Lskj.PubModuleDetail5/Lskj.PubModuleDetail5.csproj new file mode 100644 index 0000000..1a82088 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/Lskj.PubModuleDetail5.csproj @@ -0,0 +1,167 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {BF4BCE45-D6E5-4BC9-B8FC-75F2108BE702} + Library + Properties + Lskj.PubModuleDetail5 + Lskj.PubModuleDetail5 + v4.0 + 512 + + + + + + AnyCPU + true + full + false + ..\..\Debug\Lib\ + DEBUG;TRACE + prompt + 4 + ..\..\Debug\AllMethodXml\Lskj.PubModuleDetail5.XML + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + False + ..\..\..\..\dev\Components\Bin\Framework\DevExpress.XtraGrid.v15.2.dll + + + + + + + + + + + + + + + + Form + + + FrmMain.cs + + + + UserControl + + + ProductionMain.cs + + + + UserControl + + + TabIntoAddControl.cs + + + UserControl + + + TabIntoControl.cs + + + FrmMain.cs + + + ProductionMain.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + TabIntoAddControl.cs + + + TabIntoControl.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {7eafccc2-a18f-49e9-85c6-a984966cfd01} + Lskj.Business + + + {447cdc40-659f-4cca-9ed6-8e818b4cf8bf} + Lskj.Control + + + {2a1be6ac-1077-491b-a754-c5822fe8121e} + Lskj.Core + + + {308b9b18-9be2-495c-9c64-eed81d567813} + Lskj.Data + + + {00899d25-c9cf-4d50-b6d2-e6f0da2d3d8c} + Lskj.Help + + + {24e9a18a-baf8-4052-809e-582b4fc6a8c4} + Lskj.Interface.Api + + + {52bc40e0-c0c6-4f78-996b-cae028d209ca} + Lskj.Model + + + {a51bf642-6543-4de3-8948-83f558b72bd4} + Lskj.Util + + + + + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/ProductionMain.Designer.cs b/插件库/Lskj.PubModuleDetail5/ProductionMain.Designer.cs new file mode 100644 index 0000000..1987557 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/ProductionMain.Designer.cs @@ -0,0 +1,152 @@ +namespace Lskj.PubModuleDetail5 +{ + partial class ProductionMain + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl(); + this.Tab_additional = new DevExpress.XtraTab.XtraTabControl(); + this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage(); + this.mg_control = new Lskj.Control.ModuleGridEx(); + this.splitBottomControl = new DevExpress.XtraEditors.SplitContainerControl(); + this.gridLeftButtom = new Lskj.Control.GridControlEx(); + this.pl_bottom = new DevExpress.XtraEditors.PanelControl(); + this.tcButtom = new Lskj.Control.TabControlEx(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit(); + this.splitContainerControl1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.Tab_additional)).BeginInit(); + this.Tab_additional.SuspendLayout(); + this.xtraTabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitBottomControl)).BeginInit(); + this.splitBottomControl.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).BeginInit(); + this.SuspendLayout(); + // + // splitContainerControl1 + // + this.splitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainerControl1.Horizontal = false; + this.splitContainerControl1.Location = new System.Drawing.Point(0, 0); + this.splitContainerControl1.Name = "splitContainerControl1"; + this.splitContainerControl1.Panel1.Controls.Add(this.Tab_additional); + this.splitContainerControl1.Panel1.Text = "Panel1"; + this.splitContainerControl1.Panel2.Controls.Add(this.splitBottomControl); + this.splitContainerControl1.Panel2.Text = "Panel2"; + this.splitContainerControl1.Size = new System.Drawing.Size(1249, 679); + this.splitContainerControl1.SplitterPosition = 404; + this.splitContainerControl1.TabIndex = 0; + this.splitContainerControl1.Text = "splitContainerControl1"; + this.splitContainerControl1.SplitterPositionChanged += new System.EventHandler(this.splitContainer_SplitterPositionChanged); + // + // Tab_additional + // + this.Tab_additional.Dock = System.Windows.Forms.DockStyle.Fill; + this.Tab_additional.Location = new System.Drawing.Point(0, 0); + this.Tab_additional.Name = "Tab_additional"; + this.Tab_additional.SelectedTabPage = this.xtraTabPage1; + this.Tab_additional.Size = new System.Drawing.Size(1249, 404); + this.Tab_additional.TabIndex = 2; + this.Tab_additional.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { + this.xtraTabPage1}); + // + // xtraTabPage1 + // + this.xtraTabPage1.Controls.Add(this.mg_control); + this.xtraTabPage1.Name = "xtraTabPage1"; + this.xtraTabPage1.Size = new System.Drawing.Size(1243, 375); + this.xtraTabPage1.Text = "默认页签"; + // + // mg_control + // + this.mg_control.BackColor = System.Drawing.Color.Transparent; + this.mg_control.Dock = System.Windows.Forms.DockStyle.Fill; + this.mg_control.Location = new System.Drawing.Point(0, 0); + this.mg_control.Name = "mg_control"; + this.mg_control.OperShortMode = true; + this.mg_control.Size = new System.Drawing.Size(1243, 375); + this.mg_control.TabIndex = 1; + this.mg_control.VisibleMrpSearchPanel = false; + this.mg_control.VisibleOperPanel = true; + this.mg_control.VisibleSearchPanel = true; + // + // splitBottomControl + // + this.splitBottomControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitBottomControl.Location = new System.Drawing.Point(0, 0); + this.splitBottomControl.Name = "splitBottomControl"; + this.splitBottomControl.Panel1.Controls.Add(this.gridLeftButtom); + this.splitBottomControl.Panel1.Text = "Panel1"; + this.splitBottomControl.Panel2.Controls.Add(this.tcButtom); + this.splitBottomControl.Panel2.Controls.Add(this.pl_bottom); + this.splitBottomControl.Panel2.Text = "Panel2"; + this.splitBottomControl.Size = new System.Drawing.Size(1249, 270); + this.splitBottomControl.SplitterPosition = 437; + this.splitBottomControl.TabIndex = 0; + this.splitBottomControl.Text = "splitContainerControl2"; + this.splitBottomControl.SplitterPositionChanged += new System.EventHandler(this.splitContainerBotton_SplitterPositionChanged); + // + // gridLeftButtom + // + this.gridLeftButtom.AdapterObj = null; + this.gridLeftButtom.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridLeftButtom.Location = new System.Drawing.Point(0, 0); + this.gridLeftButtom.Margin = new System.Windows.Forms.Padding(4); + this.gridLeftButtom.Name = "gridLeftButtom"; + this.gridLeftButtom.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum; + this.gridLeftButtom.Size = new System.Drawing.Size(437, 270); + this.gridLeftButtom.SysModel = null; + this.gridLeftButtom.TabIndex = 0; + // + // pl_bottom + // + this.pl_bottom.Appearance.BackColor = System.Drawing.Color.Transparent; + this.pl_bottom.Appearance.Options.UseBackColor = true; + this.pl_bottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pl_bottom.Location = new System.Drawing.Point(0, 234); + this.pl_bottom.Name = "pl_bottom"; + this.pl_bottom.Size = new System.Drawing.Size(807, 36); + this.pl_bottom.TabIndex = 2; + this.pl_bottom.Visible = false; + // + // tcButtom + // + this.tcButtom.Dock = System.Windows.Forms.DockStyle.Fill; + this.tcButtom.Location = new System.Drawing.Point(0, 0); + this.tcButtom.Name = "tcButtom"; + this.tcButtom.Size = new System.Drawing.Size(807, 234); + this.tcButtom.TabIndex = 3; + // + // ProductionMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainerControl1); + this.Name = "ProductionMain"; + this.Size = new System.Drawing.Size(1249, 679); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).EndInit(); + this.splitContainerControl1.ResumeLayout(false); + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/ProductionMain.cs b/插件库/Lskj.PubModuleDetail5/ProductionMain.cs new file mode 100644 index 0000000..684ce1a --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/ProductionMain.cs @@ -0,0 +1,1262 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Lskj.Control.Model; +using Lskj.Model; +using Lskj.Util; +using Lskj.Data; +using DevExpress.XtraTab; +using Lskj.Control; +using DevExpress.XtraGrid.Views.Grid; +using Lskj.Business.Impl; +using DevExpress.Utils; +using DevExpress.XtraEditors; +using Lskj.Core; +using DevExpress.XtraGrid.Views.Base; +using Lskj.Business; +using System.Collections; +using System.Threading.Tasks; + +namespace Lskj.PubModuleDetail5 +{ + public partial class ProductionMain : UserControl + { + /// + /// 左侧树数据 + /// + public DataRow LeftRowObj; + /// + /// 表格明细集合 + /// + public List GridDetailModelObjs; + /// + /// 基础模型 + /// + public DynamicModuleDetailModel Model; + /// + /// 表格列 + /// + private DataTable _gridColumns = new DataTable(); + + /// + /// 系统模块实体对象 + /// + /// The system model. + public ModuleModel SysModel; + /// + /// 主键名 + /// + private string _primaryLeftKey; + /// + /// 顶部表格控件 + /// + public ModuleGridEx ModuleGridObj; + /// + /// 底部多标签控件 + /// + //public XtraTabControl TabObj; + /// + /// 底部多标签控件 + /// + public TabControlEx TabIntoObj; + /// + /// 初始化完成 + /// + private bool _isInitFinish; + public List DataItem = new List(); + /// + /// 主键值 + /// + private string _keyValue; + + private string LeftBoottomModel; + + /// + /// 上方刷新 + /// + private bool istop = false; + /// + /// 拖拽模式 + /// + private string dragModel = "0"; + + + public ProductionMain() + { + InitializeComponent(); + } + + /// + /// 说明:窗口加载 + /// 创建人:龚宇超 + /// 创建日期:2019-06-28 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The instance containing the event data. + public void OnLoad(DynamicModuleDetailModel Model) + { + WaitForm.ShowForm(); + try + { + this._isInitFinish = false; + this.Model = Model; + Dictionary dataCaches = Model != null ? Model.DataCaches : null; + if (!dataCaches.GetValue(this, "MainInfo", out DataRow modelRow)) + { + modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode); + } + if (modelRow == null) + { + MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); + return; + } + if (!dataCaches.GetValue(this, "ProductionMainModel", out this.SysModel)) + { + this.SysModel = new ModuleModel(modelRow); + } + this.ModuleGridObj = this.mg_control; + this.TabIntoObj = this.tcButtom; + if (!dataCaches.GetValue(this, "Details", out this.GridDetailModelObjs)) + { + this.GridDetailModelObjs = GetDetails(Model.ModuleCode); + } + if (!dataCaches.GetValue(this, "GetMenuConfigTab", out DataRow menuCondRow)) + { + menuCondRow = BaseImpl.GetMenuConfigTab(this.Model.ModuleId); + } + if (menuCondRow["DllFileName"].Equals("Lskj.PubModuleDetailSearch5.dll")) Model.IsDetailSearch = true; + //初始化主表 + this.mg_control.RightGridCallBack += Mg_control_RightGridCallBack; + this.mg_control.InitializeControl(SysModel, Model); + this.mg_control.SearchObj.SearchGrid(); + this.InitilizeGridViewEvent(); + //初始化左下角数据 + this.InitializeLeft(); + //初始化底部多标签 + this.InitializePages(this.mg_control); + //初始化主表附件模块 + this.GetBaseAttachPage();//获取附加模块 + + + if (Model.HasOperPrivilege() && Model.IsBaseModule) + { + // 有权限则允许拖拽 + GridDragGrid dragGrid = new GridDragGrid(this.ModuleGridObj.GridControlObj.GridView, this.gridLeftButtom.GridView); + dragGrid.isDropColorVisble = true; + //dragGrid.sequentialReturn = true; + dragGrid.TargetTableMultiSelect = false; + dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + // 有权限则上下结构允许拖拽 + foreach (XtraTabPage tabPage in this.tcButtom.TabControlObj.TabPages) + { + if (tabPage.Tag is GridControlEx) + { + GridDragGrid dragGridToptoBottom = new GridDragGrid(this.ModuleGridObj.GridControlObj.GridView, (tabPage.Tag as GridControlEx).GridView); + dragGridToptoBottom.isDropColorVisble = true; + //dragGridToptoBottom.sequentialReturn = true; + dragGridToptoBottom.TargetTableMultiSelect = false; + dragGridToptoBottom.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + } + } + XtraTabPage page = Tab_additional.TabPages[0]; + page.Tag = this.mg_control; + this.SetTabPageStyle(); + } + this.InitSpliterPosition(); + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + finally + { + this._isInitFinish = true; + } + WaitForm.HideForm(); + } + + private void Mg_control_RightGridCallBack(object sender, EventArgs e) + { + XtraTabPage tabPage = this.Tab_additional.SelectedTabPage; + foreach (System.Windows.Forms.Control control in tabPage.Controls) + { + if (control.GetType().Name == "ModuleGridEx") + { + ModuleGridEx moduleGridEx = control as ModuleGridEx; + try + { + + this.GridView_DoubleClick(moduleGridEx.GridControlObj.GridView, null);//刷新上方明细 + + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show(ResourceKeys.OperFault); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + + } + } + + /// + /// 获取数据源缓存 + /// + /// + public void GetDataCaches(Dictionary cachesDic) + { + + Task dynamicModelTask = cachesDic.GetTask(this, "DynamicModel"); + DynamicModuleDetailModel dynamicModel = (DynamicModuleDetailModel)dynamicModelTask.Result; + + Task MainInfoTask = cachesDic.AddTask(this, "MainInfo", new Task(() => + { + return MainImpl.GetSystemdllTab(dynamicModel.ModuleCode);//获取单个模块信息 + })); + Task ProductionMainModelTask = cachesDic.AddTask(this, "ProductionMainModel", new Task(() => + { + return new ModuleModel(MainInfoTask.Result); ; + })); + Task> detailTask = cachesDic.AddTask(this, "Details", new Task>(() => + { + DataTable detailPages = BaseModuleImpl.GetBaseDetailPages(dynamicModel.ModuleCode);//根据传入的模块编号获得基础档案底部标签的数据 + List details = new List();//表格明细对象的集合 + foreach (DataRow item in detailPages.Rows) + { + GridDetailModel gridDetailModel = new GridDetailModel(item, null, GridCustomColumnStruct.BaseDetailGridView); + details.Add(gridDetailModel); + Task addGridColumnsTask = cachesDic.AddTask(gridDetailModel, "GridColumns", new Task(() => + { + DataTable gridColumns = ReportImpl.GetReportDetailColumns(dynamicModel.ModuleCode, item["id"] + "");//获取报表明细列 + gridDetailModel.GridColumns = gridColumns; + return gridColumns; + })); + } + return details; + })); + Task GetMenuConfigTabTask = cachesDic.AddTask(this, "GetMenuConfigTab", new Task(() => + { + return BaseImpl.GetMenuConfigTab(dynamicModel.ModuleId); + })); + //右上方主表 + cachesDic.AddTask(mg_control, "DynamicModel", dynamicModelTask); + cachesDic.AddTask(mg_control, "SysModel", ProductionMainModelTask); + mg_control.GetDataCaches(cachesDic); + + + } + + + + + #region 初始化分割条位置 + /// + /// 说明:初始化分割条位置 + /// 创建人:王一帆 + /// 创建日期:2020-06-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void InitSpliterPosition() + { + string spliterPosition = IniHelper.Read(string.Format("Production_SplitterPositionMain_{0}", this.Model.ModuleCode)); + if (!string.IsNullOrEmpty(spliterPosition)) this.splitContainerControl1.SplitterPosition = Convert.ToInt32(spliterPosition); + string splitterBottonPosition = IniHelper.Read(string.Format("Production_spliterPositionBotton_{0}", this.Model.ModuleCode)); + if (!string.IsNullOrEmpty(splitterBottonPosition)) this.splitBottomControl.SplitterPosition = Convert.ToInt32(splitterBottonPosition); + } + #endregion + #region 分割条位置改变 + /// + /// 说明:分割条位置改变事件 + /// 创建人:王一帆 + /// 创建日期:2020-06-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void splitContainer_SplitterPositionChanged(object sender, EventArgs e) + { + try + { + if (_isInitFinish) + { + IniHelper.Write(string.Format("Production_SplitterPositionMain_{0}", this.Model.ModuleCode), this.splitContainerControl1.SplitterPosition + ""); + } + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + private void splitContainerBotton_SplitterPositionChanged(object sender, EventArgs e) + { + try + { + if (this._isInitFinish) + { + IniHelper.Write(string.Format("Production_spliterPositionBotton_{0}", this.Model.ModuleCode), this.splitBottomControl.SplitterPosition + ""); + } + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + #endregion + + + #region 设置动态TabPage的样式 + /// + /// 刷新所有表格 + /// + /// + /// + protected void RefreshAllGrid(object sender, EventArgs e) + { + try + { + XtraTabPage tabPage = Tab_additional.SelectedTabPage; + if (tabPage != null && tabPage.Tag != null && tabPage.Tag is ModuleGridEx) + { + ModuleGridEx moduleGridEx = tabPage.Tag as ModuleGridEx; + this.GridView_DoubleClick(moduleGridEx.GridControlObj.GridView, null); + } + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + + + + /// + /// 说明:设置动态的TabPage的样式隐藏页签标题 + /// 创建人:龚宇超 + /// 创建日期:2018-02-27 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void SetTabPageStyle() + { + if (this.SysModel.isHideHomeTAB) + { + Tab_additional.ShowTabHeader = Tab_additional.TabPages.Count == 2 ? DefaultBoolean.False : DefaultBoolean.Default; + } + else + { + Tab_additional.ShowTabHeader = Tab_additional.TabPages.Count == 1 ? DefaultBoolean.False : DefaultBoolean.Default; + } + //this.tcButtom.TabControlObj.ShowTabHeader = DefaultBoolean.False; + } + #endregion + private void InitializeLeft() + { + DataTable moduleDetailBottomTable = BaseModuleImpl.GetBaseDetailPages(this.Model.ModuleCode); + foreach (DataRow item in moduleDetailBottomTable.Rows) + { + if (int.Parse(item["orderId"] + "") == -1) + { + DataTable gridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + ""); + ModuleModel MoudleLeftObj = new ModuleModel(MainImpl.GetSystemdllTab(item["UnionModule"] + "")); + this._gridColumns = BaseModuleImpl.GetBaseGridColumns(item["UnionModule"] + ""); + this.gridLeftButtom.SetReadOnlyColumns(this._gridColumns, GridCustomColumnStruct.BaseMainGridView + MoudleLeftObj.FormKey); + GridDetailModel detailModel = new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView); + detailModel.SystemModel = MoudleLeftObj; + gridLeftButtom.Tag = detailModel; + this.LeftBoottomModel = item["UnionModule"] + ""; + this._primaryLeftKey = BaseImpl.GetBasePrimaryKey(item["UnionModule"] + ""); + this.gridLeftButtom.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(item["UnionModule"] + "")); + //this.gridLeftButtom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(item["UnionModule"] + ""), this.Model, OnGridLeftRightCallBack, null, null);//右键 + this.gridLeftButtom.GridView.BestFitColumns(); + if (this.SysModel.ModuleDetailClickMode) + { + this.gridLeftButtom.GridView.RowClick += GridViewLeftBottom_DoubleClick; + } + else + { + this.gridLeftButtom.GridView.DoubleClick += new EventHandler(GridViewLeftBottom_DoubleClick); + } + } + + } + } + + /// + /// 说明:初始化底部多标签数据 + /// 创建人:龚宇超 + /// 创建日期:2017-11-21 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + protected void InitializePages(ModuleGridEx gridEx) + { + this.tcButtom.Model = gridEx.Model; + DataRow modelRow = MainImpl.GetSystemdllTab(gridEx.Model.ModuleCode); + ModuleModel SysModel1 = new ModuleModel(modelRow); + if (this.SysModel.RefreshDetails) + { + tcButtom.OnDetailRightCallback += RefreshAllGrid; + } + + //主表和左侧表会刷新同一个右侧表时,刷新所有表格方法会导致右侧表执行的可能不是上一次的sql + //tcButtom.OnDetailRightCallback += RefreshAllGrid;//刷新所有表格 + this.tcButtom.DrgaParentPrimaryKey = SysModel1.ParmaryKey; + this.tcButtom.ParentGridEx = gridEx.GridControlObj; + this.tcButtom.InitTabPages(this.GridDetailModelObjs.Where(o => o.Orderid != -1).ToList()); + //this.tcButtom.OnRightCallback += new EventHandler(OnGridViewRightCallBack); + + + } + /// + /// 说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新 + /// 创建人:龚宇超 + /// 创建日期:2017-11-02 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The instance containing the event data. + protected void OnGridViewRightCallBack(object sender, EventArgs e) + { + try + { + DataRow item = this.ModuleGridObj.GridControlObj.GridView.GetFocusedDataRow(); + this.SetDetailGridDataSource(this.tcButtom.TabControlObj.SelectedTabPage, item); + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + /// + /// 左下方右键刷新 + /// + /// + /// + protected void OnGridLeftRightCallBack(object sender, EventArgs e) + { + try + { + this.RefreshAllGrid(null, null); + + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + + /// + /// 说明:绑定事件 + /// 创建人:龚宇超 + /// 创建日期:2017-11-22 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + protected void InitilizeGridViewEvent() + { + if (this.SysModel.ModuleDetailClickMode) + { + this.ModuleGridObj.GridControlObj.GridView.RowClick += GridView_DoubleClick; + } + else + { + this.ModuleGridObj.GridControlObj.GridView.DoubleClick += new EventHandler(GridView_DoubleClick); + } + } + + + + /// + /// 说明:左下方点击 + /// 创建人:龚宇超 + /// 创建日期:2018-09-28 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void GridViewLeftBottom_DoubleClick(object sender, EventArgs e) + { + try + { + WaitForm.ShowForm(); + GridView grid = sender as GridView; + DataRow rowItem = grid.GetFocusedDataRow(); + GridDetailModel detailModel = gridLeftButtom.Tag as GridDetailModel; + + if (string.IsNullOrWhiteSpace(detailModel.PlanLetfControl)) + { + //刷新全部 + this.SetDetailGridDataSource(null, rowItem); + } + else + { + List details = new List(); + if (!string.IsNullOrWhiteSpace(this.Model.ModuleCode) && this.tcButtom.DetailTabPagesDic.ContainsKey(this.Model.ModuleCode.ToLower())) + { + details = this.tcButtom.DetailTabPagesDic[this.Model.ModuleCode.ToLower()].OrderBy(n => n.TabPageIndex).ToList(); + } + + //刷新指定页签 + foreach (string item in detailModel.PlanLetfControl.Split(',')) + { + if (string.IsNullOrWhiteSpace(item)) continue; + DetailTabPageModel detail = details.Find(o => o.DetailModel.Orderid == int.Parse(item)); + if (detail != null) + { + XtraTabPage xtraTab = this.tcButtom.TabControlObj.TabPages[detail.TabPageIndex]; + this.SetDetailGridDataSource(xtraTab, rowItem); + } + } + } + istop = false; + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show("加载明细数据失败!" + ex); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + finally + { + WaitForm.HideForm(); + } + } + + + + + /// + /// 说明:加载明细数据 + /// 创建人:龚宇超 + /// 创建日期:2018-09-28 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void GridView_DoubleClick(object sender, EventArgs e) + { + try + { + WaitForm.ShowForm(); + GridView grid = sender as GridView; + DataRow rowItem = grid.GetFocusedDataRow(); + + if (string.IsNullOrWhiteSpace(this.SysModel.DetaiTabControl)) + { + //刷新全部 + this.SetDetailGridDataSource(null, rowItem); + } + else + { + List details = new List(); + if (!string.IsNullOrWhiteSpace(this.Model.ModuleCode) && this.tcButtom.DetailTabPagesDic.ContainsKey(this.Model.ModuleCode.ToLower())) + { + details = this.tcButtom.DetailTabPagesDic[this.Model.ModuleCode.ToLower()].OrderBy(n => n.TabPageIndex).ToList(); + } + //刷新指定页签 + foreach (string item in this.SysModel.DetaiTabControl.Split(',')) + { + if (string.IsNullOrWhiteSpace(item)) continue; + DetailTabPageModel detail = details.Find(o => o.DetailModel.Orderid == int.Parse(item)); + if (detail != null) + { + XtraTabPage xtraTab = this.tcButtom.TabControlObj.TabPages[detail.TabPageIndex]; + this.SetDetailGridDataSource(xtraTab, rowItem); + } + else if (item.Equals("-1") && detail == null) + { + //刷新左侧表格 + int oldRowHandle = gridLeftButtom.GridView.FocusedRowHandle; + GridDetailModel model = gridLeftButtom.Tag as GridDetailModel; + string searchSql = this.GetSearchSql(model, rowItem); + this.gridLeftButtom.LastSearchSql = searchSql; + gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); + gridLeftButtom.GridView.SelectRowHandler(oldRowHandle); + if (!string.IsNullOrEmpty(model.SystemModel.SelectHandleCond)) + { + string selectHandleCond = model.SystemModel.SelectHandleCond; + + List parmars = Util.ReplaceHelper.GetParamFields(selectHandleCond); + foreach (string parmar in parmars) + { + string field = parmar.Replace("{", "").Replace("}", ""); + string value = BaseImpl.GetDefaultValue(field); + selectHandleCond = selectHandleCond.Replace(parmar, value); + } + DataRow selectRow = null; + DataTable filterTable = gridLeftButtom.GridView.GetGridViewFilteredAndSortedDataToDataTable(); + try + { + selectRow = filterTable.Select(selectHandleCond).FirstOrDefault(); + } + catch (Exception) + { + } + if (selectRow != null) + { + int selectHandle = filterTable.Rows.IndexOf(selectRow); + gridLeftButtom.GridView.FocusedRowHandle = selectHandle; + } + } + this.GridViewLeftBottom_DoubleClick(this.gridLeftButtom.GridView, null);//刷新右侧明细 + } + } + } + + istop = true; + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show("加载明细数据失败!" + ex); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + finally + { + WaitForm.HideForm(); + } + } + + + /// + /// 说明:获取底部多标签数据 + /// 创建人:龚宇超 + /// 创建日期:2017-12-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + public void SetDetailGridDataSource(XtraTabPage tabPage = null, DataRow rowItem = null) + { + if (tabPage != null) + { + this.SetTabPageDataSource(tabPage, rowItem); + } + else + { + foreach (XtraTabPage page in this.tcButtom.TabControlObj.TabPages) + { + if (rowItem != null && page != null) + { + this.SetTabPageDataSource(page, rowItem); + } + else + { + SetTabPageDataSource(page, rowItem, true); + } + } + } + } + /// + /// 说明:设置表格数据 + /// 创建人:龚宇超 + /// 创建日期:2018-01-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// The grid control. + protected void SetTabPageDataSource(XtraTabPage tabPage, DataRow rowItem = null, bool isNull = false) + { + if (isNull) + { + this.TabIntoObj.SetGridDataSource(tabPage, new DataTable()); + return; + } + GridDetailModel model = this.TabIntoObj.GetGridDetailModel(tabPage); + if (rowItem != null && model != null) + { + if (!string.IsNullOrEmpty(model.UnionModule) && (string.IsNullOrEmpty(model.UnionValue) && string.IsNullOrEmpty(model.UnionCond))) return; + if (tabPage.Tag is FrmWebBrowser) + { + // 加载网页 + FrmWebBrowser webView = tabPage.Tag as FrmWebBrowser; + string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); + url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; + //webView.FrmLoad(url); + webView.LoadUrl(url); + webView.Dock = DockStyle.Fill; + webView.Tag = model; + } + else if (tabPage.Tag is FrmWebBrowser2) + { + // 加载网页 + FrmWebBrowser2 webView = tabPage.Tag as FrmWebBrowser2; + string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); + url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; + webView.LoadUrl(url); + webView.Dock = DockStyle.Fill; + webView.Tag = model; + } + else if (tabPage.Tag is FrmMiniBlink) + { + // 加载网页 + FrmMiniBlink webView = tabPage.Tag as FrmMiniBlink; + string url = ReplaceHelper.ReplaceRowParam(rowItem, ReplaceHelper.ReplaceUserInfo(model.DetailSql)); + url = url.StartsWith("http") ? url : SystemInfo.Instance.OAUrl + url; + webView.LoadUrl(url); + webView.Dock = DockStyle.Fill; + webView.Tag = model; + } + else if (tabPage.Tag is TabMultipledetails) + { + TabMultipledetails tabMultipledetails = tabPage.Tag as TabMultipledetails; + tabMultipledetails.SetConditionValues(rowItem); + GridControlEx grdExMain = (tabMultipledetails.SplitMain.Panel1.Tag as GridControlEx); + GridDetailModel MainModel = grdExMain.Tag as GridDetailModel; + string searchMainSql = this.GetSearchSql(MainModel, rowItem); + DataTable firstTable = MainImpl.GetDataTableResult(searchMainSql); + grdExMain.LastSearchSql = searchMainSql; + grdExMain.SetGridViewDataSource(firstTable); + if (tabMultipledetails.SplitMain.Panel2.Tag is GridControlEx) + { + GridControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as GridControlEx); + GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; + string searchAddSql = this.GetSearchSql(AdditionalModel, rowItem); + if (!MainModel.IsUnioDetail) + { + grdExAdditional.LastSearchSql = searchAddSql; + grdExAdditional.SetGridViewDataSource(MainImpl.GetDataTableResult(searchAddSql)); + } + //右侧是左侧的明细,左侧没有数据时。右侧赋空值(因为无法触发左侧行改变事件) + if (MainModel.IsUnioDetail && firstTable.Rows.Count == 0) + { + grdExAdditional.LastSearchSql = ""; + grdExAdditional.SetGridViewDataSource(new DataTable()); + } + } + else if (tabMultipledetails.SplitMain.Panel2.Tag is ChartControlEx) + { + ChartControlEx grdExAdditional = (tabMultipledetails.SplitMain.Panel2.Tag as ChartControlEx); + GridDetailModel AdditionalModel = grdExAdditional.Tag as GridDetailModel; + string searchAddSql = this.GetSearchSql(AdditionalModel, rowItem); + DataTable table = MainImpl.GetDataTableResult(searchAddSql); + grdExAdditional.CreateChart(table); + } + + tabPage.Text = MainModel.DetailName + "(" + firstTable.Rows.Count + "条)"; + tabPage.Appearance.Header.ForeColor = firstTable.Rows.Count > 0 ? Color.Red : Color.FromArgb(0, 0, 0); + } + else if (tabPage.Tag is FrmProductSched) + { + string searchSql = this.GetSearchSql(model, rowItem); + FrmProductSched frmProductSched = tabPage.Tag as FrmProductSched; + DataTable table = MainImpl.GetDataTableResult(searchSql); + frmProductSched.setDataSource(table); + + tabPage.Text = model.DetailName + "(" + table.Rows.Count + "条)"; + tabPage.Appearance.Header.ForeColor = table.Rows.Count > 0 ? Color.Red : Color.FromArgb(0, 0, 0); + + } + else + { + if (model.IsDrag) + { + return; + } + string searchSql = this.GetSearchSql(model, rowItem); + if (tabPage.Tag is GridControlEx) + { + (tabPage.Tag as GridControlEx).LastSearchSql = searchSql; + } + GridView view = this.ModuleGridObj.GridControlObj.GridView; + if (model.DynamicDetails && rowItem.Table.Columns.Contains("DisplayColumns")) // + { + this.tcButtom.SetGridDisplayColumns(tabPage, rowItem["DisplayColumns"] + ""); + } + this.tcButtom.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(searchSql), view); + if (tabPage.Tag is GridControlEx && (tabPage.Tag as GridControlEx).ParentControl != null) + (tabPage.Tag as GridControlEx).ParentControl.SetAllControlValue(rowItem); + //配置明细直接根据条件加载 + if (model.SystemModel != null && 1 == model.SystemModel.isFirstLoad) + { + (tabPage.Tag as GridControlEx).ParentControl.SearchGrid(); + tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)"; + } + + } + //string searchSql = this.GetSearchSql(model, rowItem); + //if (tabPage.Tag is GridControlEx) + //{ + // (tabPage.Tag as GridControlEx).LastSearchSql = searchSql; + //} + //this.TabIntoObj.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(searchSql)); + } + } + /// + /// 说明:设置表格数据 + /// 创建人:龚宇超 + /// 创建日期:2018-01-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// The grid control. + protected void SetRightDataSource(XtraTabPage tabPage) + { + + GridDetailModel model = this.tcButtom.GetGridDetailModel(tabPage); + + this.tcButtom.SetGridDataSource(tabPage, MainImpl.GetDataTableResult((tabPage.Tag as GridControlEx).LastSearchSql)); + + } + /// + /// 说明:获取查询条件 + /// 创建人:龚宇超 + /// 创建日期:2017-11-22 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The model. + /// The row item. + /// System.String. + protected string GetSearchSql(GridDetailModel model, DataRow rowItem) + { + string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ModuleGridObj.ParmaryKey; + string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; + + sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + + if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) + { + string WhereConnect = rowItem.Table.Columns.Contains(fieldName) ? string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + "") : "and 1<>1"; + sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + WhereConnect; + + } + return sqlValue; + } + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2017-11-21 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// List<GridDetailModel>. + private List GetDetails(string ModuleCode) + { + List details = new List(); + + DataTable table = BaseModuleImpl.GetBaseDetailPages(ModuleCode); + foreach (DataRow item in table.Rows) + { + DataTable gridColumns = ReportImpl.GetReportDetailColumns(ModuleCode, item["id"] + ""); + details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView)); + } + + return details; + } + /// + /// 获取附加模块 + /// + private void GetBaseAttachPage() + { + DataTable table = BaseModuleImpl.GetBaseAttach(this.Model.ModuleCode);//查看是否有附加模块 + if (table.Rows.Count > 0) + { + this.xtraTabPage1.Text = this.SysModel.MenuText; + if (this.SysModel.isHideHomeTAB) this.xtraTabPage1.PageVisible = false; + + foreach (DataRow item in table.Rows) + { + string DragType = "0";//0默认(上下),1上左,2上下和上左 + string DragConditions = string.Empty; + if (table.Columns.Contains("DragType") && !string.IsNullOrWhiteSpace(item["DragType"] + "")) + { + dragModel = DragType = item["DragType"] + ""; + } + if (table.Columns.Contains("DragConditions") && !string.IsNullOrWhiteSpace(item["DragConditions"] + "")) + { + DragConditions = item["DragConditions"] + ""; + } + + DataRow modelRow = MainImpl.GetSystemdllTab(item["unionModule"] + ""); + ModuleModel addModel = new ModuleModel(modelRow); + if (addModel == null) continue; + XtraTabPage page = new XtraTabPage(); + page.Text = item["AttachName"] + ""; + ModuleGridEx modegridEx = new ModuleGridEx(); + modegridEx.Name = "modegridEx"; + modegridEx.Dock = DockStyle.Fill; + DynamicModel dyncModel = new DynamicModuleModel(new string[] { "0", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", item["unionModule"] + "", "0" }); + modegridEx.RightGridCallBack += Mg_control_RightGridCallBack; + modegridEx.InitializeControl(addModel, dyncModel); + modegridEx.SearchObj.OnDataSourceBindCallBack += OnDataSourceBindCallBack; + //加载复选框 + if (table.Columns.Contains("gridObjCheck") && "1".Equals(item["gridObjCheck"] + "")) + { + GridDragGrid.GridAddCheckBox(modegridEx.GridControlObj.GridView); + } + + if (dyncModel.HasOperPrivilege() && dyncModel.IsBaseModule) + { + // 有权限则允许拖拽 + if (DragType.Equals("1") || DragType.Equals("2")) + { + GridDragGrid dragGrid = new GridDragGrid(modegridEx.GridControlObj.GridView, this.gridLeftButtom.GridView); + dragGrid.isDropColorVisble = true; + dragGrid.TargetTableMultiSelect = false; + //dragGrid.sequentialReturn = true; + dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + dragGrid.DragConditions = DragConditions; + } + + // 有权限则上下结构允许拖拽 + foreach (XtraTabPage tabPage in this.tcButtom.TabControlObj.TabPages) + { + if (tabPage.Tag is GridControlEx) + { + if (DragType.Equals("0") || DragType.Equals("2")) + { + GridDragGrid dragGridToptoBottom = new GridDragGrid(modegridEx.GridControlObj.GridView, (tabPage.Tag as GridControlEx).GridView); + dragGridToptoBottom.isDropColorVisble = true; + dragGridToptoBottom.TargetTableMultiSelect = false; + //dragGridToptoBottom.sequentialReturn = true; + dragGridToptoBottom.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + dragGridToptoBottom.DragConditions = DragConditions; + } + } + } + } + page.Controls.Add(modegridEx); + page.Tag = modegridEx; + this.Tab_additional.TabPages.Add(page); + + + if (this.SysModel.ModuleDetailClickMode) + { + modegridEx.GridControlObj.GridView.RowClick += GridView_DoubleClick; + } + else + { + modegridEx.GridControlObj.GridView.DoubleClick += new EventHandler(GridView_DoubleClick); + } + + + + } + } + } + /// + /// 数据源绑定完成后触发 + /// + /// + /// + private void OnDataSourceBindCallBack(object sender, EventArgs e) + { + MyControl searchControl = (MyControl)sender; + searchControl.SearchGrid(); + } + #region 表格拖拽完成 + /// + /// 说明:表格拖拽完成 + /// 创建人:龚宇超 + /// 创建日期:2017-11-14 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The e. + protected void OnDragGridCompleted(object sender, GridDragGridArgs e) + { + //e.TargetGridViewObj.OptionsSelection.MultiSelect = true; + string sql = string.Empty; + string msgs = string.Empty; + int refreshTypes; + DataRow GridLeftItem = this.gridLeftButtom.GridView.GetFocusedDataRow(); + if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0 || GridLeftItem == null) return; + XtraTabPage tabPage = this.Tab_additional.SelectedTabPage; + foreach (System.Windows.Forms.Control control in tabPage.Controls) + { + if (control.GetType().Name == "ModuleGridEx") + { + ModuleGridEx moduleGridEx = control as ModuleGridEx; + try + { + int[] records = new int[e.GridViewSelectRows.Length]; + string ParmaryKey = moduleGridEx.ParmaryKey; + + List apiHelpers = new List();//拖拽前缓存接口调用数据 + + + if (SystemInfo.Instance.ProductionSchedulingVerification) + { + //拖动行全部主键 + string ParmaryValues = string.Empty; + DataRow firstLine = null; + for (int i = 0; i < e.GridViewSelectRows.Length; i++) + { + if (i == 0) firstLine = e.GridViewSelectRows[i]; + ParmaryValues += e.GridViewSelectRows[i][ParmaryKey] + ","; + } + + int result = ProduceImpl.DragRefresh(moduleGridEx.Model.ModuleCode, ParmaryKey, firstLine[ParmaryKey] + "", LeftBoottomModel, _primaryLeftKey, GridLeftItem[_primaryLeftKey] + "", out refreshTypes, out msgs, ParmaryValues, "0"); + switch (result) + { + case 1: + // 继续执行保存 + break; + case 9: + // 根据选择判断是否继续执行保存 + if (MessageUtil.Show(msgs, MessageBoxButtons.YesNo) == DialogResult.No) + { + return; + } + break; + default: + // 保存失败 + MessageUtil.Show("数据错误" + "\r\n" + msgs); + return; + } + } + + + for (int i = 0; i < e.GridViewSelectRows.Length; i++) + { + DataRow item = e.GridViewSelectRows[i]; + try + { + records[i] = ProduceImpl.DragRefresh(moduleGridEx.Model.ModuleCode, ParmaryKey, item[ParmaryKey] + "", LeftBoottomModel, _primaryLeftKey, GridLeftItem[_primaryLeftKey] + "", out refreshTypes, out msgs, "", "1"); + if (records[i] == 1 && ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterGridDragComplete, moduleGridEx.Model.ModuleCode, 0)) + { + ApiHelper apiHelper = new ApiHelper(moduleGridEx.Model.ModuleCode, item[ParmaryKey] + "", ParmaryKey, this.SysModel.MenuTable, 0); + Interface.Api.ActionType actionType = Interface.Api.ActionType.None; + apiHelper.OnEvent(Interface.Api.OperateEvent.AfterGridDragComplete, actionType, false); + apiHelpers.Add(apiHelper); + } + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show("表格拖拽出错!" + ex); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + #region 拖拽后调用api接口 + string apiMsg = ""; + foreach (ApiHelper apiHelper in apiHelpers) + { + apiHelper.OnEvent(); + apiMsg = apiMsg + apiHelper.apiResutMsg; + } + if (!string.IsNullOrEmpty(apiMsg)) + MessageUtil.Show(apiMsg); + #endregion + int successCount = records.Contains(1) ? records.Where(x => x == 1).Count() : 0; + int faultCount = records.Contains(0) ? records.Where(x => x == 0).Count() : 0; + string tipMsg = string.Empty; + string filepath = string.Empty; + string paramstr = string.Empty; + if (successCount > 0) tipMsg = string.Format(ResourceKeys.DragSuccessCount, successCount); + if (faultCount > 0) tipMsg += successCount > 0 ? "\r\n" : "" + string.Format(ResourceKeys.DragFaultCount, faultCount); + //tipMsg = string.IsNullOrWhiteSpace(tipMsg) ? msgs : tipMsg; + //MessageUtil.Show(tipMsg); + if (!string.IsNullOrEmpty(msgs)) + { + // 返回Msg值:tipmsg=我是提示信息;filepath=ccc.lsp;params=daskd + string[] msgItem = msgs.Split(';'); + if (msgItem != null && msgItem.Length > 2) + { + msgs = msgItem[0].Replace("tipmsg=", ""); + filepath = msgItem[1].Replace("filepath=", ""); + paramstr = msgItem[2].Replace("params=", ""); + } + + if (!string.IsNullOrEmpty(msgs)) + MessageUtil.Show(msgs); + if (filepath.Contains(".dll")) + { + GetMsgParamters(paramstr); + } + if (filepath.Contains(".lsp")) + { + DelphiHelper.LoadDelphiDll(PubUtil.AbsolutelyLibPath + filepath, "", "", paramstr, "", 0, ""); + } + } + + int rowHandle = this.gridLeftButtom.GridView.FocusedRowHandle; + gridLeftButtom.SetGridViewDataSource(MainImpl.GetDataTableResult(gridLeftButtom.LastSearchSql)); + this.gridLeftButtom.GridView.SelectRowHandler(rowHandle); + //this.GridView_RowCellClick(this.gridLeftButtom.GridView, null); + if (!this.SysModel.DisableDragRefresh) + { + moduleGridEx.SearchObj.SearchLastGrid();//刷新上方表 + } + + if (istop) + { + this.GridView_DoubleClick(moduleGridEx.GridControlObj.GridView, null);//刷新上方明细 + } + else + { + this.GridViewLeftBottom_DoubleClick(this.gridLeftButtom.GridView, null);//刷新右侧明细 + } + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show(ResourceKeys.OperFault); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + } + } + #endregion + /// + /// 说明:调用弹出dll + /// 创建人:王一帆 + /// 创建日期:2020-04-14 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void GetMsgParamters(string msgs) + { + if (msgs.Contains("module=")) + { + string[] paramters = msgs.Split('='); + if (paramters.Length != 2) + { + MessageUtil.Show(ResourceKeys.ProcNameSettingFault); + return; + } + string[] defaultParams = paramters[1].Split('^'); + if (defaultParams.Length < 4) + { + MessageUtil.Show(ResourceKeys.ExcuteMoudleFail); + return; + } + string dllName = defaultParams[1]; + string moduleTitle = defaultParams[2]; + string saveState = defaultParams[3]; + if ("lskj.pubadd3.dll".Equals(dllName) || "lskj.pubadd2.dll".Equals(dllName) || "lskj.pubadd4.dll".Equals(dllName)) + dllName = "Lskj.PubAdd.dll"; + + List paramList = new List(); + for (int i = 4; i < 14; i++) + { + paramList.Add(defaultParams.Length > i ? defaultParams[i] : ""); + } + //执行dll + string[] str = { + moduleTitle, + ERPInfo.Instance.UserId, + ERPInfo.Instance.UserName, + "1", + ERPInfo.Instance.WorkModid, + paramList[0], + paramList[1], + paramList[2], + paramList[3], + paramList[4], + paramList[5], + paramList[6], + paramList[7], + paramList[8], + paramList[9], + "", + "", + saveState + }; + IForm form = FormHelper.LoadDllForm(dllName, str); + if (form == null) + { + MessageUtil.Show(ResourceKeys.DyncmicDllNotFount); + return; + } + if (form.SubForm == null) + { + MessageUtil.Show(ResourceKeys.DyncmicDllInitFault); + return; + } + form.SubForm.WindowState = FormWindowState.Normal; + form.SubForm.StartPosition = FormStartPosition.CenterScreen; + form.SubForm.Text = moduleTitle; + DialogResult dr = form.SubForm.ShowDialog(); + + } + } + #region 切换页签 + /// + /// 切换附加模块页签 + /// + /// + /// + private void Tab_additional_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) + { + try + { + //XtraTabPage item = Tab_Bottom.TabPages[Tab_additional.SelectedTabPageIndex]; + XtraTabPage tabPage = this.Tab_additional.SelectedTabPage; + //Tab_Bottom.SelectedTabPage= item; + if (tabPage != null) + { + this.ModuleGridObj = tabPage.Tag as ModuleGridEx; + } + + //this.TabIntoObj=item.Tag as TabIntoControl; + //this.TabObj = TabIntoObj.TabControlObj;} + + //如果是默认页签,则隐藏左侧 + //if (this.SearchLeftObj != null && Tab_additional.SelectedTabPage == xtraTabPage1)//进行tabpage位置判断 + //{ + // // this.splitLeftControl.Panel1.Visible = false; + // //splitLeftControl.SplitterPosition = \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/ProductionMain.resx b/插件库/Lskj.PubModuleDetail5/ProductionMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/ProductionMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/Properties/AssemblyInfo.cs b/插件库/Lskj.PubModuleDetail5/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8a28a1b --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Lskj.PubModuleDetail5")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[ \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/Properties/Resources.Designer.cs b/插件库/Lskj.PubModuleDetail5/Properties/Resources.Designer.cs new file mode 100644 index 0000000..692f455 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/Properties/Resources.Designer.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace Lskj.PubModuleDetail5.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::Sys \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/Properties/Resources.resx b/插件库/Lskj.PubModuleDetail5/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/Properties/Settings.Designer.cs b/插件库/Lskj.PubModuleDetail5/Properties/Settings.Designer.cs new file mode 100644 index 0000000..537c086 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/Properties/Settings.Designer.cs @@ -0,0 +1,2 @@ +//------------------------------------------------------------------------------ +// + + + + + + diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.Designer.cs b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.Designer.cs new file mode 100644 index 0000000..877917a --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.Designer.cs @@ -0,0 +1,41 @@ +namespace Lskj.PubModuleDetail5 +{ + partial class TabIntoAddControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.splitMainControl = new DevExpress.XtraEditors.SplitContainerControl(); + ((System.ComponentModel.ISupportInitialize)(this.splitMainControl)).BeginInit(); + this.splitMainControl.SuspendLayout(); + this.SuspendLayout(); + // + // splitMainControl + // + this.splitMainControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitMainControl.Location = new System.Drawing.Point(0, 0); + this.splitMainControl.Name = "splitMainControl"; + this.splitMainControl. \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.cs b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.cs new file mode 100644 index 0000000..bd6b490 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.cs @@ -0,0 +1,435 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Lskj.Control.Model; +using Lskj.Model; +using DevExpress.XtraReports.Design; +using Lskj.Business.Impl; +using DevExpress.XtraGrid.Views.Grid; +using Lskj.Util; +using DevExpress.XtraGrid.Columns; +using Lskj.Business; +using Lskj.Data; +using DevExpress.XtraEditors; +using Lskj.Control; + +namespace Lskj.PubModuleDetail5 +{ + public partial class TabIntoAddControl : UserControl + { + + /// + /// 分割条 + /// + public SplitContainerControl splitContainerControl { get { return this.splitMainControl; } } + + /// + /// 初始化完成 + /// + private bool _isInitFinish; + + /// + /// 是否加载明细刷新 + /// + /// true if [_ un refresh]; otherwise, false. + private bool _UnRefresh + { + get + { + return Model is DynamicModuleDetailModel || Model is DynamicModuleModel || Model is DynamicProductionModel; + } + } + + /// + /// 表一 + /// + public ModuleGridEx gridEx = new ModuleGridEx(); + /// + /// 表二 + /// + public ModuleGridEx gridEx2 = new ModuleGridEx(); + + /// + /// 表一(动态表) + /// + public GridControlEx gridControlEx = new GridControlEx(); + /// + /// 表二(动态表) + /// + public GridControlEx gridControlEx2 = new GridControlEx(); + + + /// + /// 拖拽模式 + /// + public bool IsDragDetail; + /// + /// 拖拽目标主键字段 + /// + public string DrgaParentPrimaryKey; + /// + /// 主键字段 + /// + public string PrimaryKey; + /// + /// 添加数据sql赋值 + /// + public string ControlSql; + /// + /// tab标签 + /// + private List _gridDetail; + /// + /// tab标签内页签 + /// + private List _gridDetail2; + /// + /// The system model + /// + public DynamicModel Model; + /// + /// 父表格 + /// + public GridControlEx ParentGridEx; + /// + /// 父容器 + /// + public MyControl ParentControlEx; + + /// + /// 右键菜单执行后调用 + /// + /// The sender. + public event EventHandler OnRightCallback; + /// + ///第一个模块的模块编号(Model拿不到,所以使用第一个模块的模块编号设置ini文件分割条编号,) + /// + public string ModuleNumber; + + + public TabIntoAddControl() + { + InitializeComponent(); + this.splitContainerControl.Horizontal = false;//上下结构 + this.splitMainControl.SplitterPositionChanged += new System.EventHandler(this.splitContainer_SplitterPositionChanged); + } + /// + /// 说明:绑定选项卡 + /// 创建人:龚宇超 + /// 创建日期:2018-01-09 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + public void InitTabPages(List gridDetail) + { + this._gridDetail = gridDetail; + int i = 0; + foreach (GridDetailModel model in this._gridDetail) + { + if (i == 0) + { + GroupBox groupBox = new GroupBox(); + groupBox.Dock = DockStyle.Fill; + groupBox.Text = model.DetailName; + + if (string.IsNullOrWhiteSpace(model.UnionModule)) + { + PanelControl plBottom = new PanelControl(); + plBottom.Dock = DockStyle.Bottom; + plBottom.Visible = false; + PanelControl plMain = new PanelControl(); + plMain.Dock = DockStyle.Fill; + gridControlEx = new GridControlEx(); + gridControlEx = model.AutoMultiHeader == 1 ? new BandedGridControlEx() : new GridControlEx(); + gridControlEx.Dock = DockStyle.Fill; + gridControlEx.Tag = model; + gridControlEx.Parent = plMain; + gridControlEx.Model = this.Model; + gridControlEx.SetReadOnlyColumns(model.GridColumns, model.GridCustomColumnKey); + //gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + //gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + gridControlEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + gridControlEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + if (Model != null && Model.IsDetailSearch) + { + plBottom.Visible = true; + MyControl searchObj = new MyControl(model.DetailSql, gridControlEx); + plBottom.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(model.FormKey), plBottom); + } + groupBox.Controls.AddRange(new PanelControl[] { plBottom, plMain }); + splitMainControl.Panel1.Tag = gridControlEx; + } + else + { + DynamicModel dyncModel = new DynamicModuleModel(new string[] { model.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", model.UnionModule, "0" }); + model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); + ModuleNumber = model.UnionModule; + if (Model != null) + model.SystemModel.ParmaryKey = BaseImpl.GetBasePrimaryKey(Model.ModuleCode); + + gridEx = new ModuleGridEx(); + gridEx.Name = "gridEx1"; + gridEx.Dock = DockStyle.Fill; + gridEx.OperShortMode = false; // 不显示简短模式 + gridEx.VisibleSearchPanel = false; + gridEx.VisibleOperPanel = !model.IsReadOnly; + gridEx.InitializeControl(model.SystemModel, dyncModel); + gridEx.GridControlObj.Tag = model; + gridEx.ParentControlEx = this.ParentControlEx; + this.ParentGridEx = gridEx.GridControlObj; + gridEx.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.SystemModel.ParmaryKey : model.UnionParentField; + gridEx.DetailKeyField = model.UnionValue; + + if (model.AutoRefresh && !_UnRefresh) + gridEx2.SearchObj.SearchGrid(); + + groupBox.Controls.Add(gridEx); + splitMainControl.Panel1.Tag = gridEx; + } + + splitMainControl.Panel1.Controls.Add(groupBox); + } + else + { + GroupBox groupBox2 = new GroupBox(); + groupBox2.Dock = DockStyle.Fill; + groupBox2.Text = model.DetailName; + if (string.IsNullOrWhiteSpace(model.UnionModule)) + { + PanelControl plBottom = new PanelControl(); + plBottom.Dock = DockStyle.Bottom; + plBottom.Visible = false; + PanelControl plMain = new PanelControl(); + plMain.Dock = DockStyle.Fill; + gridControlEx2 = new GridControlEx(); + gridControlEx2 = model.AutoMultiHeader == 1 ? new BandedGridControlEx() : new GridControlEx(); + gridControlEx2.Dock = DockStyle.Fill; + gridControlEx2.Tag = model; + gridControlEx2.Parent = plMain; + gridControlEx2.Model = this.Model; + gridControlEx2.SetReadOnlyColumns(model.GridColumns, model.GridCustomColumnKey); + //gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + //gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + gridControlEx2.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + gridControlEx2.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + if (Model != null && Model.IsDetailSearch) + { + plBottom.Visible = true; + MyControl searchObj = new MyControl(model.DetailSql, gridControlEx2); + plBottom.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(model.FormKey), plBottom); + } + groupBox2.Controls.AddRange(new PanelControl[] { plBottom, plMain }); + splitMainControl.Panel2.Tag = gridControlEx2; + } + else + { + DynamicModel dyncModel = new DynamicModuleModel(new string[] { model.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", model.UnionModule, "0" }); + model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); + if (Model != null) + model.SystemModel.ParmaryKey = BaseImpl.GetBasePrimaryKey(Model.ModuleCode); + + gridEx2 = new ModuleGridEx(); + gridEx2.Name = "gridEx2"; + gridEx2.Dock = DockStyle.Fill; + gridEx2.OperShortMode = false; // 不显示简短模式 + gridEx2.VisibleSearchPanel = false; + gridEx2.VisibleOperPanel = !model.IsReadOnly; + gridEx2.InitializeControl(model.SystemModel, dyncModel); + gridEx2.GridControlObj.Tag = model; + gridEx2.ParentControlEx = this.ParentControlEx; + this.ParentGridEx = gridEx2.GridControlObj; + gridEx2.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.SystemModel.ParmaryKey : model.UnionParentField; + gridEx2.DetailKeyField = model.UnionValue; + //if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) + //{ + // // 拖拽模式,绑定拖拽对象 + // GridDragGrid dragGrid = new GridDragGrid(gridEx.GridControlObj.GridView, this.ParentGridEx.GridView); + // dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + //} + + if (model.AutoRefresh && !_UnRefresh) + gridEx2.SearchObj.SearchGrid(); + groupBox2.Controls.Add(gridEx2); + splitMainControl.Panel2.Tag = gridEx2; + } + + splitMainControl.Panel2.Controls.Add(groupBox2); + + } + i++; + } + InitSpliterPosition(); + if (i==1) { splitMainControl.PanelVisibility = SplitPanelVisibility.Panel1; } + _isInitFinish = true; + } + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The instance containing the event data. + protected void OnGridViewRightCallBack(object sender, EventArgs e) + { + try + { + if (this.OnRightCallback != null) + this.OnRightCallback(sender, e); + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + + } + /// + /// 说明:加载tab标签里得明细数据 + /// 创建人:王一帆 + /// 创建日期:2018-09-28 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void GridView_DoubleClick(object sender, EventArgs e) + { + //try + //{ + // WaitForm.ShowForm(); + // GridDetailModel model = gridEx2.GridControlObj.Tag as GridDetailModel; + // DataRow rowItem = gridEx.GridView.GetFocusedDataRow(); + + // if (rowItem != null && model != null) + // { + // string searchSql = this.GetSearchSql(model, rowItem); + // gridEx2.GridControlObj.LastSearchSql = searchSql; + // gridEx2.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(gridEx2.GridControlObj.LastSearchSql)); + // } + + //} + //catch (Exception ex) + //{ + // LogHelper.Instance.WriteError(ex); + // string Message = ErrorMessage.PromptErrorMessage(ex); + // MessageUtil.Show(Message,ex.Message); + //} + //finally + //{ + // WaitForm.HideForm(); + //} + + } + /// + /// 说明:获取查询条件 + /// 创建人:龚宇超 + /// 创建日期:2017-11-22 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The model. + /// The row item. + /// System.String. + protected string GetSearchSql(GridDetailModel model, DataRow rowItem) + { + string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : this.PrimaryKey; + string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; + + sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + + if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) + { + sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + ""); + } + return sqlValue; + } + /// + /// 说明:表格双击完成 + /// 创建人:王一帆 + /// 创建日期:2019-08-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The e. + protected void OnDoubleGridClic(object sender, EventArgs e) + { + //try + //{ + // DataRow[] rowItems = new DataRow[] { gridEx.GridView.GetFocusedDataRow() }; + // GridColumnCollection gridColumns = this.ParentGridEx.GridView.Columns; + // DataTable table = this.ParentGridEx.gridControl.DataSource as DataTable; + // foreach (DataRow rowItem in rowItems) + // { + // DataRow newRow = table.NewRow(); + // foreach (GridColumn col in gridColumns) + // { + // if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.DrgaParentPrimaryKey)) continue; + + // if (rowItem.Table.Columns.Contains(col.FieldName)) + // { + // // 列中是否包含对应字段,包含则使用值 + // newRow[col.FieldName] = rowItem[col.FieldName]; + // } + // else + // { + // // 未包含字段,则使用控件默认值. + // GridColumnModel model = col.Tag as GridColumnModel; + // string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue); + + // if (!string.IsNullOrEmpty(model.DefaultValue)) + // { + // newRow[col.FieldName] = fieldValue; + // } + // } + // } + // table.Rows.Add(newRow); + // } + + // this.ParentGridEx.GridView.ClearSelection(); + // this.ParentGridEx.GridView.SelectRowHandler(table.Rows.Count - 1); + // this.ParentGridEx.GridView.UpdateCurrentRow(); + // this.ParentGridEx.GridView.ShowEditor(); + //} + + //catch (Exception ex) + //{ + // string Message = ErrorMessage.PromptErrorMessage(ex); + // MessageUtil.Show(Message,ex.Message); + // LogHelper.Instance.WriteError(ex); + + //} + } + + + + /// + /// 说明:初始化分割条位置 + /// 创建人:王一帆 + /// 创建日期:2020-06-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void InitSpliterPosition() + { + string spliterPosition = IniHelper.Read(string.Format("PubModuleDetail5RightLowerRight_SplitterPositionMain_{0}", ModuleNumber)); + if (!string.IsNullOrEmpty(spliterPosition)) this.splitMainControl.SplitterPosition = Conv \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.resx b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoAddControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoControl.Designer.cs b/插件库/Lskj.PubModuleDetail5/TabIntoControl.Designer.cs new file mode 100644 index 0000000..a639ffc --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoControl.Designer.cs @@ -0,0 +1,55 @@ +namespace Lskj.PubModuleDetail5 +{ + partial class TabIntoControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl(); + this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage(); + this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage(); + ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit(); + this.xtraTabControl1.SuspendLayout(); + this.SuspendLayout(); + // + // xtraTabControl1 + // + this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.xtraTabControl1.Location = new System.Drawing.Point(0, 0); + this.xtraTabControl1.Name = "xtraTabControl1"; + this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1; + this.xtraTabControl1.Size = new System.Drawing.Size(750, 502); + this.xtraTabControl1.TabIndex = 0; + this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { + this.xtraTabPage1, + this.xtraTabPage2}); + // + // xtraTabPage1 + // + this.xtraTabPage1.Name = "xtraTabPage1"; + this.xtraTabPage1.Size = new System.Drawing.Size(743, 466); + this.xtraTabPage1.Text = "xtraTabPage1"; + // \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoControl.cs b/插件库/Lskj.PubModuleDetail5/TabIntoControl.cs new file mode 100644 index 0000000..f0d67e2 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoControl.cs @@ -0,0 +1,884 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Lskj.Control; +using Lskj.Business; +using Lskj.Data; +using DevExpress.XtraGrid.Columns; +using Lskj.Util; +using Lskj.Control.Model; +using Lskj.Business.Impl; +using DevExpress.XtraTab; +using Lskj.Model; +using DevExpress.XtraEditors; +using DevExpress.XtraGrid.Views.Grid; + +namespace Lskj.PubModuleDetail5 +{ + public partial class TabIntoControl : TabControlEx + { + /// + /// 是否加载明细刷新 + /// + /// true if [_ un refresh]; otherwise, false. + private bool _UnRefresh + { + get + { + return Model is DynamicModuleDetailModel || Model is DynamicModuleModel || Model is DynamicProductionModel; + } + } + /// + /// 拖拽模式 + /// + public bool IsDragDetail; + /// + /// 拖拽目标主键字段 + /// + public string DrgaParentPrimaryKey; + /// + /// 添加数据sql赋值 + /// + public string ControlSql; + /// + /// tab标签 + /// + private List _gridDetail; + /// + /// tab标签里明细数据 + /// + private List _gridIntoDetail; + /// + /// The system model + /// + public DynamicModel Model; + /// + /// 父表格 + /// + public GridControlEx ParentGridEx; + /// + /// 父容器 + /// + public MyControl ParentControlEx; + /// + /// 明细数据里的主表格 + /// + public ModuleGridEx ModuleGridObj; + /// + /// 选项卡 + /// + public XtraTabControl TabIntoControlObj + { + get { return this.xtc_container; } + } + /// + /// 右键菜单执行后调用 + /// + /// The sender. + public event EventHandler OnRightCallback; + /// + /// 在保存网格回调 + /// + /// The sender. + public event EventHandler OnDetailRightCallback; + /// + /// 表格保存执行后调用 + /// + /// The sender. + public event EventHandler OnAllGridCallback; + /// + /// 分割条 + /// + public SplitContainerControl splitContainer { get; set; } + /// + /// 初始化完成 + /// + private bool _isInitFinish; + public TabIntoControl() + { + InitializeComponent(); + } + + /// + /// 说明:绑定选项卡 + /// 创建人:龚宇超 + /// 创建日期:2018-01-09 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + public void InitTabPages(List gridDetail) + { + this._gridDetail = gridDetail; + this.xtc_container.TabPages.Clear(); + + foreach (GridDetailModel model in this._gridDetail) + { + XtraTabPage page = new XtraTabPage(); + page.Text = model.DetailName; + + if (model.IsChart) + { + ChartControlEx chartEx = new ChartControlEx(); + chartEx.Dock = DockStyle.Fill; + chartEx.SetCharts(BaseModuleImpl.GetChartParams(model.FormKey)); + chartEx.SetChartRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + chartEx.Tag = model; + + page.Tag = chartEx; + page.Controls.Add(chartEx); + } + else if (model.IsExcel) + { + ExcelControlEx excelEx = new ExcelControlEx(); + excelEx.Dock = DockStyle.Fill; + excelEx.Tag = model; + + page.Tag = excelEx; + page.Controls.Add(excelEx); + } + else + { + if (model.IsReadOnly) + { + PanelControl plBottom = new PanelControl(); + plBottom.Visible = false; + plBottom.Dock = DockStyle.Bottom; + + PanelControl plMain = new PanelControl(); + plMain.Dock = DockStyle.Fill; + + GridControlEx gridEx = new GridControlEx(); + gridEx.Dock = DockStyle.Fill; + gridEx.Tag = model; + gridEx.Parent = plMain; + + gridEx.Model = this.Model; + gridEx.SetReadOnlyColumns(model.GridColumns, model.GridCustomColumnKey); + gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) + { + // 拖拽模式,绑定拖拽对象 + GridDragGrid dragGrid = new GridDragGrid(gridEx.GridView, this.ParentGridEx.GridView); + dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + } + + // 加载配置查询条件 + if (model.IsSearch) + { + plBottom.Visible = true; + MyControl searchObj = new MyControl(model.DetailSql, gridEx); + plBottom.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(model.SystemModel.CondKey), plBottom); + } + page.Tag = gridEx; + page.Controls.AddRange(new PanelControl[] { plBottom, plMain }); + } + else + { + DynamicModel dyncModel = new DynamicModuleModel(new string[] { model.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", model.UnionModule, "0" }); + model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); + if (Model != null) + model.SystemModel.ParmaryKey = BaseImpl.GetBasePrimaryKey(Model.ModuleCode); + ModuleGridEx gridEx = new ModuleGridEx(); + + if (model.SystemModel.RefreshDetails) + { + gridEx.DetailRightGridCallBack += OnDetailRightCallback; + } + + gridEx.GridControlObj.GridView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect; + gridEx.Name = "gridEx"; + gridEx.IsDetail = true; + gridEx.Dock = DockStyle.Fill; + gridEx.OperShortMode = false; // 不显示简短模式 + gridEx.VisibleSearchPanel = Model.IsDetailSearch; + gridEx.VisibleOperPanel = !model.IsReadOnly; + gridEx.InitializeControl(model.SystemModel, dyncModel); + gridEx.GridControlObj.Tag = model; + gridEx.ParentControlEx = this.ParentControlEx; + gridEx.ParentGridEx = this.ParentGridEx; + gridEx.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.SystemModel.ParmaryKey : model.UnionParentField; + gridEx.DetailKeyField = model.UnionValue; + gridEx.OnSaveGridCallBack += new EventHandler(OnGridViewAllCallBack); + if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) + { + // 拖拽模式,绑定拖拽对象 + GridDragGrid dragGrid = new GridDragGrid(gridEx.GridControlObj.GridView, this.ParentGridEx.GridView); + dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted); + } + + if (model.AutoRefresh && !_UnRefresh) + gridEx.SearchObj.SearchGrid(); + this._gridIntoDetail = GetDetails(model.UnionModule); + if (_gridIntoDetail.Count > 0) + { + page.Tag = gridEx.GridControlObj; + + SplitContainerControl splitLeftControl = new SplitContainerControl(); + splitLeftControl.Dock = DockStyle.Fill; + splitContainer = splitLeftControl; + splitLeftControl.Tag = model.UnionModule; + splitLeftControl.SplitterPositionChanged += SplitLeftControl_SplitterMoved; + + TabIntoAddControl tabAdd = new TabIntoAddControl(); + //tabAdd.splitContainerControl.Horizontal = false;//上下结构 + tabAdd.InitTabPages(_gridIntoDetail); + tabAdd.Dock = DockStyle.Fill; + splitLeftControl.Panel1.Controls.Add(gridEx); + splitLeftControl.Panel2.Controls.Add(tabAdd); + splitLeftControl.Panel1.Tag = gridEx; + splitLeftControl.Panel2.Tag = tabAdd; + page.Controls.AddRange(new SplitContainerControl[] { splitLeftControl }); + gridEx.GridControlObj.GridView.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(GridView_RowCellClick); + } + else + { + page.Tag = gridEx.GridControlObj; + page.Controls.Add(gridEx); + } + } + } + + this.xtc_container.TabPages.Add(page); + + } + InitSpliterPosition(); + _isInitFinish = true; + } + + + + /// + /// 说明:特殊情况绑定选项卡 + /// 创建人:龚宇超 + /// 创建日期:2018-04-04 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The grid detail. + /// The parent value. + public void InitTabPages(List gridDetail, string parentValue) + { + this._gridDetail = gridDetail; + this.xtc_container.TabPages.Clear(); + + foreach (GridDetailModel model in this._gridDetail) + { + XtraTabPage page = new XtraTabPage(); + page.Text = model.DetailName; + + if (model.IsChart) + { + ChartControlEx chartEx = new ChartControlEx(); + chartEx.Dock = DockStyle.Fill; + chartEx.SetCharts(BaseModuleImpl.GetChartParams(model.FormKey)); + chartEx.SetChartRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + chartEx.Tag = model; + + page.Tag = chartEx; + page.Controls.Add(chartEx); + } + else if (model.IsExcel) + { + ExcelControlEx excelEx = new ExcelControlEx(); + excelEx.Dock = DockStyle.Fill; + excelEx.Tag = model; + + page.Tag = excelEx; + page.Controls.Add(excelEx); + } + else + { + if (model.IsReadOnly) + { + PanelControl plTop = new PanelControl(); + plTop.Dock = DockStyle.Top; + + PanelControl plMain = new PanelControl(); + plMain.Dock = DockStyle.Fill; + + GridControlEx gridEx = new GridControlEx(); + gridEx.Dock = DockStyle.Fill; + gridEx.Tag = model; + gridEx.Parent = plMain; + + gridEx.Model = this.Model; + gridEx.SetReadOnlyColumns(model.GridColumns, model.GridCustomColumnKey); + gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack); + gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey)); + + // 加载配置查询条件 + if (model.IsSearch) + { + MyControl searchObj = new MyControl(model.DetailSql, gridEx); + if (!string.IsNullOrEmpty(model.UnionValue) && !string.IsNullOrEmpty(parentValue)) + searchObj.WhereCond = string.Format(" and {0}='{1}'", model.UnionValue, parentValue); + plTop.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(model.SystemModel.CondKey), plTop); + } + + page.Tag = gridEx; + page.Controls.AddRange(new PanelControl[] { plTop, plMain }); + } + else + { + DynamicModel dyncModel = new DynamicModel(new string[] { model.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", model.UnionModule, "0" }); + model.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(model.UnionModule)); + + ModuleGridEx gridEx = new ModuleGridEx(); + gridEx.Name = "gridEx"; + gridEx.Dock = DockStyle.Fill; + gridEx.OperShortMode = false; // 不显示简短模式 + gridEx.VisibleSearchPanel = model.IsSearch; + gridEx.VisibleOperPanel = true; + gridEx.ParentGridEx = this.ParentGridEx; + gridEx.ParentControlEx = this.ParentControlEx; + gridEx.ParentKeyField = string.IsNullOrEmpty(model.UnionParentField) ? model.UnionValue : model.UnionParentField; + gridEx.ParentKeyValue = parentValue; + gridEx.DetailKeyField = model.UnionValue; + gridEx.UnionKey = model.UnionValue; + gridEx.UnionValue = parentValue; //Model.ObjectId; + gridEx.InitializeControl(model.SystemModel, dyncModel); + gridEx.GridControlObj.Tag = model; + gridEx.ControlSql = ControlSql; + + if (model.AutoRefresh) + gridEx.SearchObj.SearchGrid(); + + page.Tag = gridEx.GridControlObj; + page.Controls.Add(gridEx); + + } + } + this.xtc_container.TabPages.Add(page); + } + } + + + + + + + /// + /// 说明:加载tab标签里得明细数据 + /// 创建人:王一帆 + /// 创建日期:2018-09-28 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The source of the event. + /// The instance containing the event data. + protected void GridView_RowCellClick(object sender, RowCellClickEventArgs e) + { + try + { + WaitForm.ShowForm(); + + XtraTabPage tabPage = this.xtc_container.SelectedTabPage; + foreach (System.Windows.Forms.Control control in tabPage.Controls) + { + if (control is SplitContainerControl) + { + SplitContainerControl splitContainer = control as SplitContainerControl; + ModuleGridEx gcMain = splitContainer.Panel1.Tag as ModuleGridEx; + TabIntoAddControl tabadd = splitContainer.Panel2.Tag as TabIntoAddControl; + + GridDetailModel model = null; + if (tabadd.splitContainerControl.Panel1.Tag is ModuleGridEx) + { + model = tabadd.gridEx.GridControlObj.Tag as GridDetailModel; + } + if (tabadd.splitContainerControl.Panel1.Tag is GridControlEx) + { + model = tabadd.gridControlEx.Tag as GridDetailModel; + } + + GridDetailModel model2 = null; + if (tabadd.splitContainerControl.Panel2.Tag is ModuleGridEx) + { + model2 = tabadd.gridEx2.GridControlObj.Tag as GridDetailModel; + } + if (tabadd.splitContainerControl.Panel2.Tag is GridControlEx) + { + model2 = tabadd.gridControlEx2.Tag as GridDetailModel; + } + + DataRow rowItem = gcMain.GridControlObj.GridView.GetFocusedDataRow(); + this.ModuleGridObj = gcMain; + tabadd.PrimaryKey = this.ModuleGridObj.ParmaryKey; + if (rowItem != null) + { + if (model != null) + { + string searchSql = this.GetSearchSql(model, rowItem); + if (tabadd.splitContainerControl.Panel1.Tag is ModuleGridEx) + { + tabadd.gridEx.GridControlObj.LastSearchSql = searchSql; + tabadd.gridEx.SearchObj.SearchLastGrid(); + } + if (tabadd.splitContainerControl.Panel1.Tag is GridControlEx) + { + tabadd.gridControlEx.LastSearchSql = searchSql; + tabadd.gridControlEx.SetGridViewDataSource(MainImpl.GetDataTableResult(searchSql)); + } + + } + if (model2 != null) + { + string searchSql2 = this.GetSearchSql(model2, rowItem); + if (tabadd.splitContainerControl.Panel2.Tag is ModuleGridEx) + { + tabadd.gridEx2.GridControlObj.LastSearchSql = searchSql2; + tabadd.gridEx2.SearchObj.SearchLastGrid(); + } + if (tabadd.splitContainerControl.Panel2.Tag is GridControlEx) + { + tabadd.gridControlEx2.LastSearchSql = searchSql2; + tabadd.gridControlEx2.SetGridViewDataSource(MainImpl.GetDataTableResult(searchSql2)); + } + } + } + else + { + if (model != null) + { + + if (tabadd.splitContainerControl.Panel1.Tag is ModuleGridEx) + { + tabadd.gridEx.GridControlObj.gridControl.DataSource = null; + } + if (tabadd.splitContainerControl.Panel1.Tag is GridControlEx) + { + tabadd.gridControlEx.gridControl.DataSource = null; + } + + } + if (model2 != null) + { + if (tabadd.splitContainerControl.Panel2.Tag is ModuleGridEx) + { + tabadd.gridEx2.GridControlObj.gridControl.DataSource = null; + } + if (tabadd.splitContainerControl.Panel2.Tag is GridControlEx) + { + tabadd.gridControlEx2.gridControl.DataSource = null; + } + } + + } + } + + } + + } + catch (Exception ex) + { + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show("加载明细数据失败!" + ex); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + finally + { + WaitForm.HideForm(); + } + + } + /// + /// 说明:获取查询条件 + /// 创建人:龚宇超 + /// 创建日期:2017-11-22 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The model. + /// The row item. + /// System.String. + protected string GetSearchSql(GridDetailModel model, DataRow rowItem) + { + string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ModuleGridObj.ParmaryKey; + string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql; + + sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue); + + //if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue)) + //{ + // sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + ""); + //} + return sqlValue; + } + /// + /// 说明:判断多标签里是否有明细表 + /// 创建人:王一帆 + /// 创建日期:2019-12-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// List<GridDetailModel>. + private List GetDetails(string ModuleCode) + { + List details = new List(); + + DataTable table = BaseModuleImpl.GetBaseDetailPages(ModuleCode); + foreach (DataRow item in table.Rows) + { + DataTable gridColumns = ReportImpl.GetReportDetailColumns(ModuleCode, item["id"] + ""); + details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView)); + } + + return details; + } + /// + /// 说明:获取TabPage绑定的实体对象 + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// GridDetailModel. + public GridDetailModel GetGridDetailModel(XtraTabPage tabPage) + { + if (tabPage == null) return null; + + if (tabPage.Tag is GridControlEx) + return (tabPage.Tag as GridControlEx).Tag as GridDetailModel; + if (tabPage.Tag is ChartControlEx) + return (tabPage.Tag as ChartControlEx).Tag as GridDetailModel; + + return null; + } + /// + /// 说明:获取选中TabPage绑定的实体对象 + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// GridDetailModel. + public GridDetailModel GetFocusTabPageGridDetailModel() + { + return this.GetGridDetailModel(this.xtc_container.SelectedTabPage); + } + /// + /// 说明:设置指定TabPage数据源 + /// 创建人:龚宇超 + /// 创建日期:2018-01-15 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// The row item. + public void SetGridDataSource(XtraTabPage tabPage, DataTable table) + { + try + { + if (tabPage == null) return; + + if (tabPage.Tag is GridControlEx) + { + this.SetGridViewTabPage(tabPage, table); + //GridView_RowCellClick(null,null); + } + else if (tabPage.Tag is ChartControlEx) + { + this.SetChartViewTabPage(tabPage, table); + } + } + catch (Exception ex) + { + LogUtil.WriteError("TabPage配置错误-->" + tabPage.Text, ex); + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show(ex); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + + /// + /// 说明:设置指定TabPage中表格明细的数据源 + /// 创建人:龚宇超 + /// 创建日期:2018-01-15 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + public void SetGridDetailsDataSource() + { + GridView_RowCellClick(null, null); + } + + /// + /// 说明:设置选中TabPage数据源 + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The table. + public void SetGridDataSource(DataTable table) + { + this.SetGridDataSource(this.xtc_container.SelectedTabPage, table); + } + /// + /// 说明:设置表格数据 + /// 创建人:龚宇超 + /// 创建日期:2018-01-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// The grid control. + protected void SetGridViewTabPage(XtraTabPage tabPage, DataTable table) + { + GridControlEx gridControl = tabPage.Tag as GridControlEx; + GridDetailModel model = gridControl.Tag as GridDetailModel; + gridControl.SetGridViewDataSource(table); + gridControl.GridView.DoubleClick -= new EventHandler(OnGridCompleted); + int dataRowCount = gridControl.GridView.DataRowCount; + if (IsDragDetail && this.ParentGridEx != null && model.IsDrag) + { + gridControl.GridView.DoubleClick += new EventHandler(OnGridCompleted); + } + tabPage.Text = model.DetailName + "(" + dataRowCount + ")"; + tabPage.Appearance.Header.ForeColor = gridControl.GridView.DataRowCount > 0 ? Color.Red : Color.FromArgb(0, 0, 0); + } + + /// + /// 说明:设置图表数据 + /// 创建人:龚宇超 + /// 创建日期:2018-01-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The tab page. + /// The chart control. + protected void SetChartViewTabPage(XtraTabPage tabPage, DataTable table) + { + ChartControlEx chartEx = tabPage.Tag as ChartControlEx; + GridDetailModel model = chartEx.Tag as GridDetailModel; + + chartEx.CreateChart(table); + } + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The instance containing the event data. + protected void OnGridViewRightCallBack(object sender, EventArgs e) + { + try + { + if (this.OnRightCallback != null) + this.OnRightCallback(sender, e); + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + /// + /// 说明: + /// 创建人:龚宇超 + /// 创建日期:2018-02-24 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The instance containing the event data. + protected void OnGridViewAllCallBack(object sender, EventArgs e) + { + try + { + if (this.OnAllGridCallback != null) + this.OnAllGridCallback(sender, e); + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + /// + /// 说明:表格双击完成 + /// 创建人:王一帆 + /// 创建日期:2019-08-29 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The e. + protected void OnGridCompleted(object sender, EventArgs e) + { + try + { + XtraTabPage tabPage = this.xtc_container.SelectedTabPage; + GridControlEx ge = tabPage.Tag as GridControlEx; + DataRow[] rowItems = new DataRow[] { ge.GridView.GetFocusedDataRow() }; + GridColumnCollection gridColumns = this.ParentGridEx.GridView.Columns; + DataTable table = this.ParentGridEx.gridControl.DataSource as DataTable; + foreach (DataRow rowItem in rowItems) + { + DataRow newRow = table.NewRow(); + foreach (GridColumn col in gridColumns) + { + if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.DrgaParentPrimaryKey)) continue; + + if (rowItem.Table.Columns.Contains(col.FieldName)) + { + // 列中是否包含对应字段,包含则使用值 + newRow[col.FieldName] = rowItem[col.FieldName]; + } + else + { + // 未包含字段,则使用控件默认值. + GridColumnModel model = col.Tag as GridColumnModel; + string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue); + + if (!string.IsNullOrEmpty(model.DefaultValue)) + { + newRow[col.FieldName] = fieldValue; + } + } + } + table.Rows.Add(newRow); + } + + this.ParentGridEx.GridView.ClearSelection(); + this.ParentGridEx.GridView.SelectRowHandler(table.Rows.Count - 1); + this.ParentGridEx.GridView.UpdateCurrentRow(); + this.ParentGridEx.GridView.ShowEditor(); + } + + catch (Exception ex) + { + LogUtil.WriteError("表格双击移动错误", ex); + LogHelper.Instance.WriteError(ex); + // MessageUtil.Show(ResourceKeys.OperFault); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + /// + /// 说明:表格拖拽完成 + /// 创建人:龚宇超 + /// 创建日期:2017-11-14 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + /// The sender. + /// The e. + protected void OnDragGridCompleted(object sender, GridDragGridArgs e) + { + if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0 || this.ParentGridEx == null) return; + + try + { + if (MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes) + { + GridColumnCollection gridColumns = this.ParentGridEx.GridView.Columns; + DataTable table = this.ParentGridEx.gridControl.DataSource as DataTable; + foreach (DataRow rowItem in e.GridViewSelectRows) + { + DataRow newRow = table.NewRow(); + foreach (GridColumn col in gridColumns) + { + if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.DrgaParentPrimaryKey)) continue; + + if (rowItem.Table.Columns.Contains(col.FieldName)) + { + // 列中是否包含对应字段,包含则使用值 + newRow[col.FieldName] = rowItem[col.FieldName]; + } + else + { + // 未包含字段,则使用控件默认值. + GridColumnModel model = col.Tag as GridColumnModel; + string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue); + + if (!string.IsNullOrEmpty(model.DefaultValue)) + { + newRow[col.FieldName] = fieldValue; + } + } + } + table.Rows.Add(newRow); + } + + this.ParentGridEx.GridView.ClearSelection(); + this.ParentGridEx.GridView.SelectRowHandler(table.Rows.Count - 1); + this.ParentGridEx.GridView.UpdateCurrentRow(); + this.ParentGridEx.GridView.ShowEditor(); + } + } + catch (Exception ex) + { + LogUtil.WriteError("表格拖拽错误", ex); + LogHelper.Instance.WriteError(ex); + //MessageUtil.Show(ResourceKeys.OperFault); + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(Message, ex.Message); + } + } + + /// + /// 说明:初始化分割条位置 + /// 创建人:王一帆 + /// 创建日期:2020-06-19 + /// 修改人: + /// 修改日期: + /// 修改备注: + /// 版本:1.0 + /// + private void InitSpliterPosition() + { + if (this.splitContainer != null) + { + string spliterPosition = IniHelper.Read(string.Format("PubModuleDetail5RightLower_SplitterPositionMain_{0}", this.splitContainer.Tag + "")); + if (!string.IsNullOrEmpty(spliterPosition)) this.splitContainer.SplitterPosition = Convert.ToInt32(spliterPosition); + } + + } + + /// \ No newline at end of file diff --git a/插件库/Lskj.PubModuleDetail5/TabIntoControl.resx b/插件库/Lskj.PubModuleDetail5/TabIntoControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/插件库/Lskj.PubModuleDetail5/TabIntoControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file