浏览代码

BUG修改

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

+ 1 - 1
MainForm/ClassFile/Inovance_EIP.cs

@@ -149,7 +149,7 @@ namespace EIP_Protocol
         [MarshalAs(UnmanagedType.I2)]       //节拍返回 1:OK   2:NG   
         [MarshalAs(UnmanagedType.I2)]       //节拍返回 1:OK   2:NG   
         public short beatReturn;
         public short beatReturn;
 
 
-        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]   //一个单独的位代表一个报警32*10=320
+        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]   //一个单独的位代表一个报警32*10=320
         public uint[] fault_codes;
         public uint[] fault_codes;
     }
     }
 
 

+ 24 - 1
MainForm/ClassFile/ProjectClass/SQLHelper.cs

@@ -626,9 +626,32 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
 
 
                 return string.Empty;
                 return string.Empty;
             }
             }
+        }
+        //获取载具绑定的PCB码
 
 
+        public static string GetPCBBarcodeByCarrierCode(string carrierCode)
+        {
+            try
+            {
+                var Carrierdt = Db.Queryable<CarrierBind>()
+                   .Where(x => x.CarrierCode == carrierCode)
+                   .OrderByDescending(x => x.ID)
+                   .Take(1)
+                   .ToList();
+                if (Carrierdt != null && Carrierdt.Count > 0)
+                {
+                    return Carrierdt.First().PCBBarcode;
+                }
+                else
+                {
+                    return string.Empty;
+                }
+            }
+            catch (Exception ex)
+            {
 
 
-
+                return string.Empty;
+            }
         }
         }
 
 
         //载具码和产品码解除绑定关系
         //载具码和产品码解除绑定关系

+ 78 - 40
MainForm/FaForm/BandBarodeDialog.Designer.cs

@@ -28,30 +28,24 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
-            this.button1 = new System.Windows.Forms.Button();
             this.ProductBarcode = new System.Windows.Forms.TextBox();
             this.ProductBarcode = new System.Windows.Forms.TextBox();
             this.CarrierBarcode = new System.Windows.Forms.TextBox();
             this.CarrierBarcode = new System.Windows.Forms.TextBox();
             this.label1 = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
-            this.PCBBarcode = new System.Windows.Forms.TextBox();
+            this.Barcode = new System.Windows.Forms.TextBox();
             this.label3 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.ErrorLab = new System.Windows.Forms.Label();
             this.ErrorLab = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.PCBBarcode = new System.Windows.Forms.TextBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
-            // button1
-            // 
-            this.button1.Location = new System.Drawing.Point(530, 251);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(135, 45);
-            this.button1.TabIndex = 0;
-            this.button1.Text = "取消";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Visible = false;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
-            // 
             // ProductBarcode
             // ProductBarcode
             // 
             // 
-            this.ProductBarcode.Location = new System.Drawing.Point(230, 108);
+            this.ProductBarcode.Location = new System.Drawing.Point(187, 73);
             this.ProductBarcode.Name = "ProductBarcode";
             this.ProductBarcode.Name = "ProductBarcode";
             this.ProductBarcode.ReadOnly = true;
             this.ProductBarcode.ReadOnly = true;
             this.ProductBarcode.Size = new System.Drawing.Size(280, 28);
             this.ProductBarcode.Size = new System.Drawing.Size(280, 28);
@@ -59,7 +53,7 @@
             // 
             // 
             // CarrierBarcode
             // CarrierBarcode
             // 
             // 
-            this.CarrierBarcode.Location = new System.Drawing.Point(230, 47);
+            this.CarrierBarcode.Location = new System.Drawing.Point(187, 22);
             this.CarrierBarcode.Name = "CarrierBarcode";
             this.CarrierBarcode.Name = "CarrierBarcode";
             this.CarrierBarcode.ReadOnly = true;
             this.CarrierBarcode.ReadOnly = true;
             this.CarrierBarcode.Size = new System.Drawing.Size(280, 28);
             this.CarrierBarcode.Size = new System.Drawing.Size(280, 28);
@@ -68,7 +62,7 @@
             // label1
             // label1
             // 
             // 
             this.label1.AutoSize = true;
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(124, 50);
+            this.label1.Location = new System.Drawing.Point(81, 25);
             this.label1.Name = "label1";
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(62, 18);
             this.label1.Size = new System.Drawing.Size(62, 18);
             this.label1.TabIndex = 3;
             this.label1.TabIndex = 3;
@@ -77,68 +71,112 @@
             // label2
             // label2
             // 
             // 
             this.label2.AutoSize = true;
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(124, 111);
+            this.label2.Location = new System.Drawing.Point(81, 76);
             this.label2.Name = "label2";
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(62, 18);
             this.label2.Size = new System.Drawing.Size(62, 18);
             this.label2.TabIndex = 4;
             this.label2.TabIndex = 4;
             this.label2.Text = "产品码";
             this.label2.Text = "产品码";
             // 
             // 
-            // PCBBarcode
+            // Barcode
             // 
             // 
-            this.PCBBarcode.Location = new System.Drawing.Point(230, 172);
-            this.PCBBarcode.Name = "PCBBarcode";
-            this.PCBBarcode.Size = new System.Drawing.Size(280, 28);
-            this.PCBBarcode.TabIndex = 5;
-            this.PCBBarcode.TextChanged += new System.EventHandler(this.PCBBarcode_TextChanged);
+            this.Barcode.Location = new System.Drawing.Point(187, 24);
+            this.Barcode.Name = "Barcode";
+            this.Barcode.Size = new System.Drawing.Size(280, 28);
+            this.Barcode.TabIndex = 5;
+            this.Barcode.TextChanged += new System.EventHandler(this.PCBBarcode_TextChanged);
             // 
             // 
             // label3
             // label3
             // 
             // 
             this.label3.AutoSize = true;
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(133, 175);
+            this.label3.Location = new System.Drawing.Point(81, 27);
             this.label3.Name = "label3";
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(53, 18);
+            this.label3.Size = new System.Drawing.Size(62, 18);
             this.label3.TabIndex = 6;
             this.label3.TabIndex = 6;
-            this.label3.Text = "PCB码";
+            this.label3.Text = "二维码";
             // 
             // 
             // ErrorLab
             // ErrorLab
             // 
             // 
             this.ErrorLab.AutoSize = true;
             this.ErrorLab.AutoSize = true;
             this.ErrorLab.ForeColor = System.Drawing.Color.Red;
             this.ErrorLab.ForeColor = System.Drawing.Color.Red;
-            this.ErrorLab.Location = new System.Drawing.Point(227, 216);
+            this.ErrorLab.Location = new System.Drawing.Point(184, 55);
             this.ErrorLab.Name = "ErrorLab";
             this.ErrorLab.Name = "ErrorLab";
             this.ErrorLab.Size = new System.Drawing.Size(0, 18);
             this.ErrorLab.Size = new System.Drawing.Size(0, 18);
             this.ErrorLab.TabIndex = 7;
             this.ErrorLab.TabIndex = 7;
             // 
             // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(90, 130);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(53, 18);
