From 5e376d06404a16cb3c82a93cff351c5315bbcfe3 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期六, 28 六月 2025 16:10:22 +0800 Subject: [PATCH] 客户多打印 --- DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs | 9 DevApp/Gs.DevApp/DevFrm/FrmLogin.cs | 1 DevApp/Gs.DevApp/XtraForm1.Designer.cs | 173 ++++++++++++------- DevApp/Gs.DevApp/App.config | 4 DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs | 1 DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs | 70 +++--- DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs | 78 +++++++- DevApp/Gs.DevApp/XtraForm1.resx | 6 DevApp/Gs.DevApp/XtraForm1.cs | 179 ------------------- 9 files changed, 223 insertions(+), 298 deletions(-) diff --git a/DevApp/Gs.DevApp/App.config b/DevApp/Gs.DevApp/App.config index f77fd81..3d80851 100644 --- a/DevApp/Gs.DevApp/App.config +++ b/DevApp/Gs.DevApp/App.config @@ -28,9 +28,9 @@ </assemblyBinding> </runtime> <appSettings> - <!--<add key="WebApiUrl" value="http://localhost:5263/" />--> + <add key="WebApiUrl" value="http://localhost:5263/" /> <!--<add key="WebApiUrl" value="http://192.168.1.145:8081/" />--> - <add key="WebApiUrl" value="http://192.168.1.145:81/" /> + <!--<add key="WebApiUrl" value="http://192.168.1.145:81/" />--> <add key="LogPath" value="logs" /> <add key="ProductName" value="G-MES V2.0" /> <add key="PageSize" value="50" /> diff --git a/DevApp/Gs.DevApp/DevFrm/FrmLogin.cs b/DevApp/Gs.DevApp/DevFrm/FrmLogin.cs index d9a062b..001f9b8 100644 --- a/DevApp/Gs.DevApp/DevFrm/FrmLogin.cs +++ b/DevApp/Gs.DevApp/DevFrm/FrmLogin.cs @@ -109,7 +109,6 @@ { MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } - } /// <summary> /// 璇诲彇瀛椾綋 diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs b/DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs index 3132710..49d989e 100644 --- a/DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs +++ b/DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs @@ -1,5 +1,4 @@ -锘縰sing Gs.DevApp.DevFrm.BasicData; -using Gs.DevApp.Entity; +锘縰sing Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; @@ -20,7 +19,11 @@ btnSave.Click += BtnSave_Click; this.FormClosed += EasyRptEdtShow_FormClosed; } - + /// <summary> + /// 鍏抽棴鍚庡埛鏂扮埗椤甸潰 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void EasyRptEdtShow_FormClosed(object sender, FormClosedEventArgs e) { UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringSingle = "1" }); diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs index 493843b..461f2ba 100644 --- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs +++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs @@ -908,7 +908,6 @@ + "," + "" + "}"; } - #endregion } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs index b8ab7dc..dbea880 100644 --- a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs +++ b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs @@ -35,13 +35,13 @@ this.btnPrint = new DevExpress.XtraEditors.SimpleButton(); this.btnAll = new DevExpress.XtraEditors.SimpleButton(); this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); - this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); - this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); + this.lay1 = new DevExpress.XtraLayout.LayoutControlItem(); + this.lay3 = new DevExpress.XtraLayout.LayoutControlItem(); ((System.ComponentModel.ISupportInitialize)(this.layoutControl2)).BeginInit(); this.layoutControl2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.lay1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.lay3)).BeginInit(); this.SuspendLayout(); // // layoutControl2 @@ -55,7 +55,7 @@ this.layoutControl2.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(803, 337, 812, 500); this.layoutControl2.Padding = new System.Windows.Forms.Padding(0, 1, 0, 0); this.layoutControl2.Root = this.layoutControlGroup1; - this.layoutControl2.Size = new System.Drawing.Size(232, 32); + this.layoutControl2.Size = new System.Drawing.Size(261, 34); this.layoutControl2.TabIndex = 6; this.layoutControl2.Text = "layoutControl2"; // @@ -65,7 +65,7 @@ this.btnPrint.Location = new System.Drawing.Point(0, 2); this.btnPrint.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); this.btnPrint.Name = "btnPrint"; - this.btnPrint.Size = new System.Drawing.Size(116, 27); + this.btnPrint.Size = new System.Drawing.Size(130, 27); this.btnPrint.StyleController = this.layoutControl2; this.btnPrint.TabIndex = 3; this.btnPrint.Text = "纭畾鎵撳嵃"; @@ -73,9 +73,9 @@ // btnAll // this.btnAll.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.refreshpivottable_16x16; - this.btnAll.Location = new System.Drawing.Point(116, 2); + this.btnAll.Location = new System.Drawing.Point(130, 2); this.btnAll.Name = "btnAll"; - this.btnAll.Size = new System.Drawing.Size(116, 27); + this.btnAll.Size = new System.Drawing.Size(131, 27); this.btnAll.StyleController = this.layoutControl2; this.btnAll.TabIndex = 4; this.btnAll.Text = "鎵归噺鎿嶄綔"; @@ -85,8 +85,8 @@ this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; this.layoutControlGroup1.GroupBordersVisible = false; this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem2, - this.layoutControlItem3}); + this.lay1, + this.lay3}); this.layoutControlGroup1.LayoutMode = DevExpress.XtraLayout.Utils.LayoutMode.Table; this.layoutControlGroup1.Name = "Root"; columnDefinition1.SizeType = System.Windows.Forms.SizeType.Percent; @@ -101,31 +101,31 @@ this.layoutControlGroup1.OptionsTableLayoutGroup.RowDefinitions.AddRange(new DevExpress.XtraLayout.RowDefinition[] { rowDefinition1}); this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 2, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(232, 32); + this.layoutControlGroup1.Size = new System.Drawing.Size(261, 34); this.layoutControlGroup1.TextVisible = false; // - // layoutControlItem2 + // lay1 // - this.layoutControlItem2.Control = this.btnPrint; - this.layoutControlItem2.Location = new System.Drawing.Point(0, 0); - this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlItem2.Size = new System.Drawing.Size(116, 30); - this.layoutControlItem2.Text = "纭畾鎵撳嵃"; - this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem2.TextVisible = false; + this.lay1.Control = this.btnPrint; + this.lay1.Location = new System.Drawing.Point(0, 0); + this.lay1.Name = "lay1"; + this.lay1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + this.lay1.Size = new System.Drawing.Size(130, 32); + this.lay1.Text = "纭畾鎵撳嵃"; + this.lay1.TextSize = new System.Drawing.Size(0, 0); + this.lay1.TextVisible = false; // - // layoutControlItem3 + // lay3 // - this.layoutControlItem3.Control = this.btnAll; - this.layoutControlItem3.Location = new System.Drawing.Point(116, 0); - this.layoutControlItem3.Name = "layoutControlItem3"; - this.layoutControlItem3.OptionsTableLayoutItem.ColumnIndex = 1; - this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlItem3.Size = new System.Drawing.Size(116, 30); - this.layoutControlItem3.Text = "鎵归噺鎿嶄綔"; - this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem3.TextVisible = false; + this.lay3.Control = this.btnAll; + this.lay3.Location = new System.Drawing.Point(130, 0); + this.lay3.Name = "lay3"; + this.lay3.OptionsTableLayoutItem.ColumnIndex = 1; + this.lay3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + this.lay3.Size = new System.Drawing.Size(131, 32); + this.lay3.Text = "鎵归噺鎿嶄綔"; + this.lay3.TextSize = new System.Drawing.Size(0, 0); + this.lay3.TextVisible = false; // // UcBtnPrint // @@ -134,12 +134,12 @@ this.Controls.Add(this.layoutControl2); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "UcBtnPrint"; - this.Size = new System.Drawing.Size(232, 32); + this.Size = new System.Drawing.Size(261, 34); ((System.ComponentModel.ISupportInitialize)(this.layoutControl2)).EndInit(); this.layoutControl2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.lay1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.lay3)).EndInit(); this.ResumeLayout(false); } @@ -150,7 +150,7 @@ private DevExpress.XtraLayout.LayoutControl layoutControl2; private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; private DevExpress.XtraEditors.SimpleButton btnAll; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; + private DevExpress.XtraLayout.LayoutControlItem lay1; + private DevExpress.XtraLayout.LayoutControlItem lay3; } } diff --git a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs index 68187f0..8dbfded 100644 --- a/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs +++ b/DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs @@ -1,8 +1,12 @@ 锘縰sing Gs.DevApp.DevFrm.Rpt; +using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; +using System.Data; +using System.Drawing; using System.Windows.Forms; + namespace Gs.DevApp.UserControl { @@ -17,7 +21,6 @@ btnPrintClick(this, e); else return; - if (rptParameter == "return false") return; if (string.IsNullOrEmpty(rptParameter)) @@ -25,24 +28,46 @@ MsgHelper.ShowError("娌℃湁鎸囧畾鎶ヨ〃鍙傛暟锛岃鑱旂郴鎶�鏈紑鍙戜汉鍛橈紒"); return; } - var _bl = false; - _bl = _ckRptService(); - if (_bl) + #region 濡傛灉鏄鎴风殑 + if (rptParameter.Contains("rpt_hgm")) { + var _obj = new + { + keyType = "瀹㈡埛妯℃澘" + }; + var json = JsonConvert.SerializeObject(_obj); try { - using (Form frm = new RptPreview(guidKey, rptParameter)) + var strReturn = + UtilityHelper.HttpPost("", "Report/GetTemplateList", json); + ReturnModel<DataTable> dd = UtilityHelper.ReturnToList(strReturn); + DataTable dt = dd.rtnData; + if (dd.rtnCode > 0) { - frm.ShowDialog(); + // 鍒涘缓鎴栬幏鍙栦竴涓狢ontextMenu瀵硅薄锛堜緥濡備娇鐢–ontextMenuStrip锛� + ContextMenu contextMenu = new ContextMenu(); + foreach (DataRow dr in dt.Rows) + { + MenuItem menuItem1 = new MenuItem(dr["reportType"].ToString() + "銆�" + dr["reportName"].ToString() + "銆�"); + menuItem1.Click += (ss, ee) => + { + rptParameter = rptParameter.Replace("rpt_hgm", dr["reportType"].ToString()); + _print(); + }; + contextMenu.MenuItems.Add(menuItem1); + } + // 鏄剧ず鑿滃崟鍦ㄦ寜閽殑浣嶇疆 + contextMenu.Show(btnPrint, new Point(0, btnPrint.Height)); // 璋冩暣绗簩涓弬鏁颁互璋冩暣鑿滃崟鐨勬樉绀轰綅缃� + return; } } - catch (Exception) - { - } - return; + catch (Exception ex) + { } } + #endregion - MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒"); + _print(); + }; this.btnAll.Click += (s, e) => { @@ -103,12 +128,35 @@ return false; } - - public void SetPlButton( bool blPiLiang) { + public void SetPlButton(bool blPiLiang) + { if (blPiLiang == true) - this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + this.lay3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; else - this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + this.lay3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + } + + /// <summary> + /// + /// </summary> + private void _print() { + var _bl = false; + _bl = _ckRptService(); + if (_bl) + { + try + { + using (Form frm = new RptPreview(guidKey, rptParameter)) + { + frm.ShowDialog(); + } + } + catch (Exception) + { + } + return; + } + MsgHelper.ShowError("娌℃湁璁捐妯℃澘锛岃鍏堣璁℃ā鏉匡紒"); } } } diff --git a/DevApp/Gs.DevApp/XtraForm1.Designer.cs b/DevApp/Gs.DevApp/XtraForm1.Designer.cs index eb687b1..252e7f0 100644 --- a/DevApp/Gs.DevApp/XtraForm1.Designer.cs +++ b/DevApp/Gs.DevApp/XtraForm1.Designer.cs @@ -28,95 +28,142 @@ /// </summary> private void InitializeComponent() { - this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton(); - this.simpleButton2 = new DevExpress.XtraEditors.SimpleButton(); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); - this.simpleButton3 = new DevExpress.XtraEditors.SimpleButton(); - this.buttonEdit1 = new DevExpress.XtraEditors.ButtonEdit(); - this.toggleSwitch1 = new DevExpress.XtraEditors.ToggleSwitch(); - ((System.ComponentModel.ISupportInitialize)(this.buttonEdit1.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.toggleSwitch1.Properties)).BeginInit(); + this.components = new System.ComponentModel.Container(); + this.dropDownButton1 = new DevExpress.XtraEditors.DropDownButton(); + this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components); + this.barManager1 = new DevExpress.XtraBars.BarManager(this.components); + this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); + this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); + this.barButtonItem1 = new DevExpress.XtraBars.BarButtonItem(); + this.barButtonItem2 = new DevExpress.XtraBars.BarButtonItem(); + this.barButtonItem3 = new DevExpress.XtraBars.BarButtonItem(); + this.barButtonItem4 = new DevExpress.XtraBars.BarButtonItem(); + ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); this.SuspendLayout(); // - // simpleButton1 + // dropDownButton1 // - this.simpleButton1.Location = new System.Drawing.Point(57, 107); - this.simpleButton1.Name = "simpleButton1"; - this.simpleButton1.Size = new System.Drawing.Size(94, 29); - this.simpleButton1.TabIndex = 0; - this.simpleButton1.Text = "鐢垫鏁版嵁"; - this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click_1); + this.dropDownButton1.DropDownControl = this.popupMenu1; + this.dropDownButton1.Location = new System.Drawing.Point(238, 110); + this.dropDownButton1.Name = "dropDownButton1"; + this.dropDownButton1.Size = new System.Drawing.Size(154, 29); + this.dropDownButton1.TabIndex = 0; + this.dropDownButton1.Text = "dropDownButton1"; // - // simpleButton2 + // popupMenu1 // - this.simpleButton2.Location = new System.Drawing.Point(57, 173); - this.simpleButton2.Name = "simpleButton2"; - this.simpleButton2.Size = new System.Drawing.Size(94, 29); - this.simpleButton2.TabIndex = 1; - this.simpleButton2.Text = "姘存鏁版嵁"; - this.simpleButton2.Click += new System.EventHandler(this.simpleButton2_Click); + this.popupMenu1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { + new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem1), + new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem2), + new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem3), + new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem4)}); + this.popupMenu1.Manager = this.barManager1; + this.popupMenu1.Name = "popupMenu1"; // - // richTextBox1 + // barManager1 // - this.richTextBox1.Location = new System.Drawing.Point(57, 227); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(740, 240); - this.richTextBox1.TabIndex = 2; - this.richTextBox1.Text = ""; + this.barManager1.DockControls.Add(this.barDockControlTop); + this.barManager1.DockControls.Add(this.barDockControlBottom); + this.barManager1.DockControls.Add(this.barDockControlLeft); + this.barManager1.DockControls.Add(this.barDockControlRight); + this.barManager1.Form = this; + this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { + this.barButtonItem1, + this.barButtonItem2, + this.barButtonItem3, + this.barButtonItem4}); + this.barManager1.MaxItemId = 4; // - // simpleButton3 + // barDockControlTop // - this.simpleButton3.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.addfile_32x32; - this.simpleButton3.Location = new System.Drawing.Point(471, 85); - this.simpleButton3.Name = "simpleButton3"; - this.simpleButton3.Size = new System.Drawing.Size(94, 29); - this.simpleButton3.TabIndex = 3; - this.simpleButton3.Text = "simpleButton3"; + this.barDockControlTop.CausesValidation = false; + this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; + this.barDockControlTop.Location = new System.Drawing.Point(0, 0); + this.barDockControlTop.Manager = this.barManager1; + this.barDockControlTop.Size = new System.Drawing.Size(887, 0); // - // buttonEdit1 + // barDockControlBottom // - this.buttonEdit1.Location = new System.Drawing.Point(312, 147); - this.buttonEdit1.Name = "buttonEdit1"; - this.buttonEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { - new DevExpress.XtraEditors.Controls.EditorButton()}); - this.buttonEdit1.Size = new System.Drawing.Size(125, 24); - this.buttonEdit1.TabIndex = 4; + this.barDockControlBottom.CausesValidation = false; + this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.barDockControlBottom.Location = new System.Drawing.Point(0, 659); + this.barDockControlBottom.Manager = this.barManager1; + this.barDockControlBottom.Size = new System.Drawing.Size(887, 0); // - // toggleSwitch1 + // barDockControlLeft // - this.toggleSwitch1.Location = new System.Drawing.Point(293, 13); - this.toggleSwitch1.Name = "toggleSwitch1"; - this.toggleSwitch1.Properties.OffText = "Off"; - this.toggleSwitch1.Properties.OnText = "On"; - this.toggleSwitch1.Size = new System.Drawing.Size(288, 24); - this.toggleSwitch1.TabIndex = 5; + this.barDockControlLeft.CausesValidation = false; + this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; + this.barDockControlLeft.Location = new System.Drawing.Point(0, 0); + this.barDockControlLeft.Manager = this.barManager1; + this.barDockControlLeft.Size = new System.Drawing.Size(0, 659); + // + // barDockControlRight + // + this.barDockControlRight.CausesValidation = false; + this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; + this.barDockControlRight.Location = new System.Drawing.Point(887, 0); + this.barDockControlRight.Manager = this.barManager1; + this.barDockControlRight.Size = new System.Drawing.Size(0, 659); + // + // barButtonItem1 + // + this.barButtonItem1.Caption = "barButtonItem1"; + this.barButtonItem1.Id = 0; + this.barButtonItem1.Name = "barButtonItem1"; + // + // barButtonItem2 + // + this.barButtonItem2.Caption = "barButtonItem2"; + this.barButtonItem2.Id = 1; + this.barButtonItem2.Name = "barButtonItem2"; + // + // barButtonItem3 + // + this.barButtonItem3.Caption = "barButtonItem3"; + this.barButtonItem3.Id = 2; + this.barButtonItem3.Name = "barButtonItem3"; + // + // barButtonItem4 + // + this.barButtonItem4.Caption = "barButtonItem4"; + this.barButtonItem4.Id = 3; + this.barButtonItem4.Name = "barButtonItem4"; // // XtraForm1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(887, 659); - this.Controls.Add(this.toggleSwitch1); - this.Controls.Add(this.buttonEdit1); - this.Controls.Add(this.simpleButton3); - this.Controls.Add(this.richTextBox1); - this.Controls.Add(this.simpleButton2); - this.Controls.Add(this.simpleButton1); + this.Controls.Add(this.dropDownButton1); + this.Controls.Add(this.barDockControlLeft); + this.Controls.Add(this.barDockControlRight); + this.Controls.Add(this.barDockControlBottom); + this.Controls.Add(this.barDockControlTop); this.Name = "XtraForm1"; this.Text = "XtraForm1"; - ((System.ComponentModel.ISupportInitialize)(this.buttonEdit1.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.toggleSwitch1.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion - private DevExpress.XtraEditors.SimpleButton simpleButton1; - private DevExpress.XtraEditors.SimpleButton simpleButton2; - private System.Windows.Forms.RichTextBox richTextBox1; - private DevExpress.XtraEditors.SimpleButton simpleButton3; - private DevExpress.XtraEditors.ButtonEdit buttonEdit1; - private DevExpress.XtraEditors.ToggleSwitch toggleSwitch1; + private DevExpress.XtraEditors.DropDownButton dropDownButton1; + private DevExpress.XtraBars.PopupMenu popupMenu1; + private DevExpress.XtraBars.BarButtonItem barButtonItem1; + private DevExpress.XtraBars.BarButtonItem barButtonItem2; + private DevExpress.XtraBars.BarButtonItem barButtonItem3; + private DevExpress.XtraBars.BarButtonItem barButtonItem4; + private DevExpress.XtraBars.BarManager barManager1; + private DevExpress.XtraBars.BarDockControl barDockControlTop; + private DevExpress.XtraBars.BarDockControl barDockControlBottom; + private DevExpress.XtraBars.BarDockControl barDockControlLeft; + private DevExpress.XtraBars.BarDockControl barDockControlRight; } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/XtraForm1.cs b/DevApp/Gs.DevApp/XtraForm1.cs index 7135380..c2a041c 100644 --- a/DevApp/Gs.DevApp/XtraForm1.cs +++ b/DevApp/Gs.DevApp/XtraForm1.cs @@ -15,183 +15,6 @@ InitializeComponent(); } - /// <summary> - /// 鏄惁绗竴娆℃姇鍏�,0涓虹涓�娆℃姇鍏ワ紝1涓虹淮淇繃鏉ヨ鎶ュ簾鐨�2涓哄凡缁忔姤搴熻繃浜嗙殑锛�3杩斿伐杩囨潵閲嶆姇鐨�4娓呭熬宸ュ崟鐨勬姤搴� - /// </summary> - private string flagFirst = "0"; //鏄惁绗竴娆℃姇鍏� - - - private void simpleButton1_Click_1(object sender, EventArgs e) - { - AddDianJian(); - } - - //娣诲姞鐢垫鏁版嵁 - private string AddDianJian() - { - string TM = ""; - string JD = ""; - string JY = ""; - string JN = ""; - string XL = ""; - string GV = ""; - string JDV = ""; - string JYV = ""; - string JNV = ""; - string XLV = ""; - string GVV = ""; - //if (imaQAB009.EditValue.ToString() != VSLoginInfo.SystemParam["DianJianNo"].ToString()) - //{ - // return ""; - //} - //string sql = string.Format(@" select MIG006 from BASMIG(nolock) where MIG001='DianJianQuShu' and MIG003='{0}' and MIG005='Y'", txtDAA042.EditValue.ToString()); - //DataTable dt = manager.GetDataTable(sql, "tmpBASMIG"); - //if (dt == null || dt.Rows.Count <= 0) - //{ - // return ""; - //} - try - { - //FileStream fs = new FileStream(dt.Rows[0][0].ToString(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - //int fsLen = (int)fs.Length; - //byte[] heByte = new byte[fsLen]; - //fs.Read(heByte, 0, heByte.Length); - //string myStr = System.Text.Encoding.Default.GetString(heByte); - //fs.Close(); - string strPath = @"D:\uploadData.txt"; - string myStr = File.ReadAllText(strPath, Encoding.Default); - if (myStr == "") - { - return "NULL"; - } - File.WriteAllText(strPath, ""); - JArray dsTemp = JArray.Parse(myStr); - - foreach (var ss in dsTemp) //鏌ユ壘鏌愪釜瀛楁涓庡�� - { - TM = (((JObject)ss)["TiaoMa"] == null) ? "" : ((JObject)ss)["TiaoMa"].ToString(); - JD = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["state"].ToString(); - JY = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["state"].ToString(); - JN = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["state"].ToString(); - XL = (((JObject)ss)["XieLou"] == null) ? "" : ((JObject)ss)["XieLou"]["state"].ToString(); - GV = (((JObject)ss)["GongLv"] == null) ? "" : ((JObject)ss)["GongLv"]["state"].ToString(); - JDV = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["value"].ToString().Replace(" ", ", "); - JYV = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["value"].ToString().Replace(" ", ", "); - JNV = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["value"].ToString().Replace(" ", ", "); - XLV = (((JObject)ss)["XieLou"] == null) ? "" : ((JObject)ss)["XieLou"]["value"].ToString().Replace(" ", ", "); - GVV = (((JObject)ss)["GongLv"] == null) ? "" : ((JObject)ss)["GongLv"]["value"].ToString().Replace(" ", ", "); - Gs.DevApp.ToolBox.LogHelper.Debug("TM", TM); - Gs.DevApp.ToolBox.LogHelper.Debug("JD", JD); - Gs.DevApp.ToolBox.LogHelper.Debug("JY", JY); - Gs.DevApp.ToolBox.LogHelper.Debug("XL", XL); - Gs.DevApp.ToolBox.LogHelper.Debug("XLV", XLV); - Gs.DevApp.ToolBox.LogHelper.Debug("GVV", GVV); - } - return "宸查噰闆�"; - } - catch (Exception e) - { - return "鏂囦欢鎵撳紑澶辫触," + e.Message; - } - } - - /// <summary> - /// 姘存 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - - private void simpleButton2_Click(object sender, EventArgs e) - { - string strCsl1 = ""; - string strSw1 = ""; - string strCsl2 = ""; - string strSw2 = ""; - string strCsl3 = ""; - string strSw3 = ""; - string strCsl4 = ""; - string strSw4 = ""; - string strCsl5 = ""; - string strSw5 = ""; - string SJJG = ""; - try//姘存鍙栨暟锛屽悗闈㈣ˉ鍏� - { - System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); - string hostname = "192.168.60.51"; - ModbusFactory modbusFactory = new ModbusFactory(); - IModbusMaster master = modbusFactory.CreateMaster(new TcpClient(hostname, 502)); - master.Transport.ReadTimeout = 10000; - master.Transport.Retries = 10000; - DataTable dt = new DataTable(); - //鍙傛暟(鍒嗗埆涓轰粠绔欏湴鍧�,璧峰鍦板潃,闀垮害) - byte slaveAddress = byte.Parse(1.ToString()); - ushort numberOfPoints = ushort.Parse("1"); - float fsw = 0; - DataTable dt1 = new DataTable(); - ushort[] csl1 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(32.ToString()), numberOfPoints); - strCsl1 = csl1[0].ToString(); - - ushort[] sw1 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(31.ToString()), numberOfPoints); - strSw1 = (float.Parse(sw1[0].ToString()) / 10).ToString(); - - ushort[] csl2 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(34.ToString()), numberOfPoints); - strCsl2 = csl2[0].ToString(); - - ushort[] sw2 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(33.ToString()), numberOfPoints); - strSw2 = (float.Parse(sw2[0].ToString()) / 10).ToString(); - - ushort[] csl3 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(36.ToString()), numberOfPoints); - strCsl3 = csl3[0].ToString(); - - ushort[] sw3 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(35.ToString()), numberOfPoints); - strSw3 = (float.Parse(sw3[0].ToString()) / 10).ToString(); - - ushort[] csl4 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(38.ToString()), numberOfPoints); - strCsl4 = csl4[0].ToString(); - - ushort[] sw4 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(37.ToString()), numberOfPoints); - strSw4 = (float.Parse(sw4[0].ToString()) / 10).ToString(); - - ushort[] csl5 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(40.ToString()), numberOfPoints); - strCsl5 = csl5[0].ToString(); - - ushort[] sw5 = master.ReadHoldingRegisters(slaveAddress, ushort.Parse(39.ToString()), numberOfPoints); - strSw5 = (float.Parse(sw5[0].ToString()) / 10).ToString(); - - bool[] sjjg = master.ReadCoils(slaveAddress, ushort.Parse(77.ToString()), numberOfPoints); - SJJG = sjjg[0].ToString(); - /////////////////// - /// - - // 3. 璇诲彇浠庣珯璁惧鐨勫瘎瀛樺櫒 - ushort startAddress = 0; // 瀵勫瓨鍣ㄨ捣濮嬪湴鍧� - ushort numRegisters = 125; // 璇诲彇 10 涓瘎瀛樺櫒 - try - { - // 璇诲彇淇濇寔瀵勫瓨鍣紙浠庣珯鍦板潃涓� 1锛� - ushort[] registers = master.ReadHoldingRegisters(1, startAddress, numRegisters); - // 杈撳嚭缁撴灉 - Console.WriteLine("璇诲彇鍒扮殑瀵勫瓨鍣ㄥ�硷細"); - foreach (var register in registers) - { - Console.WriteLine(register); - stringBuilder.Append(register.ToString()); - } - richTextBox1.Text = stringBuilder.ToString(); - } - catch (Exception ex) - { - Console.WriteLine($"璇诲彇閿欒: {ex.Message}"); - } - - } - catch (Exception ex) - { - //VisiblePanel(txtDQBarCode.EditValue.ToString(), ex.Message, "NG", Color.Yellow); - //txtGWM.EditValue = ""; - return; - } - - } + } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/XtraForm1.resx b/DevApp/Gs.DevApp/XtraForm1.resx index 1af7de1..2b48534 100644 --- a/DevApp/Gs.DevApp/XtraForm1.resx +++ b/DevApp/Gs.DevApp/XtraForm1.resx @@ -117,4 +117,10 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="popupMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="barManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>177, 17</value> + </metadata> </root> \ No newline at end of file -- Gitblit v1.9.3