WIN-GH9CEESPLTB\Administrator vor 1 Monat
Ursprung
Commit
b494ed285a
2 geänderte Dateien mit 43 neuen und 112 gelöschten Zeilen
  1. 1 1
      MainForm/ClassFile/Inovance_EIP.cs
  2. 42 111
      MainForm/FaForm/Form_Home.cs

+ 1 - 1
MainForm/ClassFile/Inovance_EIP.cs

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

+ 42 - 111
MainForm/FaForm/Form_Home.cs

@@ -4068,6 +4068,8 @@ namespace MainForm
             // PLC数据字典 赋值 
             s3PLCData.Add("a3OEEType_left", 0); // 节拍类型(plc写入) 
             s3PLCData.Add("a3OEEType_right", 0); // 节拍类型(plc写入) 
+            s5PLCData.Add("OEETypeFlag_left", 0); // 节拍标识 0 不上传 ,1 上传
+            s5PLCData.Add("OEETypeFlag_right", 0); // 节拍标识 0 不上传 ,1 上传
 
             OP30_MesData_t stPLC_MesData; //PLC的MES数据
             (int, string) result;
@@ -4100,6 +4102,14 @@ namespace MainForm
                         }
                         else
                         {
+                            //测试数据
+                            //stPLC_MesData.Left.mesCommFrmPLC.cmd = 2;
+                            //stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
+                            //stPLC_MesData.Left.BarcodeSet.strPCBBarcode = "A1507V000239";
+                            //stPLC_MesData.Left.iotData.BeatAction = 1;
+                            //stPLC_MesData.Left.iotData.BeatAction = 2;
+                            //stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
+
                             #region 去除扫码产生的特殊字符
 
                             stPLC_MesData.Left.BarcodeSet.strProductBarcode =
@@ -4294,57 +4304,19 @@ namespace MainForm
                                 stationNameStr = stationCode + stationName;
                                 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)
                                 {
-                                    //如果上位机告诉PLC NG,PLC节拍会直接从1跳到4
-                                    if (a3OEETypeGOld_left <= 2 && a3OEEType_left == 4)
-                                    {
-                                        Task.Run(() =>
-                                            通用节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName,
-                                                CarrierBarcode_Left,
-                                                stPLC_MesData.Left.iotData));
-                                    }
-                                    else
-                                    {
-                                        //节拍需要成双成对,有开始就要有结束,例如有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(() => 通用节拍接口(plcNo, stationNameStr,
-                                                tagBaseName + ".Left." + tagiotComnName, CarrierBarcode_Left,
-                                                stPLC_MesData.Left.iotData));
-                                            //Task.Run(() =>
-                                            //    S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, stPLC_MesData.Left.BarcodeSet.strCarrierBarcode.ToString(),
-                                            //        stPLC_MesData.Left.iotData));
-                                        }
-                                    }
+                                    s3PLCData["OEETypeFlag_left"] = "1";
+                                }
+                                else {
+                                    s3PLCData["OEETypeFlag_left"] = "0";
+                                }
+                                if (s3PLCData["OEETypeFlag_left"].ToString() == "1" && (a3OEEType_left == 1 || a3OEEType_left == 3 || a3OEEType_left == 5))
+                                {
+                                    Task.Run(() => 通用节拍接口(plcNo, stationNameStr,
+                                                 tagBaseName + ".Left." + tagiotComnName, CarrierBarcode_Left,
+                                                 stPLC_MesData.Left.iotData));
                                 }
                             }
 
@@ -4353,7 +4325,6 @@ namespace MainForm
                             #endregion 左工位 节拍
 
                             #region 右工位 节拍