+            this.label4.TabIndex = 9;
+            this.label4.Text = "PCB码";
+            // 
+            // PCBBarcode
+            // 
+            this.PCBBarcode.Location = new System.Drawing.Point(187, 127);
+            this.PCBBarcode.Name = "PCBBarcode";
+            this.PCBBarcode.ReadOnly = true;
+            this.PCBBarcode.Size = new System.Drawing.Size(280, 28);
+            this.PCBBarcode.TabIndex = 8;
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.label4);
+            this.groupBox1.Controls.Add(this.ProductBarcode);
+            this.groupBox1.Controls.Add(this.PCBBarcode);
+            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(43, 19);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(649, 171);
+            this.groupBox1.TabIndex = 10;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "当前物料";
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.ErrorLab);
+            this.groupBox2.Controls.Add(this.label3);
+            this.groupBox2.Controls.Add(this.Barcode);
+            this.groupBox2.Location = new System.Drawing.Point(43, 196);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(649, 92);
+            this.groupBox2.TabIndex = 11;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "扫码区域";
+            // 
             // BandBarodeDialog
             // BandBarodeDialog
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(725, 328);
-            this.Controls.Add(this.ErrorLab);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.PCBBarcode);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.CarrierBarcode);
-            this.Controls.Add(this.ProductBarcode);
-            this.Controls.Add(this.button1);
+            this.ClientSize = new System.Drawing.Size(725, 300);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.groupBox2);
             this.Name = "BandBarodeDialog";
             this.Name = "BandBarodeDialog";
             this.Text = "BandBarodeDialog";
             this.Text = "BandBarodeDialog";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BandBarodeDialog_FormClosing);
             this.Load += new System.EventHandler(this.BandBarodeDialog_Load);
             this.Load += new System.EventHandler(this.BandBarodeDialog_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
             this.ResumeLayout(false);
             this.ResumeLayout(false);
-            this.PerformLayout();
 
 
         }
         }
 
 
         #endregion
         #endregion
-
-        private System.Windows.Forms.Button button1;
         private System.Windows.Forms.TextBox ProductBarcode;
         private System.Windows.Forms.TextBox ProductBarcode;
         private System.Windows.Forms.TextBox CarrierBarcode;
         private System.Windows.Forms.TextBox CarrierBarcode;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.TextBox PCBBarcode;
+        private System.Windows.Forms.TextBox Barcode;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Label ErrorLab;
         private System.Windows.Forms.Label ErrorLab;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox PCBBarcode;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
     }
     }
 }
 }

+ 14 - 4
MainForm/FaForm/BandBarodeDialog.cs

@@ -16,6 +16,8 @@ namespace MainForm.FaForm
         public string pcbCode { get; private set; }
         public string pcbCode { get; private set; }
         public string _CarrierBarcode { private get;  set; }
         public string _CarrierBarcode { private get;  set; }
         public string _ProductBarcode { private get;  set; }
         public string _ProductBarcode { private get;  set; }
+        public string _PCBBarcode { private get; set; }
+
 
 
         private Timer _inputTimer;
         private Timer _inputTimer;
 
 
@@ -33,7 +35,10 @@ namespace MainForm.FaForm
         {
         {
             CarrierBarcode.Text = _CarrierBarcode;
             CarrierBarcode.Text = _CarrierBarcode;
             ProductBarcode.Text = _ProductBarcode;
             ProductBarcode.Text = _ProductBarcode;
-            PCBBarcode.Text = string.Empty;
+            PCBBarcode.Text = _PCBBarcode;
+            Barcode.Text = string.Empty;
+
+            Form_Home.isNoStop=true;
 
 
             // 初始化定时器
             // 初始化定时器
             _inputTimer = new Timer();
             _inputTimer = new Timer();
@@ -41,7 +46,7 @@ namespace MainForm.FaForm
             _inputTimer.Tick += InputTimer_Tick;
             _inputTimer.Tick += InputTimer_Tick;
 
 
             // 绑定 TextChanged 事件
             // 绑定 TextChanged 事件
-            PCBBarcode.TextChanged += PCBBarcode_TextChanged;
+            Barcode.TextChanged += PCBBarcode_TextChanged;
         }
         }
 
 
         private void button1_Click(object sender, EventArgs e)
         private void button1_Click(object sender, EventArgs e)
@@ -61,7 +66,7 @@ namespace MainForm.FaForm
             // 定时器触发,表示输入已经完成
             // 定时器触发,表示输入已经完成
             _inputTimer.Stop();
             _inputTimer.Stop();
             // 处理条码
             // 处理条码
-            string pcbcode = PCBBarcode.Text.Trim();
+            string pcbcode = Barcode.Text.Trim();
             if (!string.IsNullOrEmpty(pcbcode))
             if (!string.IsNullOrEmpty(pcbcode))
             {
             {
                 var Carrierdt = Db.Queryable<CarrierBind>()
                 var Carrierdt = Db.Queryable<CarrierBind>()
@@ -89,7 +94,12 @@ namespace MainForm.FaForm
         private void MainForm_Shown(object sender, EventArgs e)
         private void MainForm_Shown(object sender, EventArgs e)
         {
         {
             // 将焦点设置到 textBox1
             // 将焦点设置到 textBox1
-            PCBBarcode.Focus();
+            Barcode.Focus();
+        }
+
+        private void BandBarodeDialog_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            Form_Home.isNoStop = false;
         }
         }
     }
     }
 }
 }

+ 420 - 154
MainForm/FaForm/Form_Home.cs

@@ -151,7 +151,7 @@ namespace MainForm
         XiaomiDeviceStateData xmDeviceStateData = new XiaomiDeviceStateData();
         XiaomiDeviceStateData xmDeviceStateData = new XiaomiDeviceStateData();
 
 
         private int test_item_num = 0;//iot 过站数据序号
         private int test_item_num = 0;//iot 过站数据序号
-        private string uuid = "";
+        public static string uuid = "";
         private bool inpass = false;//保存进站测试状态
         private bool inpass = false;//保存进站测试状态
 
 
         public static XiaoMiParm xiaomiParm=new XiaoMiParm();
         public static XiaoMiParm xiaomiParm=new XiaoMiParm();
