Browse Source

30增加测试项

WIN-GH9CEESPLTB\Administrator 1 month ago
parent
commit
e88c0bda29

+ 23 - 0
MainForm/ClassFile/Inovance_EIP.cs

@@ -188,6 +188,28 @@ namespace EIP_Protocol
         public float[] fRemainGlues;                         //剩余胶量A:0 B:1
     }
 
+    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
+    public struct OP30_TestData_t                            //站数据集
+    {
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPress;             //AB管气压
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPressMax;          //AB管气压(最大值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPressMin;          //AB管气压(最小值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPressDiff;         //AB管气压差
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPressDiffMax;       //AB管气压差(最大值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fAB_AirPressDiffMin;       //AB管气压差(最小值)
+    }
+
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
     public struct OP30_stnDataSet_t
     {
@@ -195,6 +217,7 @@ namespace EIP_Protocol
         public CommandFromPLC mesCommFrmPLC;   //MES通讯
         public OP30_DataSet_t mesData;
         public IoT_DataSet_t iotData;
+        public OP30_TestData_t testData;
     }
 
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]

+ 4 - 2
MainForm/ClassFile/ProjectClass/GlobalContext.cs

@@ -163,7 +163,8 @@ namespace MainForm
         public static bool IsSendCheckOneData;   // 启用上传点检
         public static bool IsSendWorkingData;    // 启用上传状态
         public static bool IsSendAlarmData;      // 启用上传报警
-        public static bool IsSendProcessDetail;    // 启用上传出战明细
+        public static bool IsSendProcessDetail;    // 启用上传出站明细
+        public static bool IsSendTestData;    // 启用上传出站测试项
         public static bool IsUseMESRoute;   // 启用边线MES软件
         public static bool MESIsConnect;  // MES是否正常连接
         public static string MESLaserLPath;   // 三点激光数据本地存放地址
@@ -431,7 +432,8 @@ namespace MainForm
                 IsSendAlarmData = bool.Parse(IniFile.INIGetStringValue(FilePath, "MES", "IsSendAlarmData", ConstIsSend));
                 IsUseMESRoute = bool.Parse(IniFile.INIGetStringValue(FilePath, "MES", "IsUseMESRoute", ConstIsSend));
                 IsSendProcessDetail = bool.Parse(IniFile.INIGetStringValue(FilePath, "MES", "IsSendProcessDetail", ConstIsSend));
-               
+                IsSendTestData = bool.Parse(IniFile.INIGetStringValue(FilePath, "MES", "IsSendTestData", ConstIsSend));
+                
                 // MQTT
                 IsUseIot = bool.Parse(IniFile.INIGetStringValue(FilePath, "MQTT", "IsUseIot", "false"));
                 MQTTServerHost = IniFile.INIGetStringValue(FilePath, "MQTT", "MQTTServerHost", "127.0.0.1");

+ 22 - 0
MainForm/ClassFile/XiaomiAPI_MES/XiaomiMESHttp_StationOutbound.cs

@@ -192,6 +192,28 @@ namespace MainForm.ClassFile.XiaomiAPI_MES
                 /// 检测明细数据
                 /// </summary>
                 public List<XmStationOut_DataItem> dataItem { get; set; } = new List<XmStationOut_DataItem>();
+
+                /// <summary>
+                /// 添加检测项明细
+                /// </summary>
+                /// <param name="dataName">数据描述</param>
+                /// <param name="dataValue">数值</param>
+                /// <param name="maxStr">最⼤值</param>
+                /// <param name="minStr">最⼩值</param>
+                /// <param name="passStr">项⽬的检验结果:PASS/FAIL</param>
+                public void AddDataItem(string functionName,string testItem, string dataValue,string maxStr,string minStr,string passStr)
+                {
+                    dataItem.Add(new XmStationOut_DataItem
+                    {
+                        functionName = functionName,
+                        testItem = testItem,
+                        value = dataValue,
+                        hiLimit = maxStr,
+                        lowLimit = minStr,
+                        testTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                        status = passStr,
+                    });
+                }
             }
 
             /// <summary>

+ 160 - 91
MainForm/FaForm/Form_Home.cs

