lu
2025-06-04 a022ac509f831606e774993a39ab60740e5a60ac
称重
已修改3个文件
122 ■■■■■ 文件已修改
DevApp/Gs.DevApp/App.config 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.Designer.cs 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/App.config
@@ -28,7 +28,8 @@
        </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="LogPath" value="logs" />
        <add key="ProductName" value="GS-MES V2.0" />
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.Designer.cs
@@ -45,6 +45,7 @@
            this.comStopBits = new DevExpress.XtraEditors.ComboBoxEdit();
            this.comParity = new DevExpress.XtraEditors.ComboBoxEdit();
            this.txtMsg = new DevExpress.XtraEditors.MemoEdit();
            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
            this.cmbBaudRate1111 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -53,6 +54,7 @@
            this.layoutControlItem9 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
            this.gcMx1 = new DevExpress.XtraGrid.GridControl();
            this.gvMx1 = new DevExpress.XtraGrid.Views.Grid.GridView();
            this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -67,8 +69,6 @@
            this.gridColumn11 = new DevExpress.XtraGrid.Columns.GridColumn();
            this.gridColumn12 = new DevExpress.XtraGrid.Columns.GridColumn();
            this.gridColumn13 = new DevExpress.XtraGrid.Columns.GridColumn();
            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
            ((System.ComponentModel.ISupportInitialize)(this.split1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.split1.Panel1)).BeginInit();
            this.split1.Panel1.SuspendLayout();
@@ -84,6 +84,7 @@
            ((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.layoutControlItem5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
@@ -92,10 +93,9 @@
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem9)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
            this.SuspendLayout();
            // 
            // split1
@@ -144,7 +144,7 @@
            // comLine
            // 
            this.comLine.IsReadly = false;
            this.comLine.Location = new System.Drawing.Point(94, 9);
            this.comLine.Location = new System.Drawing.Point(94, 12);
            this.comLine.Name = "comLine";
            this.comLine.Size = new System.Drawing.Size(164, 24);
            this.comLine.TabIndex = 14;
@@ -154,7 +154,7 @@
            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, 9);
            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;
@@ -164,7 +164,7 @@
            // 
            // cmbSerialPortNum
            // 
            this.cmbSerialPortNum.Location = new System.Drawing.Point(344, 9);
            this.cmbSerialPortNum.Location = new System.Drawing.Point(344, 12);
            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 +177,7 @@
            // cmbBaudRate
            // 
            this.cmbBaudRate.EditValue = "9600";
            this.cmbBaudRate.Location = new System.Drawing.Point(344, 40);
            this.cmbBaudRate.Location = new System.Drawing.Point(344, 43);
            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 +195,7 @@
            // 
            // txtNum
            // 
            this.txtNum.Location = new System.Drawing.Point(594, 50);
            this.txtNum.Location = new System.Drawing.Point(594, 53);
            this.txtNum.Name = "txtNum";
            this.txtNum.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 15F);
            this.txtNum.Properties.Appearance.Options.UseFont = true;
@@ -207,7 +207,7 @@
            // comSjw
            // 
            this.comSjw.EditValue = "8";
            this.comSjw.Location = new System.Drawing.Point(94, 40);
            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)});
@@ -225,7 +225,7 @@
            // comStopBits
            // 
            this.comStopBits.EditValue = "1";
            this.comStopBits.Location = new System.Drawing.Point(344, 71);
            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)});
@@ -241,7 +241,7 @@
            // comParity
            // 
            this.comParity.EditValue = "None";
            this.comParity.Location = new System.Drawing.Point(94, 71);
            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)});