@@ -225,25 +225,25 @@ namespace MainForm
                 if (GlobalContext.IsUsePLC6)
                 if (GlobalContext.IsUsePLC6)
                 {
                 {
                     GlobalContext.IsUsePLCNow = 6;
                     GlobalContext.IsUsePLCNow = 6;
-                    GlobalContext.IsUseStationName = "[OP60]组上盖板";
+                    GlobalContext.IsUseStationName = "[OP70]组上盖板";
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC6Address, GlobalContext.Machine6Address)); //OP60 顶盖装配
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC6Address, GlobalContext.Machine6Address)); //OP60 顶盖装配
                 }
                 }
                 if (GlobalContext.IsUsePLC7)
                 if (GlobalContext.IsUsePLC7)
                 {
                 {
                     GlobalContext.IsUsePLCNow = 7;
                     GlobalContext.IsUsePLCNow = 7;
-                    GlobalContext.IsUseStationName = "[OP70]上盖板锁螺丝";
+                    GlobalContext.IsUseStationName = "[OP80]上盖板锁螺丝";
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC7Address, GlobalContext.Machine7Address)); //OP70 锁螺丝
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC7Address, GlobalContext.Machine7Address)); //OP70 锁螺丝
                 }
                 }
                 if (GlobalContext.IsUsePLC8)
                 if (GlobalContext.IsUsePLC8)
                 {
                 {
                     GlobalContext.IsUsePLCNow = 8;
                     GlobalContext.IsUsePLCNow = 8;
-                    GlobalContext.IsUseStationName = "[OP80]NG下料";
+                    GlobalContext.IsUseStationName = "[OP90]NG下料";
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC8Address, GlobalContext.Machine8Address)); //OP80 3D螺丝高度检测,NG出料站
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC8Address, GlobalContext.Machine8Address)); //OP80 3D螺丝高度检测,NG出料站
                 }
                 }
                 if (GlobalContext.IsUsePLC9)
                 if (GlobalContext.IsUsePLC9)
                 {
                 {
                     GlobalContext.IsUsePLCNow = 9;
                     GlobalContext.IsUsePLCNow = 9;
-                    GlobalContext.IsUseStationName = "[OP90]半成品下料";
+                    GlobalContext.IsUseStationName = "[OP100]半成品下料";
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC9Address, GlobalContext.Machine9Address)); //OP90 下料站
                     FunsEip.Add(GlobalContext.IsUsePLCNow, new Inovance_EIP(GlobalContext.PC9Address, GlobalContext.Machine9Address)); //OP90 下料站
                 }
                 }
                 (bool,string)DicResult=InitalDicAlarm(); // 实例化报警字典
                 (bool,string)DicResult=InitalDicAlarm(); // 实例化报警字典
@@ -1340,7 +1340,9 @@ namespace MainForm
         private static bool isCollectingFlagLeft;
         private static bool isCollectingFlagLeft;
         private static bool isCollectingFlagRight;
         private static bool isCollectingFlagRight;
         private bool OpenDailogFalg = true;//是否开启扫码弹窗标识
         private bool OpenDailogFalg = true;//是否开启扫码弹窗标识
-        
+        public static bool isNoStop = false;//是否停止循环
+
+
         /// <summary>
         /// <summary>
         /// float[]转为string
         /// float[]转为string
         /// </summary>
         /// </summary>
@@ -1568,7 +1570,7 @@ namespace MainForm
 
 
                         mesRet = $"[{response?.header?.code}]{response?.header?.desc}";
                         mesRet = $"[{response?.header?.code}]{response?.header?.desc}";
                         // 记录失败原因
                         // 记录失败原因
-                        OnMessage(LogType.Error, $"上传出站数据到MES服务器---失败!正在重新上传!请求参数:{json_Body},接口报错信息:" + mesRet);
+                        OnMessage(LogType.Error, $"上传出站数据到MES服务器---失败!正在重新上传!接口报错信息:{mesRet},请求参数:{ json_Body}");
                     }
                     }
 
 
                     if (response?.header?.code == "200")
                     if (response?.header?.code == "200")
@@ -1576,12 +1578,12 @@ namespace MainForm
                         string sql_Upd = stationIn.ToStringUpdateStatusByID(1);
                         string sql_Upd = stationIn.ToStringUpdateStatusByID(1);
                         string ret_Upd = SQLHelper_New.ExecuteNonQuery(sql_Upd, null);
                         string ret_Upd = SQLHelper_New.ExecuteNonQuery(sql_Upd, null);
                         result = ret_Upd == "成功" ? 1 : 6;
                         result = ret_Upd == "成功" ? 1 : 6;
-                        AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---成功,请求参数:{json_Body},返回参数:{resultJson}");
+                        AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---成功,返回参数:{resultJson},请求参数:{json_Body}");
                     }
                     }
                     else
                     else
                     {
                     {
                         result = 5;
                         result = 5;
-                        AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---失败!请求参数:{json_Body},接口报错信息:" + mesRet);
+                        AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---失败!接口报错信息: {mesRet},请求参数:{ json_Body}");
                     }
                     }
 
 
                     string sql_response =
                     string sql_response =
@@ -2703,6 +2705,183 @@ namespace MainForm
             }
             }
         }
         }
 
 