@@ -1625,11 +1625,11 @@ namespace MainForm
             string processItem,
             string workorder_code, string batch_num, string mtltmrk, string proDate,
             string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot, string MachineId,
-            string StationId, string PartBarcode, string jsonParm, string direction = "")
+            string StationId, string PartBarcode, string detailjson, XmStationOut_InspectionItemData inspectionItemData, string direction = "")
         {
             return SaveProcessDataByDB(stationNameStr, items, equipmentCode, processItem, workorder_code, batch_num,
                 mtltmrk,
-                proDate, supplierCode, sn, pass, vehicleSn, vehicleSlot, MachineId, StationId, PartBarcode, jsonParm,
+                proDate, supplierCode, sn, pass, vehicleSn, vehicleSlot, MachineId, StationId, PartBarcode, detailjson, inspectionItemData,
                 direction);
         }
 
@@ -1649,7 +1649,7 @@ namespace MainForm
         public int SaveProcessDataByDB(string stationNameStr, List<TestItem> items, string equipmentCode,
             string processItem, string workorder_code, string batch_num, string mtltmrk,
             string proDate, string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot,
-            string machineId, string stationId, string partBarcode, string jsonParm, string direction = "")
+            string machineId, string stationId, string partBarcode, string detailjson, XmStationOut_InspectionItemData inspectionItemData, string direction = "")
         {
             int upload = 0;
             int result = 0;
@@ -1706,16 +1706,16 @@ namespace MainForm
                             }); // 设备数据 - 部件码
                     }
 
-                    //过站明细
+                    #region 过站明细
                     if (GlobalContext.IsSendProcessDetail)
                     {
-                        if (jsonParm.Length > 0)
+                        if (detailjson.Length > 0)
                         {
-                            //jsonParm = "{\"fGlueSupplySpeed\":0.63,\"fAB_AirPress\":0.0,\"fAB_AirPressDiff\":0.0,\"fMesHeightInfos\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"fIntervalWeights\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"fRemainGlues\":[600.0,600.0]}";
+                            //detailjson = "{\"fGlueSupplySpeed\":0.63,\"fAB_AirPress\":0.0,\"fAB_AirPressDiff\":0.0,\"fMesHeightInfos\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"fIntervalWeights\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"fRemainGlues\":[600.0,600.0]}";
                             // 解析JSON字符串为字典
-                            jsonParm = jsonParm.Replace("[", "\"[");
-                            jsonParm = jsonParm.Replace("]", "]\"");
-                            var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonParm);
+                            detailjson = detailjson.Replace("[", "\"[");
+                            detailjson = detailjson.Replace("]", "]\"");
+                            var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(detailjson);
                             foreach (var kvp in dictionary)
                             {
                                 outRequest_Body.unitData.processData.Add(
@@ -1727,8 +1727,28 @@ namespace MainForm
                             }
                         }
                     }
+                    #endregion
+
+                    #region 测试项
+                    if (GlobalContext.IsSendTestData)
+                    {
+                        if (stationNameStr.Contains("OP31") || stationNameStr.Contains("OP32"))
+                        {
+                            outRequest_Body.unitData.inspectionItemData.Add(
+                                    new XmStationOut_InspectionItemData()
+                                    {
+                                        childUnitSn = inspectionItemData.childUnitSn,
+                                        childUnitState = inspectionItemData.childUnitState,
+                                        toolVersion = inspectionItemData.toolVersion,
+                                        dataItem = inspectionItemData.dataItem,
 
-                    //OP30站读txt数据
+                                    }
+                                );
+                        }
+                    }
+                    #endregion
+
+                    #region OP30站读txt数据
                     if (stationNameStr.Contains("OP31") || stationNameStr.Contains("OP32"))
                     {
                         string path = "";
@@ -1767,9 +1787,12 @@ namespace MainForm
                             }
                         }
                     }
+                    #endregion
 
-                    string jsonstr1 = JsonConvert.SerializeObject(outRequest_Body);
 
