lu
2 天以前 5e376d06404a16cb3c82a93cff351c5315bbcfe3
客户多打印
已修改9个文件
521 ■■■■■ 文件已修改
DevApp/Gs.DevApp/App.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/FrmLogin.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcBtnPrint.Designer.cs 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/XtraForm1.Designer.cs 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/XtraForm1.cs 179 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/XtraForm1.resx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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" />
DevApp/Gs.DevApp/DevFrm/FrmLogin.cs
@@ -109,7 +109,6 @@
            {
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 读取字体
DevApp/Gs.DevApp/DevFrm/Sys/EasyRptEdtShow.cs
@@ -1,5 +1,4 @@
using Gs.DevApp.DevFrm.BasicData;
using Gs.DevApp.Entity;
using 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" });
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
@@ -908,7 +908,6 @@
                   + "," + ""
                   + "}";
        }
        #endregion
    }
}
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;
    }
}
DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
@@ -1,8 +1,12 @@
using 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();
                            // 创建或获取一个ContextMenu对象(例如使用ContextMenuStrip)
                            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("没有设计模板,请先设计模板!");
        }
    }
}
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;
    }
}
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;
            }
        }
    }
}
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>