+        private void 通用节拍接口(int plcNo, string stationNameStr, string tagMesCommName, string CarrierBarcode, IoT_DataSet_t iot_data)
+        {
+            Stopwatch stopwatch1 = new Stopwatch();
+            Stopwatch stopwatch2 = new Stopwatch();
+
+            string resultStr = string.Empty;
+            try
+            {
+                stopwatch1.Start();
+                string oEEType = iot_data.BeatAction.ToString(); // 节拍类型(plc写入)
+                string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(CarrierBarcode);//产品SN
+
+                bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
+                if (!actionBool)
+                {
+                    stopwatch2.Start();
+                    //写入PLC
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                    stopwatch2.Stop();
+                    AddMessage(LogType.Info,
+                        stationNameStr + $"_节拍接口-- 设备上传了未识别的节拍类型【{oEEType}】请检查;总用时" + stopwatch1.ElapsedMilliseconds +
+                        "ms;写入用时" + stopwatch2.ElapsedMilliseconds + "ms");
+                    return;
+                }
+                //作业开始后要有物料和载具信息
+                //if (string.IsNullOrEmpty(strProductBarcode) && string.IsNullOrEmpty(CarrierBarcode) &&
+                //    Convert.ToInt32(oEEType) > 2)
+                //{
+                //    stopwatch2.Start();
+                //    //写入PLC
+                //    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                //    iotData.machineState = iot_data.machineState;
+                //    iotData.work_type = iot_data.work_type;
+                //    iotData.testStatus = iot_data.testStatus;
+                //    iotData.BeatAction = iot_data.BeatAction;
+                //    iotData.beatReturn = 2; //NG
+                //    iotData.fault_codes = iot_data.fault_codes;
+                //    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                //    stopwatch2.Stop();
+                //    AddMessage_Station(stationNameStr, LogType.Info,
+                //        stationNameStr + $"_[{CarrierBarcode}][{strProductBarcode}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
+                //        stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
+                //    return;
+                //}
+                //else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(strProductBarcode))
+                //{
+                //    stopwatch2.Start();
+                //    //写入PLC
+                //    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                //    iotData.machineState = iot_data.machineState;
+                //    iotData.work_type = iot_data.work_type;
+                //    iotData.testStatus = iot_data.testStatus;
+                //    iotData.BeatAction = iot_data.BeatAction;
+                //    iotData.beatReturn = 2; //NG
+                //    iotData.fault_codes = iot_data.fault_codes;
+                //    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                //    stopwatch2.Stop();
+                //    AddMessage_Station(stationNameStr, LogType.Info,
+                //        stationNameStr + $"_[{CarrierBarcode}]上传节拍失败!物料码不可为空;总用时" +
+                //        stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
+                //    return;
+                //}
+                //else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(CarrierBarcode))
+                //{
+                //    stopwatch2.Start();
+                //    //写入PLC
+                //    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                //    iotData.machineState = iot_data.machineState;
+                //    iotData.work_type = iot_data.work_type;
+                //    iotData.testStatus = iot_data.testStatus;
+                //    iotData.BeatAction = iot_data.BeatAction;
+                //    iotData.beatReturn = 2; //NG
+                //    iotData.fault_codes = iot_data.fault_codes;
+                //    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                //    stopwatch2.Stop();
+                //    AddMessage_Station(stationNameStr, LogType.Info,
+                //        stationNameStr + $"_上传节拍失败!载具码不可为空;总用时" +
+                //        stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
+                //    return;
+                //}
+
+                short _result = 0;
+
+                // 上传OEE
+                (short, string) result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
+                _result = result.Item1;
+                resultStr = result.Item2;
+
+                if (_result == 1)
+                {
+                    stopwatch2.Start();
+                    //写入PLC
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 1;//OK
+                    iotData.fault_codes = iot_data.fault_codes;
+                    (int,string) PLCresult= WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                    if (PLCresult.Item1 != 0)
+                    {
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT成功!上传结果:" + resultStr);
+                    }
+                    else { 
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT失敗!上传结果:" + resultStr);
+                    }
+                    stopwatch2.Stop();
+                }
+                else
+                {
+                    stopwatch2.Start();
+                    //写入PLC
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                    if (PLCresult.Item1 != 0)
+                    {
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT成功!上传结果:" + resultStr);
+                    }
+                    else
+                    {
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT失敗!上传结果:" + resultStr);
+                    }
+                    stopwatch2.Stop();
+                    AddMessage_Station(stationNameStr, LogType.Error,
+                        $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + resultStr);
+                }
+
+            }
+            catch (Exception ex)
+            {
+                string str = ex.StackTrace;
+                AddMessage_Station(stationNameStr, LogType.Error,
+                    $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + ex.Message + "异常位置:" +
+                    str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1));
+
+                // MES_Flag
+                stopwatch2.Start();
+                //写入PLC
+                IoT_DataSet_t iotData = new IoT_DataSet_t();
+                iotData.machineState = iot_data.machineState;
+                iotData.work_type = iot_data.work_type;
+                iotData.testStatus = iot_data.testStatus;
+                iotData.BeatAction = iot_data.BeatAction;
+                iotData.beatReturn = 2; //NG
+                iotData.fault_codes = iot_data.fault_codes;
+                (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                if (PLCresult.Item1 != 0)
+                {
+                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT成功!上传结果:" + resultStr);
+                }
+                else
+                {
+                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT失敗!上传结果:" + resultStr);
+                }
+                stopwatch2.Stop();
+            }
+
+            stopwatch1.Stop();
+            AddMessage(LogType.Info,
+                stationNameStr + $"_节拍接口-- {resultStr};总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
+                stopwatch2.ElapsedMilliseconds + "ms");
+        }
+
         #endregion
         #endregion
 
 
         #region S1
         #region S1
@@ -3577,9 +3756,7 @@ namespace MainForm
 
 
             // PLC数据字典 赋值 
             // PLC数据字典 赋值 
             s3PLCData.Add("a3OEEType_left", 0); // 节拍类型(plc写入) 
             s3PLCData.Add("a3OEEType_left", 0); // 节拍类型(plc写入) 
-            s3PLCData.Add("a3OEEPartNo_left", ""); // 物料码(物料码还未绑定载具SN时必填)
             s3PLCData.Add("a3OEEType_right", 0); // 节拍类型(plc写入) 
             s3PLCData.Add("a3OEEType_right", 0); // 节拍类型(plc写入) 
-            s3PLCData.Add("a3OEEPartNo_right", ""); // 物料码(物料码还未绑定载具SN时必填)
 
 
             OP30_MesData_t stPLC_MesData; //PLC的MES数据
             OP30_MesData_t stPLC_MesData; //PLC的MES数据
             (int, string) result;
             (int, string) result;
@@ -3601,9 +3778,6 @@ namespace MainForm
                         stopwatch1.Start();
                         stopwatch1.Start();
                         stopwatch2.Start();
                         stopwatch2.Start();
 
 
-                        stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
-                        stPLC_MesData.Left.iotData.BeatAction = 1;
-
                         #region 一次性读取所有数据
                         #region 一次性读取所有数据
 
 
                         // 一次性读取所有数据
                         // 一次性读取所有数据
