lu
2025-08-22 931767239577c1a81f298ddccd65e3137c80b326
称重
已修改9个文件
已删除2个文件
1630 ■■■■ 文件已修改
DevApp/Gs.DevApp/App.config 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/QC/WeightIqc.Designer.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/QC/WeightIqc.cs 734 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.Designer.cs 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs 474 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/Gs.DevApp.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/Program.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.Designer.cs 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.resx 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/App.config
@@ -49,6 +49,7 @@
    <add key="AsyncSeconds" value="2" /><!--水检超时时间-->
    <add key="IsWater" value="0" /><!--是否要水检及工位码-->
    <add key="IqcGetWeight" value="3000" /><!--iqc读称重时-->
  <add key="TimingMailInterval" value="10000" />
  </appSettings>
  <userSettings>
    <Gs.DevApp.Properties.Settings>
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -103,7 +103,7 @@
                }
                catch (Exception ex)
                {
                    LoggerHelper.WriteInfoLog("WorkWeight/GetIqcWeight:" + ex.Message);
                    Gs.DevApp.ToolBox.LogHelper.Debug(this.ToString(), "WorkWeight/GetIqcWeight:" + ex.Message);
                }
            };
            timer.AutoReset = true; // è®¾ç½®ä¸ºtrue表示重复执行,false表示执行一次后停止
DevApp/Gs.DevApp/DevFrm/QC/WeightIqc.Designer.cs
ÎļþÒÑɾ³ý
DevApp/Gs.DevApp/DevFrm/QC/WeightIqc.cs
ÎļþÒÑɾ³ý
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.Designer.cs
@@ -37,23 +37,19 @@
            this.split1 = new DevExpress.XtraEditors.SplitContainerControl();
            this.layoutMx1 = new DevExpress.XtraDataLayout.DataLayoutControl();
            this.comLine = new Gs.DevApp.UserControl.UcLookWorkline();
            this.btnStart = new DevExpress.XtraEditors.SimpleButton();
            this.button1 = new DevExpress.XtraEditors.SimpleButton();
            this.cmbSerialPortNum = new DevExpress.XtraEditors.ComboBoxEdit();
            this.cmbBaudRate = new DevExpress.XtraEditors.ComboBoxEdit();
            this.txtNum = new DevExpress.XtraEditors.TextEdit();
            this.comSjw = new DevExpress.XtraEditors.ComboBoxEdit();
            this.comStopBits = new DevExpress.XtraEditors.ComboBoxEdit();
            this.comParity = new DevExpress.XtraEditors.ComboBoxEdit();
            this.txtMsg = new DevExpress.XtraEditors.MemoEdit();
            this.button2 = new DevExpress.XtraEditors.SimpleButton();
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
            this.cmbBaudRate1111 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem9 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            this.cmbBaudRate1111 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
            this.gcMx1 = new DevExpress.XtraGrid.GridControl();
            this.gvMx1 = new DevExpress.XtraGrid.Views.Grid.GridView();
@@ -80,19 +76,14 @@
            ((System.ComponentModel.ISupportInitialize)(this.cmbSerialPortNum.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtNum.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comSjw.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comStopBits.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comParity.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtMsg.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem9)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).BeginInit();
@@ -122,17 +113,13 @@
            // layoutMx1
            // 
            this.layoutMx1.Controls.Add(this.comLine);
            this.layoutMx1.Controls.Add(this.btnStart);
            this.layoutMx1.Controls.Add(this.button1);
            this.layoutMx1.Controls.Add(this.cmbSerialPortNum);
            this.layoutMx1.Controls.Add(this.cmbBaudRate);
            this.layoutMx1.Controls.Add(this.txtNum);
            this.layoutMx1.Controls.Add(this.comSjw);
            this.layoutMx1.Controls.Add(this.comStopBits);
            this.layoutMx1.Controls.Add(this.comParity);
            this.layoutMx1.Controls.Add(this.txtMsg);
            this.layoutMx1.Controls.Add(this.button2);
            this.layoutMx1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.layoutMx1.HiddenItems.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
            this.layoutControlItem5});
            this.layoutMx1.Location = new System.Drawing.Point(0, 0);
            this.layoutMx1.Name = "layoutMx1";
            this.layoutMx1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(310, 455, 812, 500);
@@ -149,22 +136,21 @@
            this.comLine.Size = new System.Drawing.Size(164, 24);
            this.comLine.TabIndex = 14;
            // 
            // btnStart
            // button1
            // 
            this.btnStart.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Question;
            this.btnStart.Appearance.Options.UseBackColor = true;
            this.btnStart.Appearance.Options.UseFont = true;
            this.btnStart.Location = new System.Drawing.Point(512, 12);
            this.btnStart.Name = "btnStart";
            this.btnStart.Size = new System.Drawing.Size(246, 27);
            this.btnStart.StyleController = this.layoutMx1;
            this.btnStart.TabIndex = 5;
            this.btnStart.Text = "启动";
            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
            this.button1.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Question;
            this.button1.Appearance.Options.UseBackColor = true;
            this.button1.Appearance.Options.UseFont = true;
            this.button1.Location = new System.Drawing.Point(262, 12);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(246, 27);
            this.button1.StyleController = this.layoutMx1;
            this.button1.TabIndex = 5;
            this.button1.Text = "启动";
            // 
            // cmbSerialPortNum
            // 
            this.cmbSerialPortNum.Location = new System.Drawing.Point(344, 12);
            this.cmbSerialPortNum.Location = new System.Drawing.Point(94, 43);
            this.cmbSerialPortNum.Name = "cmbSerialPortNum";
            this.cmbSerialPortNum.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
@@ -177,7 +163,7 @@
            // cmbBaudRate
            // 
            this.cmbBaudRate.EditValue = "9600";
            this.cmbBaudRate.Location = new System.Drawing.Point(344, 43);
            this.cmbBaudRate.Location = new System.Drawing.Point(94, 74);
            this.cmbBaudRate.Name = "cmbBaudRate";
            this.cmbBaudRate.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
@@ -195,7 +181,7 @@
            // 
            // txtNum
            // 
            this.txtNum.Location = new System.Drawing.Point(594, 53);
            this.txtNum.Location = new System.Drawing.Point(594, 22);
            this.txtNum.Name = "txtNum";
            this.txtNum.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 15F);
            this.txtNum.Properties.Appearance.Options.UseFont = true;
