callm пре 2 дана
родитељ
комит
1c1ac8ddc6

+ 18 - 0
UAS_MES_ZDXW/.workbuddy/memory/2026-10-09.md

@@ -0,0 +1,18 @@
+## 2026-10-09 工作日志
+
+### 新增 Make_GetTestData 界面
+- 在 FunctionCode/Make/ 下新增 Make_GetTestData 界面三件套(.cs / .Designer.cs / .resx)
+- 界面功能:扫描SN -> CheckStepSNAndMacode校验 -> 通过SCPI协议从台式电桥(ET35)获取测试数据 -> 插入STEPTESTDETAIL表 -> SetStepResult过站
+- 串口配置:SerialPortCombox选COM口 + ComboBox选波特率(默认9600)
+- SCPI通讯:发送*TRG触发测量 -> FETCh?获取数据 -> FUNCtion?获取测量功能名
+- 已注册到csproj(Compile x2 + EmbeddedResource x1)
+- 参考模板:Make_GetTestFileData(STEPTESTDETAIL插入), Make_CollectElec(SN扫码交互), SystemSetting_ScaleTest(SerialPortCombox用法)
+- 通讯协议来源:台式电桥SCPI通讯协议v1.03.doc
+
+### 扩展串口参数到界面
+- 在Designer中增加DataBits/Parity/StopBits/Handshake四个ComboBox及对应Label
+- 串口设置分两行布局:第一行(串口/波特率/数据位/校验位),第二行(停止位/流控)
+- .cs中新增CreateSerialPort()辅助方法,统一从界面读取所有串口参数,消除GetTestDataFromBridge和GetFunctionName中的重复代码
+- Load事件中默认选中:9600/8/None/1/None(SCPI协议默认值)
+- OperateResult高度从300调整为260以容纳新增控件
+

+ 396 - 0
UAS_MES_ZDXW/FunctionCode/Make/Make_GetTestData.Designer.cs