@@ -3771,89 +3945,103 @@ namespace MainForm
                         #region 节拍接口
                         #region 节拍接口
                         try
                         try
                         {
                         {
-                            #region 左工位 节拍
-                            int a3OEEType_left = Convert.ToInt32(s3PLCData["a3OEEType_left"]);
-                            int a3OEETypeGOld_left = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_left"]);
-                            //若设备紧急复原后节拍重置
-                            if (a3OEEType_left == 1)
-                            {
-                                a3OEETypeGOld_left = 0;
-                            }
 
 
-                            if (a3OEEType_left != a3OEETypeGOld_left)
+                            #region 左工位 节拍
+                            if (stPLC_MesData.Left.iotData.BeatAction > 0)
                             {
                             {
-                                stationNameStr = stationNameStr + "_Left";
-                                //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
-                                if ((a3OEETypeGOld_left == 1 && a3OEEType_left != 2)  || (a3OEETypeGOld_left == 3 && a3OEEType_left != 4) 
-                                    || (a3OEETypeGOld_left == 5 && a3OEEType_left != 6))
+                                stationCode = "[OP31]";
+                                stationName = "点散热胶装备1";
+                                stationNameStr = stationCode + stationName;
+                                int a3OEEType_left = Convert.ToInt32(s3PLCData["a3OEEType_left"]);
+                                int a3OEETypeGOld_left = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_left"]);
+                                //若设备紧急复原后节拍重置
+                                if (a3OEEType_left == 1)
                                 {
                                 {
-                                    //写入PLC
-                                    IoT_DataSet_t iotData=new IoT_DataSet_t();
-                                    iotData.machineState = stPLC_MesData.Left.iotData.machineState;
-                                    iotData.work_type = stPLC_MesData.Left.iotData.work_type;
-                                    iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
-                                    iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
-                                    iotData.beatReturn = 2; //NG
-                                    iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
-                                    WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, 1, iotData);
-                                    AddMessage(LogType.Info,
-                                        stationNameStr +
-                                        $"_节拍接口-- 设备本次上传节拍[{a3OEEType_left}],未上传节拍[{a3OEETypeGOld_left}]的结束信号,请检查;总用时" +
-                                        stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
-                                        "ms");
-                                    return;
+                                    a3OEETypeGOld_left = 0;
                                 }
                                 }
-                                else
+
+                                if (a3OEEType_left != a3OEETypeGOld_left)
                                 {
                                 {
-                                    Task.Run(() =>
-                                        S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, stPLC_MesData.Left.BarcodeSet.strCarrierBarcode.ToString(),
-                                            stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
+                                    stationNameStr = stationNameStr + "_Left";
+                                    //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
+                                    if ((a3OEETypeGOld_left == 1 && a3OEEType_left != 2) || (a3OEETypeGOld_left == 3 && a3OEEType_left != 4)
+                                        || (a3OEETypeGOld_left == 5 && a3OEEType_left != 6))
+                                    {
+                                        //写入PLC
+                                        IoT_DataSet_t iotData = new IoT_DataSet_t();
+                                        iotData.machineState = stPLC_MesData.Left.iotData.machineState;
+                                        iotData.work_type = stPLC_MesData.Left.iotData.work_type;
+                                        iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
+                                        iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
+                                        iotData.beatReturn = 2; //NG
+                                        iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
+                                        WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, 1, iotData);
+                                        AddMessage(LogType.Info,
+                                            stationNameStr +
+                                            $"_节拍接口-- 设备本次上传节拍[{a3OEEType_left}],未上传节拍[{a3OEETypeGOld_left}]的结束信号,请检查;总用时" +
+                                            stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
+                                            "ms");
+                                        return;
+                                    }
+                                    else
+                                    {
+                                        Task.Run(() =>
+                                            S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, stPLC_MesData.Left.BarcodeSet.strCarrierBarcode.ToString(),
+                                                stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
+                                    }
+                                    s3PLCSignal_Old["a3OEEType_left"] = s3PLCData["a3OEEType_left"];
                                 }
                                 }
-                                s3PLCSignal_Old["a3OEEType_left"] = s3PLCData["a3OEEType_left"];
                             }
                             }
                             #endregion 左工位 节拍
                             #endregion 左工位 节拍
 
 
                             #region 右工位 节拍
                             #region 右工位 节拍
-                            int a3OEEType_right = Convert.ToInt32(s3PLCData["a3OEEType_right"]);
-                            int a3OEETypeGOld_right = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_right"]);
-
-                            //若设备紧急复原后节拍重置
-                            if (a3OEEType_right == 1)
+                            if (stPLC_MesData.Right.iotData.BeatAction > 0)
                             {
                             {
-                                a3OEETypeGOld_right = 0;
-                            }
-
-                            if (a3OEEType_right != a3OEETypeGOld_right)
-                            {
-                                stationNameStr = stationNameStr + "_Right";
-                                //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
-                                if ((a3OEETypeGOld_right == 1 && a3OEEType_right != 2) || (a3OEETypeGOld_right == 3 && a3OEEType_right != 4) ||
-                                    (a3OEETypeGOld_right == 5 && a3OEEType_right != 6))
+                                stationCode = "[OP32]";
+                                stationName = "点散热胶装备2";
+                                stationNameStr = stationCode + stationName;
+                                int a3OEEType_right = Convert.ToInt32(s3PLCData["a3OEEType_right"]);
+                                int a3OEETypeGOld_right = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_right"]);
+
+                                //若设备紧急复原后节拍重置
+                                if (a3OEEType_right == 1)
                                 {
                                 {
-                                    //写入PLC
-                                    IoT_DataSet_t iotData = new IoT_DataSet_t();
-                                    iotData.machineState = stPLC_MesData.Left.iotData.machineState;
-                                    iotData.work_type = stPLC_MesData.Left.iotData.work_type;
-                                    iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
-                                    iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
-                                    iotData.beatReturn = 2; //NG
-                                    iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
-                                    WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName, 1, iotData);
-                                    AddMessage(LogType.Info,
-                                        stationNameStr +
-                                        $"_节拍接口-- 设备本次上传节拍[{a3OEEType_right}],未上传节拍[{a3OEETypeGOld_right}]的结束信号,请检查;总用时" +
-                                        stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
-                                        "ms");
-                                    return;
+                                    a3OEETypeGOld_right = 0;
                                 }
                                 }
-                                else
+
+                                if (a3OEEType_right != a3OEETypeGOld_right)
                                 {
                                 {
-                                    Task.Run(() =>
-                                        S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName, stPLC_MesData.Right.BarcodeSet.strCarrierBarcode,
-                                            stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
+                                    stationNameStr = stationNameStr + "_Right";
+                                    //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
+                                    if ((a3OEETypeGOld_right == 1 && a3OEEType_right != 2) || (a3OEETypeGOld_right == 3 && a3OEEType_right != 4) ||
+                                        (a3OEETypeGOld_right == 5 && a3OEEType_right != 6))
+                                    {
+                                        //写入PLC
+                                        IoT_DataSet_t iotData = new IoT_DataSet_t();
+                                        iotData.machineState = stPLC_MesData.Left.iotData.machineState;
+                                        iotData.work_type = stPLC_MesData.Left.iotData.work_type;
+                                        iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
+                                        iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
+                                        iotData.beatReturn = 2; //NG
+                                        iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
+                                        WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Right." + tagiotComnName, 1, iotData);
+                                        AddMessage(LogType.Info,
+                                            stationNameStr +
+                                            $"_节拍接口-- 设备本次上传节拍[{a3OEEType_right}],未上传节拍[{a3OEETypeGOld_right}]的结束信号,请检查;总用时" +
+                                            stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
+                                            "ms");
+                                        return;
+                                    }
+                                    else
+                                    {
+                                        Task.Run(() =>
+                                            S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagiotComnName, stPLC_MesData.Right.BarcodeSet.strCarrierBarcode,
+                                                stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
+                                    }
+                                    s3PLCSignal_Old["a3OEEType_right"] = s3PLCData["a3OEEType_right"];
                                 }
                                 }
-                                s3PLCSignal_Old["a3OEEType_right"] = s3PLCData["a3OEEType_right"];
                             }
                             }
+                            
                             #endregion 右工位 节拍
                             #endregion 右工位 节拍
                         }
                         }
                         catch (Exception ex)
                         catch (Exception ex)
@@ -4677,16 +4865,17 @@ namespace MainForm
             string tagBaseName = "g_OP50_MES"; //标签变量名称
             string tagBaseName = "g_OP50_MES"; //标签变量名称
             string tagMesCommName = "mesCommToPC"; //标签变量名称
             string tagMesCommName = "mesCommToPC"; //标签变量名称
             string tagAgvCommName = "agvCommFrmPC";
             string tagAgvCommName = "agvCommFrmPC";
+            string tagiotComnName = "iotData";
             string tagBarsetName = "BarcodeSet";
             string tagBarsetName = "BarcodeSet";
 
 
+            string CarrierBarcode = "";
+
             // 触发信号字典
             // 触发信号字典
             //s1PLCSignal_Old.Add("a1OEEPLC_FLAG", 0);             // PLC_FLAG 节拍接口
             //s1PLCSignal_Old.Add("a1OEEPLC_FLAG", 0);             // PLC_FLAG 节拍接口
             s5PLCSignal_Old.Add("a5OEEType", 0); // 节拍类型(plc写入) 
             s5PLCSignal_Old.Add("a5OEEType", 0); // 节拍类型(plc写入) 
 
 
             // PLC数据字典 赋值 
             // PLC数据字典 赋值 
             s5PLCData.Add("a5OEEType", 0); // 节拍类型(plc写入) 
             s5PLCData.Add("a5OEEType", 0); // 节拍类型(plc写入) 
-            s5PLCData.Add("a50EEPartNo", ""); // 物料码(物料码还未绑定载具SN时必填)
-            s5PLCData.Add("a50EEVehicleCode", ""); // 载具SN
 
 
             OP50_MesData_t stPLC_MesData; //PLC的MES数据
             OP50_MesData_t stPLC_MesData; //PLC的MES数据
             (int, string) result;
             (int, string) result;
@@ -4706,9 +4895,14 @@ namespace MainForm
                         Stopwatch stopwatch1 = new Stopwatch();
                         Stopwatch stopwatch1 = new Stopwatch();
                         Stopwatch stopwatch2 = new Stopwatch();
                         Stopwatch stopwatch2 = new Stopwatch();
                         stopwatch1.Start();
                         stopwatch1.Start();
-
                         stopwatch2.Start();
                         stopwatch2.Start();
 
 
+                        //测试
+                        stPLC_MesData.mesCommFrmPLC.cmd = 1;
+                        stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
+                        stPLC_MesData.BarcodeSet.strPCBBarcode = "123456";
+                        stPLC_MesData.iotData.BeatAction = 1;
+
                         #region 一次性读取所有数据
                         #region 一次性读取所有数据
 
 
                         // 一次性读取所有数据
                         // 一次性读取所有数据
@@ -4716,20 +4910,18 @@ namespace MainForm
                             .Read_SingleTag<OP50_MesData_t>(tagBaseName, 1, out stPLC_MesData, this); //读取单个结构体数据
                             .Read_SingleTag<OP50_MesData_t>(tagBaseName, 1, out stPLC_MesData, this); //读取单个结构体数据
                         if (result.Item1 != 0)
                         if (result.Item1 != 0)
                         {
                         {
-                            //richTextBox1.AppendText("\n" + strRet);
+                            
                         }
                         }
                         else
                         else
                         {
                         {
-                            //richTextBox1.AppendText("\n" + "读取成功");
                             //richTextBox1.AppendText("\n" + "读取成功");
                             //richTextBox1.AppendText("\n" + "读取成功");
                             int xmDeviceStateInt = stPLC_MesData.iotData.machineState;
                             int xmDeviceStateInt = stPLC_MesData.iotData.machineState;
                             xmDeviceStateData.left = (xmDeviceStateInt < 0 || xmDeviceStateInt > 7)
                             xmDeviceStateData.left = (xmDeviceStateInt < 0 || xmDeviceStateInt > 7)
                                 ? XiaomiDeviceState.Unknown
                                 ? XiaomiDeviceState.Unknown
                                 : (XiaomiDeviceState)xmDeviceStateInt;
                                 : (XiaomiDeviceState)xmDeviceStateInt;
 
 
-                            s5PLCData["a5OEEPartNo"] = stPLC_MesData.BarcodeSet.strProductBarcode; // 物料码(物料码还未绑定载具SN时必填)
-                            s5PLCData["a5OEEVehicleCode"] = stPLC_MesData.BarcodeSet.strCarrierBarcode; // 载具SN
                             s5PLCData["a5OEEType"] = stPLC_MesData.iotData.BeatAction; // 节拍
                             s5PLCData["a5OEEType"] = stPLC_MesData.iotData.BeatAction; // 节拍
+                            CarrierBarcode=stPLC_MesData.BarcodeSet.strCarrierBarcode.ToString();
                         }
                         }
 
 
                         #endregion 一次性读取所有数据
                         #endregion 一次性读取所有数据
@@ -4800,39 +4992,56 @@ namespace MainForm
                         #region 节拍接口
                         #region 节拍接口
                         try
                         try
                         {
                         {
-                            int a5OEEType = (int)s5PLCData["a5OEEType"];
-                            int a5OEETypeGOld = (int)s5PLCSignal_Old["a5OEEType"];
-                            //若设备紧急复原后节拍重置
-                            if (a5OEEType == 1)
-                            {
-                                a5OEETypeGOld = 0;
-                            }
-
-                            if (a5OEEType != a5OEETypeGOld)
-                            {
-                                //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
-                                if ((a5OEETypeGOld == 1 && a5OEEType != 2) || (a5OEETypeGOld == 3 && a5OEEType != 4) ||
-                                    (a5OEETypeGOld == 5 && a5OEEType != 6))
+                            if (stPLC_MesData.iotData.BeatAction > 0) {
+                                int a5OEEType = Convert.ToInt32(s5PLCData["a5OEEType"]);
+                                int a5OEETypeGOld = Convert.ToInt32(s5PLCSignal_Old["a5OEEType"]);
+                                //若设备紧急复原后节拍重置
+                                if (a5OEEType == 1)
                                 {
                                 {
-                                    //写入PLC
-                                    stPLC_MesData.iotData.beatReturn = 2; //NG
-                                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, stPLC_MesData.iotData);
-                                    AddMessage(LogType.Info,
-                                        stationNameStr +
-                                        $"_节拍接口-- 设备本次上传节拍[{a5OEEType}],未上传节拍[{a5OEETypeGOld}]的结束信号,请检查;总用时" +
-                                        stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
-                                        "ms");
-                                    return;
+                                    a5OEETypeGOld = 0;
                                 }
                                 }
-                                else
+
+                                if (a5OEEType != a5OEETypeGOld)
                                 {
                                 {
-                                    Task.Run(() =>
-                                        S5节拍接口(plcNo, stationNameStr, tagBaseName,
-                                            stPLC_MesData.iotData)); // MreTasks[4].Set();
+                                    //如果上位机告诉PLC NG,PLC节拍会直接跳到4
+                                    if (a5OEETypeGOld == 1 && a5OEEType == 4)
+                                    {
+                                        Task.Run(() =>
+                                            通用节拍接口(plcNo, stationNameStr, tagBaseName + "." + tagiotComnName, CarrierBarcode,
+                                                stPLC_MesData.iotData));
+                                    }
+                                    else 
+                                    {
+                                        //节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
+                                        if ((a5OEETypeGOld == 1 && a5OEEType != 2) || (a5OEETypeGOld == 3 && a5OEEType != 4) ||
+                                        (a5OEETypeGOld == 5 && a5OEEType != 6))
+                                        {
+                                            //写入PLC
+                                            IoT_DataSet_t iotData = new IoT_DataSet_t();
+                                            iotData.machineState = stPLC_MesData.iotData.machineState;
+                                            iotData.work_type = stPLC_MesData.iotData.work_type;
+                                            iotData.testStatus = stPLC_MesData.iotData.testStatus;
+                                            iotData.BeatAction = stPLC_MesData.iotData.BeatAction;
+                                            iotData.beatReturn = 2; //NG
+                                            iotData.fault_codes = stPLC_MesData.iotData.fault_codes;
+                                            WriteResultToPlc(plcNo, stationNameStr, tagBaseName + "." + tagiotComnName, 1, iotData);
+                                            AddMessage(LogType.Info,
+                                                stationNameStr +
+                                                $"_节拍接口-- 设备本次上传节拍[{a5OEEType}],未上传节拍[{a5OEETypeGOld}]的结束信号,请检查;总用时" +
+                                                stopwatch1.ElapsedMilliseconds + "ms;写入用时" + stopwatch2.ElapsedMilliseconds +
+                                                "ms");
+                                            return;
+                                        }
+                                        else
+                                        {
+                                            Task.Run(() => 通用节拍接口(plcNo, stationNameStr, tagBaseName + "." + tagiotComnName, CarrierBarcode,stPLC_MesData.iotData));
+                                        }
+                                    }
+                                  
+                                    s5PLCSignal_Old["a5OEEType"] = s5PLCData["a5OEEType"];
                                 }
                                 }
-
-                                s5PLCSignal_Old["a5OEEType"] = s5PLCData["a5OEEType"];
                             }
                             }
+
                         }
                         }
                         catch (Exception ex)
                         catch (Exception ex)
                         {
                         {
@@ -5093,7 +5302,7 @@ namespace MainForm
             ProgressState = false;
             ProgressState = false;
         }
         }
 
 