+
+                        #region 上传MES
+                        string jsonstr1 = JsonConvert.SerializeObject(outRequest_Body);
                     if (GlobalContext.IsSendProcessData)
                     {
                         XmMES_StationOutResponse response = new XmMES_StationOutResponse();
@@ -1814,6 +1837,7 @@ namespace MainForm
                             JsonConvert.SerializeObject(response), id);
                         SQLHelper_New.ExecuteNonQuery(sql_UpStationout, null);
                     }
+                    #endregion
                 }
                 catch (Exception ex)
                 {
@@ -1843,10 +1867,10 @@ namespace MainForm
                 request.function_name = "Machine_加⼯模块";
                 request.status = "PASS";
                 (int, string) iotResult = (0, "");
-                if (jsonParm.Length > 0)
+                if (detailjson.Length > 0)
                 {
                     // 解析JSON字符串为字典
-                    var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonParm);
+                    var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(detailjson);
                     foreach (var kvp in dictionary)
                     {
                         test_item_num += 1;
@@ -2821,62 +2845,82 @@ namespace MainForm
                 AddMessage(LogType.Info, "【装备配置】上传失败!错误原因:" + iotResult.Item2 );
             }
         }
-
+        private static readonly object _oeeLock = new object();
         private void 通用节拍接口(int plcNo, string stationNameStr, string tagMesCommName, string CarrierBarcode,
             IoT_DataSet_t iot_data, out int res)
         {
-            Stopwatch stopwatch1 = new Stopwatch();
-            Stopwatch stopwatch2 = new Stopwatch();
-
-            string resultStr = string.Empty;
-            try
+            lock (_oeeLock) // 保证同一时间只有一个任务执行
             {
-                string oEEType = iot_data.beatAction.ToString(); // 节拍类型(plc写入)
-                string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(CarrierBarcode); //产品SN
-                bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
-                (short, string) result = (0, "");
+                Stopwatch stopwatch1 = new Stopwatch();
+                Stopwatch stopwatch2 = new Stopwatch();
 
-                // 上传开始节拍 节拍只需要PLC传1、3、4、5
-                result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
-                //上传结束节拍
-                switch (oEEType)
+                string resultStr = string.Empty;
+                try
                 {
-                    case "1":
-                        Enum.TryParse("2", out deviceOEE);
-                        result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
-                        break;
-                    case "5":
-                        Enum.TryParse("6", out deviceOEE);
-                        result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
-                        break;
-                }
+                    string oEEType = iot_data.beatAction.ToString(); // 节拍类型(plc写入)
+                    string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(CarrierBarcode); //产品SN
+                    bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
+                    (short, string) result = (0, "");
 
-                if (result.Item1 == 1)
-                {
-                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]上传成功!");
-                    //写入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 = 0;
-                    iotData.beatReturn = 1; //OK
-                    iotData.fault_codes = iot_data.fault_codes;
-                    (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
-                    if (PLCresult.Item1 == 0)
+                    // 上传开始节拍 节拍只需要PLC传1、3、4、5
+                    result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
+                    //上传结束节拍
+                    switch (oEEType)
+                    {
+                        case "1":
+                            Enum.TryParse("2", out deviceOEE);
+                            result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
+                            break;
+                        case "5":
+                            Enum.TryParse("6", out deviceOEE);
+                            result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
+                            break;
+                    }
+
+                    if (result.Item1 == 1)
                     {
-                        res = 1;
-                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]写入成功!");
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]上传成功!");
+                        //写入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 = 0;
+                        iotData.beatReturn = 1; //OK
+                        iotData.fault_codes = iot_data.fault_codes;
+                        (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
+                        if (PLCresult.Item1 == 0)
+                        {
+                            res = 1;
+                            OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]写入成功!");
+                        }
+                        else
+                        {
+                            res = 0;
+                        }
                     }
                     else
                     {
                         res = 0;
+                        OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]接口出错!错误信息:" + result.Item2);
+                        //写入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 = 0;
+                        iotData.beatReturn = 2; //NG
+                        iotData.fault_codes = iot_data.fault_codes;
+                        (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                     }
                 }