@@ -204,78 +190,38 @@
            this.txtNum.StyleController = this.layoutMx1;
            this.txtNum.TabIndex = 8;
            // 
            // comSjw
            //
            this.comSjw.EditValue = "8";
            this.comSjw.Location = new System.Drawing.Point(94, 43);
            this.comSjw.Name = "comSjw";
            this.comSjw.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.comSjw.Properties.Items.AddRange(new object[] {
            "5",
            "6",
            "7",
            "8"});
            this.comSjw.Properties.NullText = "-请选择-";
            this.comSjw.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.comSjw.Size = new System.Drawing.Size(164, 24);
            this.comSjw.StyleController = this.layoutMx1;
            this.comSjw.TabIndex = 11;
            //
            // comStopBits
            //
            this.comStopBits.EditValue = "1";
            this.comStopBits.Location = new System.Drawing.Point(344, 74);
            this.comStopBits.Name = "comStopBits";
            this.comStopBits.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.comStopBits.Properties.Items.AddRange(new object[] {
            "1",
            "2"});
            this.comStopBits.Properties.NullText = "-请选择-";
            this.comStopBits.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.comStopBits.Size = new System.Drawing.Size(164, 24);
            this.comStopBits.StyleController = this.layoutMx1;
            this.comStopBits.TabIndex = 12;
            //
            // comParity
            //
            this.comParity.EditValue = "None";
            this.comParity.Location = new System.Drawing.Point(94, 74);
            this.comParity.Name = "comParity";
            this.comParity.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.comParity.Properties.Items.AddRange(new object[] {
            "None",
            "Odd",
            "Even"});
            this.comParity.Properties.NullText = "-请选择-";
            this.comParity.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.comParity.Size = new System.Drawing.Size(164, 24);
            this.comParity.StyleController = this.layoutMx1;
            this.comParity.TabIndex = 13;
            //
            // txtMsg
            // 
            this.txtMsg.Location = new System.Drawing.Point(94, 123);
            this.txtMsg.Location = new System.Drawing.Point(512, 74);
            this.txtMsg.Name = "txtMsg";
            this.txtMsg.Size = new System.Drawing.Size(414, 35);
            this.txtMsg.Properties.ReadOnly = true;
            this.txtMsg.Size = new System.Drawing.Size(516, 27);
            this.txtMsg.StyleController = this.layoutMx1;
            this.txtMsg.TabIndex = 15;
            //
            // button2
            //
            this.button2.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Danger;
            this.button2.Appearance.Options.UseBackColor = true;
            this.button2.Location = new System.Drawing.Point(262, 43);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(246, 27);
            this.button2.StyleController = this.layoutMx1;
            this.button2.TabIndex = 16;
            this.button2.Text = "停止";
            // 
            // Root
            // 
            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
            this.Root.GroupBordersVisible = false;
            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
            this.cmbBaudRate1111,
            this.layoutControlItem3,
            this.layoutControlItem1,
            this.layoutControlItem7,
            this.layoutControlItem9,
            this.layoutControlItem4,
            this.cmbBaudRate1111,
            this.layoutControlItem2,
            this.layoutControlItem8});
            this.layoutControlItem6,
            this.layoutControlItem4,
            this.layoutControlItem5});
            this.Root.LayoutMode = DevExpress.XtraLayout.Utils.LayoutMode.Table;
            this.Root.Name = "Root";
            columnDefinition1.SizeType = System.Windows.Forms.SizeType.Absolute;
@@ -301,17 +247,6 @@
            this.Root.Size = new System.Drawing.Size(1040, 113);
            this.Root.TextVisible = false;
            // 
            // cmbBaudRate1111
            //
            this.cmbBaudRate1111.Control = this.cmbBaudRate;
            this.cmbBaudRate1111.Location = new System.Drawing.Point(250, 31);
            this.cmbBaudRate1111.Name = "cmbBaudRate1111";
            this.cmbBaudRate1111.OptionsTableLayoutItem.ColumnIndex = 1;
            this.cmbBaudRate1111.OptionsTableLayoutItem.RowIndex = 1;
            this.cmbBaudRate1111.Size = new System.Drawing.Size(250, 31);
            this.cmbBaudRate1111.Text = "波特率";
            this.cmbBaudRate1111.TextSize = new System.Drawing.Size(70, 18);
            //
            // layoutControlItem3
            // 
            this.layoutControlItem3.Control = this.comLine;
@@ -324,33 +259,48 @@
            // layoutControlItem1
            // 
            this.layoutControlItem1.Control = this.cmbSerialPortNum;
            this.layoutControlItem1.Location = new System.Drawing.Point(250, 0);
            this.layoutControlItem1.Location = new System.Drawing.Point(0, 31);
            this.layoutControlItem1.Name = "layoutControlItem1";
            this.layoutControlItem1.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem1.OptionsTableLayoutItem.RowIndex = 1;
            this.layoutControlItem1.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem1.Text = "串口号";
            this.layoutControlItem1.TextSize = new System.Drawing.Size(70, 18);
            // 
            // layoutControlItem7
            // cmbBaudRate1111
            // 
            this.layoutControlItem7.Control = this.comSjw;
            this.layoutControlItem7.Location = new System.Drawing.Point(0, 31);
            this.layoutControlItem7.Name = "layoutControlItem7";
            this.layoutControlItem7.OptionsTableLayoutItem.RowIndex = 1;
            this.layoutControlItem7.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem7.Text = "数据位";
            this.layoutControlItem7.TextSize = new System.Drawing.Size(70, 18);
            this.cmbBaudRate1111.Control = this.cmbBaudRate;
            this.cmbBaudRate1111.Location = new System.Drawing.Point(0, 62);
            this.cmbBaudRate1111.Name = "cmbBaudRate1111";
            this.cmbBaudRate1111.OptionsTableLayoutItem.RowIndex = 2;
            this.cmbBaudRate1111.Size = new System.Drawing.Size(250, 31);
            this.cmbBaudRate1111.Text = "波特率";
            this.cmbBaudRate1111.TextSize = new System.Drawing.Size(70, 18);
            // 
            // layoutControlItem9
            // layoutControlItem2
            // 
            this.layoutControlItem9.Control = this.comParity;
            this.layoutControlItem9.CustomizationFormText = "校验位";
            this.layoutControlItem9.Location = new System.Drawing.Point(0, 62);
            this.layoutControlItem9.Name = "layoutControlItem9";
            this.layoutControlItem9.OptionsTableLayoutItem.RowIndex = 2;
            this.layoutControlItem9.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem9.Text = "校验位";
            this.layoutControlItem9.TextSize = new System.Drawing.Size(70, 18);
            this.layoutControlItem2.Control = this.button1;
            this.layoutControlItem2.Location = new System.Drawing.Point(250, 0);
            this.layoutControlItem2.MaxSize = new System.Drawing.Size(250, 31);
            this.layoutControlItem2.MinSize = new System.Drawing.Size(41, 31);
            this.layoutControlItem2.Name = "layoutControlItem2";
            this.layoutControlItem2.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem2.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
            this.layoutControlItem2.Text = "启动";
            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem2.TextVisible = false;
            //
            // layoutControlItem6
            //
            this.layoutControlItem6.Control = this.button2;
            this.layoutControlItem6.Location = new System.Drawing.Point(250, 31);
            this.layoutControlItem6.Name = "layoutControlItem6";
            this.layoutControlItem6.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem6.OptionsTableLayoutItem.RowIndex = 1;
            this.layoutControlItem6.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem6.Text = "停止";
            this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem6.TextVisible = false;
            // 
            // layoutControlItem4
            // 