@@ -262,6 +262,18 @@
            this.txtMsg.Size = new System.Drawing.Size(663, 27);
            this.txtMsg.StyleController = this.layoutMx1;
            this.txtMsg.TabIndex = 15;
            //
            // layoutControlItem5
            //
            this.layoutControlItem5.Control = this.txtMsg;
            this.layoutControlItem5.Location = new System.Drawing.Point(250, 62);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnSpan = 2;
            this.layoutControlItem5.OptionsTableLayoutItem.RowIndex = 2;
            this.layoutControlItem5.Size = new System.Drawing.Size(749, 31);
            this.layoutControlItem5.Text = "收列表";
            this.layoutControlItem5.TextSize = new System.Drawing.Size(70, 18);
            // 
            // Root
            // 
@@ -381,6 +393,17 @@
            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);
            //
            // gcMx1
            // 
            this.gcMx1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -416,6 +439,7 @@
            this.gridColumn1.FieldName = "flowCode";
            this.gridColumn1.MinWidth = 25;
            this.gridColumn1.Name = "gridColumn1";
            this.gridColumn1.OptionsColumn.ReadOnly = true;
            this.gridColumn1.Visible = true;
            this.gridColumn1.VisibleIndex = 0;
            this.gridColumn1.Width = 94;
@@ -426,6 +450,7 @@
            this.gridColumn2.FieldName = "gdbh";
            this.gridColumn2.MinWidth = 25;
            this.gridColumn2.Name = "gridColumn2";
            this.gridColumn2.OptionsColumn.ReadOnly = true;
            this.gridColumn2.Visible = true;
            this.gridColumn2.VisibleIndex = 1;
            this.gridColumn2.Width = 94;
@@ -436,6 +461,7 @@
            this.gridColumn3.FieldName = "itemNo";
            this.gridColumn3.MinWidth = 25;
            this.gridColumn3.Name = "gridColumn3";
            this.gridColumn3.OptionsColumn.ReadOnly = true;
            this.gridColumn3.Visible = true;
            this.gridColumn3.VisibleIndex = 2;
            this.gridColumn3.Width = 94;
@@ -446,6 +472,7 @@
            this.gridColumn4.FieldName = "itemName";
            this.gridColumn4.MinWidth = 25;
            this.gridColumn4.Name = "gridColumn4";
            this.gridColumn4.OptionsColumn.ReadOnly = true;
            this.gridColumn4.Visible = true;
            this.gridColumn4.VisibleIndex = 3;
            this.gridColumn4.Width = 94;
@@ -456,6 +483,7 @@
            this.gridColumn5.FieldName = "itemModel";
            this.gridColumn5.MinWidth = 25;
            this.gridColumn5.Name = "gridColumn5";
            this.gridColumn5.OptionsColumn.ReadOnly = true;
            this.gridColumn5.Visible = true;
            this.gridColumn5.VisibleIndex = 4;
            this.gridColumn5.Width = 94;
@@ -466,6 +494,7 @@
            this.gridColumn6.FieldName = "processNo";
            this.gridColumn6.MinWidth = 25;
            this.gridColumn6.Name = "gridColumn6";
            this.gridColumn6.OptionsColumn.ReadOnly = true;
            this.gridColumn6.Visible = true;
            this.gridColumn6.VisibleIndex = 5;
            this.gridColumn6.Width = 94;
@@ -476,6 +505,7 @@
            this.gridColumn8.FieldName = "lineName";
            this.gridColumn8.MinWidth = 25;
            this.gridColumn8.Name = "gridColumn8";
            this.gridColumn8.OptionsColumn.ReadOnly = true;
            this.gridColumn8.Visible = true;
            this.gridColumn8.VisibleIndex = 6;
            this.gridColumn8.Width = 94;
@@ -486,6 +516,7 @@
            this.gridColumn9.FieldName = "createBy";
            this.gridColumn9.MinWidth = 25;
            this.gridColumn9.Name = "gridColumn9";
            this.gridColumn9.OptionsColumn.ReadOnly = true;
            this.gridColumn9.Visible = true;
            this.gridColumn9.VisibleIndex = 7;
            this.gridColumn9.Width = 94;
