浏览代码

10改造,支持扫码手动绑定

WIN-GH9CEESPLTB\Administrator 1 月之前
父节点
当前提交
ddb09f0ad7

+ 161 - 0
MainForm/FaForm/BandBarodeDialog_S1.Designer.cs

@@ -0,0 +1,161 @@
+namespace MainForm.FaForm
+{
+    partial class BandBarodeDialog_S1
+    {
+        /// <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.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.ProductBarcode = new System.Windows.Forms.TextBox();
+            this.CarrierBarcode = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.ErrorLab = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.GetBarcode = new System.Windows.Forms.TextBox();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.ProductBarcode);
+            this.groupBox1.Controls.Add(this.CarrierBarcode);
+            this.groupBox1.Controls.Add(this.label1);
+            this.groupBox1.Controls.Add(this.label2);
+            this.groupBox1.Location = new System.Drawing.Point(40, 33);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(720, 160);
+            this.groupBox1.TabIndex = 0;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "绑定物料";
+            // 
+            // ProductBarcode
+            // 
+            this.ProductBarcode.Location = new System.Drawing.Point(187, 92);
+            this.ProductBarcode.Name = "ProductBarcode";
+            this.ProductBarcode.ReadOnly = true;
+            this.ProductBarcode.Size = new System.Drawing.Size(441, 28);
+            this.ProductBarcode.TabIndex = 5;
+            // 
+            // CarrierBarcode
+            // 
+            this.CarrierBarcode.Location = new System.Drawing.Point(187, 41);
+            this.CarrierBarcode.Name = "CarrierBarcode";
+            this.CarrierBarcode.ReadOnly = true;
+            this.CarrierBarcode.Size = new System.Drawing.Size(441, 28);
+            this.CarrierBarcode.TabIndex = 6;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(81, 44);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(62, 18);
+            this.label1.TabIndex = 7;
+            this.label1.Text = "载具码";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(81, 95);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(62, 18);
+            this.label2.TabIndex = 8;
+            this.label2.Text = "产品码";
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.ErrorLab);
+            this.groupBox2.Controls.Add(this.label3);
+            this.groupBox2.Controls.Add(this.GetBarcode);
+            this.groupBox2.Location = new System.Drawing.Point(40, 211);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(720, 147);
+            this.groupBox2.TabIndex = 1;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "扫码区域";
+            // 
+            // ErrorLab
+            // 
+            this.ErrorLab.AutoEllipsis = true;
+            this.ErrorLab.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.ErrorLab.ForeColor = System.Drawing.Color.Red;
+            this.ErrorLab.Location = new System.Drawing.Point(187, 82);
+            this.ErrorLab.Name = "ErrorLab";
+            this.ErrorLab.Size = new System.Drawing.Size(513, 45);
+            this.ErrorLab.TabIndex = 9;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(81, 44);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(62, 18);
+            this.label3.TabIndex = 8;
+            this.label3.Text = "二维码";
+            // 
+            // GetBarcode
+            // 
+            this.GetBarcode.Location = new System.Drawing.Point(187, 40);
+            this.GetBarcode.Name = "GetBarcode";
+            this.GetBarcode.Size = new System.Drawing.Size(441, 28);
+            this.GetBarcode.TabIndex = 7;
+            this.GetBarcode.TextChanged += new System.EventHandler(this.GetBarcode_TextChanged);
+            // 
+            // BandBarodeDialog_S1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(800, 370);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Name = "BandBarodeDialog_S1";
+            this.Text = "BandBarodeDialog_S1";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BandBarodeDialog_S1_FormClosing);
+            this.Load += new System.EventHandler(this.BandBarodeDialog_S1_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.TextBox ProductBarcode;
+        private System.Windows.Forms.TextBox CarrierBarcode;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox GetBarcode;
+        private System.Windows.Forms.Label ErrorLab;
+    }
+}

+ 169 - 0
MainForm/FaForm/BandBarodeDialog_S1.cs