-                else
+                catch (Exception ex)
                 {
                     res = 0;
-                    OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍[{deviceOEE}]接口出错!错误信息:" + result.Item2);
+                    string str = ex.StackTrace;
+                    AddMessage_Station(stationNameStr, LogType.Error,
+                        $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + ex.Message + "异常位置:" +
+                        str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1));
                     //写入PLC
                     IoT_DataSet_t iotData = new IoT_DataSet_t();
                     iotData.machineState = iot_data.machineState;
@@ -2888,23 +2932,7 @@ namespace MainForm
                     (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
                 }
             }
-            catch (Exception ex)
-            {
-                res = 0;
-                string str = ex.StackTrace;
-                AddMessage_Station(stationNameStr, LogType.Error,
-                    $"PLC{plcNo}_{stationNameStr} 节拍接口出错!错误信息:" + ex.Message + "异常位置:" +
-                    str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1));
-                //写入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 = 0;
-                iotData.beatReturn = 2; //NG
-                iotData.fault_codes = iot_data.fault_codes;
-                (int, string) PLCresult = WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iotData);
-            }
+            
         }
 
         /// <summary>
@@ -3439,13 +3467,10 @@ namespace MainForm
                 AddMessage(LogType.Info, stationNameStr + "_进站开始");
                 //10扫码改造注释(临时)
                 //string sn = (string)stPLC_MesData.BarcodeSet.strProductBarcode; // 产品SN(物料码),现在PLC只有OP10和OP50返回
-                string CarrierBarcode = (string)stPLC_MesData.BarcodeSet.strCarrierBarcode; // 载具条码;
+                //string CarrierBarcode = (string)stPLC_MesData.BarcodeSet.strCarrierBarcode; // 载具条码;
                 string sn = _strProductBarcode;
-                if (string.IsNullOrEmpty(CarrierBarcode))
-                {
-                    //获取手持扫码枪的载具码
-                    CarrierBarcode = _strCarrierBarcode;
-                }
+                string CarrierBarcode = _strCarrierBarcode;
+
                 string MachineId = GlobalContext.S1_MachineId; // 装备ID(可配置)
                 string StationId = GlobalContext.S1_StationId; // 工位ID(可配置)
                 int a1Result = (int)stPLC_MesData.iotData.testStatus; // 产品结果
@@ -3607,7 +3632,7 @@ namespace MainForm
                 //出站接口
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01",
-                    MachineId, StationId, "", paramJson);
+                    MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)
@@ -4065,7 +4090,7 @@ namespace MainForm
 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01",
-                    MachineId, StationId, PartBarcode, paramJson);
+                    MachineId, StationId, PartBarcode, paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)
@@ -4202,6 +4227,13 @@ namespace MainForm
                             //stPLC_MesData.Left.iotData.beatAction = 2;
                             //stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
 
+                            //stPLC_MesData.Left.testData.fAB_AirPressDiff = 2.5f;
+                            //stPLC_MesData.Left.testData.fAB_AirPressDiffMax = 2.5f;
+                            //stPLC_MesData.Left.testData.fAB_AirPressDiffMin = 0;
+                            //stPLC_MesData.Left.testData.fAB_AirPress = 0.1f;
+                            //stPLC_MesData.Left.testData.fAB_AirPressMax = 0.2f;
+                            //stPLC_MesData.Left.testData.fAB_AirPressMin = 0;
+
                             #region 去除扫码产生的特殊字符
 
                             stPLC_MesData.Left.BarcodeSet.strProductBarcode =