@@ -496,6 +527,7 @@
            this.gridColumn10.FieldName = "createDate";
            this.gridColumn10.MinWidth = 25;
            this.gridColumn10.Name = "gridColumn10";
            this.gridColumn10.OptionsColumn.ReadOnly = true;
            this.gridColumn10.Visible = true;
            this.gridColumn10.VisibleIndex = 8;
            this.gridColumn10.Width = 94;
@@ -506,6 +538,7 @@
            this.gridColumn11.FieldName = "sjWeight";
            this.gridColumn11.MinWidth = 25;
            this.gridColumn11.Name = "gridColumn11";
            this.gridColumn11.OptionsColumn.ReadOnly = true;
            this.gridColumn11.Visible = true;
            this.gridColumn11.VisibleIndex = 9;
            this.gridColumn11.Width = 94;
@@ -516,6 +549,7 @@
            this.gridColumn12.FieldName = "maxWeight";
            this.gridColumn12.MinWidth = 25;
            this.gridColumn12.Name = "gridColumn12";
            this.gridColumn12.OptionsColumn.ReadOnly = true;
            this.gridColumn12.Visible = true;
            this.gridColumn12.VisibleIndex = 10;
            this.gridColumn12.Width = 94;
@@ -526,32 +560,10 @@
            this.gridColumn13.FieldName = "minWeight";
            this.gridColumn13.MinWidth = 25;
            this.gridColumn13.Name = "gridColumn13";
            this.gridColumn13.OptionsColumn.ReadOnly = true;
            this.gridColumn13.Visible = true;
            this.gridColumn13.VisibleIndex = 11;
            this.gridColumn13.Width = 94;
            //
            // layoutControlItem5
            //
            this.layoutControlItem5.Control = this.txtMsg;
            this.layoutControlItem5.Location = new System.Drawing.Point(250, 62);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnIndex = 1;
            this.layoutControlItem5.OptionsTableLayoutItem.ColumnSpan = 2;
            this.layoutControlItem5.OptionsTableLayoutItem.RowIndex = 2;
            this.layoutControlItem5.Size = new System.Drawing.Size(749, 31);
            this.layoutControlItem5.Text = "收列表";
            this.layoutControlItem5.TextSize = new System.Drawing.Size(70, 18);
            //
            // 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);
            // 
            // Frm_Work09
            // 
@@ -578,6 +590,7 @@
            ((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.layoutControlItem5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
@@ -586,10 +599,9 @@
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem9)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
            this.ResumeLayout(false);
        }
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
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;
@@ -19,6 +21,9 @@
        /// 串口类
        /// </summary>
        private SerialPort Sp = new SerialPort();
        /// <summary>
        /// 定时刷新
        /// </summary>
        System.Timers.Timer timer = new System.Timers.Timer(10000);
        public Frm_Work09()
        {
@@ -35,7 +40,31 @@
            };
            GetComList();
            this.comLine.getSuppler("");
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            gvMx1.OptionsFind.ShowSearchNavButtons = false;
            gvMx1.OptionsView.ShowAutoFilterRow = false;
            gvMx1.OptionsView.ShowGroupPanel = false;
            gvMx1.RowStyle += (s, e) =>
            {
                //默认选中行不变色
                gvMx1.OptionsSelection.EnableAppearanceFocusedRow = false;
                //默认选中单元格不变色
                gvMx1.OptionsSelection.EnableAppearanceFocusedCell = false;
                if (e.RowHandle >= 0)
                {
                    DataRow row = gvMx1.GetDataRow(e.RowHandle);
                    if (row == null)
                        return;
                    string colorString = row["bgColor"].ToString(); // 使用十六进制表示颜色的ARGB值
                    Color color = ColorTranslator.FromHtml(colorString);
                    e.Appearance.BackColor = color;
                }
            };
            gvMx1.IndicatorWidth = 60;
            gvMx1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
            };
        }
        /// <summary>