-        private void S5节拍接口(int plcNo, string stationNameStr, string tagMesCommName, IoT_DataSet_t iot_data)
+        private void S5节拍接口(int plcNo, string stationNameStr, string tagMesCommName, string CarrierBarcode, IoT_DataSet_t iot_data)
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
@@ -5102,19 +5311,22 @@ namespace MainForm
             try
             try
             {
             {
                 stopwatch1.Start();
                 stopwatch1.Start();
-                string oEEType = ((int)s1PLCData["a5OEEType"]).ToString(); // 节拍类型(plc写入)
-                string a50EEPartNo = (string)s1PLCData["a50EEPartNo"]; // 物料码
-                a50EEPartNo = a50EEPartNo.Replace("\0", "");
-                string a40EEVehicleCode = (string)s1PLCData["a40EEVehicleCode"]; // 载具SN
-                a40EEVehicleCode = a40EEVehicleCode.Replace("\0", "");
+                string oEEType = iot_data.BeatAction.ToString(); // 节拍类型(plc写入)
+                string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(CarrierBarcode);//产品SN
 
 
                 bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
                 bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
                 if (!actionBool)
                 if (!actionBool)
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage(LogType.Info,
                     AddMessage(LogType.Info,
                         stationNameStr + $"_节拍接口-- 设备上传了未识别的节拍类型【{oEEType}】请检查;总用时" + stopwatch1.ElapsedMilliseconds +
                         stationNameStr + $"_节拍接口-- 设备上传了未识别的节拍类型【{oEEType}】请检查;总用时" + stopwatch1.ElapsedMilliseconds +
@@ -5122,48 +5334,66 @@ namespace MainForm
                     return;
                     return;
                 }
                 }
                 //作业开始后要有物料和载具信息
                 //作业开始后要有物料和载具信息
-                if (string.IsNullOrEmpty(a50EEPartNo) && string.IsNullOrEmpty(a40EEVehicleCode) &&
+                if (string.IsNullOrEmpty(strProductBarcode) && string.IsNullOrEmpty(CarrierBarcode) &&
                     Convert.ToInt32(oEEType) > 2)
                     Convert.ToInt32(oEEType) > 2)
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
-                        stationNameStr + $"_[{a40EEVehicleCode}][{a50EEPartNo}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
+                        stationNameStr + $"_[{CarrierBarcode}][{strProductBarcode}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                     return;
                     return;
                 }
                 }