@@ -4610,7 +4642,6 @@ namespace MainForm
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            
 
             try
             {
@@ -4690,13 +4721,51 @@ namespace MainForm
                 //}
                 //string paramJson = JsonConvert.SerializeObject(dic);
                 #endregion
-                string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
-                //if (direction == "Right")
-                //{ 
+                string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);//过站生产数据
+
+                #region MAS测试项
+                XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
+                string passFlag = "";
+                string AllpassFlag = "PASS";
+
+                float fAB_AirPressDiff = stPLC_MesData.testData.fAB_AirPressDiff;
+                float fAB_AirPressDiffMax = stPLC_MesData.testData.fAB_AirPressDiffMax;
+                float fAB_AirPressDiffMin = stPLC_MesData.testData.fAB_AirPressDiffMin;
+                float fAB_AirPress = stPLC_MesData.testData.fAB_AirPress;
+                float fAB_AirPressMax = stPLC_MesData.testData.fAB_AirPressMax;
+                float fAB_AirPressMin = stPLC_MesData.testData.fAB_AirPressMin;
+
+                XmStationOut_InspectionItemData inspectionItemData = new XmStationOut_InspectionItemData();
+                if (fAB_AirPressDiffMax > fAB_AirPressDiffMin && (fAB_AirPressDiffMax != 0 || fAB_AirPressDiffMin != 0))
+                {
+                    if (fAB_AirPressDiff > fAB_AirPressDiffMin && fAB_AirPressDiff <= fAB_AirPressDiffMax)
+                        passFlag = "PASS";
+                    else
+                        passFlag = "FAIL";
+
+                    if (passFlag == "FAIL") AllpassFlag = passFlag;
+                    inspectionItemData.AddDataItem("","AB管气压", fAB_AirPressDiff.ToString(), fAB_AirPressDiffMax.ToString(), fAB_AirPressDiffMin.ToString(), passFlag);
+                }
+
+                if (fAB_AirPressMax > fAB_AirPressMin && (fAB_AirPressMax != 0 || fAB_AirPressMin != 0))
+                {
+                    if (fAB_AirPress > fAB_AirPressMin && fAB_AirPress <= fAB_AirPressMax)
+                        passFlag = "PASS";
+                    else
+                        passFlag = "FAIL";
+
+                    if (passFlag == "FAIL") AllpassFlag = passFlag;
+                    inspectionItemData.AddDataItem("","AB管气压差", fAB_AirPress.ToString(), fAB_AirPressMax.ToString(), fAB_AirPressMin.ToString(), passFlag);
+                }
+
+                inspectionItemData.childUnitSn = strProductBarcode;
+                inspectionItemData.childUnitState = AllpassFlag;
+                inspectionItemData.toolVersion = "1.0";
+                #endregion
+  
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
-                    , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode,slot,
-                    MachineId, StationId, "", paramJson, direction);
-                //}
+                    , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, strProductBarcode, pass, CarrierBarcode,slot,
+                    MachineId, StationId, "", paramJson, inspectionItemData, direction);
 
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
@@ -5190,7 +5259,7 @@ namespace MainForm
 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode,
-                    "01-SLOT-01", MachineId, StationId, "", paramJson);
+                    "01-SLOT-01", MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)
@@ -5716,7 +5785,7 @@ namespace MainForm
                     result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem, workorder_code,
                         batch_num
                         , mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01", MachineId, StationId,
-                        PartBarcode, paramJson);
+                        PartBarcode, paramJson,new XmStationOut_InspectionItemData(), "");
                     uuid = "";
                 }
                 else if (stPLC_MesData.mesCommFrmPLC.cmdParam == 1)
@@ -6264,7 +6333,7 @@ namespace MainForm
 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01",
-                    MachineId, StationId, "", paramJson);
+                    MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)
@@ -6909,7 +6978,7 @@ namespace MainForm
                 //{ 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem, workorder_code,
                     batch_num, mtltmrk, plcDate_YMD, supplierCode
-                    , sn, pass, CarrierBarcode, slot, MachineId, StationId, "", paramJson);
+                    , sn, pass, CarrierBarcode, slot, MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 //}
 
@@ -7414,7 +7483,7 @@ namespace MainForm
 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01",
-                    MachineId, StationId, "", paramJson);
+                    MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)
@@ -7861,7 +7930,7 @@ namespace MainForm
 
                 int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
                     , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "01-SLOT-01",
-                    MachineId, StationId, "", paramJson);
+                    MachineId, StationId, "", paramJson,new XmStationOut_InspectionItemData(), "");
 
                 byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
                 if (mesResultFrmWeb == 1)

+ 53 - 10
MainForm/FaForm/Form_Other.cs