@@ -358,50 +308,25 @@
            this.layoutControlItem4.AppearanceItemCaption.Options.UseFont = true;
            this.layoutControlItem4.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center;
            this.layoutControlItem4.Control = this.txtNum;
            this.layoutControlItem4.Location = new System.Drawing.Point(500, 31);
            this.layoutControlItem4.Location = new System.Drawing.Point(500, 0);
            this.layoutControlItem4.Name = "layoutControlItem4";
            this.layoutControlItem4.OptionsTableLayoutItem.ColumnIndex = 2;
            this.layoutControlItem4.OptionsTableLayoutItem.RowIndex = 1;
            this.layoutControlItem4.OptionsTableLayoutItem.RowSpan = 2;
            this.layoutControlItem4.Size = new System.Drawing.Size(520, 62);
            this.layoutControlItem4.Text = "重量";
            this.layoutControlItem4.TextSize = new System.Drawing.Size(70, 41);
            // 
            // layoutControlItem2
            //
            this.layoutControlItem2.Control = this.btnStart;
            this.layoutControlItem2.Location = new System.Drawing.Point(500, 0);
            this.layoutControlItem2.MaxSize = new System.Drawing.Size(250, 31);
            this.layoutControlItem2.MinSize = new System.Drawing.Size(41, 31);
            this.layoutControlItem2.Name = "layoutControlItem2";
            this.layoutControlItem2.OptionsTableLayoutItem.ColumnIndex = 2;
            this.layoutControlItem2.Size = new System.Drawing.Size(520, 31);
            this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
            this.layoutControlItem2.Text = "启动";
            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem2.TextVisible = false;
            //
            // layoutControlItem8
            //
            this.layoutControlItem8.Control = this.comStopBits;
            this.layoutControlItem8.Location = new System.Drawing.Point(250, 62);
            this.layoutControlItem8.Name = "layoutControlItem8";
            this.layoutControlItem8.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem8.OptionsTableLayoutItem.RowIndex = 2;
            this.layoutControlItem8.Size = new System.Drawing.Size(250, 31);
            this.layoutControlItem8.Text = "停止位";
            this.layoutControlItem8.TextSize = new System.Drawing.Size(70, 18);
            //
            // layoutControlItem5
            // 
            this.layoutControlItem5.Control = this.txtMsg;
            this.layoutControlItem5.Location = new System.Drawing.Point(0, 111);
            this.layoutControlItem5.Location = new System.Drawing.Point(500, 62);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnSpan = 2;
            this.layoutControlItem5.OptionsTableLayoutItem.RowIndex = 3;
            this.layoutControlItem5.Size = new System.Drawing.Size(500, 39);
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnIndex = 2;
            this.layoutControlItem5.OptionsTableLayoutItem.RowIndex = 2;
            this.layoutControlItem5.Size = new System.Drawing.Size(520, 31);
            this.layoutControlItem5.Text = "收列表";
            this.layoutControlItem5.TextSize = new System.Drawing.Size(70, 18);
            this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
            this.layoutControlItem5.TextVisible = false;
            // 
            // gcMx1
            // 
@@ -585,19 +510,14 @@
            ((System.ComponentModel.ISupportInitialize)(this.cmbSerialPortNum.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtNum.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comSjw.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comStopBits.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comParity.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtMsg.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem9)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).EndInit();
@@ -612,11 +532,7 @@
        private DevExpress.XtraEditors.ComboBoxEdit cmbSerialPortNum;
        private DevExpress.XtraEditors.ComboBoxEdit cmbBaudRate;
        private DevExpress.XtraEditors.TextEdit txtNum;
        private DevExpress.XtraEditors.ComboBoxEdit comSjw;
        private DevExpress.XtraEditors.ComboBoxEdit comStopBits;
        private DevExpress.XtraEditors.ComboBoxEdit comParity;
        private DevExpress.XtraLayout.LayoutControlItem cmbBaudRate1111;
        private DevExpress.XtraEditors.SimpleButton btnStart;
        private DevExpress.XtraEditors.SimpleButton button1;
        private DevExpress.XtraGrid.GridControl gcMx1;
        private DevExpress.XtraGrid.Views.Grid.GridView gvMx1;
        private DevExpress.XtraGrid.Columns.GridColumn gridColumn1;