-                else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(a50EEPartNo))
+                else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(strProductBarcode))
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
-                        stationNameStr + $"_[{a40EEVehicleCode}][{a50EEPartNo}]上传节拍失败!物料码不可为空;总用时" +
+                        stationNameStr + $"_[{CarrierBarcode}]上传节拍失败!物料码不可为空;总用时" +
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                     return;
                     return;
                 }
                 }
-                else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(a40EEVehicleCode))
+                else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(CarrierBarcode))
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
-                        stationNameStr + $"_[{a40EEVehicleCode}][{a50EEPartNo}]上传节拍失败!载具码不可为空;总用时" +
+                        stationNameStr + $"_上传节拍失败!载具码不可为空;总用时" +
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                         stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
                     return;
                     return;
                 }
                 }
 
 
                 short _result = 0;
                 short _result = 0;
-                // 上传OEE
-                (short, string) result = SaveOEEData(plcNo, stationNameStr, deviceOEE, a50EEPartNo, a40EEVehicleCode);
 
 
+                // 上传OEE
+                (short, string) result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
                 _result = result.Item1;
                 _result = result.Item1;
                 resultStr = result.Item2;
                 resultStr = result.Item2;
 
 
@@ -5171,17 +5401,29 @@ namespace MainForm
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 1; //OK
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
-                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iot_data.BeatAction}上传IOT成功!上传结果:" + resultStr);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 1;//OK
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT成功!上传结果:" + resultStr);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                 }
                 }
                 else
                 else
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Error,
                     AddMessage_Station(stationNameStr, LogType.Error,
                         $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + resultStr);
                         $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + resultStr);
@@ -5198,7 +5440,13 @@ namespace MainForm
                 // MES_Flag
                 // MES_Flag
                 stopwatch2.Start();
                 stopwatch2.Start();
                 //写入PLC
                 //写入PLC
-                iot_data.beatReturn = 2; //NG
+                IoT_DataSet_t iotData = new IoT_DataSet_t();
+                iotData.machineState = iot_data.machineState;
+                iotData.work_type = iot_data.work_type;
+                iotData.testStatus = iot_data.testStatus;
+                iotData.BeatAction = iot_data.BeatAction;
+                iotData.beatReturn = 2; //NG
+                iotData.fault_codes = iot_data.fault_codes;
                 WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
                 WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
                 stopwatch2.Stop();
                 stopwatch2.Stop();
             }
             }
@@ -5250,7 +5498,12 @@ namespace MainForm
                         UpdatePLCMonitor(1, plcNo, 0);
                         UpdatePLCMonitor(1, plcNo, 0);
                         continue;
                         continue;
                     }
                     }