-
                             if (stPLC_MesData.Right.iotData.BeatAction > 0)
                             {
                                 stationCode = "[OP32]";
@@ -4361,63 +4332,23 @@ namespace MainForm
                                 stationNameStr = stationCode + stationName;
                                 int a3OEEType_right = Convert.ToInt32(s3PLCData["a3OEEType_right"]);
                                 int a3OEETypeGOld_right = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_right"]);
-                                //若设备紧急复原后节拍重置
-                                if (a3OEEType_right == 1)
+                                if (a3OEEType_right != a3OEETypeGOld_right)
                                 {
-                                    a3OEETypeGOld_right = 0;
+                                    s3PLCData["OEETypeFlag_right"] = "1";
                                 }
-
-                                if (a3OEEType_right != a3OEETypeGOld_right)
+                                else
                                 {
-                                    if (a3OEETypeGOld_right <= 2 && a3OEEType_right == 4)
-                                    {
-                                        Task.Run(() =>
-                                            通用节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagiotComnName,
-                                                CarrierBarcode_Right,
-                                                stPLC_MesData.Right.iotData));
-                                    }
-                                    else
-                                    {
-                                        //节拍需要成双成对,有开始就要有结束,例如有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(() =>
-                                                通用节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagiotComnName,
-                                                    CarrierBarcode_Right,
-                                                    stPLC_MesData.Right.iotData));
-                                            //Task.Run(() =>
-                                            //    S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagiotComnName,
-                                            //        stPLC_MesData.Right.BarcodeSet.strCarrierBarcode,
-                                            //        stPLC_MesData.Left.iotData)); 
-                                        }
-                                    }
+                                    s3PLCData["OEETypeFlag_right"] = "0";
+                                }
+                                if (s3PLCData["OEETypeFlag_right"].ToString() == "1" && (a3OEEType_right == 1 || a3OEEType_right == 3 || a3OEEType_right == 5))
+                                {
+                                    Task.Run(() => 通用节拍接口(plcNo, stationNameStr,
+                                                 tagBaseName + ".Right." + tagiotComnName, CarrierBarcode_Right,
+                                                 stPLC_MesData.Right.iotData));
+                                    s3PLCSignal_Old["a3OEEType_right"] = s3PLCData["a3OEEType_right"];
                                 }
                             }
 
-                            s3PLCSignal_Old["a3OEEType_right"] = s3PLCData["a3OEEType_right"];
-
                             #endregion 右工位 节拍
                         }
                         catch (Exception ex)
@@ -5300,7 +5231,7 @@ namespace MainForm
 
             // PLC数据字典 赋值 
             s5PLCData.Add("a5OEEType", 0); // 节拍类型(plc写入) 
-            s5PLCData.Add("OEETypeFlag", 0); // 节拍类型(plc写入) 
+            s5PLCData.Add("OEETypeFlag", 0); // 节拍标识 0 不上传 ,1 上传
 
             (int, string) result;
 
@@ -5334,16 +5265,16 @@ namespace MainForm
                         else
                         {
                             //测试数据
-                            stPLC_MesData.mesCommFrmPLC.cmd = 2;
-                            stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
-                            stPLC_MesData.BarcodeSet.strPCBBarcode = "A1507V000239";
-                            stPLC_MesData.iotData.BeatAction = 1;
-                            stPLC_MesData.iotData.BeatAction = 2;
-                            stPLC_MesData.iotData.BeatAction = 3;
-                            stPLC_MesData.iotData.BeatAction = 4;
-                            stPLC_MesData.iotData.BeatAction = 5;
-                            stPLC_MesData.iotData.BeatAction = 6;
-                            stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
+                            //stPLC_MesData.mesCommFrmPLC.cmd = 2;
+                            //stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
+                            //stPLC_MesData.BarcodeSet.strPCBBarcode = "A1507V000239";
+                            //stPLC_MesData.iotData.BeatAction = 1;
+                            //stPLC_MesData.iotData.BeatAction = 2;
+                            //stPLC_MesData.iotData.BeatAction = 3;
+                            //stPLC_MesData.iotData.BeatAction = 4;
+                            //stPLC_MesData.iotData.BeatAction = 5;
+                            //stPLC_MesData.iotData.BeatAction = 6;
+                            //stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
 
                             #region 去除扫码产生的特殊字符