DevApp/Gs.DevApp/DevFrm/QC/Frm_MesSysLookups.Designer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesSysLookups.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesSysLookups.Designer.cs
@@ -29,11 +29,19 @@ /// </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(); this.gvMx1lookupName = new DevExpress.XtraGrid.Columns.GridColumn(); this.gvMx1lookupValue = new DevExpress.XtraGrid.Columns.GridColumn(); this.tabMxPage1 = new DevExpress.XtraTab.XtraTabPage(); this.gcMx1 = new DevExpress.XtraGrid.GridControl(); this.gvMx1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.lb_lookupTypeName = new DevExpress.XtraEditors.LabelControl(); this.txt_lookupTypeName = new DevExpress.XtraEditors.TextEdit(); this.gv_lookupTypeName = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -43,6 +51,7 @@ this.toolBarMenu1 = new Gs.DevApp.UserControl.UcToolBarMenu(); this.gcMain = new DevExpress.XtraGrid.GridControl(); this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl(); this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage(); this.pageBar1 = new UserControls.Data.UcPageBar(); @@ -51,11 +60,10 @@ this.panel1 = new System.Windows.Forms.Panel(); this.labelControl11 = new DevExpress.XtraEditors.LabelControl(); this.lbGuid = new System.Windows.Forms.Label(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.tabMxPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lookupTypeName.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lookupTypeCode.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMain)).BeginInit(); @@ -80,7 +88,7 @@ this.gvMx1lookupName.Tag = "query_a.LOOKUP_NAME"; this.gvMx1lookupName.Visible = true; this.gvMx1lookupName.VisibleIndex = 1; this.gvMx1lookupName.Width = 94; this.gvMx1lookupName.Width = 509; // // gvMx1lookupValue // @@ -93,7 +101,7 @@ this.gvMx1lookupValue.Tag = "query_a.LOOKUP_VALUE"; this.gvMx1lookupValue.Visible = true; this.gvMx1lookupValue.VisibleIndex = 0; this.gvMx1lookupValue.Width = 94; this.gvMx1lookupValue.Width = 505; // // tabMxPage1 // @@ -108,6 +116,8 @@ this.gcMx1.Location = new System.Drawing.Point(0, 0); this.gcMx1.MainView = this.gvMx1; this.gcMx1.Name = "gcMx1"; this.gcMx1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemButtonEdit1}); this.gcMx1.Size = new System.Drawing.Size(1124, 449); this.gcMx1.TabIndex = 0; this.gcMx1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { @@ -118,6 +128,7 @@ this.gvMx1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gvMx1lookupValue, this.gvMx1lookupName, this.gridColumn3, this.gridColumn2}); this.gvMx1.GridControl = this.gcMx1; this.gvMx1.Name = "gvMx1"; @@ -125,6 +136,35 @@ this.gvMx1.OptionsFind.ShowSearchNavButtons = false; this.gvMx1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom; this.gvMx1.OptionsView.ShowGroupPanel = false; // // gridColumn3 // this.gridColumn3.Caption = "删除"; this.gridColumn3.ColumnEdit = this.repositoryItemButtonEdit1; this.gridColumn3.MinWidth = 25; this.gridColumn3.Name = "gridColumn3"; this.gridColumn3.Visible = true; this.gridColumn3.VisibleIndex = 2; this.gridColumn3.Width = 80; // // repositoryItemButtonEdit1 // this.repositoryItemButtonEdit1.AutoHeight = false; editorButtonImageOptions1.Image = global::Gs.DevApp.Properties.Resources.removegroupfooter_16x16; editorButtonImageOptions1.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)}); this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; this.repositoryItemButtonEdit1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; this.repositoryItemButtonEdit1.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.repositoryItemButtonEdit1_ButtonClick); // // gridColumn2 // this.gridColumn2.Caption = "gridColumn2"; this.gridColumn2.FieldName = "guid"; this.gridColumn2.MinWidth = 25; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.Width = 94; // // lb_lookupTypeName // @@ -233,6 +273,14 @@ this.gridView1.OptionsView.ShowAutoFilterRow = true; this.gridView1.OptionsView.ShowGroupPanel = false; // // gridColumn1 // this.gridColumn1.Caption = "gridColumn1"; this.gridColumn1.FieldName = "guid"; this.gridColumn1.MinWidth = 25; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.Width = 94; // // xtraTabControl1 // this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -319,22 +367,6 @@ this.lbGuid.Size = new System.Drawing.Size(0, 21); this.lbGuid.TabIndex = 1; // // gridColumn1 // this.gridColumn1.Caption = "gridColumn1"; this.gridColumn1.FieldName = "guid"; this.gridColumn1.MinWidth = 25; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.Width = 94; // // gridColumn2 // this.gridColumn2.Caption = "gridColumn2"; this.gridColumn2.FieldName = "guid"; this.gridColumn2.MinWidth = 25; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.Width = 94; // // Frm_MesSysLookups // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); @@ -346,6 +378,7 @@ this.tabMxPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lookupTypeName.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txt_lookupTypeCode.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMain)).EndInit(); @@ -388,5 +421,7 @@ private DevExpress.XtraGrid.Columns.GridColumn gv_lookupTypeCode; private DevExpress.XtraGrid.Columns.GridColumn gridColumn2; private DevExpress.XtraGrid.Columns.GridColumn gridColumn1; private DevExpress.XtraGrid.Columns.GridColumn gridColumn3; private DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEdit1; } } DevApp/Gs.DevApp/DevFrm/QC/Frm_MesSysLookups.cs
@@ -17,6 +17,7 @@ { string _webServiceName = "MesSysLookupTypesManager/"; List<FilterEntity> _filterList = new List<FilterEntity>(); public Frm_MesSysLookups() { InitializeComponent(); @@ -41,7 +42,9 @@ { string str = "暂未查找到匹配的数据!"; Font f = new Font("微软雅黑", 16); Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); Rectangle r = new Rectangle( gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } @@ -53,10 +56,13 @@ /// <param name="e"></param> private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) { string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid"); if (!string.IsNullOrEmpty(rowGuid)) getModel(rowGuid, false, 999); } /// <summary> /// 分页事件 /// </summary> @@ -66,6 +72,7 @@ { getPageList(curPage, pageSize); } /// <summary> /// 查询事件 /// </summary> @@ -73,10 +80,13 @@ /// <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); Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } /// <summary> /// 查询回调 /// </summary> @@ -106,12 +116,14 @@ private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) { string rowGuid = "", rowName = ""; // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1); (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_lookupTypeCode, gridView1); if (string.IsNullOrEmpty(rowGuid)) { ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); return; } if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?")) return; List<dynamic> lst = new List<dynamic>(); @@ -119,13 +131,17 @@ var _obj = lst; try { string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { UtilityHelper.JumpToTab(xtraTabControl1, 0); getPageList(1, UtilityHelper.GetPageSize()); } ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); } catch (Exception ex) @@ -144,6 +160,7 @@ UtilityHelper.JumpToTab(xtraTabControl1, 0); getPageList(1, UtilityHelper.GetPageSize()); } /// <summary> /// 修改事件 /// </summary> @@ -152,14 +169,17 @@ private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) { string rowGuid = "", rowName = ""; // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1); (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_lookupTypeCode, gridView1); if (string.IsNullOrEmpty(rowGuid)) { ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); return; } getModel(rowGuid, true, 1); } /// <summary> /// 新增事件 /// </summary> @@ -169,11 +189,14 @@ { UtilityHelper.JumpToTab(xtraTabControl1, 1); lbGuid.Text = ""; List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gridViews.Add(gvMx1); UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); } /// <summary> /// 保存事件 /// </summary> @@ -188,22 +211,48 @@ txt_lookupTypeCode.Focus(); return; } List<MesSysLookups> lst = new List<MesSysLookups>(); for (int i = 0; i < gvMx1.DataRowCount; i++) { DataRow row = gvMx1.GetDataRow(i); if (row != null) { lst.Add(new MesSysLookups { Guid = (row["Guid"].ToString().Length > 0 ? Guid.Parse(row["Guid"].ToString()) : Guid.Empty), LookupName = row["LookupName"].ToString(), LookupValue = row["LookupValue"].ToString(), }); } } var _obj = new MesSysLookupTypes() { Guid = (lbGuid.Text.Trim().Length > 0 ? Guid.Parse(lbGuid.Text.Trim()) : Guid.Empty), Guid = (lbGuid.Text.Trim().Length > 0 ? Guid.Parse(lbGuid.Text.Trim()) : Guid.Empty), LookupTypeCode = txt_lookupTypeCode.Text, LookupTypeName = txt_lookupTypeName.Text, list = lst }; try { string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); if (_rtn.rtnCode > 0) { lbGuid.Text = _rtn.rtnData; toolBarMenu1.isSetBtn = true; UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); } } catch (Exception ex) @@ -219,17 +268,23 @@ /// <param name="pageSize">每页几条</param> private void getPageList(int curPage, int pageSize) { System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); foreach (FilterEntity itm in _filterList) { _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'"); } PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString()); 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); string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); gcMain.DataSource = dt; @@ -246,6 +301,7 @@ ToolBox.MsgHelper.Warning("提示:" + ex.Message); } } private void getModel(string strGuid, bool isEdit, int tabIdx) { if (string.IsNullOrEmpty(strGuid)) @@ -253,6 +309,7 @@ ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); return; } UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); var _obj = new { @@ -260,22 +317,30 @@ }; try { string strJson = UtilityHelper.HttpPost("", _webServiceName +"GetModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { dynamic dy = _rtn.rtnData; lbGuid.Text = strGuid; List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); gvList.Add(gvMx1); UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); JObject _job = JObject.Parse(strJson); JArray array = new JArray(); foreach (var a in _job["rtnData"]["list"]) { array.Add(a); } DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); DataTable dt = JsonConvert.DeserializeObject<DataTable>( array.ToString()); if (dt.Rows.Count > 0) { gcMx1.BindingContext = new BindingContext(); @@ -284,7 +349,8 @@ } else { Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); } } else @@ -295,5 +361,41 @@ ToolBox.MsgHelper.Warning("提示:" + ex.Message); } } private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int rowhandle = gvMx1.FocusedRowHandle; if (rowhandle < 0) return; if (e.Button.Index == 0) { DataRow dr = gvMx1.GetDataRow(rowhandle); string mxGuid = dr["guid"].ToString(); if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?")) return; string strJson = ""; List<string> lst = new List<string>(); lst.Add(mxGuid); try { strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModelMx", JsonConvert.SerializeObject(lst)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { getModel(lbGuid.Text, true, 1); } ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); } catch (Exception ex) { ToolBox.MsgHelper.Warning("提示:" + ex.Message); } } } } }