WIN-GH9CEESPLTB\Administrator пре 1 месец
родитељ
комит
598e9966d4
2 измењених фајлова са 131 додато и 12 уклоњено
  1. 40 1
      MainForm/ClassFile/Inovance_EIP.cs
  2. 91 11
      MainForm/FaForm/Form_Home.cs

+ 40 - 1
MainForm/ClassFile/Inovance_EIP.cs

@@ -239,6 +239,29 @@ namespace EIP_Protocol
         //public Image  TestPic;                                  //测试照片
     }
 
+    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
+    public struct OP40_TestData_t  //测试项
+    {
+        [MarshalAs(UnmanagedType.R4)]
+        public float[] fGlue_Areas;             //胶线面积
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fGlue_AreasMax;          //胶线面积(最大值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fGlue_AreasMin;          //胶线面积(最小值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float[] fGlue_Heights;         //胶线高度
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fGlue_HeightsMax;       //胶线高度(最大值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fGlue_HeightsMin;       //胶线高度(最小值)
+    }
+
+
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
     public struct OP50_DataSet_t
     {
@@ -255,6 +278,20 @@ namespace EIP_Protocol
         public int nRemainCount;                                  //ADD板余料数
     }
 
+    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
+    public struct OP50_TestData_t
+    {
+        [MarshalAs(UnmanagedType.I4)]
+        public float fForceAddPCB;                                //装ADD板的压力
+
+        [MarshalAs(UnmanagedType.I4)]
+        public float fForceAddPCBMax;                                   //装ADD板的压力(最大值)
+
+        [MarshalAs(UnmanagedType.R4)]
+        public float fForceAddPCBMin;                                //装ADD板的压力(最小值)
+
+    }
+
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
     public struct OP60_DataSet_t
     {
@@ -358,8 +395,9 @@ namespace EIP_Protocol
     {
         public BarcodeSet_t BarcodeSet;        //条码集合
         public CommandFromPLC mesCommFrmPLC;   //MES通讯
-        public OP40_DataSet_t mesData;
+        public OP40_DataSet_t mesData;    
         public IoT_DataSet_t iotData;
+        public OP40_TestData_t testData;  //测试项
     }
 
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
@@ -370,6 +408,7 @@ namespace EIP_Protocol
         public CommandFromPLC mesCommFrmPLC;  //MES通讯
         public OP50_DataSet_t mesData;
         public IoT_DataSet_t iotData;
+        public OP50_TestData_t testData;  //测试项
     }
 
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]

+ 91 - 11
MainForm/FaForm/Form_Home.cs

@@ -55,6 +55,7 @@ using System.Drawing;
 using ICSharpCode.SharpZipLib.Zip;
 using System.Text.RegularExpressions;
 using System.Text;