@@ -1,4 +1,5 @@
-using MathNet.Numerics.RootFinding;
+using EIP_Protocol;
+using MathNet.Numerics.RootFinding;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
@@ -11,6 +12,8 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using static MainForm.ClassFile.XiaomiAPI_MES.XiaomiMESHttp_StationOutbound;
+using static MainForm.ClassFile.XiaomiAPI_MES.XiaomiMESHttp_StationOutbound.XmMES_StationOutRequest_Body;
+using static MainForm.ClassFile.XiaomiClass.MesHelper;
 
 namespace MainForm.FaForm
 {
@@ -163,17 +166,57 @@ namespace MainForm.FaForm
 
         private void button13_Click(object sender, EventArgs e)
         {
+            #region MAS测试项
             XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
-            Form_Home home = new Form_Home();
-            string path=GlobalContext.MESLaserLPath;
-
-            outRequest_Body.unitData.processData.Add(
-                new XmMES_StationOutRequest_Body.XmStationOut_ProcessData()
-                {
-                    dataName = "fMesHeightInfos",
-                    dataValue = home.GetLastLineCompensation(path)
-                });
+            OP30_stnDataSet_t stPLC_MesData = new OP30_stnDataSet_t();
+            string passFlag = "";
+            string AllpassFlag = "PASS";
+            string SN = "A123456";
+
+            stPLC_MesData.testData.fAB_AirPressDiff = 2.5f;
+            stPLC_MesData.testData.fAB_AirPressDiffMax = 2.5f;
+            stPLC_MesData.testData.fAB_AirPressDiffMin = 0;
+            stPLC_MesData.testData.fAB_AirPress = 0.1f;
+            stPLC_MesData.testData.fAB_AirPressMax = 0.2f;
+            stPLC_MesData.testData.fAB_AirPressMin = 0;
+
+            float fAB_AirPressDiff = stPLC_MesData.testData.fAB_AirPressDiff;
+            float fAB_AirPressDiffMax = stPLC_MesData.testData.fAB_AirPressDiffMax;
+            float fAB_AirPressDiffMin = stPLC_MesData.testData.fAB_AirPressDiffMin;
+            float fAB_AirPress = stPLC_MesData.testData.fAB_AirPress;
+            float fAB_AirPressMax = stPLC_MesData.testData.fAB_AirPressMax;
+            float fAB_AirPressMin = stPLC_MesData.testData.fAB_AirPressMin;
+
+            XmStationOut_InspectionItemData inspectionItemData = new XmStationOut_InspectionItemData();
+            if (fAB_AirPressDiffMax > fAB_AirPressDiffMin && (fAB_AirPressDiffMax != 0 || fAB_AirPressDiffMin != 0))
+            {
+                if (fAB_AirPressDiff > fAB_AirPressDiffMin && fAB_AirPressDiff <= fAB_AirPressDiffMax)
+                    passFlag = "PASS";
+                else
+                    passFlag = "FAIL";
+
+                if (passFlag == "FAIL") AllpassFlag = passFlag;
+                inspectionItemData.AddDataItem("N801A","AB管气压", fAB_AirPressDiff.ToString(), fAB_AirPressDiffMax.ToString(), fAB_AirPressDiffMin.ToString(), passFlag);
+            }
+
+            if (fAB_AirPressMax>fAB_AirPressMin && (fAB_AirPressMax != 0 || fAB_AirPressMin != 0))
+            {
+                if (fAB_AirPress > fAB_AirPressMin && fAB_AirPress <= fAB_AirPressMax)
+                    passFlag = "PASS";
+                else
+                    passFlag = "FAIL";
+
+                if (passFlag == "FAIL") AllpassFlag = passFlag;
+                inspectionItemData.AddDataItem("N801A","AB管气压差", fAB_AirPress.ToString(), fAB_AirPressMax.ToString(), fAB_AirPressMin.ToString(), passFlag);
+            }
             
+            inspectionItemData.childUnitSn = SN;
+            inspectionItemData.childUnitState = AllpassFlag;
+            inspectionItemData.toolVersion = "1.0";
+
+            string detailjson = JsonConvert.SerializeObject(inspectionItemData);//过站测试项
+
+            #endregion
         }
     }
 }