@@ -633,13 +549,13 @@
        private DevExpress.XtraGrid.Columns.GridColumn gridColumn13;
        private UserControl.UcLookWorkline comLine;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem9;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
        private DevExpress.XtraEditors.MemoEdit txtMsg;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem8;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
        private DevExpress.XtraLayout.LayoutControlItem cmbBaudRate1111;
        private DevExpress.XtraEditors.SimpleButton button2;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
    }
}
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs
@@ -1,50 +1,193 @@
using System;
using DevExpress.Utils;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Microsoft.Win32;
using Newtonsoft.Json;
using NModbus;
using NModbus.Serial;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
using DevExpress.Utils;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
namespace Gs.DevApp.DevFrm.Work
{
    public partial class Frm_Work09 : DevExpress.XtraEditors.XtraForm
    {
        string _strType = "";
        string _webServiceName = "WorkWeight/";
        /// <summary>
        /// ä¸²å£ç±»
        /// </summary>
        private SerialPort Sp = new SerialPort();
        /// <summary>
        /// gridview定时刷新
        /// </summary>
        System.Timers.Timer timer = new System.Timers.Timer(10000);
        public System.IO.Ports.SerialPort Sp = new System.IO.Ports.SerialPort();
        public delegate void HandleInterfaceUpdataDelegate(string text);
        private Frm_Work09.HandleInterfaceUpdataDelegate interfaceUpdataHandle;
        private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>();
        private System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
        System.Timers.Timer timerGridview = new System.Timers.Timer(10000);
        public Frm_Work09(string strType)
        {
            InitializeComponent();
            this._strType = strType;
            this.Text = _strType + ":" + this.Text;
            GetComList();
            comLine.getSuppler("");
            #region MyRegion
            int int32 = 10000;
            string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"];
            if (!string.IsNullOrEmpty(_vanishingSeconds))
                int32 = int.Parse(_vanishingSeconds);
            this.timer1.Interval = int32;
            this.button1.Enabled = true;
            this.button2.Enabled = false;
            this.comLine.IsReadly = false;
            this.cmbSerialPortNum.Enabled = true;
            this.cmbBaudRate.Enabled = true;
            this.cmbBaudRate.SelectedIndex = 1;
            #endregion
            this.timer1.Tick += (s, e) =>
            {
                if (this.dicThread.Keys.Contains<string>("GetWeight"))
                    return;
                Thread thread1 = new Thread(new ThreadStart(this.GetWeight));
                thread1.Start();
                this.dicThread.Add("GetWeight", thread1);
            };
            this.button1.Click += (s, e) =>
            {
                string _comLine = comLine.GetId();
                if (string.IsNullOrEmpty(_comLine))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择线体");
                    this.comLine.Focus();
                    return;
                }
                try
                {
                    ToolBox.LogHelper.Debug(this.ToString(), " å¼€å§‹é‡‡é›†");
                    if (this.cmbBaudRate.Text.Trim() != "" && this.cmbSerialPortNum.Text != "")
                    {
                        ToolBox.LogHelper.Debug(this.ToString(), "配置串口通信");
                        this.interfaceUpdataHandle = new Frm_Work09.HandleInterfaceUpdataDelegate(this.UpdateTextBox);
                        this.Sp.PortName = this.cmbSerialPortNum.Text.Trim();
                        this.Sp.BaudRate = Convert.ToInt32(this.cmbBaudRate.Text.Trim());
                        this.Sp.Parity = Parity.None;
                        this.Sp.StopBits = StopBits.One;
                        ToolBox.LogHelper.Debug(this.ToString(), "打开串口同通信");
                        this.Sp.Open();
                        this.button1.Enabled = false;
                        this.button2.Enabled = true;
                        this.timer1.Enabled = false;
                        this.comLine.IsReadly = true;
                        this.cmbSerialPortNum.Enabled = false;
                        this.cmbBaudRate.Enabled = false;
                        ToolBox.LogHelper.Debug(this.ToString(), "启动刷新数据定时器");
                        this.timer1.Start();
                    }
                    else
                    {
                        ToolBox.LogHelper.Debug(this.ToString(), "请输入正确的串口号和波特率");
                        int num = (int)MessageBox.Show("请输入正确的串口号和波特率!");
                        this.cmbSerialPortNum.Focus();
                    }
                }
                catch (Exception ex)
                {
                    ToolBox.LogHelper.Debug(this.ToString(), ex.Message);
                    int num = (int)MessageBox.Show($"串口{this.cmbSerialPortNum.Text.Trim()}打开失败!{ex.Message}");
                }
            };
            this.button2.Click += (s, e) =>
            {
                try
                {
                    if (this.dicThread.Keys.Contains<string>("GetWeight"))
                    {
                        Thread thread = this.dicThread["GetWeight"];
                        if (thread.IsAlive)
                            thread.Abort();
                        this.dicThread.Remove("GetWeight");
                    }
                    this.button1.Enabled = true;
                    this.button2.Enabled = false;
                    this.comLine.IsReadly = false;
                    this.cmbSerialPortNum.Enabled = true;
                    this.cmbBaudRate.Enabled = true;
                    this.timer1.Stop();
                    this.Sp.Close();
                }
                catch (Exception ex)
                {
                    //int num = (int)MessageBox.Show(ex.Message);
                    //Application.Exit();
                    MessageBox.Show(ex.Message);
                    ToolBox.LogHelper.Debug(this.ToString(), ex.Message);
                }
            };
            this.FormClosing += (s, e) =>
            {
                if (Sp.IsOpen)
                    Sp.Close();
                if (timer != null)
                if (timer1 != null)
                {
                    timer.Stop();
                    timer.Dispose();
                    timer1.Stop();
                    timer1.Dispose();
                }
                if (timerGridview != null)
                {
                    timerGridview.Stop();
                    timerGridview.Dispose();
                }
                try
                {
                    if (this.dicThread.Keys.Contains<string>("GetWeight"))
                    {
                        Thread thread = this.dicThread["GetWeight"];
                        if (thread.IsAlive)
                            thread.Abort();
                        this.dicThread.Remove("GetWeight");
                    }
                    this.timer1.Stop();
                    this.Sp.Close();
                }
                catch (Exception ex)
                {
                    //int num = (int)MessageBox.Show(ex.Message);
                    //Application.Exit();
                    MessageBox.Show(ex.Message);
                }
            };
            GetComList();
            if (this._strType == QcSeason.产线称重.ToString())
            {
                this.comLine.getSuppler("");
            }
            #region gridview设置
            timerGridview.Elapsed += (s, e) => {
                var _obj = new
                {
                    lineId = comLine.GetId(),
                };
                try
                {
                    var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModelList", JsonConvert.SerializeObject(_obj), false);
                    var dd = UtilityHelper.ReturnToList(strReturn);
                    var dt = dd.rtnData;
                    BeginInvoke(new Action(() =>
                    {
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                    }));
                    BeginInvoke(new Action(() => {
                        this.txtMsg.Text = "最近刷新列表时间:" + DateTime.Now.ToString();
                    }));
                }
                catch (Exception ex)
                {
                    Toast vm = new Toast(-1, "gvMx1:" + ex.Message);
                    vm.Show();
                }
            };
            timerGridview.AutoReset = true; // è®¾ç½®ä¸ºtrue表示重复执行,false表示执行一次后停止
            timerGridview.Enabled = true; // å¼€å§‹è®¡æ—¶
            gvMx1.OptionsFind.ShowSearchNavButtons = false;
            gvMx1.OptionsView.ShowAutoFilterRow = false;
            gvMx1.OptionsView.ShowGroupPanel = false;
@@ -70,178 +213,65 @@
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
            };
        }
        /// <summary>
        /// ä»Žæ³¨å†Œè¡¨èŽ·å–ç³»ç»Ÿä¸²å£åˆ—è¡¨
        /// </summary>
        private void GetComList()
        {
            this.cmbSerialPortNum.Clear();
            string[] ports = SerialPort.GetPortNames();
            foreach (string port in ports)
            {
                cmbSerialPortNum.Properties.Items.Add(port);
            }
        }
        /// <summary>
        /// å¯åŠ¨äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStart_Click(object sender, EventArgs e)
        {
            Sp.DataReceived -= new SerialDataReceivedEventHandler(Sp_DataReceived);
            string _cmbSerialPortNum = cmbSerialPortNum.Text.Trim();
            string _cmbBaudRate = cmbBaudRate.Text.Trim();
            string _comSjw = comSjw.Text.Trim();
            string _comStopBits = comStopBits.Text.Trim();
            string _comParity = comParity.Text.Trim();
            if (this._strType == QcSeason.产线称重.ToString())
            {
                string _comLine = comLine.GetId();
                if (string.IsNullOrEmpty(_comLine))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择线体");
                    this.comLine.Focus();
                    return;
                }
            }
            if (cmbSerialPortNum.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择串口号");
                this.cmbSerialPortNum.Focus();
                return;
            }
            if (cmbBaudRate.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择波特率");
                this.cmbBaudRate.Focus();
                return;
            }
            if (comSjw.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择数据位");
                this.comSjw.Focus();
                return;
            }
            if (comStopBits.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择停止位");
                this.comStopBits.Focus();
                return;
            }
            if (comParity.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择校验");
                this.comParity.Focus();
                return;
            }
            try
            {
                Sp.ReceivedBytesThreshold = 1;
                Sp.PortName = _cmbSerialPortNum;
                Sp.BaudRate = Convert.ToInt32(_cmbBaudRate);//设置波特率
                if (Enum.TryParse(_comParity, out Parity pt1))
                {
                    Sp.Parity = pt1;// è®¾ç½®æ ¡éªŒä½
                }
                else
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("无法识别的校验");
                }
                if (Enum.TryParse(_comStopBits, out StopBits pt2))
                {
                    Sp.StopBits = pt2;//设置停止位
                }
                else
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("无法识别的停止位");
                }
                Sp.DataBits = int.Parse(_comSjw); // è®¾ç½®æ•°æ®ä½
                //Sp.ReadTimeout = 500; // è®¾ç½®è¶…时时间,例如500毫秒
                //Sp.ReadBufferSize = 4096; // è®¾ç½®ç¼“冲区大小
                Sp.DataReceived += new SerialDataReceivedEventHandler(Sp_DataReceived);
                Sp.ReceivedBytesThreshold = 1;
                LogHelper.Debug(this.ToString(), "打开串口通信PortName-" + Sp.PortName.ToString() + ",BaudRate-" + Sp.BaudRate.ToString() + ",StopBits-" + Sp.StopBits.ToString() + ",Parity-" + Sp.Parity.ToString());
                if (!Sp.IsOpen)
                    Sp.Open();
                setEnable(false);
                timer.Elapsed += OnTimedEvent;
                timer.AutoReset = true; // è®¾ç½®ä¸ºtrue表示重复执行,false表示执行一次后停止
                timer.Enabled = true; // å¼€å§‹è®¡æ—¶
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("打开成功!");
            }
            catch (Exception exe)
            {
                LogHelper.Debug(this.ToString(), "打开串口通信失败:" + exe.Message);
                Gs.DevApp.ToolBox.MsgHelper.ShowError("打开失败" + exe.Message);
            }
            #endregion
        }
        /// <summary>
        /// ä¸²å£æ”¶åˆ°æ•°æ®
        /// èŽ·å–é‡é‡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Sp_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        public void GetWeight()
        {
            string _tmpStr = string.Empty;
            try
            ModbusFactory factory = new ModbusFactory();
            ToolBox.LogHelper.Debug(this.ToString(), "GetWeight创建modbus对象");
            IModbusMaster rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp);
            bool flag = true;
            while (true)
            {
                int i = Sp.BytesToRead;
                if (i > 0)
                // addModel("1", "2");
                //ToolBox.LogHelper.Debug(this.ToString(), "GetWeight创建modbus对象");
                try
                {
                    _tmpStr = Sp.ReadExisting();
                    // Thread.Sleep(1000);
                    LogHelper.Debug(this.ToString(), $"监听到数据,字节长度:{i.ToString()},{_tmpStr}");
                    this.BeginInvoke(new Action(() =>
                    if (!this.Sp.IsOpen)
                    {
                        txtMsg.AppendLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff->字节数字" + i.ToString() + "->") + _tmpStr);
                        //ST,GS,+  250.2kg
                        if (_tmpStr.Length <= 0)
                        {
                            LogHelper.Debug(this.ToString(), "_tmpStr长度<=0,退出上报");
                            return;
                        }
                        if (!_tmpStr.Contains("ST"))
                        {
                            LogHelper.Debug(this.ToString(), "_tmpStr重量状态不为ST,退出上报");
                            return;
                        }
                        if (!_tmpStr.Contains("+"))
                        {
                            LogHelper.Debug(this.ToString(), "_tmpStr不包含重量+,退出上报");
                            return;
                        }
                        string[] _ary = _tmpStr.Split('+');
                        string abc = _ary.Last();//ST,GS,
                        txtNum.Text = (abc.Trim().Replace("k", "").Replace("g", "").Replace("S", "").Replace("T", "").Replace("G", "").Replace(",", ""));
                        addModel(txtNum.Text, _tmpStr);
                    }));
                        ToolBox.LogHelper.Debug(this.ToString(), "GetWeight é‡æ–°æ‰“开串口连接");
                        this.Sp.Open();
                        rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp);
                    }
                    if (rtuMaster == null)
                    {
                        ToolBox.LogHelper.Debug(this.ToString(), "GetWeight é‡æ–°åˆ›å»ºmodbus对象2");
                        rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp);
                    }
                    byte slaveAddress3 = byte.Parse("1");
                    ushort startAddress3 = ushort.Parse("0002");
                    ushort numberOfPoints1 = ushort.Parse("2");
                    ushort[] numArray = rtuMaster.ReadHoldingRegisters(slaveAddress3, startAddress3, numberOfPoints1);
                    float single = BitConverter.ToSingle(this.CombomBinaryArray(BitConverter.GetBytes(numArray[1]), BitConverter.GetBytes(numArray[0])), 0);
                    this.Invoke((Delegate)this.interfaceUpdataHandle, (object)single.ToString());
                    byte slaveAddress4 = byte.Parse("1");
                    ushort startAddress4 = ushort.Parse("0001");
                    ushort numberOfPoints2 = ushort.Parse("1");
                    int int32 = Convert.ToInt32(rtuMaster.ReadHoldingRegisters(slaveAddress4, startAddress4, numberOfPoints2)[0].ToString());
                    string str = Convert.ToString(int32, 2).PadLeft(16 /*0x10*/, '0');
                    char ch1 = str[1];
                    char ch2 = str[6];
                    if (ch1 == '0' && ch2 == '0')
                    {
                        flag = true;
                    }
                    else if (flag)
                    {
                        flag = false;
                    }
                    addModel(single.ToString(), int32.ToString());
                    ToolBox.LogHelper.Debug(this.ToString(), "single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString());
                    Thread.Sleep(2000);
                }
                catch (Exception ex)
                {
                    Thread.Sleep(2000);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug(this.ToString(), $"监听到数据error:{ex.Message}");
                return;
            }
        }
        /// <summary>
        /// å¯ç”¨æˆ–禁用
        /// </summary>
        /// <param name="bl"></param>
        private void setEnable(bool bl)
        {
            comLine.Enabled = bl;
            cmbSerialPortNum.Enabled = bl;
            cmbBaudRate.Enabled = bl;
            comSjw.Enabled = bl;
            comStopBits.Enabled = bl;
            comParity.Enabled = bl;
            btnStart.Enabled = false;
        }
        /// <summary>
        /// ä¸Šä¼ ç§°é‡æ•°æ®