@@ -0,0 +1,169 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static MainForm.SQLHelper;
+using ZedGraph;
+using EIP_Protocol;
+using System.Numerics;
+using SqlSugar;
+
+namespace MainForm.FaForm
+{
+    public partial class BandBarodeDialog_S1 : Form
+    {
+        public static bool isNoClose { get; set; }=false;
+
+        //private string _strProductBarcode = "";
+        //private string _CarrierBarcode = "";
+        int plcNo = 1;
+        string stationCode = "[OP10]";
+        string stationName = "壳体清洁上料";
+        string tagBaseName = "g_OP10_MES"; //标签变量名称
+        string tagMesCommName = "mesCommToPC"; //标签变量名称
+        string tagBarsetName = "BarcodeSet";
+
+        OP10_MesData_t stPLC_MesData; //PLC的MES数据
+
+        private Timer _inputTimer;
+        Form_Home home=new Form_Home();
+
+        public BandBarodeDialog_S1()
+        {
+            InitializeComponent();
+        }
+
+
+        private void BandBarodeDialog_S1_Load(object sender, EventArgs e)
+        {
+            // 初始化定时器
+            _inputTimer = new Timer();
+            _inputTimer.Interval = 500; // 500毫秒
+            _inputTimer.Tick += InputTimer_Tick;
+
+            // 绑定 TextChanged 事件
+            //GetBarcode.TextChanged += GetBarcode_TextChanged;
+
+            //Form_Home.StopWhile = true;
+
+            home.FunsEip.Add(GlobalContext.IsUsePLCNow,
+                        new Inovance_EIP(GlobalContext.PC1Address, GlobalContext.Machine1Address)); //OP10 壳体清洁上料装备
+
+            foreach (Inovance_EIP plcEIP in home.FunsEip.Values)
+            {
+                if (plcEIP != null)
+                {
+                    try
+                    {
+                        (int, string) result = plcEIP.Connect();
+                    }
+                    catch (Exception ex)
+                    {
+                        MessageBox.Show($"PLC[{plcEIP._pcIPStr}]连接失败!失败信息:" + ex.Message,
+                            "PLC连接提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
+                            MessageBoxOptions.ServiceNotification);
+                    }
+                }
+            }
+            List<Task> TaskReadProcess = new List<Task>(); // 线程-触发点位(PLC)的线程
+            TaskReadProcess.Add(new Task(() => { ReadStation(); })); //OP10 壳体清洁上料装备
+                                                                     // 开启PLC的业务处理线程-监听PLC点位+状态
+            foreach (Task task in TaskReadProcess)
+            {
+                if (task != null)
+                    task.Start();
+            }
+        }
+
+        private void InputTimer_Tick(object sender, EventArgs e)
+        {
+            int nRet = 0;
+            string strRet = "";
+            string stationNameStr = stationCode + stationName;
+
+            // 定时器触发,表示输入已经完成
+            _inputTimer.Stop();
+            GetBarcode.Focus();
+
+            //收到PLC确认反馈,关闭弹窗
+            if (isNoClose) { 
+                closeWin();
+            }
+
+            // 处理条码
+            string Barcode = GetBarcode.Text.Trim();
+            if (!string.IsNullOrEmpty(Barcode))
+            {
+                if (Barcode.Length > 9)
+                    ProductBarcode.Text = Barcode;
+                else 
+                    CarrierBarcode.Text= Barcode;
+
+                Form_Home._strProductBarcode = ProductBarcode.Text.Trim();
+                Form_Home._strCarrierBarcode = CarrierBarcode.Text.Trim();
+
+                GetBarcode.Text = "";
+            }
+            if (!string.IsNullOrEmpty(ProductBarcode.Text) && !string.IsNullOrEmpty(CarrierBarcode.Text))
+            {
+                CommandFromPLC CommandToPlC = new CommandFromPLC();
+                CommandToPlC.cmd = 0;
+                CommandToPlC.cmdParam = 0;
+                CommandToPlC.cmdResult = 1;
+                (nRet, strRet) = home.WriteResultToPlc(plcNo, stationNameStr, tagBaseName + "." + tagMesCommName, 1, CommandToPlC);
+
+                if (nRet != 0)
+                {
+                    ErrorLab.Text = $"PLC写入失败!失败原因:" + strRet;
+                }
+                else
+                {
+                    ErrorLab.Text = $"扫码完成,请点击下方设备屏幕上确认按键!";
+                }
+            }
+
+        }
+
+
+        private void GetBarcode_TextChanged(object sender, EventArgs e)
+        {
+            // 每次文本变化时重置定时器
+            _inputTimer.Stop();
+            _inputTimer.Start();
+        }
+
+        private void closeWin()
+        {
+            this.DialogResult = DialogResult.OK;
+            //Form_Home.StopWhile = false;
+            this.Close();
+        }
+
+        private void BandBarodeDialog_S1_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            //Form_Home.StopWhile = false;
+        }
+
+        private void ReadStation() {
+            while (true)
+            {
+                (int, string) result = home.FunsEip[plcNo]
+                            .Read_SingleTag<OP10_MesData_t>(tagBaseName, 1, out stPLC_MesData, this); //读取单个结构体数据
+                if (result.Item1==0)
+                {
+                    if (stPLC_MesData.mesCommFrmPLC.cmdParam==2)
+                    {
+                        closeWin();
+                    };
+                }
+
+            }
+        }
+    }
+
+}