@@ -0,0 +1,396 @@
+namespace UAS_MES_NEW.Make
+{
+    partial class Make_GetTestData
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.pr_detail_label = new System.Windows.Forms.Label();
+            this.sncode_label = new System.Windows.Forms.Label();
+            this.pr_code_label = new System.Windows.Forms.Label();
+            this.ms_makecode_label = new System.Windows.Forms.Label();
+            this.com_label = new System.Windows.Forms.Label();
+            this.baudrate_label = new System.Windows.Forms.Label();
+            this.databits_label = new System.Windows.Forms.Label();
+            this.parity_label = new System.Windows.Forms.Label();
+            this.stopbits_label = new System.Windows.Forms.Label();
+            this.handshake_label = new System.Windows.Forms.Label();
+            this.StepCount = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SourceStepCount();
+            this.ms_makecode = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.ms_prodcode = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.pr_detail = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.ComList = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.SerialPortCombox();
+            this.BaudRate = new System.Windows.Forms.ComboBox();
+            this.DataBits = new System.Windows.Forms.ComboBox();
+            this.Parity = new System.Windows.Forms.ComboBox();
+            this.StopBits = new System.Windows.Forms.ComboBox();
+            this.Handshake = new System.Windows.Forms.ComboBox();
+            this.sncode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.SuspendLayout();
+            // 
+            // pr_detail_label
+            // 
+            this.pr_detail_label.AutoSize = true;
+            this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail_label.Location = new System.Drawing.Point(904, 44);
+            this.pr_detail_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail_label.Name = "pr_detail_label";
+            this.pr_detail_label.Size = new System.Drawing.Size(146, 41);
+            this.pr_detail_label.TabIndex = 211;
+            this.pr_detail_label.Text = "产品名称";
+            // 
+            // sncode_label
+            // 
+            this.sncode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.sncode_label.AutoSize = true;
+            this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.sncode_label.Location = new System.Drawing.Point(28, 900);
+            this.sncode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.sncode_label.Name = "sncode_label";
+            this.sncode_label.Size = new System.Drawing.Size(114, 41);
+            this.sncode_label.TabIndex = 210;
+            this.sncode_label.Text = "录入框";
+            // 
+            // pr_code_label
+            // 
+            this.pr_code_label.AutoSize = true;
+            this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_code_label.Location = new System.Drawing.Point(472, 44);
+            this.pr_code_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_code_label.Name = "pr_code_label";
+            this.pr_code_label.Size = new System.Drawing.Size(146, 41);
+            this.pr_code_label.TabIndex = 205;
+            this.pr_code_label.Text = "产品编号";
+            // 
+            // ms_makecode_label
+            // 
+            this.ms_makecode_label.AutoSize = true;
+            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_makecode_label.Location = new System.Drawing.Point(12, 44);
+            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ms_makecode_label.Name = "ms_makecode_label";
+            this.ms_makecode_label.Size = new System.Drawing.Size(146, 41);
+            this.ms_makecode_label.TabIndex = 204;
+            this.ms_makecode_label.Text = "工单编号";
+            // 
+            // com_label
+            // 
+            this.com_label.AutoSize = true;
+            this.com_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.com_label.Location = new System.Drawing.Point(28, 764);
+            this.com_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.com_label.Name = "com_label";
+            this.com_label.Size = new System.Drawing.Size(82, 41);
+            this.com_label.TabIndex = 220;
+            this.com_label.Text = "串口";
+            // 
+            // baudrate_label
+            // 
+            this.baudrate_label.AutoSize = true;
+            this.baudrate_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.baudrate_label.Location = new System.Drawing.Point(392, 764);
+            this.baudrate_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.baudrate_label.Name = "baudrate_label";
+            this.baudrate_label.Size = new System.Drawing.Size(114, 41);
+            this.baudrate_label.TabIndex = 222;
+            this.baudrate_label.Text = "波特率";
+            // 
+            // databits_label
+            // 
+            this.databits_label.AutoSize = true;
+            this.databits_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.databits_label.Location = new System.Drawing.Point(712, 764);
+            this.databits_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.databits_label.Name = "databits_label";
+            this.databits_label.Size = new System.Drawing.Size(114, 41);
+            this.databits_label.TabIndex = 224;
+            this.databits_label.Text = "数据位";
+            // 
+            // parity_label
+            // 
+            this.parity_label.AutoSize = true;
+            this.parity_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.parity_label.Location = new System.Drawing.Point(968, 764);
+            this.parity_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.parity_label.Name = "parity_label";
+            this.parity_label.Size = new System.Drawing.Size(114, 41);
+            this.parity_label.TabIndex = 226;
+            this.parity_label.Text = "校验位";
+            // 
+            // stopbits_label
+            // 
+            this.stopbits_label.AutoSize = true;
+            this.stopbits_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.stopbits_label.Location = new System.Drawing.Point(28, 832);
+            this.stopbits_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.stopbits_label.Name = "stopbits_label";
+            this.stopbits_label.Size = new System.Drawing.Size(114, 41);
+            this.stopbits_label.TabIndex = 228;
+            this.stopbits_label.Text = "停止位";
+            // 
+            // handshake_label
+            // 
+            this.handshake_label.AutoSize = true;
+            this.handshake_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.handshake_label.Location = new System.Drawing.Point(392, 832);
+            this.handshake_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.handshake_label.Name = "handshake_label";
+            this.handshake_label.Size = new System.Drawing.Size(82, 41);
+            this.handshake_label.TabIndex = 230;
+            this.handshake_label.Text = "流控";
+            // 
+            // StepCount
+            // 
+            this.StepCount.LineCode = null;
+            this.StepCount.Location = new System.Drawing.Point(912, 140);
+            this.StepCount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.StepCount.Name = "StepCount";
+            this.StepCount.Size = new System.Drawing.Size(160, 44);
+            this.StepCount.Source = null;
+            this.StepCount.StepCode = null;
+            this.StepCount.TabIndex = 200;
+            // 
+            // ms_makecode
+            // 
+            this.ms_makecode.AutoSize = true;
+            this.ms_makecode.CutLength = null;
+            this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_makecode.Location = new System.Drawing.Point(184, 44);
+            this.ms_makecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_makecode.MaximumSize = new System.Drawing.Size(400, 0);
+            this.ms_makecode.Name = "ms_makecode";
+            this.ms_makecode.Size = new System.Drawing.Size(0, 41);
+            this.ms_makecode.TabIndex = 218;
+            // 
+            // ms_prodcode
+            // 
+            this.ms_prodcode.AutoSize = true;
+            this.ms_prodcode.CutLength = null;
+            this.ms_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_prodcode.Location = new System.Drawing.Point(636, 44);
+            this.ms_prodcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ms_prodcode.MaximumSize = new System.Drawing.Size(400, 0);
+            this.ms_prodcode.Name = "ms_prodcode";
+            this.ms_prodcode.Size = new System.Drawing.Size(0, 41);
+            this.ms_prodcode.TabIndex = 213;
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.AutoSize = true;
+            this.pr_detail.CutLength = null;
+            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail.Location = new System.Drawing.Point(1084, 44);
+            this.pr_detail.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail.MaximumSize = new System.Drawing.Size(400, 0);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 41);
+            this.pr_detail.TabIndex = 212;
+            // 
+            // ComList
+            // 
+            this.ComList.Location = new System.Drawing.Point(124, 756);
+            this.ComList.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.ComList.Name = "ComList";
+            this.ComList.Size = new System.Drawing.Size(240, 56);
+            this.ComList.TabIndex = 221;
+            // 
+            // BaudRate
+            // 
+            this.BaudRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.BaudRate.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BaudRate.FormattingEnabled = true;
+            this.BaudRate.Items.AddRange(new object[] {
+            "9600",
+            "19200",
+            "38400",
+            "57600",
+            "115200"});
+            this.BaudRate.Location = new System.Drawing.Point(520, 756);
+            this.BaudRate.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.BaudRate.Name = "BaudRate";
+            this.BaudRate.Size = new System.Drawing.Size(156, 49);
+            this.BaudRate.TabIndex = 223;
+            // 
+            // DataBits
+            // 
+            this.DataBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.DataBits.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.DataBits.FormattingEnabled = true;
+            this.DataBits.Items.AddRange(new object[] {
+            "8",
+            "7",
+            "6",
+            "5"});
+            this.DataBits.Location = new System.Drawing.Point(840, 756);
+            this.DataBits.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.DataBits.Name = "DataBits";
+            this.DataBits.Size = new System.Drawing.Size(96, 49);
+            this.DataBits.TabIndex = 225;
+            // 
+            // Parity
+            // 
+            this.Parity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.Parity.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Parity.FormattingEnabled = true;
+            this.Parity.Items.AddRange(new object[] {
+            "None",
+            "Odd",
+            "Even",
+            "Mark",
+            "Space"});
+            this.Parity.Location = new System.Drawing.Point(1096, 756);
+            this.Parity.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.Parity.Name = "Parity";
+            this.Parity.Size = new System.Drawing.Size(176, 49);
+            this.Parity.TabIndex = 227;
+            // 
+            // StopBits
+            // 
+            this.StopBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.StopBits.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.StopBits.FormattingEnabled = true;
+            this.StopBits.Items.AddRange(new object[] {
+            "1",
+            "1.5",
+            "2"});
+            this.StopBits.Location = new System.Drawing.Point(160, 824);
+            this.StopBits.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.StopBits.Name = "StopBits";
+            this.StopBits.Size = new System.Drawing.Size(96, 49);
+            this.StopBits.TabIndex = 229;
+            // 
+            // Handshake
+            // 
+            this.Handshake.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.Handshake.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Handshake.FormattingEnabled = true;
+            this.Handshake.Items.AddRange(new object[] {
+            "None",
+            "Hardware",
+            "XOnXOff",
+            "Both"});
+            this.Handshake.Location = new System.Drawing.Point(480, 824);
+            this.Handshake.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.Handshake.Name = "Handshake";
+            this.Handshake.Size = new System.Drawing.Size(216, 49);
+            this.Handshake.TabIndex = 231;
+            // 
+            // sncode
+            // 
+            this.sncode.AllPower = "ifall";
+            this.sncode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.sncode.BackColor = System.Drawing.Color.White;
+            this.sncode.ID = null;
+            this.sncode.Location = new System.Drawing.Point(154, 906);
+            this.sncode.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.sncode.Name = "sncode";
+            this.sncode.Power = null;
+            this.sncode.Size = new System.Drawing.Size(388, 35);
+            this.sncode.Str = null;
+            this.sncode.Str1 = null;
+            this.sncode.Str2 = null;
+            this.sncode.TabIndex = 209;
+            this.sncode.Tag = "ifread";
+            this.sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sncode_KeyDown);
+            // 
+            // OperateResult
+            // 
+            this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OperateResult.Location = new System.Drawing.Point(20, 212);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.OperateResult.Name = "OperateResult";
+            this.OperateResult.Size = new System.Drawing.Size(1438, 516);
+            this.OperateResult.TabIndex = 208;
+            this.OperateResult.Text = "";
+            // 
+            // Make_GetTestData
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1482, 980);
+            this.Controls.Add(this.StepCount);
+            this.Controls.Add(this.Handshake);
+            this.Controls.Add(this.handshake_label);
+            this.Controls.Add(this.StopBits);
+            this.Controls.Add(this.stopbits_label);
+            this.Controls.Add(this.Parity);
+            this.Controls.Add(this.parity_label);
+            this.Controls.Add(this.DataBits);
+            this.Controls.Add(this.databits_label);
+            this.Controls.Add(this.BaudRate);
+            this.Controls.Add(this.baudrate_label);
+            this.Controls.Add(this.ComList);
+            this.Controls.Add(this.com_label);
+            this.Controls.Add(this.ms_makecode);
+            this.Controls.Add(this.ms_prodcode);
+            this.Controls.Add(this.pr_detail);
+            this.Controls.Add(this.pr_detail_label);
+            this.Controls.Add(this.sncode_label);
+            this.Controls.Add(this.sncode);
+            this.Controls.Add(this.OperateResult);
+            this.Controls.Add(this.pr_code_label);
+            this.Controls.Add(this.ms_makecode_label);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Name = "Make_GetTestData";
+            this.Tag = "Make!GetTestData";
+            this.Text = "测试数据获取";
+            this.Load += new System.EventHandler(this.Make_GetTestData_Load);
+            this.SizeChanged += new System.EventHandler(this.Make_GetTestData_SizeChanged);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label pr_detail_label;
+        private System.Windows.Forms.Label sncode_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox sncode;
+        private CustomControl.RichText.RichTextAutoBottom OperateResult;
+        private System.Windows.Forms.Label pr_code_label;
+        private System.Windows.Forms.Label ms_makecode_label;
+        private CustomControl.ValueLabel.ValueLabel ms_makecode;
+        private CustomControl.ValueLabel.ValueLabel ms_prodcode;
+        private CustomControl.ValueLabel.ValueLabel pr_detail;
+        private CustomControl.TextBoxWithIcon.SourceStepCount StepCount;
+        private System.Windows.Forms.Label com_label;
+        private CustomControl.ComBoxWithFocus.SerialPortCombox ComList;
+        private System.Windows.Forms.Label baudrate_label;
+        private System.Windows.Forms.ComboBox BaudRate;
+        private System.Windows.Forms.Label databits_label;
+        private System.Windows.Forms.ComboBox DataBits;
+        private System.Windows.Forms.Label parity_label;
+        private System.Windows.Forms.ComboBox Parity;
+        private System.Windows.Forms.Label stopbits_label;
+        private System.Windows.Forms.ComboBox StopBits;
+        private System.Windows.Forms.Label handshake_label;
+        private System.Windows.Forms.ComboBox Handshake;
+    }
+}