@@ -250,13 +280,7 @@
        /// <param name="_realWeightTxt">原子串</param>
        private void addModel(string _realWeight, string _realWeightTxt)
        {
            string _lineId = "";
            if (this._strType == QcSeason.产线称重.ToString())
            {
                _lineId = comLine.GetId();
            }
            else
                _lineId = "0";
            string _lineId = "0";
            var _obj = new
            {
                lineId = _lineId,
@@ -265,51 +289,63 @@
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                string strJson = UtilityHelper.HttpPost("", "WorkWeight/EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode <= 0)
                {
                    Toast vm = new Toast(-1, _rtn.rtnMsg);
                    vm.Show();
                    ToolBox.LogHelper.Debug(this.ToString(), "WorkWeight/EditModel:" + strJson);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
                ToolBox.LogHelper.Debug(this.ToString(), ex.Message);
            }
        }
        /// <summary>
        /// å®šæ—¶è¯»å–列表
        /// æ›´æ–°UI
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void OnTimedEvent(Object source, ElapsedEventArgs e)
        /// <param name="text"></param>
        private void UpdateTextBox(string text)
        {
            if (this._strType == QcSeason.iqc称重.ToString())
                return;
            var _obj = new
            {
                lineId = comLine.GetId(),
            };
            try
            {
                var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModelList", JsonConvert.SerializeObject(_obj), false);
                var dd = UtilityHelper.ReturnToList(strReturn);
                var dt = dd.rtnData;
                BeginInvoke(new Action(() =>
                {
                    gcMx1.BindingContext = new BindingContext();
                    gcMx1.DataSource = dt;
                    gcMx1.ForceInitialize();
                    gvMx1.BestFitColumns();
                }));
                this.txtMsg.Text ="最近称重时间:"+ DateTime.Now.ToString();
                if (this.txtNum.Text == text)
                    return;
                this.txtNum.Text = text;
            }
            catch (Exception ex)
            {
                Toast vm = new Toast(-1, "gvMx1:" + ex.Message);
                vm.Show();
                ToolBox.LogHelper.Debug(this.ToString(), ex.Message);
            }
        }
        private void GetComList()
        {
            this.cmbSerialPortNum.Clear();
            RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Hardware\\DeviceMap\\SerialComm");
            if (registryKey == null)
                return;
            foreach (string valueName in registryKey.GetValueNames())
            {
                string description = (string)registryKey.GetValue(valueName);
                cmbSerialPortNum.Properties.Items.Add(description);
            }
            if (this.cmbSerialPortNum.Properties.Items.Count > 0)
                this.cmbSerialPortNum.SelectedIndex = 0;
        }
        private byte[] CombomBinaryArray(byte[] srcArray1, byte[] srcArray2)
        {
            byte[] destinationArray = new byte[srcArray1.Length + srcArray2.Length];
            Array.Copy((Array)srcArray1, 0, (Array)destinationArray, 0, srcArray1.Length);
            Array.Copy((Array)srcArray2, 0, (Array)destinationArray, srcArray1.Length, srcArray2.Length);
            return destinationArray;
        }
    }
}
DevApp/Gs.DevApp/Gs.DevApp.csproj
@@ -662,12 +662,6 @@
    <Compile Include="DevFrm\QC\Models\MesQmCheckitemDt.cs" />
    <Compile Include="DevFrm\QC\Models\MesSysLookups.cs" />
    <Compile Include="DevFrm\QC\Models\MesSysLookupTypes.cs" />
    <Compile Include="DevFrm\QC\WeightIqc.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="DevFrm\QC\WeightIqc.Designer.cs">
      <DependentUpon>WeightIqc.cs</DependentUpon>
    </Compile>
    <Compile Include="DevFrm\QC\Xls.cs">
      <SubType>Form</SubType>
    </Compile>