+ 120 - 0
MainForm/FaForm/BandBarodeDialog_S1.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>

+ 74 - 32
MainForm/FaForm/Form_Home.cs

@@ -156,7 +156,7 @@ namespace MainForm
         /// </summary>
         /// </summary>
         private Dictionary<string, List<Alarm>> DicAlarms_Cur = new Dictionary<string, List<Alarm>>();
         private Dictionary<string, List<Alarm>> DicAlarms_Cur = new Dictionary<string, List<Alarm>>();
 
 
-        Dictionary<int, Inovance_EIP> FunsEip = new Dictionary<int, Inovance_EIP>();
+        public Dictionary<int, Inovance_EIP> FunsEip = new Dictionary<int, Inovance_EIP>();
 
 
         /// <summary>
         /// <summary>
         /// 单机用-设备状态
         /// 单机用-设备状态
@@ -1117,6 +1117,8 @@ namespace MainForm
         private static int res = 0;
         private static int res = 0;
         public static bool StopWhile =false; //二维码弹窗后停止循环
         public static bool StopWhile =false; //二维码弹窗后停止循环
         public static bool inStationPass = true;  //过站结果,保存进站结果
         public static bool inStationPass = true;  //过站结果,保存进站结果
+        public static string _strProductBarcode = "";
+        public static string _strCarrierBarcode = "";
 
 
         public void ConnectToIOT()
         public void ConnectToIOT()
         {
         {
@@ -3182,6 +3184,8 @@ namespace MainForm
                         continue;
                         continue;
                     }
                     }
 
 
+                   
+
                     if (FunsEip[plcNo].IsConnected) // 检查PLC是否已连接上
                     if (FunsEip[plcNo].IsConnected) // 检查PLC是否已连接上
                     {
                     {
                         Stopwatch stopwatch1 = new Stopwatch();
                         Stopwatch stopwatch1 = new Stopwatch();
@@ -3201,6 +3205,10 @@ namespace MainForm
                         }
                         }
                         else
                         else
                         {
                         {
+                            //测试数据
+                            //stPLC_MesData.mesCommFrmPLC.cmdParam = 1;
+
+
                             //richTextBox1.AppendText("\n" + "读取成功");
                             //richTextBox1.AppendText("\n" + "读取成功");
                             stPLC_MesData.BarcodeSet.strProductBarcode =
                             stPLC_MesData.BarcodeSet.strProductBarcode =
                                 FormatStrbyPLC(stPLC_MesData.BarcodeSet.strProductBarcode);
                                 FormatStrbyPLC(stPLC_MesData.BarcodeSet.strProductBarcode);
@@ -3225,36 +3233,69 @@ namespace MainForm
                             s1PLCData["a1OEEType"] = stPLC_MesData.iotData.beatAction;
                             s1PLCData["a1OEEType"] = stPLC_MesData.iotData.beatAction;
                             //报警信息
                             //报警信息
                             _FaultDatas = stPLC_MesData.iotData.fault_codes;
                             _FaultDatas = stPLC_MesData.iotData.fault_codes;
+
+                            if (stPLC_MesData.mesCommFrmPLC.cmdParam == 2)
+                            {
+                                BandBarodeDialog_S1.isNoClose=true;
+                            }
                         }
                         }
 
 
                         #endregion 一次性读取所有数据
                         #endregion 一次性读取所有数据
 
 
                         stopwatch2.Stop();
                         stopwatch2.Stop();
 
 