-
+                    //弹出扫码框则停止循环
+                    if (isNoStop)
+                    {
+                        Task.Delay(1000);
+                        continue;
+                    }
                     if (FunsEip[plcNo].IsConnected) // 检查PLC是否已连接上
                     if (FunsEip[plcNo].IsConnected) // 检查PLC是否已连接上
                     {
                     {
                         Stopwatch stopwatch1 = new Stopwatch();
                         Stopwatch stopwatch1 = new Stopwatch();
@@ -5264,13 +5517,16 @@ namespace MainForm
                         // 一次性读取所有数据
                         // 一次性读取所有数据
                         result = FunsEip[plcNo]
                         result = FunsEip[plcNo]
                             .Read_SingleTag<OP60_MesData_t>(tagBaseName, 1, out stPLC_MesData, this); //读取单个结构体数据
                             .Read_SingleTag<OP60_MesData_t>(tagBaseName, 1, out stPLC_MesData, this); //读取单个结构体数据
+                        //测试
+                        stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
+                        stPLC_MesData.mesCommFrmPLC.cmd = 1;
+
                         if (result.Item1 != 0)
                         if (result.Item1 != 0)
                         {
                         {
                             //richTextBox1.AppendText("\n" + strRet);
                             //richTextBox1.AppendText("\n" + strRet);
                         }
                         }
                         else
                         else
                         {
                         {
-                            //richTextBox1.AppendText("\n" + "读取成功");
                             //richTextBox1.AppendText("\n" + "读取成功");
                             //richTextBox1.AppendText("\n" + "读取成功");
                             int xmDeviceStateInt = stPLC_MesData.iotData.machineState;
                             int xmDeviceStateInt = stPLC_MesData.iotData.machineState;
                             xmDeviceStateData.left = (xmDeviceStateInt < 0 || xmDeviceStateInt > 7)
                             xmDeviceStateData.left = (xmDeviceStateInt < 0 || xmDeviceStateInt > 7)
@@ -5447,6 +5703,8 @@ namespace MainForm
                 //strCarrierBarcode = "N801A-003";
                 //strCarrierBarcode = "N801A-003";
                 //载具码验证产品码 
                 //载具码验证产品码 
                 string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
                 string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
+                string strPCBBarcode = SQLHelper.GetPCBBarcodeByCarrierCode(strCarrierBarcode);
+
                 if (string.IsNullOrEmpty(strProductBarcode))
                 if (string.IsNullOrEmpty(strProductBarcode))
                 {
                 {
                     AddMessage(LogType.Error, $"{stationNameStr}_未能查到已绑定的载具信息,无法进行载具绑定产品验证");
                     AddMessage(LogType.Error, $"{stationNameStr}_未能查到已绑定的载具信息,无法进行载具绑定产品验证");
@@ -5461,11 +5719,13 @@ namespace MainForm
                     {
                     {
                         dialog._CarrierBarcode = strCarrierBarcode;
                         dialog._CarrierBarcode = strCarrierBarcode;
                         dialog._ProductBarcode = sn;
                         dialog._ProductBarcode = sn;
+                        dialog._PCBBarcode = strPCBBarcode;
                         var rs = dialog.ShowDialog();
                         var rs = dialog.ShowDialog();
                         if (rs == DialogResult.OK)
                         if (rs == DialogResult.OK)
                         {
                         {
                             AddMessage(LogType.Info, $"扫码校验通过,载具码:{strCarrierBarcode};产品码:{sn};产品码:{sn}");
                             AddMessage(LogType.Info, $"扫码校验通过,载具码:{strCarrierBarcode};产品码:{sn};产品码:{sn}");
                             OpenDailogFalg = false;//关闭扫码
                             OpenDailogFalg = false;//关闭扫码
+                            isNoStop = false;
                         }
                         }
                         else {
                         else {
                             ProgressState = false;
                             ProgressState = false;
@@ -10436,8 +10696,14 @@ namespace MainForm
                 {
                 {
                     stopwatch2.Start();
                     stopwatch2.Start();
                     //写入PLC
                     //写入PLC
-                    iot_data.beatReturn = 2; //NG
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    IoT_DataSet_t iotData = new IoT_DataSet_t();
+                    iotData.machineState = iot_data.machineState;
+                    iotData.work_type = iot_data.work_type;
+                    iotData.testStatus = iot_data.testStatus;
+                    iotData.BeatAction = iot_data.BeatAction;
+                    iotData.beatReturn = 2; //NG
+                    iotData.fault_codes = iot_data.fault_codes;
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage(LogType.Info,
                     AddMessage(LogType.Info,
                         stationNameStr + $"_节拍接口-- 设备上传了未识别的节拍类型【{oEEType}】请检查;总用时" + stopwatch1.ElapsedMilliseconds +
                         stationNameStr + $"_节拍接口-- 设备上传了未识别的节拍类型【{oEEType}】请检查;总用时" + stopwatch1.ElapsedMilliseconds +
@@ -10457,7 +10723,7 @@ namespace MainForm
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.beatReturn = 2; //NG
                     iotData.beatReturn = 2; //NG
                     iotData.fault_codes = iot_data.fault_codes;
                     iotData.fault_codes = iot_data.fault_codes;
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
                         stationNameStr + $"_[{CarrierBarcode}][{strProductBarcode}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
                         stationNameStr + $"_[{CarrierBarcode}][{strProductBarcode}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
@@ -10475,7 +10741,7 @@ namespace MainForm
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.beatReturn = 2; //NG
                     iotData.beatReturn = 2; //NG
                     iotData.fault_codes = iot_data.fault_codes;
                     iotData.fault_codes = iot_data.fault_codes;
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
                         stationNameStr + $"_[{CarrierBarcode}]上传节拍失败!物料码不可为空;总用时" +
                         stationNameStr + $"_[{CarrierBarcode}]上传节拍失败!物料码不可为空;总用时" +
@@ -10493,7 +10759,7 @@ namespace MainForm
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.beatReturn = 2; //NG
                     iotData.beatReturn = 2; //NG
                     iotData.fault_codes = iot_data.fault_codes;
                     iotData.fault_codes = iot_data.fault_codes;
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Info,
                     AddMessage_Station(stationNameStr, LogType.Info,
                         stationNameStr + $"_上传节拍失败!载具码不可为空;总用时" +
                         stationNameStr + $"_上传节拍失败!载具码不可为空;总用时" +
@@ -10519,8 +10785,8 @@ namespace MainForm
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.beatReturn = 1;//OK
                     iotData.beatReturn = 1;//OK
                     iotData.fault_codes = iot_data.fault_codes;
                     iotData.fault_codes = iot_data.fault_codes;
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
-                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iot_data.BeatAction}上传IOT成功!上传结果:" + resultStr);
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iotData.BeatAction}上传IOT成功!上传结果:" + resultStr);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                 }
                 }
                 else
                 else
@@ -10534,7 +10800,7 @@ namespace MainForm
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.BeatAction = iot_data.BeatAction;
                     iotData.beatReturn = 2; //NG
                     iotData.beatReturn = 2; //NG
                     iotData.fault_codes = iot_data.fault_codes;
                     iotData.fault_codes = iot_data.fault_codes;
-                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
+                    WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     stopwatch2.Stop();
                     stopwatch2.Stop();
                     AddMessage_Station(stationNameStr, LogType.Error,
                     AddMessage_Station(stationNameStr, LogType.Error,
                         $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + resultStr);
                         $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + resultStr);

+ 1 - 2
MainForm/FaForm/Form_Home_SaveData.cs

@@ -987,8 +987,7 @@ namespace MainForm
                         AddMessage(LogType.Error, $"PLC{plcNo}_{stationNameStr}_[{oEEPartNo}]异步上传Iot节拍数据失败!报错信息:" + ex.Message + "异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1));
                         AddMessage(LogType.Error, $"PLC{plcNo}_{stationNameStr}_[{oEEPartNo}]异步上传Iot节拍数据失败!报错信息:" + ex.Message + "异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1));
                     }
                     }
                 });
                 });
-
-                return ((short)1, "异步上传中!");
+                return ((short)1, $"Iot节拍数据[SN:{oEEPartNo}]上传成功!");
             }
             }
             else
             else
                 return ((short)0, "未启用上传!");
                 return ((short)0, "未启用上传!");