+using SixLabors.ImageSharp;
 
 /*
  * 注:本源码对外提供,所以有些地方使用中文命名方法及变量
@@ -1732,7 +1733,7 @@ namespace MainForm
                     #region 测试项
                     if (GlobalContext.IsSendTestData)
                     {
-                        if (stationNameStr.Contains("OP31") || stationNameStr.Contains("OP32"))
+                        if (stationNameStr.Contains("OP31") || stationNameStr.Contains("OP32") || stationNameStr.Contains("OP40") || stationNameStr.Contains("OP50"))
                         {
                             outRequest_Body.unitData.inspectionItemData.Add(
                                     new XmStationOut_InspectionItemData()
@@ -1741,7 +1742,6 @@ namespace MainForm
                                         childUnitState = inspectionItemData.childUnitState,
                                         toolVersion = inspectionItemData.toolVersion,
                                         dataItem = inspectionItemData.dataItem,
-
                                     }
                                 );
                         }
@@ -1770,7 +1770,9 @@ namespace MainForm
                             });
                       
                     }
+                    #endregion
 
+                    #region 上传文件
                     if (GlobalContext.MESIsSendUpFile)
                     {
                         foreach (var item in fileUploadData.fileData)
@@ -1789,10 +1791,8 @@ namespace MainForm
                     }
                     #endregion
 
-
-
-                        #region 上传MES
-                        string jsonstr1 = JsonConvert.SerializeObject(outRequest_Body);
+                    #region 上传MES
+                    string jsonstr1 = JsonConvert.SerializeObject(outRequest_Body);
                     if (GlobalContext.IsSendProcessData)
                     {
                         XmMES_StationOutResponse response = new XmMES_StationOutResponse();
@@ -4744,7 +4744,7 @@ namespace MainForm
                         passFlag = "FAIL";
 
                     if (passFlag == "FAIL") AllpassFlag = passFlag;
-                    inspectionItemData.AddDataItem("","AB管气压", fAB_AirPressDiff.ToString(), fAB_AirPressDiffMax.ToString(), fAB_AirPressDiffMin.ToString(), passFlag);
+                    inspectionItemData.AddDataItem("AirPressure","AB管气压", fAB_AirPressDiff.ToString(), fAB_AirPressDiffMax.ToString(), fAB_AirPressDiffMin.ToString(), passFlag);
                 }
 
                 if (fAB_AirPressMax > fAB_AirPressMin && (fAB_AirPressMax != 0 || fAB_AirPressMin != 0))
@@ -4755,7 +4755,7 @@ namespace MainForm
                         passFlag = "FAIL";
 
                     if (passFlag == "FAIL") AllpassFlag = passFlag;
-                    inspectionItemData.AddDataItem("","AB管气压差", fAB_AirPress.ToString(), fAB_AirPressMax.ToString(), fAB_AirPressMin.ToString(), passFlag);
+                    inspectionItemData.AddDataItem("AirPressure","AB管气压差", fAB_AirPress.ToString(), fAB_AirPressMax.ToString(), fAB_AirPressMin.ToString(), passFlag);
                 }
 
                 inspectionItemData.childUnitSn = strProductBarcode;
@@ -4908,9 +4908,15 @@ namespace MainForm
                         {
                             //测试数据
                             //stPLC_MesData.mesCommFrmPLC.cmd = 2;
-                            //stPLC_MesData.BarcodeSet.strCarrierBarcode = "A235461";
+                            stPLC_MesData.BarcodeSet.strCarrierBarcode = "A235461";
                             //stPLC_MesData.BarcodeSet.strPCBBarcode = "A1507V000239";
 
+                            //stPLC_MesData.testData.fGlue_Areas = new float[] {12,22,16 };
+                            //stPLC_MesData.testData.fGlue_AreasMax = 20f;
+                            //stPLC_MesData.testData.fGlue_AreasMin = 0;
+                            //stPLC_MesData.testData.fGlue_Heights = new float[] { 5, 8, 6.6f};
+                            //stPLC_MesData.testData.fGlue_HeightsMax = 10f;
+                            //stPLC_MesData.testData.fGlue_HeightsMin = 0;
 
                             //去除扫码产生的特殊字符
                             stPLC_MesData.BarcodeSet.strProductBarcode =
@@ -5255,7 +5261,55 @@ namespace MainForm
                 //}
                 //string paramJson = JsonConvert.SerializeObject(dic);
                 #endregion
-                string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
+
+                string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);//过站生产数据
+
+                #region MAS测试项
+                XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
+                string passFlag = "";
+                string AllpassFlag = "PASS";
+                //胶线面积
+                float[] fGlue_Areas = stPLC_MesData.testData.fGlue_Areas;
+                float fGlue_AreasMax = stPLC_MesData.testData.fGlue_AreasMax;
+                float fGlue_AreasMin = stPLC_MesData.testData.fGlue_AreasMin;
+                //胶线高度
+                float[] fGlue_Heights = stPLC_MesData.testData.fGlue_Heights;
+                float fGlue_HeightsMax = stPLC_MesData.testData.fGlue_HeightsMax;
+                float fGlue_HeightsMin = stPLC_MesData.testData.fGlue_HeightsMin;
+
+                XmStationOut_InspectionItemData inspectionItemData = new XmStationOut_InspectionItemData();
+                if (fGlue_AreasMax > fGlue_AreasMin && (fGlue_AreasMax != 0 || fGlue_AreasMin != 0))
+                {
+                    for (int i = 0; i < fGlue_Areas.Length -1 ; i++)
+                    {
+                        if (fGlue_Areas[i] > fGlue_AreasMin && fGlue_Areas[i] <= fGlue_AreasMax)
+                            passFlag = "PASS";
+                        else
+                            passFlag = "FAIL";
+
+                        if (passFlag == "FAIL") AllpassFlag = passFlag;
+                    }
+                    inspectionItemData.AddDataItem("GlueLine", "胶线面积", string.Join(",", fGlue_Areas), fGlue_AreasMax.ToString(), fGlue_AreasMin.ToString(), passFlag);
+                }
+
+                if (fGlue_HeightsMax > fGlue_HeightsMin && (fGlue_HeightsMax != 0 || fGlue_HeightsMin != 0))
+                {
+                    for (int i = 0; i < fGlue_Heights.Length-1; i++)
+                    {
+                        if (fGlue_Heights[i] > fGlue_HeightsMin && fGlue_Heights[i] <= fGlue_HeightsMax)
+                            passFlag = "PASS";
+                        else
+                            passFlag = "FAIL";
+
+                        if (passFlag == "FAIL") AllpassFlag = passFlag;
+                    }
+                    inspectionItemData.AddDataItem("GlueLine", "胶线高度", string.Join(",", fGlue_Heights), fGlue_HeightsMax.ToString(), fGlue_HeightsMin.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,
@@ -5668,7 +5722,6 @@ namespace MainForm
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            
 
             try
             {
@@ -5778,6 +5831,33 @@ namespace MainForm
                 #endregion
                 string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
 
+
+                #region MAS测试项
+                XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
+                string passFlag = "";
+                string AllpassFlag = "PASS";
+                //ADD板的压力
+                float fForceAddPCB = stPLC_MesData.testData.fForceAddPCB;
+                float fForceAddPCBMax = stPLC_MesData.testData.fForceAddPCBMax;
+                float fForceAddPCBMin = stPLC_MesData.testData.fForceAddPCBMin;
+
+                XmStationOut_InspectionItemData inspectionItemData = new XmStationOut_InspectionItemData();
+                if (fForceAddPCBMax > fForceAddPCBMin && (fForceAddPCBMax != 0 || fForceAddPCBMin != 0))
+                {
+                    if (fForceAddPCB > fForceAddPCBMin && fForceAddPCB <= fForceAddPCBMax)
+                        passFlag = "PASS";
+                    else
+                        passFlag = "FAIL";
+                    
+                    if (passFlag == "FAIL") AllpassFlag = passFlag;
+                    inspectionItemData.AddDataItem("AirPressure", "ADD板压力", fForceAddPCB.ToString(), fForceAddPCBMax.ToString(), fForceAddPCBMin.ToString(), passFlag);
+                }
+
+                inspectionItemData.childUnitSn = strProductBarcode;
+                inspectionItemData.childUnitState = AllpassFlag;
+                inspectionItemData.toolVersion = "1.0";
+                #endregion
+
                 int result1 = 0;
                 byte mesResultFrmWeb = 0;
                 if (stPLC_MesData.mesCommFrmPLC.cmdParam == 2)