DevApp/Gs.DevApp/Program.cs
@@ -42,8 +42,6 @@
        /// </summary>
        private static void _startLogin()
        {
            //Application.Run(new WeightIqc());
            //return;
            CefSettings settings = new CefSettings();
            settings.Locale = "zh-CN";
            Cef.Initialize(settings);
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.Designer.cs
@@ -74,12 +74,11 @@
            this.barLargeButtonItem2 = new DevExpress.XtraBars.BarLargeButtonItem();
            this.barLargeButtonItem3 = new DevExpress.XtraBars.BarLargeButtonItem();
            this.barLargeButtonItem4 = new DevExpress.XtraBars.BarLargeButtonItem();
            this.btnWeight = new DevExpress.XtraBars.BarLargeButtonItem();
            this.btnBaoGao = new DevExpress.XtraBars.BarLargeButtonItem();
            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.btnBaoGao = new DevExpress.XtraBars.BarLargeButtonItem();
            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
            this.SuspendLayout();
            // 
@@ -137,7 +136,6 @@
            this.btnGongZi,
            this.btnLianBan,
            this.btnGx,
            this.btnWeight,
            this.btnBaoGao});
            this.barManager1.MainMenu = this.bar2;
            this.barManager1.MaxItemId = 76;
@@ -194,7 +192,6 @@
            new DevExpress.XtraBars.LinkPersistInfo(this.barLargeButtonItem2),
            new DevExpress.XtraBars.LinkPersistInfo(this.barLargeButtonItem3),
            new DevExpress.XtraBars.LinkPersistInfo(this.barLargeButtonItem4),
            new DevExpress.XtraBars.LinkPersistInfo(this.btnWeight),
            new DevExpress.XtraBars.LinkPersistInfo(this.btnBaoGao)});
            this.bar2.OptionsBar.DrawDragBorder = false;
            this.bar2.OptionsBar.MultiLine = true;