-                        #region 进站
+                        #region 扫码
+                        //弹窗期间跳过循环
+                        //if (StopWhile)
+                        //{
+                        //    continue;
+                        //}
 
 
-                        try
+                        if (stPLC_MesData.mesCommFrmPLC.cmdParam==1)
                         {
                         {
-                            if (OpenDailogFalg)
+                            using (var dialog = new BandBarodeDialog_S1())
                             {
                             {
-                                using (var dialog = new BandBarodeDialog(strCarrierBarcode, ProductBarcode, PCBBarcode))
+                                var rs = dialog.ShowDialog();
+                                if (rs == DialogResult.OK)
                                 {
                                 {
-                                    var rs = dialog.ShowDialog();
-                                    if (rs == DialogResult.OK)
+                                    //绑定载具和产品
+                                    ResponseMessage message = new ResponseMessage();
+
+                                    message = SQLHelper.InsertCarrierBind(_strCarrierBarcode, _strProductBarcode);
+                                    if (message.result == false)
                                     {
                                     {
-                                        AddMessage(LogType.Info, $"扫码校验通过,载具码:{strCarrierBarcode}");
-                                        OpenDailogFalg = false; //关闭扫码
-                                        StopWhile = false;//开启while循环
+                                        AddMessage(LogType.Error, stationNameStr + "_载具码与产品码绑定失败,错误:" + message.text);
+
+                                        CommandFromPLC CommandToPlC = new CommandFromPLC();
+                                        CommandToPlC.cmd = 0;
+                                        CommandToPlC.cmdParam = 0;
+                                        CommandToPlC.cmdResult = 110;
+                                        WriteResultToPlc(plcNo, stationNameStr, tagBaseName + "." + tagMesCommName, 1, CommandToPlC);
+                                        return;
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {
-                                        ProgressState = false;
-                                        return;
+                                        AddMessage(LogType.Error, stationNameStr + "_载具码与产品码绑定成功");
+
+                                        CommandFromPLC CommandToPlC = new CommandFromPLC();
+                                        CommandToPlC.cmd = 0;
+                                        CommandToPlC.cmdParam = 0;
+                                        CommandToPlC.cmdResult = 1;
+                                        WriteResultToPlc(plcNo, stationNameStr, tagBaseName + "." + tagMesCommName, 1, CommandToPlC);
                                     }
                                     }
+                                    AddMessage(LogType.Info, $"载具码:{_strCarrierBarcode},产品码:{_strProductBarcode}");
+                                    _strCarrierBarcode = "";
+                                    _strProductBarcode = "";
+                                    //StopWhile = false;//开启while循环
                                 }
                                 }
                             }
                             }
+                        }
+                        #endregion
 
 
+                        #region 进站
 
 
+                        try
+                        {
                             if (stPLC_MesData.mesCommFrmPLC.cmd == (byte)eMesCmd.InStation)
                             if (stPLC_MesData.mesCommFrmPLC.cmd == (byte)eMesCmd.InStation)
                             {
                             {
                                 lock (lockObj)
                                 lock (lockObj)
@@ -4146,7 +4187,7 @@ namespace MainForm
                         else
                         else
                         {
                         {
                             //测试数据
                             //测试数据
-                            //stPLC_MesData.Left.mesCommFrmPLC.cmd = 2;
+                            //stPLC_MesData.Left.mesCommFrmPLC.cmdParam = 1;
                             //stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
                             //stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
                             //stPLC_MesData.Left.BarcodeSet.strPCBBarcode = "A1507V000239";
                             //stPLC_MesData.Left.BarcodeSet.strPCBBarcode = "A1507V000239";
                             //stPLC_MesData.Left.iotData.beatAction = 1;
                             //stPLC_MesData.Left.iotData.beatAction = 1;
@@ -6059,24 +6100,6 @@ namespace MainForm
                     return;
                     return;
                 }
                 }
                 sn = ProductBarcode;
                 sn = ProductBarcode;
-                if (OpenDailogFalg)
-                {
-                    using (var dialog = new BandBarodeDialog(strCarrierBarcode, ProductBarcode, PCBBarcode))
-                    {
-                        var rs = dialog.ShowDialog();
-                        if (rs == DialogResult.OK)
-                        {
-                            AddMessage(LogType.Info, $"扫码校验通过,载具码:{strCarrierBarcode}");
-                            OpenDailogFalg = false; //关闭扫码
-                            StopWhile = false;//开启while循环
-                        }
-                        else
-                        {
-                            ProgressState = false;
-                            return;
-                        }
-                    }
-                }
                 AddMessage(LogType.Info, $"载具码:{strCarrierBarcode};产品码:{sn}");
                 AddMessage(LogType.Info, $"载具码:{strCarrierBarcode};产品码:{sn}");
 
 
                 // 产品SN(物料码)校验
                 // 产品SN(物料码)校验
@@ -6093,6 +6116,25 @@ namespace MainForm
                     if (a1Result == 1)
                     if (a1Result == 1)
                     {
                     {
                         mesResultFrmWeb = 1;
                         mesResultFrmWeb = 1;
+
+                        if (OpenDailogFalg)
+                        {
+                            using (var dialog = new BandBarodeDialog(strCarrierBarcode, ProductBarcode, PCBBarcode))
+                            {
+                                var rs = dialog.ShowDialog();
+                                if (rs == DialogResult.OK)
+                                {
+                                    AddMessage(LogType.Info, $"扫码校验通过,载具码:{strCarrierBarcode}");
+                                    OpenDailogFalg = false; //关闭扫码
+                                    StopWhile = false;//开启while循环
+                                }
+                                else
+                                {
+                                    ProgressState = false;
+                                    return;
+                                }
+                            }
+                        }
                     }
                     }
                     else
                     else
                     {
                     {
@@ -14135,7 +14177,7 @@ namespace MainForm
         /// </summary>
         /// </summary>
         /// <param name="logType">日志类型</param>
         /// <param name="logType">日志类型</param>
         /// <param name="message">日志内容</param>
         /// <param name="message">日志内容</param>
-        private void OnMessage(LogType logType, string msg)
+        public void OnMessage(LogType logType, string msg)
         {
         {
             MessageEvent?.Invoke(logType, msg);
             MessageEvent?.Invoke(logType, msg);
         }
         }

+ 1 - 1
MainForm/FaForm/Form_Home_SaveData.cs

@@ -985,7 +985,7 @@ namespace MainForm
                         if (result == 0)
                         if (result == 0)
                             OnMessage(LogType.Info, stationNameStr + $"_异步上传Iot节拍数据[SN:{oEEPartNo}]成功!iot接口返回结果:{msg}");
                             OnMessage(LogType.Info, stationNameStr + $"_异步上传Iot节拍数据[SN:{oEEPartNo}]成功!iot接口返回结果:{msg}");
                         else
                         else
-                            AddMessage(LogType.Info, stationNameStr + $"_异步上传Iot节拍数据[SN:{oEEPartNo}]失败!iot接口返回结果:{msg}");
+                        OnMessage(LogType.Info, stationNameStr + $"_异步上传Iot节拍数据[SN:{oEEPartNo}]失败!iot接口返回结果:{msg}");
                     }
                     }
                     catch (Exception ex)
                     catch (Exception ex)
                     {
                     {

+ 9 - 0
MainForm/MainForm.csproj

@@ -312,6 +312,12 @@
     <Compile Include="FaForm\BandBarodeDialog.Designer.cs">
     <Compile Include="FaForm\BandBarodeDialog.Designer.cs">
       <DependentUpon>BandBarodeDialog.cs</DependentUpon>
       <DependentUpon>BandBarodeDialog.cs</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="FaForm\BandBarodeDialog_S1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FaForm\BandBarodeDialog_S1.Designer.cs">
+      <DependentUpon>BandBarodeDialog_S1.cs</DependentUpon>
+    </Compile>
     <Compile Include="FaForm\Form_DevAlarm.cs">
     <Compile Include="FaForm\Form_DevAlarm.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
     </Compile>
     </Compile>
@@ -432,6 +438,9 @@
     <EmbeddedResource Include="FaForm\BandBarodeDialog.resx">
     <EmbeddedResource Include="FaForm\BandBarodeDialog.resx">
       <DependentUpon>BandBarodeDialog.cs</DependentUpon>
       <DependentUpon>BandBarodeDialog.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
+    <EmbeddedResource Include="FaForm\BandBarodeDialog_S1.resx">
+      <DependentUpon>BandBarodeDialog_S1.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FaForm\Form_DevAlarm.resx">
     <EmbeddedResource Include="FaForm\Form_DevAlarm.resx">
       <DependentUpon>Form_DevAlarm.cs</DependentUpon>
       <DependentUpon>Form_DevAlarm.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>