From 085fef1f2662c238d56ee0dbaae1e4c777c171e2 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 25 十一月 2024 09:55:10 +0800 Subject: [PATCH] 分页查询 --- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.Designer.cs | 2 DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesUnit.cs | 61 + DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.Designer.cs | 123 +--- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesPosition.cs | 60 + DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.Designer.cs | 38 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs | 75 +- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.Designer.cs | 1 DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.cs | 60 + DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category2/category.cs | 121 ++- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.Designer.cs | 24 DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs | 59 + DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.cs | 76 +- DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs | 111 ++++ DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category1/category.cs | 110 ++- DevApp/Gs.DevApp/UserControl/UcPageBar.resx | 244 ++++---- DevApp/Gs.DevApp/UserControl/UcPageBar.cs | 25 DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.cs | 60 + DevApp/Gs.DevApp/UserControl/UcPageBar.Designer.cs | 16 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs | 69 + DevApp/Gs.DevApp/UserControl/ShowFilter.cs | 4 DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.cs | 77 +- DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.Designer.cs | 67 +- DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.Designer.cs | 74 -- 23 files changed, 916 insertions(+), 641 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.Designer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.Designer.cs index 19c9e77..a09cee9 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.Designer.cs @@ -40,9 +40,6 @@ this.gv_lotFlag = new DevExpress.XtraGrid.Columns.GridColumn(); this.gv_itemSap = new DevExpress.XtraGrid.Columns.GridColumn(); this.gv_itemC = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gv_factory = new DevExpress.XtraGrid.Columns.GridColumn(); - this.lb_company = new DevExpress.XtraEditors.LabelControl(); - this.txt_company = new DevExpress.XtraEditors.TextEdit(); this.lb_remark = new DevExpress.XtraEditors.LabelControl(); this.txt_remark = new DevExpress.XtraEditors.TextEdit(); this.gv_remark = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -84,6 +81,7 @@ this.toolBarMenu1 = new Gs.DevApp.UserControl.UcToolBarMenu(); this.gcMain = new DevExpress.XtraGrid.GridControl(); this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); + this.gv_org = new DevExpress.XtraGrid.Columns.GridColumn(); this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl(); this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage(); this.pageBar1 = new UserControls.Data.UcPageBar(); @@ -93,7 +91,6 @@ this.lbGuid = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.txt_fseller.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_fforbidstatus.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.txt_company.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_remark.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lastupdateBy.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lastupdateDate.Properties)).BeginInit(); @@ -121,7 +118,7 @@ // this.lb_fseller.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_fseller.Appearance.Options.UseFont = true; - this.lb_fseller.Location = new System.Drawing.Point(567, 155); + this.lb_fseller.Location = new System.Drawing.Point(567, 124); this.lb_fseller.Name = "lb_fseller"; this.lb_fseller.Size = new System.Drawing.Size(56, 21); this.lb_fseller.TabIndex = 298; @@ -129,7 +126,7 @@ // // txt_fseller // - this.txt_fseller.Location = new System.Drawing.Point(626, 151); + this.txt_fseller.Location = new System.Drawing.Point(626, 120); this.txt_fseller.Name = "txt_fseller"; this.txt_fseller.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_fseller.Properties.Appearance.Options.UseFont = true; @@ -239,44 +236,11 @@ this.gv_itemC.VisibleIndex = 11; this.gv_itemC.Width = 94; // - // gv_factory - // - this.gv_factory.AppearanceCell.Font = new System.Drawing.Font("Tahoma", 10F); - this.gv_factory.AppearanceCell.Options.UseFont = true; - this.gv_factory.Caption = "宸ュ巶缂栫爜 "; - this.gv_factory.FieldName = "factory"; - this.gv_factory.MinWidth = 50; - this.gv_factory.Name = "gv_factory"; - this.gv_factory.OptionsColumn.AllowEdit = false; - this.gv_factory.Tag = "query_a.factory"; - this.gv_factory.Visible = true; - this.gv_factory.VisibleIndex = 1; - this.gv_factory.Width = 94; - // - // lb_company - // - this.lb_company.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.lb_company.Appearance.Options.UseFont = true; - this.lb_company.Location = new System.Drawing.Point(337, 191); - this.lb_company.Name = "lb_company"; - this.lb_company.Size = new System.Drawing.Size(39, 21); - this.lb_company.TabIndex = 258; - this.lb_company.Text = "鍏徃 "; - // - // txt_company - // - this.txt_company.Location = new System.Drawing.Point(377, 187); - this.txt_company.Name = "txt_company"; - this.txt_company.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.txt_company.Properties.Appearance.Options.UseFont = true; - this.txt_company.Size = new System.Drawing.Size(150, 28); - this.txt_company.TabIndex = 258; - // // lb_remark // this.lb_remark.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_remark.Appearance.Options.UseFont = true; - this.lb_remark.Location = new System.Drawing.Point(584, 117); + this.lb_remark.Location = new System.Drawing.Point(584, 86); this.lb_remark.Name = "lb_remark"; this.lb_remark.Size = new System.Drawing.Size(39, 21); this.lb_remark.TabIndex = 252; @@ -284,7 +248,7 @@ // // txt_remark // - this.txt_remark.Location = new System.Drawing.Point(626, 113); + this.txt_remark.Location = new System.Drawing.Point(626, 82); this.txt_remark.Name = "txt_remark"; this.txt_remark.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_remark.Properties.Appearance.Options.UseFont = true; @@ -366,7 +330,7 @@ // this.lb_createDate.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_createDate.Appearance.Options.UseFont = true; - this.lb_createDate.Location = new System.Drawing.Point(550, 84); + this.lb_createDate.Location = new System.Drawing.Point(303, 197); this.lb_createDate.Name = "lb_createDate"; this.lb_createDate.Size = new System.Drawing.Size(73, 21); this.lb_createDate.TabIndex = 235; @@ -374,7 +338,7 @@ // // txt_createDate // - this.txt_createDate.Location = new System.Drawing.Point(626, 80); + this.txt_createDate.Location = new System.Drawing.Point(379, 193); this.txt_createDate.Name = "txt_createDate"; this.txt_createDate.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_createDate.Properties.Appearance.Options.UseFont = true; @@ -675,7 +639,7 @@ this.gv_id.OptionsColumn.AllowEdit = false; this.gv_id.Tag = "query_a.id"; this.gv_id.Visible = true; - this.gv_id.VisibleIndex = 0; + this.gv_id.VisibleIndex = 1; this.gv_id.Width = 94; // // toolBarMenu1 @@ -709,8 +673,8 @@ this.gridView1.Appearance.Row.Font = new System.Drawing.Font("Tahoma", 10F); this.gridView1.Appearance.Row.Options.UseFont = true; this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { + this.gv_org, this.gv_id, - this.gv_factory, this.gv_custNo, this.gv_custName, this.gv_custSname, @@ -732,6 +696,17 @@ this.gridView1.OptionsFind.ShowSearchNavButtons = false; this.gridView1.OptionsView.ShowAutoFilterRow = true; this.gridView1.OptionsView.ShowGroupPanel = false; + // + // gv_org + // + this.gv_org.Caption = "浣跨敤缁勭粐"; + this.gv_org.FieldName = "fSubsidiary"; + this.gv_org.MinWidth = 250; + this.gv_org.Name = "gv_org"; + this.gv_org.Tag = "org.fnamber"; + this.gv_org.Visible = true; + this.gv_org.VisibleIndex = 0; + this.gv_org.Width = 250; // // xtraTabControl1 // @@ -783,8 +758,6 @@ this.panel1.Controls.Add(this.txt_fseller); this.panel1.Controls.Add(this.lb_fforbidstatus); this.panel1.Controls.Add(this.txt_fforbidstatus); - this.panel1.Controls.Add(this.lb_company); - this.panel1.Controls.Add(this.txt_company); this.panel1.Controls.Add(this.lb_remark); this.panel1.Controls.Add(this.txt_remark); this.panel1.Controls.Add(this.lb_lastupdateBy); @@ -848,7 +821,6 @@ this.Name = "Frm_Customer"; ((System.ComponentModel.ISupportInitialize)(this.txt_fseller.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_fforbidstatus.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.txt_company.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_remark.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lastupdateBy.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lastupdateDate.Properties)).EndInit(); @@ -897,10 +869,6 @@ private DevExpress.XtraGrid.Columns.GridColumn gv_lotFlag; private DevExpress.XtraGrid.Columns.GridColumn gv_itemSap; private DevExpress.XtraGrid.Columns.GridColumn gv_itemC; - private DevExpress.XtraGrid.Columns.GridColumn gv_factory; - - private DevExpress.XtraEditors.LabelControl lb_company; - private DevExpress.XtraEditors.TextEdit txt_company; private DevExpress.XtraEditors.LabelControl lb_remark; private DevExpress.XtraEditors.TextEdit txt_remark; @@ -953,6 +921,6 @@ private DevExpress.XtraEditors.LabelControl lb_id; private DevExpress.XtraEditors.TextEdit txt_id; private DevExpress.XtraGrid.Columns.GridColumn gv_id; - + private DevExpress.XtraGrid.Columns.GridColumn gv_org; } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.cs index 50d46d9..5f98028 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Customer.cs @@ -1,14 +1,12 @@ -锘縰sing DevExpress.XtraEditors; -using DevExpress.XtraGrid.Views.Base; -using DevExpress.XtraGrid.Views.Grid; -using DevExpress.XtraGrid.Views.Grid.ViewInfo; +锘縰sing DevExpress.XtraGrid.Views.Grid; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; +using Gs.DevApp.UserControl; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; -using System.Drawing; +using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm @@ -20,12 +18,20 @@ public Frm_Customer() { InitializeComponent(); - this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; - this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; + toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; + toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - gridView1.CustomDrawRowIndicator += GridView1_CustomDrawRowIndicator; + gridView1.CustomDrawRowIndicator += + GridView1_CustomDrawRowIndicator; + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; - getPageList(1, UtilityHelper.GetPageSize()); + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); + } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); } private void GridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) { @@ -53,7 +59,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -62,7 +68,10 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -74,7 +83,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -87,38 +96,48 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - foreach (FilterEntity itm in _filterList) - { - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); - } - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { - string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -129,6 +148,7 @@ { ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } private void getModel(string strGuid, bool isEdit, int tabIdx) { diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.Designer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.Designer.cs index 1cf7ebb..f7dcc93 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.Designer.cs @@ -31,8 +31,6 @@ /// </summary> private void InitializeComponent() { - this.lb_parentId = new DevExpress.XtraEditors.LabelControl(); - this.txt_parentId = new DevExpress.XtraEditors.TextEdit(); this.gv_parentId = new DevExpress.XtraGrid.Columns.GridColumn(); this.lb_materialProperti = new DevExpress.XtraEditors.LabelControl(); this.txt_materialProperti = new DevExpress.XtraEditors.TextEdit(); @@ -73,8 +71,6 @@ this.lb_departmentid = new DevExpress.XtraEditors.LabelControl(); this.txt_departmentid = new DevExpress.XtraEditors.TextEdit(); this.gv_departmentid = new DevExpress.XtraGrid.Columns.GridColumn(); - this.lb_company = new DevExpress.XtraEditors.LabelControl(); - this.txt_company = new DevExpress.XtraEditors.TextEdit(); this.toolBarMenu1 = new Gs.DevApp.UserControl.UcToolBarMenu(); this.gcMain = new DevExpress.XtraGrid.GridControl(); this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); @@ -85,7 +81,6 @@ this.panel1 = new System.Windows.Forms.Panel(); this.labelControl11 = new DevExpress.XtraEditors.LabelControl(); this.lbGuid = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.txt_parentId.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_materialProperti.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_productionWorkshop.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_remark.Properties)).BeginInit(); @@ -99,7 +94,6 @@ ((System.ComponentModel.ISupportInitialize)(this.txt_departmentname.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_departmentcode.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_departmentid.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.txt_company.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMain)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit(); @@ -108,25 +102,6 @@ this.xtraTabPage2.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); - // - // lb_parentId - // - this.lb_parentId.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.lb_parentId.Appearance.Options.UseFont = true; - this.lb_parentId.Location = new System.Drawing.Point(28, 184); - this.lb_parentId.Name = "lb_parentId"; - this.lb_parentId.Size = new System.Drawing.Size(73, 21); - this.lb_parentId.TabIndex = 312; - this.lb_parentId.Text = "涓婄骇閮ㄩ棬 "; - // - // txt_parentId - // - this.txt_parentId.Location = new System.Drawing.Point(106, 180); - this.txt_parentId.Name = "txt_parentId"; - this.txt_parentId.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.txt_parentId.Properties.Appearance.Options.UseFont = true; - this.txt_parentId.Size = new System.Drawing.Size(150, 28); - this.txt_parentId.TabIndex = 312; // // gv_parentId // @@ -137,7 +112,8 @@ this.gv_parentId.MinWidth = 150; this.gv_parentId.Name = "gv_parentId"; this.gv_parentId.OptionsColumn.AllowEdit = false; - this.gv_parentId.Tag = "query_a.parent_id"; + this.gv_parentId.OptionsFilter.ImmediateUpdateAutoFilter = false; + this.gv_parentId.Tag = "query_c.Departmentname"; this.gv_parentId.Visible = true; this.gv_parentId.VisibleIndex = 13; this.gv_parentId.Width = 150; @@ -146,7 +122,7 @@ // this.lb_materialProperti.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_materialProperti.Appearance.Options.UseFont = true; - this.lb_materialProperti.Location = new System.Drawing.Point(270, 91); + this.lb_materialProperti.Location = new System.Drawing.Point(270, 87); this.lb_materialProperti.Name = "lb_materialProperti"; this.lb_materialProperti.Size = new System.Drawing.Size(73, 21); this.lb_materialProperti.TabIndex = 291; @@ -154,7 +130,7 @@ // // txt_materialProperti // - this.txt_materialProperti.Location = new System.Drawing.Point(349, 91); + this.txt_materialProperti.Location = new System.Drawing.Point(349, 83); this.txt_materialProperti.Name = "txt_materialProperti"; this.txt_materialProperti.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_materialProperti.Properties.Appearance.Options.UseFont = true; @@ -173,7 +149,7 @@ // // txt_productionWorkshop // - this.txt_productionWorkshop.Location = new System.Drawing.Point(106, 150); + this.txt_productionWorkshop.Location = new System.Drawing.Point(107, 150); this.txt_productionWorkshop.Name = "txt_productionWorkshop"; this.txt_productionWorkshop.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_productionWorkshop.Properties.Appearance.Options.UseFont = true; @@ -189,6 +165,7 @@ this.gv_productionWorkshop.MinWidth = 50; this.gv_productionWorkshop.Name = "gv_productionWorkshop"; this.gv_productionWorkshop.OptionsColumn.AllowEdit = false; + this.gv_productionWorkshop.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_productionWorkshop.Tag = "query_a.production_workshop"; this.gv_productionWorkshop.Visible = true; this.gv_productionWorkshop.VisibleIndex = 12; @@ -198,7 +175,7 @@ // this.lb_remark.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_remark.Appearance.Options.UseFont = true; - this.lb_remark.Location = new System.Drawing.Point(573, 119); + this.lb_remark.Location = new System.Drawing.Point(304, 154); this.lb_remark.Name = "lb_remark"; this.lb_remark.Size = new System.Drawing.Size(39, 21); this.lb_remark.TabIndex = 273; @@ -206,7 +183,7 @@ // // txt_remark // - this.txt_remark.Location = new System.Drawing.Point(618, 115); + this.txt_remark.Location = new System.Drawing.Point(349, 150); this.txt_remark.Name = "txt_remark"; this.txt_remark.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_remark.Properties.Appearance.Options.UseFont = true; @@ -222,6 +199,7 @@ this.gv_remark.MinWidth = 50; this.gv_remark.Name = "gv_remark"; this.gv_remark.OptionsColumn.AllowEdit = false; + this.gv_remark.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_remark.Tag = "query_a.remark"; this.gv_remark.Visible = true; this.gv_remark.VisibleIndex = 11; @@ -236,7 +214,9 @@ this.gv_factory.MinWidth = 250; this.gv_factory.Name = "gv_factory"; this.gv_factory.OptionsColumn.AllowEdit = false; - this.gv_factory.Tag = "query_a.factory"; + this.gv_factory.OptionsFilter.AllowFilterModeChanging = DevExpress.Utils.DefaultBoolean.False; + this.gv_factory.OptionsFilter.ImmediateUpdateAutoFilter = false; + this.gv_factory.Tag = "org.fnamber"; this.gv_factory.Visible = true; this.gv_factory.VisibleIndex = 0; this.gv_factory.Width = 250; @@ -253,7 +233,7 @@ // // txt_fmanager // - this.txt_fmanager.Location = new System.Drawing.Point(106, 115); + this.txt_fmanager.Location = new System.Drawing.Point(107, 115); this.txt_fmanager.Name = "txt_fmanager"; this.txt_fmanager.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_fmanager.Properties.Appearance.Options.UseFont = true; @@ -269,6 +249,7 @@ this.gv_fmanager.MinWidth = 50; this.gv_fmanager.Name = "gv_fmanager"; this.gv_fmanager.OptionsColumn.AllowEdit = false; + this.gv_fmanager.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_fmanager.Tag = "query_a.fmanager"; this.gv_fmanager.Visible = true; this.gv_fmanager.VisibleIndex = 10; @@ -278,7 +259,7 @@ // this.lb_workshopName.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_workshopName.Appearance.Options.UseFont = true; - this.lb_workshopName.Location = new System.Drawing.Point(287, 119); + this.lb_workshopName.Location = new System.Drawing.Point(543, 87); this.lb_workshopName.Name = "lb_workshopName"; this.lb_workshopName.Size = new System.Drawing.Size(56, 21); this.lb_workshopName.TabIndex = 240; @@ -286,7 +267,7 @@ // // txt_workshopName // - this.txt_workshopName.Location = new System.Drawing.Point(349, 115); + this.txt_workshopName.Location = new System.Drawing.Point(605, 83); this.txt_workshopName.Name = "txt_workshopName"; this.txt_workshopName.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_workshopName.Properties.Appearance.Options.UseFont = true; @@ -302,6 +283,7 @@ this.gv_workshopName.MinWidth = 150; this.gv_workshopName.Name = "gv_workshopName"; this.gv_workshopName.OptionsColumn.AllowEdit = false; + this.gv_workshopName.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_workshopName.Tag = "query_a.workshop_name"; this.gv_workshopName.Visible = true; this.gv_workshopName.VisibleIndex = 9; @@ -311,7 +293,7 @@ // this.lb_workshopNo.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_workshopNo.Appearance.Options.UseFont = true; - this.lb_workshopNo.Location = new System.Drawing.Point(555, 84); + this.lb_workshopNo.Location = new System.Drawing.Point(542, 52); this.lb_workshopNo.Name = "lb_workshopNo"; this.lb_workshopNo.Size = new System.Drawing.Size(57, 21); this.lb_workshopNo.TabIndex = 235; @@ -319,7 +301,7 @@ // // txt_workshopNo // - this.txt_workshopNo.Location = new System.Drawing.Point(618, 84); + this.txt_workshopNo.Location = new System.Drawing.Point(605, 48); this.txt_workshopNo.Name = "txt_workshopNo"; this.txt_workshopNo.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_workshopNo.Properties.Appearance.Options.UseFont = true; @@ -335,6 +317,7 @@ this.gv_workshopNo.MinWidth = 50; this.gv_workshopNo.Name = "gv_workshopNo"; this.gv_workshopNo.OptionsColumn.AllowEdit = false; + this.gv_workshopNo.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_workshopNo.Tag = "query_a.workshop_no"; this.gv_workshopNo.Visible = true; this.gv_workshopNo.VisibleIndex = 8; @@ -344,7 +327,7 @@ // this.lb_depextr4.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_depextr4.Appearance.Options.UseFont = true; - this.lb_depextr4.Location = new System.Drawing.Point(7, 84); + this.lb_depextr4.Location = new System.Drawing.Point(7, 87); this.lb_depextr4.Name = "lb_depextr4"; this.lb_depextr4.Size = new System.Drawing.Size(94, 21); this.lb_depextr4.TabIndex = 228; @@ -352,7 +335,7 @@ // // txt_depextr4 // - this.txt_depextr4.Location = new System.Drawing.Point(106, 84); + this.txt_depextr4.Location = new System.Drawing.Point(107, 83); this.txt_depextr4.Name = "txt_depextr4"; this.txt_depextr4.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_depextr4.Properties.Appearance.Options.UseFont = true; @@ -368,6 +351,7 @@ this.gv_depextr4.MinWidth = 50; this.gv_depextr4.Name = "gv_depextr4"; this.gv_depextr4.OptionsColumn.AllowEdit = false; + this.gv_depextr4.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_depextr4.Tag = "query_a.depextr4"; this.gv_depextr4.Visible = true; this.gv_depextr4.VisibleIndex = 7; @@ -377,7 +361,7 @@ // this.lb_depextr3.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_depextr3.Appearance.Options.UseFont = true; - this.lb_depextr3.Location = new System.Drawing.Point(274, 154); + this.lb_depextr3.Location = new System.Drawing.Point(274, 119); this.lb_depextr3.Name = "lb_depextr3"; this.lb_depextr3.Size = new System.Drawing.Size(69, 21); this.lb_depextr3.TabIndex = 226; @@ -385,7 +369,7 @@ // // txt_depextr3 // - this.txt_depextr3.Location = new System.Drawing.Point(348, 150); + this.txt_depextr3.Location = new System.Drawing.Point(349, 115); this.txt_depextr3.Name = "txt_depextr3"; this.txt_depextr3.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_depextr3.Properties.Appearance.Options.UseFont = true; @@ -401,6 +385,7 @@ this.gv_depextr3.MinWidth = 50; this.gv_depextr3.Name = "gv_depextr3"; this.gv_depextr3.OptionsColumn.AllowEdit = false; + this.gv_depextr3.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_depextr3.Tag = "query_a.depextr3"; this.gv_depextr3.Visible = true; this.gv_depextr3.VisibleIndex = 6; @@ -410,7 +395,7 @@ // this.lb_depextr2.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_depextr2.Appearance.Options.UseFont = true; - this.lb_depextr2.Location = new System.Drawing.Point(539, 52); + this.lb_depextr2.Location = new System.Drawing.Point(526, 14); this.lb_depextr2.Name = "lb_depextr2"; this.lb_depextr2.Size = new System.Drawing.Size(73, 21); this.lb_depextr2.TabIndex = 222; @@ -418,7 +403,7 @@ // // txt_depextr2 // - this.txt_depextr2.Location = new System.Drawing.Point(618, 52); + this.txt_depextr2.Location = new System.Drawing.Point(605, 14); this.txt_depextr2.Name = "txt_depextr2"; this.txt_depextr2.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_depextr2.Properties.Appearance.Options.UseFont = true; @@ -434,6 +419,7 @@ this.gv_depextr2.MinWidth = 100; this.gv_depextr2.Name = "gv_depextr2"; this.gv_depextr2.OptionsColumn.AllowEdit = false; + this.gv_depextr2.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_depextr2.Tag = "query_a.depextr2"; this.gv_depextr2.Visible = true; this.gv_depextr2.VisibleIndex = 5; @@ -451,7 +437,7 @@ // // txt_depextr1 // - this.txt_depextr1.Location = new System.Drawing.Point(349, 52); + this.txt_depextr1.Location = new System.Drawing.Point(349, 48); this.txt_depextr1.Name = "txt_depextr1"; this.txt_depextr1.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_depextr1.Properties.Appearance.Options.UseFont = true; @@ -467,6 +453,7 @@ this.gv_depextr1.MinWidth = 100; this.gv_depextr1.Name = "gv_depextr1"; this.gv_depextr1.OptionsColumn.AllowEdit = false; + this.gv_depextr1.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_depextr1.Tag = "query_a.depextr1"; this.gv_depextr1.Visible = true; this.gv_depextr1.VisibleIndex = 4; @@ -484,7 +471,7 @@ // // txt_departmentname // - this.txt_departmentname.Location = new System.Drawing.Point(106, 52); + this.txt_departmentname.Location = new System.Drawing.Point(107, 48); this.txt_departmentname.Name = "txt_departmentname"; this.txt_departmentname.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_departmentname.Properties.Appearance.Options.UseFont = true; @@ -500,6 +487,7 @@ this.gv_departmentname.MinWidth = 150; this.gv_departmentname.Name = "gv_departmentname"; this.gv_departmentname.OptionsColumn.AllowEdit = false; + this.gv_departmentname.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_departmentname.Tag = "query_a.departmentname"; this.gv_departmentname.Visible = true; this.gv_departmentname.VisibleIndex = 3; @@ -509,7 +497,7 @@ // this.lb_departmentcode.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_departmentcode.Appearance.Options.UseFont = true; - this.lb_departmentcode.Location = new System.Drawing.Point(539, 18); + this.lb_departmentcode.Location = new System.Drawing.Point(270, 14); this.lb_departmentcode.Name = "lb_departmentcode"; this.lb_departmentcode.Size = new System.Drawing.Size(73, 21); this.lb_departmentcode.TabIndex = 216; @@ -517,7 +505,7 @@ // // txt_departmentcode // - this.txt_departmentcode.Location = new System.Drawing.Point(618, 18); + this.txt_departmentcode.Location = new System.Drawing.Point(349, 14); this.txt_departmentcode.Name = "txt_departmentcode"; this.txt_departmentcode.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_departmentcode.Properties.Appearance.Options.UseFont = true; @@ -533,6 +521,7 @@ this.gv_departmentcode.MinWidth = 80; this.gv_departmentcode.Name = "gv_departmentcode"; this.gv_departmentcode.OptionsColumn.AllowEdit = false; + this.gv_departmentcode.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_departmentcode.Tag = "query_a.departmentcode"; this.gv_departmentcode.Visible = true; this.gv_departmentcode.VisibleIndex = 2; @@ -542,7 +531,7 @@ // this.lb_departmentid.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_departmentid.Appearance.Options.UseFont = true; - this.lb_departmentid.Location = new System.Drawing.Point(286, 18); + this.lb_departmentid.Location = new System.Drawing.Point(44, 14); this.lb_departmentid.Name = "lb_departmentid"; this.lb_departmentid.Size = new System.Drawing.Size(57, 21); this.lb_departmentid.TabIndex = 213; @@ -550,7 +539,7 @@ // // txt_departmentid // - this.txt_departmentid.Location = new System.Drawing.Point(349, 18); + this.txt_departmentid.Location = new System.Drawing.Point(107, 14); this.txt_departmentid.Name = "txt_departmentid"; this.txt_departmentid.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_departmentid.Properties.Appearance.Options.UseFont = true; @@ -566,29 +555,11 @@ this.gv_departmentid.MinWidth = 50; this.gv_departmentid.Name = "gv_departmentid"; this.gv_departmentid.OptionsColumn.AllowEdit = false; + this.gv_departmentid.OptionsFilter.ImmediateUpdateAutoFilter = false; this.gv_departmentid.Tag = "query_a.departmentid"; this.gv_departmentid.Visible = true; this.gv_departmentid.VisibleIndex = 1; this.gv_departmentid.Width = 94; - // - // lb_company - // - this.lb_company.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.lb_company.Appearance.Options.UseFont = true; - this.lb_company.Location = new System.Drawing.Point(62, 18); - this.lb_company.Name = "lb_company"; - this.lb_company.Size = new System.Drawing.Size(39, 21); - this.lb_company.TabIndex = 211; - this.lb_company.Text = "鍏徃 "; - // - // txt_company - // - this.txt_company.Location = new System.Drawing.Point(106, 18); - this.txt_company.Name = "txt_company"; - this.txt_company.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.txt_company.Properties.Appearance.Options.UseFont = true; - this.txt_company.Size = new System.Drawing.Size(150, 28); - this.txt_company.TabIndex = 211; // // toolBarMenu1 // @@ -638,6 +609,10 @@ this.gridView1.GridControl = this.gcMain; this.gridView1.IndicatorWidth = 50; this.gridView1.Name = "gridView1"; + this.gridView1.OptionsCustomization.AllowFilter = false; + this.gridView1.OptionsFilter.AllowAutoFilterConditionChange = DevExpress.Utils.DefaultBoolean.False; + this.gridView1.OptionsFilter.AllowFilterEditor = false; + this.gridView1.OptionsFilter.ShowCustomFunctions = DevExpress.Utils.DefaultBoolean.False; this.gridView1.OptionsFind.ShowSearchNavButtons = false; this.gridView1.OptionsView.ShowAutoFilterRow = true; this.gridView1.OptionsView.ShowGroupPanel = false; @@ -688,8 +663,6 @@ this.panel1.BackColor = System.Drawing.Color.White; this.panel1.Controls.Add(this.labelControl11); this.panel1.Controls.Add(this.lbGuid); - this.panel1.Controls.Add(this.lb_parentId); - this.panel1.Controls.Add(this.txt_parentId); this.panel1.Controls.Add(this.lb_materialProperti); this.panel1.Controls.Add(this.txt_materialProperti); this.panel1.Controls.Add(this.lb_productionWorkshop); @@ -716,8 +689,6 @@ this.panel1.Controls.Add(this.txt_departmentcode); this.panel1.Controls.Add(this.lb_departmentid); this.panel1.Controls.Add(this.txt_departmentid); - this.panel1.Controls.Add(this.lb_company); - this.panel1.Controls.Add(this.txt_company); this.panel1.Font = new System.Drawing.Font("Tahoma", 10F); this.panel1.Location = new System.Drawing.Point(76, 20); this.panel1.Name = "panel1"; @@ -751,7 +722,6 @@ this.Controls.Add(this.xtraTabControl1); this.Controls.Add(this.toolBarMenu1); this.Name = "Frm_Department"; - ((System.ComponentModel.ISupportInitialize)(this.txt_parentId.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_materialProperti.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_productionWorkshop.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_remark.Properties)).EndInit(); @@ -765,7 +735,6 @@ ((System.ComponentModel.ISupportInitialize)(this.txt_departmentname.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_departmentcode.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_departmentid.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.txt_company.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMain)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit(); @@ -788,9 +757,6 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label lbGuid; private DevExpress.XtraEditors.LabelControl labelControl11; - - private DevExpress.XtraEditors.LabelControl lb_parentId; - private DevExpress.XtraEditors.TextEdit txt_parentId; private DevExpress.XtraGrid.Columns.GridColumn gv_parentId; private DevExpress.XtraEditors.LabelControl lb_materialProperti; @@ -844,8 +810,5 @@ private DevExpress.XtraEditors.LabelControl lb_departmentid; private DevExpress.XtraEditors.TextEdit txt_departmentid; private DevExpress.XtraGrid.Columns.GridColumn gv_departmentid; - - private DevExpress.XtraEditors.LabelControl lb_company; - private DevExpress.XtraEditors.TextEdit txt_company; } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.cs index a3823cb..fb21fc4 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Department.cs @@ -1,10 +1,9 @@ 锘縰sing System; using System.Collections.Generic; using System.Data; -using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; -using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Grid; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; @@ -17,7 +16,6 @@ { private List<FilterEntity> _filterList = new List<FilterEntity>(); private readonly string _webServiceName = "SysDepartmentManager/"; - public Frm_Department() { InitializeComponent(); @@ -26,22 +24,16 @@ gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; gridView1.CustomDrawRowIndicator += GridView1_CustomDrawRowIndicator; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; - gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); } - private void GridView1_ColumnFilterChanged(object sender, EventArgs e) + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) { - //string filterString = gridView1.Columns[0].FilterInfo.ToString(); - //ColumnFilterInfo filterString222 = gridView1.Columns[0].FilterInfo; - //if (filterString222 == null) - // return; - //_filterList.Clear(); - //System.Text.StringBuilder sbSql = new StringBuilder(); - //_filterList.Add(new FilterEntity("b.FNumber", "浣跨敤缁勭粐", " like ", "鍖呭惈", "%"+ filterString222.Value + "%")); - //getPageList(1, UtilityHelper.GetPageSize()); - ////MessageBox.Show(filterString222); + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); } private void GridView1_CustomDrawRowIndicator(object sender, @@ -71,7 +63,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -81,6 +73,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -94,7 +89,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -107,39 +102,51 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "a.create_date", - "asc", "", _sbSqlWhere.ToString()); + + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", + "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -150,6 +157,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } private void getModel(string strGuid, bool isEdit, int tabIdx) @@ -159,7 +167,6 @@ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } - UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); var _obj = new { @@ -187,7 +194,5 @@ MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } - - } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.Designer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.Designer.cs index 2213377..098315a 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.Designer.cs @@ -328,11 +328,11 @@ this.gv_isStatus.AppearanceCell.Font = new System.Drawing.Font("Tahoma", 10F); this.gv_isStatus.AppearanceCell.Options.UseFont = true; this.gv_isStatus.Caption = "绂佺敤鐘舵��"; - this.gv_isStatus.FieldName = "isStatus"; + this.gv_isStatus.FieldName = "fforbidstatus"; this.gv_isStatus.MinWidth = 50; this.gv_isStatus.Name = "gv_isStatus"; this.gv_isStatus.OptionsColumn.AllowEdit = false; - this.gv_isStatus.Tag = "query_a.isStatus"; + this.gv_isStatus.Tag = "query_a.fforbidstatus"; this.gv_isStatus.Visible = true; this.gv_isStatus.VisibleIndex = 19; this.gv_isStatus.Width = 94; @@ -444,7 +444,7 @@ this.gv_depotNo.MinWidth = 80; this.gv_depotNo.Name = "gv_depotNo"; this.gv_depotNo.OptionsColumn.AllowEdit = false; - this.gv_depotNo.Tag = "query_a.depotNo"; + this.gv_depotNo.Tag = "query_m.depot_name"; this.gv_depotNo.Visible = true; this.gv_depotNo.VisibleIndex = 18; this.gv_depotNo.Width = 94; @@ -479,7 +479,7 @@ this.gv_subconUnitNo.MinWidth = 80; this.gv_subconUnitNo.Name = "gv_subconUnitNo"; this.gv_subconUnitNo.OptionsColumn.AllowEdit = false; - this.gv_subconUnitNo.Tag = "query_a.subconUnitNo"; + this.gv_subconUnitNo.Tag = "query_g.fname"; this.gv_subconUnitNo.Visible = true; this.gv_subconUnitNo.VisibleIndex = 16; this.gv_subconUnitNo.Width = 94; @@ -514,7 +514,7 @@ this.gv_purchaseUnitNo.MinWidth = 80; this.gv_purchaseUnitNo.Name = "gv_purchaseUnitNo"; this.gv_purchaseUnitNo.OptionsColumn.AllowEdit = false; - this.gv_purchaseUnitNo.Tag = "query_a.purchaseUnitNo"; + this.gv_purchaseUnitNo.Tag = "query_d.fname"; this.gv_purchaseUnitNo.Visible = true; this.gv_purchaseUnitNo.VisibleIndex = 13; this.gv_purchaseUnitNo.Width = 94; @@ -549,7 +549,7 @@ this.gv_produceUnitNo.MinWidth = 80; this.gv_produceUnitNo.Name = "gv_produceUnitNo"; this.gv_produceUnitNo.OptionsColumn.AllowEdit = false; - this.gv_produceUnitNo.Tag = "query_a.produceUnitNo"; + this.gv_produceUnitNo.Tag = "query_h.fname"; this.gv_produceUnitNo.Visible = true; this.gv_produceUnitNo.VisibleIndex = 17; this.gv_produceUnitNo.Width = 94; @@ -584,7 +584,7 @@ this.gv_storeUnitNo.MinWidth = 80; this.gv_storeUnitNo.Name = "gv_storeUnitNo"; this.gv_storeUnitNo.OptionsColumn.AllowEdit = false; - this.gv_storeUnitNo.Tag = "query_a.storeUnitNo"; + this.gv_storeUnitNo.Tag = "query_f.fname"; this.gv_storeUnitNo.Visible = true; this.gv_storeUnitNo.VisibleIndex = 15; this.gv_storeUnitNo.Width = 94; @@ -619,7 +619,7 @@ this.gv_saleUnitNo.MinWidth = 80; this.gv_saleUnitNo.Name = "gv_saleUnitNo"; this.gv_saleUnitNo.OptionsColumn.AllowEdit = false; - this.gv_saleUnitNo.Tag = "query_a.saleUnitNo"; + this.gv_saleUnitNo.Tag = "query_e.fname"; this.gv_saleUnitNo.Visible = true; this.gv_saleUnitNo.VisibleIndex = 14; this.gv_saleUnitNo.Width = 94; @@ -675,7 +675,7 @@ this.gv_prdPack.MinWidth = 80; this.gv_prdPack.Name = "gv_prdPack"; this.gv_prdPack.OptionsColumn.AllowEdit = false; - this.gv_prdPack.Tag = "query_a.prdPack"; + this.gv_prdPack.Tag = "query_a.prd_pack"; this.gv_prdPack.Visible = true; this.gv_prdPack.VisibleIndex = 8; this.gv_prdPack.Width = 94; @@ -745,7 +745,7 @@ this.gv_lowLimt.MinWidth = 80; this.gv_lowLimt.Name = "gv_lowLimt"; this.gv_lowLimt.OptionsColumn.AllowEdit = false; - this.gv_lowLimt.Tag = "query_a.lowLimt"; + this.gv_lowLimt.Tag = "query_a.lowlimit"; this.gv_lowLimt.Visible = true; this.gv_lowLimt.VisibleIndex = 6; this.gv_lowLimt.Width = 94; @@ -843,7 +843,7 @@ this.gv_itemUnitNo.MinWidth = 80; this.gv_itemUnitNo.Name = "gv_itemUnitNo"; this.gv_itemUnitNo.OptionsColumn.AllowEdit = false; - this.gv_itemUnitNo.Tag = "query_a.itemUnitNo"; + this.gv_itemUnitNo.Tag = "query_c.fname"; this.gv_itemUnitNo.Visible = true; this.gv_itemUnitNo.VisibleIndex = 12; this.gv_itemUnitNo.Width = 94; @@ -890,7 +890,7 @@ this.gv_itemModel.MinWidth = 360; this.gv_itemModel.Name = "gv_itemModel"; this.gv_itemModel.OptionsColumn.AllowEdit = false; - this.gv_itemModel.Tag = "query_a.itemModel"; + this.gv_itemModel.Tag = "query_a.item_model"; this.gv_itemModel.Visible = true; this.gv_itemModel.VisibleIndex = 4; this.gv_itemModel.Width = 360; @@ -940,10 +940,10 @@ this.gv_itemName.Caption = "鐗╂枡鍚嶇О"; this.gv_itemName.ColumnEdit = this.repositoryItemMemoEdit2; this.gv_itemName.FieldName = "itemName"; - this.gv_itemName.MinWidth = 260; + this.gv_itemName.MinWidth = 250; this.gv_itemName.Name = "gv_itemName"; this.gv_itemName.OptionsColumn.AllowEdit = false; - this.gv_itemName.Tag = "query_a.itemName"; + this.gv_itemName.Tag = "query_a.item_name"; this.gv_itemName.Visible = true; this.gv_itemName.VisibleIndex = 3; this.gv_itemName.Width = 260; @@ -977,12 +977,12 @@ // this.gv_itemNo.AppearanceCell.Font = new System.Drawing.Font("Tahoma", 10F); this.gv_itemNo.AppearanceCell.Options.UseFont = true; - this.gv_itemNo.Caption = "鐗╂枡缂栫爜||ERP鐗╂枡缂栧彿"; + this.gv_itemNo.Caption = "鐗╂枡缂栫爜"; this.gv_itemNo.FieldName = "itemNo"; - this.gv_itemNo.MinWidth = 160; + this.gv_itemNo.MinWidth = 120; this.gv_itemNo.Name = "gv_itemNo"; this.gv_itemNo.OptionsColumn.AllowEdit = false; - this.gv_itemNo.Tag = "query_a.itemNo"; + this.gv_itemNo.Tag = "query_a.item_no"; this.gv_itemNo.Visible = true; this.gv_itemNo.VisibleIndex = 2; this.gv_itemNo.Width = 160; @@ -1019,7 +1019,7 @@ this.gv_id.Name = "gv_id"; this.gv_id.OptionsColumn.AllowEdit = false; this.gv_id.OptionsColumn.ReadOnly = true; - this.gv_id.Tag = "query_a.factory"; + this.gv_id.Tag = "query_a.id"; this.gv_id.Visible = true; this.gv_id.VisibleIndex = 1; this.gv_id.Width = 94; @@ -1097,6 +1097,7 @@ this.gridColumn4.MinWidth = 250; this.gridColumn4.Name = "gridColumn4"; this.gridColumn4.OptionsColumn.AllowEdit = false; + this.gridColumn4.Tag = "org.FNumber"; this.gridColumn4.Visible = true; this.gridColumn4.VisibleIndex = 0; this.gridColumn4.Width = 250; @@ -1106,6 +1107,7 @@ this.gridColumn1.Caption = "瀹夊叏搴撳瓨"; this.gridColumn1.MinWidth = 80; this.gridColumn1.Name = "gridColumn1"; + this.gridColumn1.Tag = ""; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 5; this.gridColumn1.Width = 94; diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.cs index b4888ec..66dffe0 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesItems.cs @@ -3,6 +3,7 @@ using System.Data; using System.Drawing; using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using Gs.DevApp.Entity; @@ -23,8 +24,9 @@ toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); gridView1.CustomDrawRowIndicator += (s, e) => { if (e.Info.IsRowIndicator && e.RowHandle >= 0) @@ -39,7 +41,12 @@ e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } - + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } /// <summary> /// 鍙屽嚮浜嬩欢 /// </summary> @@ -60,7 +67,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -70,6 +77,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -83,7 +93,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -96,39 +106,50 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "item_no", "asc", + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "item_no", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -139,6 +160,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } private void getModel(string strGuid, bool isEdit, int tabIdx) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesPosition.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesPosition.cs index bda48d8..e70624f 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesPosition.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesPosition.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Data; using System.Drawing; -using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using Gs.DevApp.Entity; @@ -23,7 +23,8 @@ toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); pageBar1.PagerEvent += PageBar1_PagerEvent; gridView1.CustomDrawRowIndicator += (s, e) => { @@ -38,6 +39,12 @@ e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Gray, r); }; + } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); } /// <summary> @@ -60,7 +67,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -70,6 +77,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -83,7 +93,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -96,39 +106,50 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "position_name", + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "position_name", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -139,6 +160,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } /// <summary> diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesUnit.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesUnit.cs index 5866d3f..63e33dc 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesUnit.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesUnit.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Data; using System.Drawing; -using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using Gs.DevApp.Entity; @@ -22,7 +22,7 @@ toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; gridView1.CustomDrawRowIndicator += (s, e) => { @@ -37,8 +37,14 @@ e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Gray, r); }; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); } - + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } /// <summary> /// 鍙屽嚮浜嬩欢 /// </summary> @@ -59,7 +65,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -69,6 +75,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -82,7 +91,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -95,39 +104,50 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "fname", "asc", "", + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "fname", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -138,6 +158,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } /// <summary> diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.Designer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.Designer.cs index 4e6afcd..456feae 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.Designer.cs @@ -700,6 +700,7 @@ this.gridColumn1.MinWidth = 250; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.OptionsColumn.AllowEdit = false; + this.gridColumn1.Tag = "org.Fnamber"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; this.gridColumn1.Width = 250; diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs index 7e2ea38..61adfbc 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Staff.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Data; using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; @@ -25,10 +26,17 @@ gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; gridView1.CustomDrawRowIndicator += GridView1_CustomDrawRowIndicator; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } private void GridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) { @@ -56,7 +64,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -66,6 +74,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -79,7 +90,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } @@ -93,39 +104,50 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "create_date", + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -136,6 +158,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } private void getModel(string strGuid, bool isEdit, int tabIdx) diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.Designer.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.Designer.cs index 74f2ea9..1be5fce 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.Designer.cs @@ -614,6 +614,7 @@ this.gridColumn2.MinWidth = 250; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.OptionsColumn.AllowEdit = false; + this.gridColumn2.Tag = "org.FNumber"; this.gridColumn2.Visible = true; this.gridColumn2.VisibleIndex = 0; this.gridColumn2.Width = 250; @@ -624,6 +625,7 @@ this.gridColumn1.FieldName = "suppSname"; this.gridColumn1.MinWidth = 100; this.gridColumn1.Name = "gridColumn1"; + this.gridColumn1.Tag = "a.supp_sname"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 4; this.gridColumn1.Width = 100; diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.cs index 6116484..c98fb83 100644 --- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.cs +++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_Supplier.cs @@ -1,7 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using System.Data; -using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; @@ -24,8 +24,15 @@ gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; gridView1.CustomDrawRowIndicator += GridView1_CustomDrawRowIndicator; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); + } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); } private void GridView1_CustomDrawRowIndicator(object sender, @@ -55,7 +62,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -65,6 +72,9 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); @@ -78,7 +88,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -91,39 +101,50 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); - var pgq = new PageQueryModel(curPage, pageSize, "create_date", + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -134,6 +155,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } private void getModel(string strGuid, bool isEdit, int tabIdx) diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.Designer.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.Designer.cs index 7a40272..9053684 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.Designer.cs @@ -94,11 +94,11 @@ // this.lb_suppNo.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_suppNo.Appearance.Options.UseFont = true; - this.lb_suppNo.Location = new System.Drawing.Point(4, 89); + this.lb_suppNo.Location = new System.Drawing.Point(11, 89); this.lb_suppNo.Name = "lb_suppNo"; - this.lb_suppNo.Size = new System.Drawing.Size(90, 21); + this.lb_suppNo.Size = new System.Drawing.Size(85, 21); this.lb_suppNo.TabIndex = 235; - this.lb_suppNo.Text = "渚涘簲鍟嗙紪鐮� "; + this.lb_suppNo.Text = "閫夋嫨渚涘簲鍟�"; // // gv_suppNo // @@ -118,11 +118,11 @@ // this.lb_itemId.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_itemId.Appearance.Options.UseFont = true; - this.lb_itemId.Location = new System.Drawing.Point(37, 13); + this.lb_itemId.Location = new System.Drawing.Point(28, 13); this.lb_itemId.Name = "lb_itemId"; - this.lb_itemId.Size = new System.Drawing.Size(57, 21); + this.lb_itemId.Size = new System.Drawing.Size(68, 21); this.lb_itemId.TabIndex = 231; - this.lb_itemId.Text = "鐗╂枡ID "; + this.lb_itemId.Text = "閫夋嫨鐗╂枡"; // // gv_itemId // @@ -142,7 +142,7 @@ // this.lb_status.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_status.Appearance.Options.UseFont = true; - this.lb_status.Location = new System.Drawing.Point(294, 89); + this.lb_status.Location = new System.Drawing.Point(348, 89); this.lb_status.Name = "lb_status"; this.lb_status.Size = new System.Drawing.Size(73, 21); this.lb_status.TabIndex = 228; @@ -167,7 +167,7 @@ // this.lb_checkDate.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_checkDate.Appearance.Options.UseFont = true; - this.lb_checkDate.Location = new System.Drawing.Point(541, 51); + this.lb_checkDate.Location = new System.Drawing.Point(595, 51); this.lb_checkDate.Name = "lb_checkDate"; this.lb_checkDate.Size = new System.Drawing.Size(73, 21); this.lb_checkDate.TabIndex = 226; @@ -176,7 +176,7 @@ // txt_checkDate // this.txt_checkDate.Enabled = false; - this.txt_checkDate.Location = new System.Drawing.Point(619, 47); + this.txt_checkDate.Location = new System.Drawing.Point(673, 47); this.txt_checkDate.Name = "txt_checkDate"; this.txt_checkDate.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_checkDate.Properties.Appearance.Options.UseFont = true; @@ -201,7 +201,7 @@ // this.lb_checkUser.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_checkUser.Appearance.Options.UseFont = true; - this.lb_checkUser.Location = new System.Drawing.Point(558, 13); + this.lb_checkUser.Location = new System.Drawing.Point(612, 13); this.lb_checkUser.Name = "lb_checkUser"; this.lb_checkUser.Size = new System.Drawing.Size(56, 21); this.lb_checkUser.TabIndex = 222; @@ -210,7 +210,7 @@ // txt_checkUser // this.txt_checkUser.Enabled = false; - this.txt_checkUser.Location = new System.Drawing.Point(619, 9); + this.txt_checkUser.Location = new System.Drawing.Point(673, 9); this.txt_checkUser.Name = "txt_checkUser"; this.txt_checkUser.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_checkUser.Properties.Appearance.Options.UseFont = true; @@ -235,7 +235,7 @@ // this.lb_lastupdateDate.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_lastupdateDate.Appearance.Options.UseFont = true; - this.lb_lastupdateDate.Location = new System.Drawing.Point(798, 51); + this.lb_lastupdateDate.Location = new System.Drawing.Point(852, 51); this.lb_lastupdateDate.Name = "lb_lastupdateDate"; this.lb_lastupdateDate.Size = new System.Drawing.Size(107, 21); this.lb_lastupdateDate.TabIndex = 219; @@ -244,7 +244,7 @@ // txt_lastupdateDate // this.txt_lastupdateDate.Enabled = false; - this.txt_lastupdateDate.Location = new System.Drawing.Point(911, 47); + this.txt_lastupdateDate.Location = new System.Drawing.Point(965, 47); this.txt_lastupdateDate.Name = "txt_lastupdateDate"; this.txt_lastupdateDate.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_lastupdateDate.Properties.Appearance.Options.UseFont = true; @@ -269,7 +269,7 @@ // this.lb_lastupdateBy.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_lastupdateBy.Appearance.Options.UseFont = true; - this.lb_lastupdateBy.Location = new System.Drawing.Point(815, 13); + this.lb_lastupdateBy.Location = new System.Drawing.Point(869, 13); this.lb_lastupdateBy.Name = "lb_lastupdateBy"; this.lb_lastupdateBy.Size = new System.Drawing.Size(90, 21); this.lb_lastupdateBy.TabIndex = 217; @@ -278,7 +278,7 @@ // txt_lastupdateBy // this.txt_lastupdateBy.Enabled = false; - this.txt_lastupdateBy.Location = new System.Drawing.Point(911, 9); + this.txt_lastupdateBy.Location = new System.Drawing.Point(965, 9); this.txt_lastupdateBy.Name = "txt_lastupdateBy"; this.txt_lastupdateBy.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_lastupdateBy.Properties.Appearance.Options.UseFont = true; @@ -303,7 +303,7 @@ // this.lb_createDate.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_createDate.Appearance.Options.UseFont = true; - this.lb_createDate.Location = new System.Drawing.Point(294, 51); + this.lb_createDate.Location = new System.Drawing.Point(348, 51); this.lb_createDate.Name = "lb_createDate"; this.lb_createDate.Size = new System.Drawing.Size(73, 21); this.lb_createDate.TabIndex = 216; @@ -312,7 +312,7 @@ // txt_createDate // this.txt_createDate.Enabled = false; - this.txt_createDate.Location = new System.Drawing.Point(373, 47); + this.txt_createDate.Location = new System.Drawing.Point(427, 47); this.txt_createDate.Name = "txt_createDate"; this.txt_createDate.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_createDate.Properties.Appearance.Options.UseFont = true; @@ -337,7 +337,7 @@ // this.lb_createBy.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_createBy.Appearance.Options.UseFont = true; - this.lb_createBy.Location = new System.Drawing.Point(311, 13); + this.lb_createBy.Location = new System.Drawing.Point(365, 13); this.lb_createBy.Name = "lb_createBy"; this.lb_createBy.Size = new System.Drawing.Size(56, 21); this.lb_createBy.TabIndex = 213; @@ -346,7 +346,7 @@ // txt_createBy // this.txt_createBy.Enabled = false; - this.txt_createBy.Location = new System.Drawing.Point(373, 9); + this.txt_createBy.Location = new System.Drawing.Point(427, 9); this.txt_createBy.Name = "txt_createBy"; this.txt_createBy.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_createBy.Properties.Appearance.Options.UseFont = true; @@ -371,7 +371,7 @@ // this.lb_itemNo.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.lb_itemNo.Appearance.Options.UseFont = true; - this.lb_itemNo.Location = new System.Drawing.Point(21, 51); + this.lb_itemNo.Location = new System.Drawing.Point(23, 51); this.lb_itemNo.Name = "lb_itemNo"; this.lb_itemNo.Size = new System.Drawing.Size(73, 21); this.lb_itemNo.TabIndex = 211; @@ -380,11 +380,11 @@ // txt_itemNo // this.txt_itemNo.Enabled = false; - this.txt_itemNo.Location = new System.Drawing.Point(114, 47); + this.txt_itemNo.Location = new System.Drawing.Point(106, 47); this.txt_itemNo.Name = "txt_itemNo"; this.txt_itemNo.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.txt_itemNo.Properties.Appearance.Options.UseFont = true; - this.txt_itemNo.Size = new System.Drawing.Size(174, 28); + this.txt_itemNo.Size = new System.Drawing.Size(239, 28); this.txt_itemNo.TabIndex = 211; // // gv_itemNo @@ -410,7 +410,7 @@ this.toolBarMenu1.Location = new System.Drawing.Point(0, 0); this.toolBarMenu1.Name = "toolBarMenu1"; this.toolBarMenu1.rptParameter = null; - this.toolBarMenu1.Size = new System.Drawing.Size(1128, 80); + this.toolBarMenu1.Size = new System.Drawing.Size(1215, 80); this.toolBarMenu1.TabIndex = 0; this.toolBarMenu1.xlsInService = null; this.toolBarMenu1.xlsOutParameter = null; @@ -459,6 +459,7 @@ this.gridColumn1.MinWidth = 250; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.OptionsColumn.AllowEdit = false; + this.gridColumn1.Tag = "org.fnamber"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; this.gridColumn1.Width = 250; @@ -470,6 +471,7 @@ this.gridColumn2.MinWidth = 125; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.OptionsColumn.AllowEdit = false; + this.gridColumn2.Tag = "query_b.item_name"; this.gridColumn2.Visible = true; this.gridColumn2.VisibleIndex = 2; this.gridColumn2.Width = 125; @@ -481,6 +483,7 @@ this.gridColumn3.MinWidth = 125; this.gridColumn3.Name = "gridColumn3"; this.gridColumn3.OptionsColumn.AllowEdit = false; + this.gridColumn3.Tag = "d.supp_name"; this.gridColumn3.Visible = true; this.gridColumn3.VisibleIndex = 5; this.gridColumn3.Width = 125; @@ -491,7 +494,7 @@ this.xtraTabControl1.Location = new System.Drawing.Point(0, 80); this.xtraTabControl1.Name = "xtraTabControl1"; this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1; - this.xtraTabControl1.Size = new System.Drawing.Size(1128, 602); + this.xtraTabControl1.Size = new System.Drawing.Size(1215, 602); this.xtraTabControl1.TabIndex = 3; this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { this.xtraTabPage1, @@ -523,7 +526,7 @@ this.xtraTabPage2.Controls.Add(this.panel1); this.xtraTabPage2.Name = "xtraTabPage2"; this.xtraTabPage2.PageEnabled = false; - this.xtraTabPage2.Size = new System.Drawing.Size(1126, 570); + this.xtraTabPage2.Size = new System.Drawing.Size(1213, 570); this.xtraTabPage2.Text = "鏁版嵁缂栬緫"; // // panel1 @@ -553,33 +556,33 @@ this.panel1.Font = new System.Drawing.Font("Tahoma", 10F); this.panel1.Location = new System.Drawing.Point(23, 20); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1092, 196); + this.panel1.Size = new System.Drawing.Size(1163, 196); this.panel1.TabIndex = 1; // // txt_suppId // this.txt_suppId.IsReadly = false; this.txt_suppId.KeyFile = ""; - this.txt_suppId.Location = new System.Drawing.Point(114, 90); + this.txt_suppId.Location = new System.Drawing.Point(106, 90); this.txt_suppId.Margin = new System.Windows.Forms.Padding(0); this.txt_suppId.Name = "txt_suppId"; - this.txt_suppId.Size = new System.Drawing.Size(174, 30); + this.txt_suppId.Size = new System.Drawing.Size(239, 30); this.txt_suppId.TabIndex = 238; // // txt_itemId // this.txt_itemId.IsReadly = false; this.txt_itemId.KeyFile = ""; - this.txt_itemId.Location = new System.Drawing.Point(114, 12); + this.txt_itemId.Location = new System.Drawing.Point(106, 12); this.txt_itemId.Name = "txt_itemId"; - this.txt_itemId.Size = new System.Drawing.Size(174, 33); + this.txt_itemId.Size = new System.Drawing.Size(239, 33); this.txt_itemId.TabIndex = 237; this.txt_itemId.Tag = "no"; // // txt_status // this.txt_status.Enabled = false; - this.txt_status.Location = new System.Drawing.Point(372, 87); + this.txt_status.Location = new System.Drawing.Point(426, 87); this.txt_status.Name = "txt_status"; this.txt_status.Properties.Caption = ""; this.txt_status.Size = new System.Drawing.Size(94, 24); @@ -609,7 +612,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1128, 682); + this.ClientSize = new System.Drawing.Size(1215, 682); this.Controls.Add(this.picCheckBox); this.Controls.Add(this.xtraTabControl1); this.Controls.Add(this.toolBarMenu1); diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs index 475319a..2b46c9a 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs @@ -1,12 +1,13 @@ -using DevExpress.RichEdit.Export; using Gs.DevApp.DevFrm.QC.Models; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; +using Gs.DevApp.UserControl; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Drawing; +using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.QC @@ -32,7 +33,8 @@ { UtilityHelper.SetCheckIco(s, picCheckBox, this, "status", ""); }; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); pageBar1.PagerEvent += PageBar1_PagerEvent; gridView1.CustomDrawRowIndicator += (s, e) => { @@ -49,6 +51,12 @@ e.Graphics.DrawString(str, f, Brushes.Gray, r); }; _setIno(); + } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); } private void _setIno() { @@ -80,7 +88,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -89,7 +97,10 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -101,7 +112,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> @@ -140,7 +151,7 @@ if (_rtn.rtnCode > 0) { UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); } ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -157,10 +168,20 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { + if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// 淇敼浜嬩欢 @@ -188,7 +209,6 @@ UtilityHelper.JumpToTab(xtraTabControl1, 1); lbGuid.Text = ""; UtilityHelper.CleanValueByControl(this.panel1.Controls, true); - txt_createBy.Enabled = false; txt_createDate.Enabled = false; txt_lastupdateBy.Enabled = false; @@ -196,7 +216,6 @@ txt_checkUser.Enabled = false; txt_checkDate.Enabled = false; txt_status.Enabled = false; - } /// <summary> /// 淇濆瓨浜嬩欢 @@ -250,31 +269,32 @@ /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - foreach (FilterEntity itm in _filterList) - { - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); - } - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { - string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -285,6 +305,7 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Stop(); } /// <summary> /// diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.Designer.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.Designer.cs index dc9108e..85d55fe 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.Designer.cs @@ -29,11 +29,11 @@ /// </summary> private void InitializeComponent() { - DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions(); - DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject(); - DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject(); - DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject(); - DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions3 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject9 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject10 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject11 = new DevExpress.Utils.SerializableAppearanceObject(); + DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject12 = new DevExpress.Utils.SerializableAppearanceObject(); this.gvMx1pid = new DevExpress.XtraGrid.Columns.GridColumn(); this.gvMx1facLevel = new DevExpress.XtraGrid.Columns.GridColumn(); this.rptJSSP = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); @@ -429,10 +429,10 @@ // repositoryItemButtonEdit1 // this.repositoryItemButtonEdit1.AutoHeight = false; - editorButtonImageOptions1.Image = global::Gs.DevApp.Properties.Resources.removegroupfooter_16x16; - editorButtonImageOptions1.ImageToTextAlignment = DevExpress.XtraEditors.ImageAlignToText.LeftCenter; + editorButtonImageOptions3.Image = global::Gs.DevApp.Properties.Resources.removegroupfooter_16x16; + editorButtonImageOptions3.ImageToTextAlignment = DevExpress.XtraEditors.ImageAlignToText.LeftCenter; this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { - new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "绉婚櫎", -1, true, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)}); + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "绉婚櫎", -1, true, true, false, editorButtonImageOptions3, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject9, serializableAppearanceObject10, serializableAppearanceObject11, serializableAppearanceObject12, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)}); this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick); @@ -703,7 +703,7 @@ this.gv_itemNo.MinWidth = 150; this.gv_itemNo.Name = "gv_itemNo"; this.gv_itemNo.OptionsColumn.AllowEdit = false; - this.gv_itemNo.Tag = "query_a.ITEM_NO"; + this.gv_itemNo.Tag = "query_b.item_no"; this.gv_itemNo.Visible = true; this.gv_itemNo.VisibleIndex = 5; this.gv_itemNo.Width = 150; @@ -804,6 +804,7 @@ this.gridColumn8.MinWidth = 250; this.gridColumn8.Name = "gridColumn8"; this.gridColumn8.OptionsColumn.AllowEdit = false; + this.gridColumn8.Tag = "org.fnumber"; this.gridColumn8.Visible = true; this.gridColumn8.VisibleIndex = 0; this.gridColumn8.Width = 250; @@ -815,6 +816,7 @@ this.gridColumn7.MinWidth = 80; this.gridColumn7.Name = "gridColumn7"; this.gridColumn7.OptionsColumn.AllowEdit = false; + this.gridColumn7.Tag = "query_a.ITEM_ID"; this.gridColumn7.Visible = true; this.gridColumn7.VisibleIndex = 4; this.gridColumn7.Width = 94; @@ -826,6 +828,7 @@ this.gridColumn3.MinWidth = 250; this.gridColumn3.Name = "gridColumn3"; this.gridColumn3.OptionsColumn.AllowEdit = false; + this.gridColumn3.Tag = "query_b.item_name"; this.gridColumn3.Visible = true; this.gridColumn3.VisibleIndex = 6; this.gridColumn3.Width = 250; @@ -837,6 +840,7 @@ this.gridColumn2.MinWidth = 100; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.OptionsColumn.AllowEdit = false; + this.gridColumn2.Tag = "query_b.item_model"; this.gridColumn2.Visible = true; this.gridColumn2.VisibleIndex = 7; this.gridColumn2.Width = 100; @@ -848,6 +852,7 @@ this.gridColumn1.MinWidth = 50; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.OptionsColumn.AllowEdit = false; + this.gridColumn1.Tag = "query_a.CREATE_BY"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 12; this.gridColumn1.Width = 94; @@ -859,6 +864,7 @@ this.gridColumn4.MinWidth = 180; this.gridColumn4.Name = "gridColumn4"; this.gridColumn4.OptionsColumn.AllowEdit = false; + this.gridColumn4.Tag = "query_a.CREATE_DATE"; this.gridColumn4.Visible = true; this.gridColumn4.VisibleIndex = 13; this.gridColumn4.Width = 180; diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs index dd56432..f393971 100644 --- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs +++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs @@ -3,8 +3,8 @@ using System.Data; using System.Drawing; using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; -using DevExpress.RichEdit.Export; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; using Gs.DevApp.Entity; @@ -39,7 +39,8 @@ { UtilityHelper.SetCheckIco(s, picCheckBox, this, "foneChecked", ""); }; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); pageBar1.PagerEvent += PageBar1_PagerEvent; gridView1.CustomDrawRowIndicator += (s, e) => { @@ -58,7 +59,12 @@ //鍒濆鍖栫墿鏂欓�夋嫨鍜屽悇绉嶄笅鎷� _setIno(); } - + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } /// <summary> /// 鍙屽嚮浜嬩欢 /// </summary> @@ -80,7 +86,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> @@ -90,9 +96,10 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - var frm = - new ShowFilter(gridView1.Columns, - _filterList); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -105,7 +112,7 @@ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + getPageList(1); } /// <summary> /// 鎵瑰噯 @@ -124,7 +131,7 @@ if (_rtn.rtnCode > 0) { UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); } ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -202,7 +209,7 @@ if (_rtn.rtnCode > 0) { UtilityHelper.JumpToTab(xtraTabControl1, 0); - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); } MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); } @@ -222,7 +229,16 @@ if (xtraTabControl1.SelectedTabPageIndex == 1) getModel(lbGuid.Text.Trim(), false, 999); else - getPageList(1, UtilityHelper.GetPageSize()); + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> @@ -337,36 +353,36 @@ /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - var _sbSqlWhere = - new StringBuilder(); - foreach (var itm in _filterList) - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + - itm.fileValue + "'"); + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); - var pgq = new PageQueryModel(curPage, pageSize, + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", - // _webServiceName + "GetListPageIQC", json); + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { - var dt = dd.rtnData.list; + DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - var dddd = dd.rtnData.pages; //鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total; //璁板綍鎬绘暟 - pageBar1.CurrentPage = curPage; //褰撳墠椤� - pageBar1.RowsCount = pageSize; //姣忛〉鏄剧ず - pageBar1.setTxt(); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 + pageBar1.CurrentPage = curPage;//褰撳墠椤� + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 } else { @@ -377,6 +393,7 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } + _loading.Close(); } private void getModel(string strGuid, bool isEdit, int tabIdx) diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs index da48bf5..2a711c6 100644 --- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs +++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs @@ -718,11 +718,41 @@ ctrl.Enabled = !isEdt; continue; } - + // if (ctrl is CheckEdit) { var txt = ctrl as CheckEdit; txt.ReadOnly = isEdt; + continue; + } + //鑷畾涔変粨搴� + if (ctrl is UcLookCk) + { + var txt = ctrl as UcLookCk; + if (txt.IsReadly == false) + txt.Enabled = !isEdt; + else + txt.Enabled = false; + continue; + } + //鑷畾涔変緵搴斿晢 + if (ctrl is UcLookSupplier) + { + var txt = ctrl as UcLookSupplier; + if (txt.IsReadly == false) + txt.Enabled = !isEdt; + else + txt.Enabled = false; + continue; + } + //鑷畾涔夌墿鏂� + if (ctrl is UcLookItems) + { + var txt = ctrl as UcLookItems; + if (txt.IsReadly == false) + txt.Enabled = !isEdt; + else + txt.Enabled = false; continue; } } @@ -1052,6 +1082,84 @@ } } } + + + #region 璁剧疆鎼滅储 + public static string getQueryWord(string str) + { + return str.ToUpper().Replace("query_".ToUpper(), ""); + } + public static FilterEntity getFilterEntityWord(string id, string idDec, string val) + { + return new FilterEntity(getQueryWord(id), idDec + ")", " like ", "鍖呭惈)", "%" + val + "%"); + } + public static List<FilterEntity> GetDilter(GridColumnCollection Columns) + { + List<FilterEntity> fiList = new List<FilterEntity>(); + foreach (DevExpress.XtraGrid.Columns.GridColumn col in Columns) + { + ColumnFilterInfo filter = col.FilterInfo; + if (string.IsNullOrEmpty(filter.FilterString)) + continue; + // fiList.Add(new FilterEntity("b.FNumber", "浣跨敤缁勭粐", " like ", "鍖呭惈", "%" + filter.Value + "%")); + string[] ddd = filter.FilterString.Replace("Contains","").Replace("(","").Replace(")","").Replace("'", "").Replace("'", "").Split(','); + //Contains([fSubsidiary], '005') + fiList.Add(getFilterEntityWord(col.Tag.ToString(), col.Caption.Trim(), ddd[1].Trim())); + } + return fiList; + } + + /// <summary> + /// 鏍规嵁杩囨护鍣紝璇诲彇鏌ヨ鏉′欢,org琛ㄤ负缁勭粐 + /// </summary> + /// <param name="_filterList"></param> + /// <returns></returns> + public static string GetSearchWhere(List<FilterEntity> _filterList) + { + var _sbSqlWhere = new StringBuilder(); + foreach (var itm in _filterList) + { + if (itm.fileId.ToUpper().Contains("org".ToUpper())) + { + if (IsNumeric(itm.fileValue.Replace("%", ""))) + _sbSqlWhere.Append(" and org.FNumber " + itm.fileOper + "'" + itm.fileValue + "'"); + else + { + _sbSqlWhere.Append(" and org.NAME " + itm.fileOper + "'" + itm.fileValue.Trim() + "'"); + } + } + else + _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + + itm.fileValue + "'"); + } + return _sbSqlWhere.ToString(); + } + /// <summary> + /// 鍒濆鍖杇ridview + /// </summary> + /// <param name="gridView1"></param> + public static void SetGridSear(GridView gridView1) + { + foreach (GridColumn column in gridView1.Columns) + { + column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; + column.OptionsFilter.ImmediateUpdateAutoFilter = false; + column.OptionsColumn.AllowEdit = false; + if (column.Tag==null || column.Tag.ToString().Length <= 0) + column.OptionsFilter.AllowAutoFilter = false; + } + gridView1.OptionsFilter.AllowAutoFilterConditionChange = DevExpress.Utils.DefaultBoolean.False; + gridView1.OptionsFilter.AllowFilterEditor = false; + gridView1.OptionsFilter.ShowCustomFunctions = DevExpress.Utils.DefaultBoolean.False; + } + #endregion + + + public static bool IsNumeric(string str) + { + Regex regex = new Regex("^[0-9]+$"); + return regex.IsMatch(str); + } } /// <summary> @@ -1083,6 +1191,7 @@ { return Text.ToString(); } + } /// <summary> diff --git a/DevApp/Gs.DevApp/UserControl/ShowFilter.cs b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs index 91537cc..8d41cfc 100644 --- a/DevApp/Gs.DevApp/UserControl/ShowFilter.cs +++ b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs @@ -97,10 +97,10 @@ if (col.Tag != null && col.Tag.ToString().StartsWith("query")) { var item = new CboItemEntity(); - item.Text = col.Tag.ToString().Replace("query_a.", "") + + item.Text = col.Tag.ToString().Replace("query_", "") + "锛�" + col.Caption + "锛�"; //item.Value = col.FieldName; - item.Value = col.Tag.ToString().Replace("query_a.", ""); + item.Value = col.Tag.ToString().Replace("query_", ""); repositoryItemComboBox1.Items.Add(item); } diff --git a/DevApp/Gs.DevApp/UserControl/UcPageBar.Designer.cs b/DevApp/Gs.DevApp/UserControl/UcPageBar.Designer.cs index 74f172d..b3d67aa 100644 --- a/DevApp/Gs.DevApp/UserControl/UcPageBar.Designer.cs +++ b/DevApp/Gs.DevApp/UserControl/UcPageBar.Designer.cs @@ -257,7 +257,7 @@ this.cbxRowCount.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.cbxRowCount.EditValue = "20"; + this.cbxRowCount.EditValue = "0"; this.cbxRowCount.Location = new System.Drawing.Point(846, 2); this.cbxRowCount.Margin = new System.Windows.Forms.Padding(3, 6, 3, 0); this.cbxRowCount.Name = "cbxRowCount"; @@ -270,12 +270,16 @@ "20", "50", "100", - "200"}); + "200", + "250", + "500", + "800", + "1000"}); + this.cbxRowCount.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cbxRowCount.Size = new System.Drawing.Size(62, 28); this.cbxRowCount.StyleController = this.layoutControl1; this.cbxRowCount.TabIndex = 5; this.cbxRowCount.Tag = "rowcount"; - this.cbxRowCount.SelectedIndexChanged += new System.EventHandler(this.cbxRowCount_SelectedIndexChanged); // // labelControl1 // @@ -301,6 +305,8 @@ this.tbxCurrentPage.Name = "tbxCurrentPage"; this.tbxCurrentPage.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); this.tbxCurrentPage.Properties.Appearance.Options.UseFont = true; + this.tbxCurrentPage.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; + this.tbxCurrentPage.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; this.tbxCurrentPage.Size = new System.Drawing.Size(66, 28); this.tbxCurrentPage.StyleController = this.layoutControl1; this.tbxCurrentPage.TabIndex = 2; @@ -562,12 +568,12 @@ this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); // - // PageBar + // UcPageBar // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.layoutControl1); - this.Name = "PageBar"; + this.Name = "UcPageBar"; this.Size = new System.Drawing.Size(954, 40); ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); this.layoutControl1.ResumeLayout(false); diff --git a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs index bec80ee..e0c5213 100644 --- a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs +++ b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing Gs.DevApp.ToolBox; +using System; using System.Windows.Forms; namespace UserControls.Data @@ -11,7 +12,8 @@ public UcPageBar() { InitializeComponent(); - // UtilityHelper.SetFont(layoutControl1); + this.cbxRowCount.Text = "50"; + this.cbxRowCount.SelectedIndexChanged += new System.EventHandler(this.cbxRowCount_SelectedIndexChanged); } public event GetPageDataEvents PagerEvent; //瀹氫箟浜嬩欢 @@ -23,7 +25,8 @@ RowsCount = Convert.ToInt32(cbxRowCount.Text); CurrentPage = 1; if (PagerEvent != null) - BtnEvents(sender, e); + if (RecordCount > 0 && RowsCount>0) + BtnEvents(sender, e); } //鎵嬪姩杈撳叆鏄剧ず椤甸潰缂栧彿 @@ -86,7 +89,6 @@ private void BtnEvents(object sender, EventArgs e) { - //setTxt(); PagerEvent(CurrentPage, RowsCount); } @@ -95,7 +97,8 @@ tbxCurrentPage.Text = CurrentPage.ToString(); lbTotalPages.Text = "鍏� " + TotalPages + "椤�"; lbTotalRows.Text = "鍏� " + RecordCount + " 鏉¤褰�"; - cbxRowCount.Text = RowsCount.ToString(); + if (RowsCount > 0) + cbxRowCount.Text = RowsCount.ToString(); if (CurrentPage == 1) lbFirstPage.Enabled = false; else @@ -131,10 +134,20 @@ /// </summary> public int RowsCount { get; set; } + + int _RecordCount; /// <summary> /// 鎬昏褰曟暟 /// </summary> - public int RecordCount { get; set; } + public int RecordCount + { + get { return _RecordCount; } + set + { + _RecordCount = value; + setTxt(); + } + } #endregion } diff --git a/DevApp/Gs.DevApp/UserControl/UcPageBar.resx b/DevApp/Gs.DevApp/UserControl/UcPageBar.resx index bfad99e..1af7de1 100644 --- a/DevApp/Gs.DevApp/UserControl/UcPageBar.resx +++ b/DevApp/Gs.DevApp/UserControl/UcPageBar.resx @@ -1,134 +1,120 @@ 锘�<?xml version="1.0" encoding="utf-8"?> <root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root" - xmlns=""> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> - <xsd:element name="root" msdata:IsDataSet="true"> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" - minOccurs="0"/> - </xsd:sequence> - <xsd:attribute name="name" use="required" - type="xsd:string"/> - <xsd:attribute name="type" type="xsd:string"/> - <xsd:attribute name="mimetype" type="xsd:string"/> - <xsd:attribute ref="xml:space"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string"/> - <xsd:attribute name="name" type="xsd:string"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" - minOccurs="0" msdata:Ordinal="1"/> - <xsd:element name="comment" type="xsd:string" - minOccurs="0" msdata:Ordinal="2"/> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" - use="required" msdata:Ordinal="1"/> - <xsd:attribute name="type" type="xsd:string" - msdata:Ordinal="3"/> - <xsd:attribute name="mimetype" type="xsd:string" - msdata:Ordinal="4"/> - <xsd:attribute ref="xml:space"/> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" - minOccurs="0" msdata:Ordinal="1"/> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" - use="required"/> - </xsd:complexType> - </xsd:element> - </xsd:choice> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, - Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - </value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, - Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - </value> - </resheader> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> </root> \ No newline at end of file diff --git a/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category1/category.cs b/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category1/category.cs index 308680a..cdec80a 100644 --- a/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category1/category.cs +++ b/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category1/category.cs @@ -24,8 +24,9 @@ this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); + getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); gridView1.CustomDrawRowIndicator += (s, e) => { if (e.Info.IsRowIndicator && e.RowHandle >= 0) @@ -41,7 +42,12 @@ e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } - + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } /// <summary> /// 鍙屽嚮浜嬩欢 /// </summary> @@ -60,7 +66,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -69,9 +75,12 @@ /// <param name="e"></param> private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { - Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); - frm.UpdateParent += Frm_UpdateParent; - frm.ShowDialog(); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; +gridView1.ActiveFilter.Clear(); +gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; +var frm = new ShowFilter(gridView1.Columns, _filterList); +frm.UpdateParent += Frm_UpdateParent; +frm.ShowDialog(); } /// <summary> /// 鏌ヨ鍥炶皟 @@ -137,10 +146,19 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); - else - getPageList(1, UtilityHelper.GetPageSize()); + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim(), false, 999); +else +{ + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); +} } /// <summary> /// 淇敼浜嬩欢 @@ -212,41 +230,45 @@ /// </summary> /// <param name="curPage">绗嚑椤�</param> /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) + private async void getPageList(int curPage) { - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - foreach (FilterEntity itm in _filterList) - { - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); - } - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); - string json = JsonConvert.SerializeObject(pgq); - try - { - string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); - ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); - if (dd.rtnCode > 0) - { - DataTable dt = dd.rtnData.list; - gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 - pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); - } - else - { - ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); - } - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", + "asc", "", _sbSqlWhere.ToString()); + var json = JsonConvert.SerializeObject(pgq); + try + { + var strReturn = await UtilityHelper.HttpPostAsync("", + _webServiceName + "GetListPage", json); + var dd = UtilityHelper.ReturnToTablePage(strReturn); + if (dd.rtnCode > 0) + { + DataTable dt = dd.rtnData.list; + gcMain.BindingContext = new BindingContext(); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 + pageBar1.CurrentPage = curPage;//褰撳墠椤� + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 + } + else + { + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + _loading.Stop(); } /// <summary> /// diff --git a/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category2/category.cs b/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category2/category.cs index 3b884d3..b7dadcb 100644 --- a/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category2/category.cs +++ b/DevApp/Gs.DevApp/bin/Debug/templeEasyCode/category2/category.cs @@ -27,8 +27,9 @@ this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; - getPageList(1, UtilityHelper.GetPageSize()); - pageBar1.PagerEvent += PageBar1_PagerEvent; + getPageList(1); + pageBar1.PagerEvent += PageBar1_PagerEvent; + Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); gridView1.CustomDrawRowIndicator += (s, e) => { if (e.Info.IsRowIndicator && e.RowHandle >= 0) @@ -44,7 +45,12 @@ e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } - + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) + { + _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); + await Task.Delay(100); + getPageList(1); + } /// <summary> /// 鍙屽嚮浜嬩欢 /// </summary> @@ -63,7 +69,7 @@ /// <param name="pageSize"></param> private void PageBar1_PagerEvent(int curPage, int pageSize) { - getPageList(curPage, pageSize); + getPageList(curPage); } /// <summary> /// 鏌ヨ浜嬩欢 @@ -83,8 +89,12 @@ /// <param name="e"></param> private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { - _filterList = e.FilterList; - getPageList(1, pageBar1.RowsCount); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList); + frm.UpdateParent += Frm_UpdateParent; + frm.ShowDialog(); } /// <summary> @@ -140,10 +150,19 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { - if (xtraTabControl1.SelectedTabPageIndex == 1) - getModel(lbGuid.Text.Trim(), false, 999); - else - getPageList(1, UtilityHelper.GetPageSize()); + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim(), false, 999); + else + { + _filterList.Clear(); + if (gridView1.ActiveFilter.Count > 0) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + } + getPageList(1); + } } /// <summary> /// 淇敼浜嬩欢 @@ -212,46 +231,48 @@ } /// <summary> - /// - /// </summary> - /// <param name="curPage">绗嚑椤�</param> - /// <param name="pageSize">姣忛〉鍑犳潯</param> - private void getPageList(int curPage, int pageSize) - { - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - foreach (FilterEntity itm in _filterList) - { - _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); - } - PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); - string json = JsonConvert.SerializeObject(pgq); - try - { - string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); - ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); - if (dd.rtnCode > 0) - { - DataTable dt = dd.rtnData.list; - gcMain.BindingContext = new BindingContext(); - gcMain.DataSource = dt; - gcMain.ForceInitialize(); - int dddd = dd.rtnData.pages;//鎬婚〉 - pageBar1.TotalPages = dddd; - pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟 - pageBar1.CurrentPage = curPage;//褰撳墠椤� - pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず - pageBar1.setTxt(); - } - else - { - ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); - } - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } + /// + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private async void getPageList(int curPage) + { + UcLoading _loading = new UcLoading(); + var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString()); + string json = JsonConvert.SerializeObject(pgq); + try + { + var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); + ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); + if (dd.rtnCode > 0) + { + DataTable dt = dd.rtnData.list; + gcMain.BindingContext = new BindingContext(); + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + if (dt.Rows.Count > 0) + { + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + else + UtilityHelper.SetDefaultTable(gcMain, gridView1); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉 + pageBar1.CurrentPage = curPage;//褰撳墠椤� + pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟 + } + else + { + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); + } + } + catch (Exception ex) + { + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); + } + _loading.Stop(); + } private void getModel(string strGuid, bool isEdit, int tabIdx) { if (string.IsNullOrEmpty(strGuid)) -- Gitblit v1.9.3