@@ -601,14 +598,14 @@
            this.barLargeButtonItem4.Tag = "Never";
            this.barLargeButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            // 
            // btnWeight
            // btnBaoGao
            // 
            this.btnWeight.Caption = "称重";
            this.btnWeight.Id = 73;
            this.btnWeight.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnWeight.ImageOptions.Image")));
            this.btnWeight.ImageOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("btnWeight.ImageOptions.LargeImage")));
            this.btnWeight.Name = "btnWeight";
            this.btnWeight.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            this.btnBaoGao.Caption = "生成报告";
            this.btnBaoGao.Id = 75;
            this.btnBaoGao.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnBaoGao.ImageOptions.Image")));
            this.btnBaoGao.ImageOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("btnBaoGao.ImageOptions.LargeImage")));
            this.btnBaoGao.Name = "btnBaoGao";
            this.btnBaoGao.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            // 
            // barDockControlTop
            // 
@@ -641,15 +638,6 @@
            this.barDockControlRight.Location = new System.Drawing.Point(1543, 213);
            this.barDockControlRight.Manager = this.barManager1;
            this.barDockControlRight.Size = new System.Drawing.Size(0, 0);
            //
            // btnBaoGao
            //
            this.btnBaoGao.Caption = "生成报告";
            this.btnBaoGao.Id = 75;
            this.btnBaoGao.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnBaoGao.ImageOptions.Image")));
            this.btnBaoGao.ImageOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("btnBaoGao.ImageOptions.LargeImage")));
            this.btnBaoGao.Name = "btnBaoGao";
            this.btnBaoGao.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            // 
            // UcToolBarMenu
            // 
@@ -715,7 +703,6 @@
        private DevExpress.XtraBars.BarLargeButtonItem btnGongZi;
        private DevExpress.XtraBars.BarLargeButtonItem btnLianBan;
        private DevExpress.XtraBars.BarLargeButtonItem btnGx;
        private DevExpress.XtraBars.BarLargeButtonItem btnWeight;
        private DevExpress.XtraBars.BarLargeButtonItem btnBaoGao;
    }
}
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs
@@ -62,7 +62,6 @@
            btnGongZi.ItemClick += BtnGongZi_ItemClick;
            btnLianBan.ItemClick += BtnLianBan_ItemClick;
            btnGx.ItemClick += BtnGx_ItemClick;
            btnWeight.ItemClick += BtnWeight_ItemClick;
            btnBaoGao.ItemClick += BtnBaoGao_ItemClick;
            var lst = new List<string>();
            foreach (BarItem item in barManager1.Items)
@@ -74,34 +73,7 @@
        /// <summary>
        /// å¯åŠ¨ç§°é‡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void BtnWeight_ItemClick(object sender, ItemClickEventArgs e)
        {
            bool isOpen = false;
            foreach (Form form in Application.OpenForms)
            {
                if (form is WeightIqc)
                {
                    isOpen = true;
                    //form.Activate(); // æ¿€æ´»å·²å­˜åœ¨çš„窗体
                    //form.MaximizeBox = true;
                    //form.TopMost = true;
                    MsgHelper.ShowInformation("已经打开了,请勿重复打开!");
                    break;
                }
            }
            if (!isOpen)
            {
                var form = new WeightIqc();
                form.Show();
            }
        }
        /// <summary>
        ///     åˆå§‹åŒ–按钮状态
        /// </summary>
@@ -466,7 +438,6 @@
                lst.Add(btnLianBan.Name);
                // lst.Add(btnEsc.Name);
                lst.Add(btnGx.Name);
                lst.Add(btnWeight.Name);
                _enabledBtn(lst);
                this.currentAction = "esc";
                if (btnEscClick != null) btnEscClick(this, e);
@@ -519,7 +490,6 @@
                    lst.Add(btnLianBan.Name);
                    // lst.Add(btnEsc.Name);
                    lst.Add(btnGx.Name);
                    lst.Add(btnWeight.Name);
                    _enabledBtn(lst);
                }
            }
@@ -545,7 +515,6 @@
            lst.Add(btnLayout.Name);
            lst.Add(btnFont.Name);
            lst.Add(btnLog.Name);
            lst.Add(btnWeight.Name);
            _enabledBtn(lst);
            this.currentAction = "edit";
            if (btnEdtClick != null) btnEdtClick(this, e);