+ 272 - 0
UAS_MES_ZDXW/FunctionCode/Make/Make_GetTestData.cs

@@ -0,0 +1,272 @@
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.IO.Ports;
+using System.Threading;
+using System.Windows.Forms;
+using UAS_MES_NEW.DataOperate;
+using UAS_MES_NEW.Entity;
+using UAS_MES_NEW.PublicMethod;
+
+namespace UAS_MES_NEW.Make
+{
+    public partial class Make_GetTestData : Form
+    {
+        DataHelper dh;
+        AutoSizeFormClass asc = new AutoSizeFormClass();
+        LogStringBuilder sql = new LogStringBuilder();
+
+        string oErrorMessage = "";
+        string oMakeCode = "";
+        string oMsID = "";
+
+        public Make_GetTestData()
+        {
+            InitializeComponent();
+        }
+
+        private void Make_GetTestData_Load(object sender, EventArgs e)
+        {
+            asc.controllInitializeSize(this);
+            dh = SystemInf.dh;
+            //默认选中串口参数(SCPI协议: 9600/8/N/1/None)
+            BaudRate.SelectedIndex = 0;
+            DataBits.SelectedIndex = 0;
+            Parity.SelectedIndex = 0;
+            StopBits.SelectedIndex = 0;
+            Handshake.SelectedIndex = 0;
+            //聚焦SN输入框
+            sncode.Focus();
+            OperateResult.AppendText(">>请输入SN\n", Color.Black);
+            //初始化工步计数
+            StepCount.StepCode = User.CurrentStepCode;
+            StepCount.Source = User.UserSourceCode;
+            StepCount.LineCode = User.UserLineCode;
+            StepCount.Dh = dh;
+            StepCount.Start();
+        }
+
+        private void Make_GetTestData_SizeChanged(object sender, EventArgs e)
+        {
+            asc.controlAutoSize(this);
+        }
+
+        /// <summary>
+        /// 根据界面设置创建并配置SerialPort
+        /// </summary>
+        private SerialPort CreateSerialPort(int readTimeout = 3000)
+        {
+            int baud = 9600;
+            int.TryParse(BaudRate.Text, out baud);
+            int dataBits = 8;
+            int.TryParse(DataBits.Text, out dataBits);
+
+            System.IO.Ports.Parity parity = System.IO.Ports.Parity.None;
+            switch (Parity.Text)
+            {
+                case "Odd": parity = System.IO.Ports.Parity.Odd; break;
+                case "Even": parity = System.IO.Ports.Parity.Even; break;
+                case "Mark": parity = System.IO.Ports.Parity.Mark; break;
+                case "Space": parity = System.IO.Ports.Parity.Space; break;
+            }
+
+            System.IO.Ports.StopBits stopBits = System.IO.Ports.StopBits.One;
+            switch (StopBits.Text)
+            {
+                case "1.5": stopBits = System.IO.Ports.StopBits.OnePointFive; break;
+                case "2": stopBits = System.IO.Ports.StopBits.Two; break;
+            }
+
+            System.IO.Ports.Handshake handshake = System.IO.Ports.Handshake.None;
+            switch (Handshake.Text)
+            {
+                case "Hardware": handshake = System.IO.Ports.Handshake.RequestToSend; break;
+                case "XOnXOff": handshake = System.IO.Ports.Handshake.XOnXOff; break;
+                case "Both": handshake = System.IO.Ports.Handshake.RequestToSendXOnXOff; break;
+            }
+
+            SerialPort sp = new SerialPort();
+            sp.PortName = ComList.Text;
+            sp.BaudRate = baud;
+            sp.DataBits = dataBits;
+            sp.Parity = parity;
+            sp.StopBits = stopBits;
+            sp.Handshake = handshake;
+            sp.NewLine = "\n";
+            sp.ReadTimeout = readTimeout;
+            sp.WriteTimeout = 1000;
+            return sp;
+        }
+
+        /// <summary>
+        /// 从台式电桥获取测试数据
+        /// 通讯协议: SCPI, 参数由界面设置
+        /// 发送格式: 指令 + 0x0A(换行)
+        /// 返回格式: 以回车换行结尾
+        /// </summary>
+        /// <returns>测量数据字符串, 多个值以逗号分隔; 失败返回空字符串</returns>
+        private string GetTestDataFromBridge()
+        {
+            if (ComList.Text == "")
+            {
+                OperateResult.AppendText("<<请先选择串口\n", Color.Red);
+                return "";
+            }
+
+            SerialPort sp = CreateSerialPort();
+            string result = "";
+            try
+            {
+                sp.Open();
+                //发送触发命令 *TRG
+                sp.WriteLine("*TRG");
+                //等待测量完成
+                Thread.Sleep(500);
+                //发送查询命令 FETCh? 获取测量数据
+                sp.WriteLine("FETCh?");
+                //读取返回数据(以回车换行结尾)
+                result = sp.ReadLine().Trim();
+                sp.Close();
+            }
+            catch (Exception ex)
+            {
+                OperateResult.AppendText("<<串口通讯异常:" + ex.Message + "\n", Color.Red);
+                if (sp.IsOpen)
+                    sp.Close();
+                return "";
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 查询当前测量功能名称
+        /// </summary>
+        private string GetFunctionName()
+        {
+            if (ComList.Text == "")
+                return "";
+            SerialPort sp = CreateSerialPort(2000);
+            string funcName = "";
+            try
+            {
+                sp.Open();
+                sp.WriteLine("FUNCtion?");
+                funcName = sp.ReadLine().Trim();
+                sp.Close();
+            }
+            catch
+            {
+                if (sp.IsOpen)
+                    sp.Close();
+            }
+            return funcName;
+        }
+
+        private void LoadCollectedNum()
+        {
+            sql.Clear();
+            sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,");
+            sql.Append("ma_qty - nvl(mcd_okqty, 0) remain_qty from make left join makecraftdetail on ");
+            sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='" + oMakeCode + "'  and mcd_stepcode='" + User.CurrentStepCode + "'");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            BaseUtil.SetFormValue(Controls, dt);
+        }
+
+        private void sncode_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode != Keys.Enter)
+                return;
+
+            //1) 校验SN非空
+            if (sncode.Text == "")
+            {
+                OperateResult.AppendText("<<输入不能为空\n", Color.Red);
+                return;
+            }
+
+            //2) 校验工步属性
+            if (!LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out oErrorMessage))
+            {
+                OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
+                return;
+            }
+
+            //3) 获取工单信息
+            string oStatus = "";
+            if (!LogicHandler.GetMakeInfo(sncode.Text, out oMakeCode, out oStatus, out oErrorMessage))
+            {
+                if (ms_makecode.Text == "")
+                {
+                    OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
+                    return;
+                }
+            }
+
+            //4) CheckStepSNAndMacode 校验SN与工单
+            if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text == "" ? oMakeCode : ms_makecode.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out oErrorMessage))
+            {
+                //查询并显示工单产品信息
+                sql.Clear();
+                sql.Append("select ms_makecode,ms_prodcode,pr_detail from makeserial left join product on ");
+                sql.Append(" ms_prodcode = pr_code where ms_id = '" + oMsID + "'");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                BaseUtil.SetFormValue(this.Controls, dt);
+                LoadCollectedNum();
+
+                OperateResult.AppendText(">>" + sncode.Text + " SN校验通过, 开始读取台式电桥数据\n", Color.Black);
+
+                //5) 从台式电桥获取测试数据
+                string testData = GetTestDataFromBridge();
+                if (testData == "")
+                {
+                    OperateResult.AppendText(">>未获取到测试数据, 请检查串口连接\n", Color.Red, sncode);
+                    return;
+                }
+
+                OperateResult.AppendText(">>电桥返回数据:" + testData + "\n", Color.Black);
+
+                //6) 解析数据并插入STEPTESTDETAIL
+                //电桥返回数据以逗号分隔多个测量值
+                string[] values = testData.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+                //尝试获取当前测量功能
+                string funcName = GetFunctionName();
+
+                for (int i = 0; i < values.Length; i++)
+                {
+                    string className = funcName != "" ? funcName + (i + 1) : "测量值" + (i + 1);
+                    string testResult = values[i].Trim();
+                    dh.ExecuteSql("insert into STEPTESTDETAIL(std_id,std_sn,std_indate,std_class,std_testtimes,std_testresult,std_badcode) values(STEPTESTDETAIL_seq.nextval,'" + sncode.Text + "',sysdate,'" + className + "','','" + testResult + "','')", "insert");
+                    OperateResult.AppendText(">>" + className + ":" + testResult + "\n", Color.Black);
+                }
+
+                //7) 过站 SetStepResult
+                if (LogicHandler.SetStepResult(oMakeCode, User.UserSourceCode, sncode.Text, "电桥测试", "OK", User.UserCode, out oErrorMessage))
+                {
+                    //提示正确返回时传递的信息
+                    if (oErrorMessage.Contains("AFTERSUCCESS"))
+                        OperateResult.AppendText(">>" + oErrorMessage + "\n");
+                    //刷新工单计数
+                    LoadCollectedNum();
+                    //记录日志
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "电桥测试", "测试数据采集成功", sncode.Text, "");
+                    //SN核对成功
+                    OperateResult.AppendText("<<" + sncode.Text + "测试数据采集完成, 过站成功\n", Color.Green, sncode);
+                    OperateResult.AppendText(">>请输入SN\n", Color.Black);
+                }
+                else
+                {
+                    OperateResult.AppendText(">>过站失败:" + oErrorMessage + "\n", Color.Red, sncode);
+                }
+
+                //清空SN输入框, 准备下一次扫码
+                sncode.Text = "";
+                sncode.Focus();
+            }
+            else
+            {
+                OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
+            }
+        }
+    }
+}

+ 120 - 0
UAS_MES_ZDXW/FunctionCode/Make/Make_GetTestData.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 9 - 0
UAS_MES_ZDXW/UAS_MES_ZDXW.csproj

@@ -585,6 +585,12 @@
     <Compile Include="FunctionCode\Make\Make_GetTestFileData.Designer.cs">
       <DependentUpon>Make_GetTestFileData.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Make\Make_GetTestData.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Make\Make_GetTestData.Designer.cs">
+      <DependentUpon>Make_GetTestData.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Make\Make_ReadWriteInfo.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1363,6 +1369,9 @@
     <EmbeddedResource Include="FunctionCode\Make\Make_GetTestFileData.resx">
       <DependentUpon>Make_GetTestFileData.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Make\Make_GetTestData.resx">
+      <DependentUpon>Make_GetTestData.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Make\Make_ReadWriteInfo.resx">
       <DependentUpon>Make_ReadWriteInfo.cs</DependentUpon>
     </EmbeddedResource>