@@ -573,7 +542,6 @@
            lst.Add(btnHelp.Name);
            lst.Add(btnLayout.Name);
            lst.Add(btnFont.Name);
            lst.Add(btnWeight.Name);
            _enabledBtn(lst);
            this.currentAction = "add";
            if (btnAddClick != null) btnAddClick(this, e);
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.resx
@@ -556,31 +556,31 @@
  </data>
  <data name="btnBaoGao.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
        YQUAAAAddEVYdFRpdGxlAFJlcG9ydExheW91dFBpdm90VGFibGU7x1GJfgAAAUlJREFUOE+Fk8tKw0AU
        htuSduNCfBZfSgRRRJAiKkVEEQWlgqCbLkSFiiIqIrhxI3h5EVG02kua6/F8oa0knaGBbzHzf/mZOSQ5
        Ecnpk6+evhzsn73JKPDweS95t1dQ2Dt+ljgWCaPYCjkefrbA2a49SRDGMjl1M6DrRynI8fCzBcWNw0cV
        InG90Ao5Hn62oFSpPogfRNLuhlKrvw5g3T8ROR7+UMHK7r14KrTcwAo5nrFgaedO7xnKb9tPnYD1/0xC
        wTMWlLduk3s2Wp4VcjxjweLmtXRU+Gp6VsjxjAUL61c6sGBwXPj86aYgxzMWzK9dSlsH9dFwrZDjGQvm
        KhfJpN+/3dQQWfdPRI5nKijOrp4nn2uz41shx8PPFjjT5ZOjmeW6jAIPP1tQUErKmDKuTBhgnxxv6GfK
        s6k4SlFBysI+OV7vd5bcHwTlmSbOHjj9AAAAAElFTkSuQmCC
        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAB10RVh0VGl0
        bGUAUmVwb3J0TGF5b3V0UGl2b3RUYWJsZTvHUYl+AAABSUlEQVQ4T4WTy0rDQBSG25J240J8Fl9KBFFE
        kCIqRUQRBaWCoJsuRIWKIioiuHEjeHkRUbTaS5rr8XyhrSSdoYFvMfN/+Zk5JDkRyemTr56+HOyfvcko
        8PB5L3m3V1DYO36WOBYJo9gKOR5+tsDZrj1JEMYyOXUzoOtHKcjx8LMFxY3DRxUicb3QCjkefragVKk+
        iB9E0u6GUqu/DmDdPxE5Hv5QwcruvXgqtNzACjmesWBp507vGcpv20+dgPX/TELBMxaUt26TezZanhVy
        PGPB4ua1dFT4anpWyPGMBQvrVzqwYHBc+PzppiDHMxbMr11KWwf10XCtkOMZC+YqF8mk37/d1BBZ909E
        jmcqKM6uniefa7PjWyHHw88WONPlk6OZ5bqMAg8/W1BQSsqYMq5MGGCfHG/oZ8qzqThKUUHKwj45Xu93
        ltwfBOWZJs4eOP0AAAAASUVORK5CYII=
</value>
  </data>
  <data name="btnBaoGao.ImageOptions.LargeImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
        YQUAAAAddEVYdFRpdGxlAFJlcG9ydExheW91dFBpdm90VGFibGU7x1GJfgAAAoBJREFUWEe1l3lrE0EY
        h+uBtuIfoh/FL1XEet82tVarpR7VWlAUoRRapPW+D0QQEWn9INajR5pssrtJxveZZssgs/uCnQaefzLz
        Pu9vJzsTpsMYY5HPJmHz6NTsnbEH381GgJse9Frr+0+Arbem5kyrZUyj2QoKTtz0yAtAsm03J2dtQZw2
        g4ITNz3o5QuwRegcmfhm0kbL1JNmUHDipge98gJ0XRv/KpMpagQFJ256FAXYMXz/i51ck6KMvd0vvbhz
        NHDipkdhgKG7n1cDxFIYEJy41QCDtz+ZRCZHUuRjfGYuF8bdFXLrcOJWAwyMfTSJvLXVeiMoOHGrAfpH
        P9htU6mlXnxPnsG4uwJuHU7caoC+G+8LA/wvOHGrAUoj70ws+3YlSr34njyDcXcF3DqcuNUAvdff2n1b
        jpKg4MStBjh79Y2dvFxNvPiePINxdwXcOpy41QBnrry2+3apkgQFJ241wKnhV+0AcVBw4lYDnBySI1Ym
        L67EQcGJWw1w4vILE8nBsVCOg4ITtxrg+KXnMjk1f8r1NdwXy8Wdo4ETtxrg2OAzOTpT83u5HhScuNUA
        Ry8+LQzg234ZjLsr5NbhxK0GOHLhianK0flrqRYUnLjVAIcHHtuz++dizYvvyTMYd1fArcOJWw1w6Pxq
        gHkpCglO3GqAg/2PTEX+POYXpDAgOHHrAc49tP9eP6QoJDhxawG6DvQRIJGiKCg4cdOjKEBnT2nGXiIo
        CAlO3PTIC2BvRvtOT97rKU3L5PDgpge9fAHs3VDYLuwUdgm7hT3rBAcunLhz74b2dtyeQEqWit+Ll2Y9
        4MCFE7f/dry/d1q+tyGyILwTIbGN27T7mo6/6HxMbvJS20MAAAAASUVORK5CYII=
        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAB10RVh0VGl0
        bGUAUmVwb3J0TGF5b3V0UGl2b3RUYWJsZTvHUYl+AAACgElEQVRYR7WXeWsTQRiH64G24h+iH8UvVcR6
        3za1VqulHtVaUBShFFqk9b4PRBARaf0g1qNHmmyyu0nG95lmyyCz+4KdBp5/MvM+728nOxOmwxhjkc8m
        YfPo1OydsQffzUaAmx70Wuv7T4Ctt6bmTKtlTKPZCgpO3PTIC0CybTcnZ21BnDaDghM3PejlC7BF6ByZ
        +GbSRsvUk2ZQcOKmB73yAnRdG/8qkylqBAUnbnoUBdgxfP+LnVyTooy93S+9uHM0cOKmR2GAobufVwPE
        UhgQnLjVAIO3P5lEJkdS5GN8Zi4Xxt0Vcutw4lYDDIx9NIm8tdV6Iyg4casB+kc/2G1TqaVefE+ewbi7
        Am4dTtxqgL4b7wsD/C84casBSiPvTCz7diVKvfiePINxdwXcOpy41QC919/afVuOkqDgxK0GOHv1jZ28
        XE28+J48g3F3Bdw6nLjVAGeuvLb7dqmSBAUnbjXAqeFX7QBxUHDiVgOcHJIjViYvrsRBwYlbDXDi8gsT
        ycGxUI6DghO3GuD4pecyOTV/yvU13BfLxZ2jgRO3GuDY4DM5OlPze7keFJy41QBHLz4tDODbfhmMuyvk
        1uHErQY4cuGJqcrR+WupFhScuNUAhwce27P752LNi+/JMxh3V8Ctw4lbDXDo/GqAeSkKCU7caoCD/Y9M
        Rf485hekMCA4cesBzj20/14/pCgkOHFrAboO9BEgkaIoKDhx06MoQGdPacZeIigICU7c9MgLYG9G+05P
        3uspTcvk8OCmB718AezdUNgu7BR2CbuFPesEBy6cuHPvhvZ23J5ASpaK34uXZj3gwIUTt/92vL93Wr63
        IbIgvBMhsY3btPuajr/ofExu8lLbQwAAAABJRU5ErkJggg==
</value>
  </data>
</root>