Quellcode durchsuchen

修复双站uuid丢失、iot过站明细序号不增加、50绑定pcb编码问题

WIN-GH9CEESPLTB\Administrator vor 1 Monat
Ursprung
Commit
8cb8678c54
1 geänderte Dateien mit 51 neuen und 38 gelöschten Zeilen
  1. 51 38
      MainForm/FaForm/Form_Home.cs

+ 51 - 38
MainForm/FaForm/Form_Home.cs

@@ -164,7 +164,9 @@ namespace MainForm
         XiaomiDeviceStateData xmDeviceStateData = new XiaomiDeviceStateData();
         XiaomiDeviceStateData xmDeviceStateData = new XiaomiDeviceStateData();
 
 
         private int test_item_num = 0; //iot 过站数据序号
         private int test_item_num = 0; //iot 过站数据序号
-        public static string uuid = "";
+        public static string uuid = ""; //单工位或左工位
+        public static string uuid2 = ""; //右工位
+
         private bool inpass = false; //保存进站测试状态
         private bool inpass = false; //保存进站测试状态
 
 
         public static XiaoMiParm xiaomiParm = new XiaoMiParm();
         public static XiaoMiParm xiaomiParm = new XiaoMiParm();
@@ -1947,7 +1949,12 @@ namespace MainForm
                     string id = processData.ID.Copy();
                     string id = processData.ID.Copy();
 
 
                     XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
                     XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
-                    outRequest_Body.uuidInspection = uuid;
+
+                    if (direction == "Right")
+                        outRequest_Body.uuidInspection = uuid2;
+                    else 
+                        outRequest_Body.uuidInspection = uuid;
+
                     outRequest_Body.machineId = machineId; // 装备id(可配置) 
                     outRequest_Body.machineId = machineId; // 装备id(可配置) 
                     outRequest_Body.stationId = stationId; // ⼯位ID(可配置)  
                     outRequest_Body.stationId = stationId; // ⼯位ID(可配置)  
                     outRequest_Body.clientMac = GlobalContext.MacStr; // 客⼾端本机MAC地址,格式:XX-XX-XX-XX-XX-XX
                     outRequest_Body.clientMac = GlobalContext.MacStr; // 客⼾端本机MAC地址,格式:XX-XX-XX-XX-XX-XX
@@ -2095,12 +2102,13 @@ namespace MainForm
             //过站明细
             //过站明细
             if (GlobalContext.IsMqttSendProcessData)
             if (GlobalContext.IsMqttSendProcessData)
             {
             {
-                test_item_num += 1;
                 PassStationDetailRequest request = new PassStationDetailRequest();
                 PassStationDetailRequest request = new PassStationDetailRequest();
-                request.pass_station_id = uuid;
+                if (direction == "Right")
+                    request.pass_station_id = uuid2;
+                else
+                    request.pass_station_id = uuid;
                 request.sn = sn; // 产品SN
                 request.sn = sn; // 产品SN
                 request.slot = vehicleSlot; // 槽位编码
                 request.slot = vehicleSlot; // 槽位编码
-                request.test_item_num = test_item_num.ToString();
                 request.function_name = "Machine_加⼯模块";
                 request.function_name = "Machine_加⼯模块";
                 request.status = "PASS";
                 request.status = "PASS";
                 (int, string) iotResult = (0, "");
                 (int, string) iotResult = (0, "");
@@ -2110,6 +2118,8 @@ namespace MainForm
                     var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonParm);
                     var dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonParm);
                     foreach (var kvp in dictionary)
                     foreach (var kvp in dictionary)
                     {
                     {
+                        test_item_num += 1;
+                        request.test_item_num = test_item_num.ToString();
                         request.test_item = kvp.Key.ToString();
                         request.test_item = kvp.Key.ToString();
                         request.result_val = string.IsNullOrEmpty(kvp.Value) ? "" : kvp.Value.ToString();
                         request.result_val = string.IsNullOrEmpty(kvp.Value) ? "" : kvp.Value.ToString();
                         request.description = request.test_item;
                         request.description = request.test_item;
@@ -3481,7 +3491,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -3929,7 +3939,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -4244,7 +4254,7 @@ namespace MainForm
                                 {
                                 {
                                     if (!ProgressState)
                                     if (!ProgressState)
                                     {
                                     {
-                                        uuid = Guid.NewGuid().ToString(); //创建贯穿进出站的uuid
+                                        uuid2 = Guid.NewGuid().ToString(); //创建贯穿进出站的uuid
                                         stationCode = "[OP32]";
                                         stationCode = "[OP32]";
                                         stationName = "点散热胶装备2";
                                         stationName = "点散热胶装备2";
                                         stationNameStr = stationCode + stationName;
                                         stationNameStr = stationCode + stationName;
@@ -4528,7 +4538,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -4665,7 +4675,8 @@ namespace MainForm
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stopwatch2.ElapsedMilliseconds + "ms");
                 stopwatch2.ElapsedMilliseconds + "ms");
             ProgressState = false;
             ProgressState = false;
-            uuid = "";
+            if (direction == "Left") uuid = "";
+            if (direction == "Right") uuid2 = "";
         }
         }
 
 
         #endregion S3
         #endregion S3
@@ -4901,7 +4912,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -4986,7 +4997,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -5178,8 +5189,8 @@ namespace MainForm
                         {
                         {
                             //测试数据
                             //测试数据
                             //stPLC_MesData.mesCommFrmPLC.cmd = 2;
                             //stPLC_MesData.mesCommFrmPLC.cmd = 2;
-                            //stPLC_MesData.BarcodeSet.strCarrierBarcode = "A123456";
-                            //stPLC_MesData.BarcodeSet.strPCBBarcode = "A1507V000239";
+                            stPLC_MesData.BarcodeSet.strCarrierBarcode = "A235461";
+                            stPLC_MesData.BarcodeSet.strPCBBarcode = "A1507V000239";
                             //stPLC_MesData.iotData.beatAction = 1;
                             //stPLC_MesData.iotData.beatAction = 1;
                             //stPLC_MesData.iotData.beatAction = 2;
                             //stPLC_MesData.iotData.beatAction = 2;
                             //stPLC_MesData.iotData.beatAction = 3;
                             //stPLC_MesData.iotData.beatAction = 3;
@@ -5379,15 +5390,15 @@ namespace MainForm
                 AddMessage(LogType.Info, $"ADD板编码(PCB码):{pcbBarcode}");
                 AddMessage(LogType.Info, $"ADD板编码(PCB码):{pcbBarcode}");
 
 
                 //绑定载具和产品
                 //绑定载具和产品
-                ResponseMessage message = new ResponseMessage();
-                message = SQLHelper.PCBCarrierBind(strCarrierBarcode, pcbBarcode);
-                if (message.result == false)
-                {
-                    AddMessage(LogType.Error, stationNameStr + "_载具码与产品码绑定失败,错误:" + message.text);
-                    ProgressState = false;
-                    Thread.Sleep(10000);
-                    return;
-                }
+                //ResponseMessage message = new ResponseMessage();
+                //message = SQLHelper.PCBCarrierBind(strCarrierBarcode, pcbBarcode);
+                //if (message.result == false)
+                //{
+                //    AddMessage(LogType.Error, stationNameStr + "_载具码与产品码绑定失败,错误:" + message.text);
+                //    ProgressState = false;
+                //    Thread.Sleep(10000);
+                //    return;
+                //}
 
 
                 //载具码验证产品码                                                                              //载具码验证产品码 
                 //载具码验证产品码                                                                              //载具码验证产品码 
                 //string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
                 //string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
@@ -5461,7 +5472,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -6033,7 +6044,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -6639,7 +6650,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -6740,10 +6751,10 @@ namespace MainForm
                     string strScrewResults = ShortArrayToString(stPLC_MesData.mesData.nScrewResults);
                     string strScrewResults = ShortArrayToString(stPLC_MesData.mesData.nScrewResults);
                     message = SQLHelper.InsertOp701Data(CarrierBarcode, sn, strMesHeightInfos,
                     message = SQLHelper.InsertOp701Data(CarrierBarcode, sn, strMesHeightInfos,
                         strScrewOrders, strScrewResults, stPLC_MesData.mesData.nRemainCount);
                         strScrewOrders, strScrewResults, stPLC_MesData.mesData.nRemainCount);
-                    if (message.result == false)
-                    {
-                        AddMessage(LogType.Info, stationNameStr + "_Left_保存加工数据失败");
-                    }
+                    //if (message.result == false)
+                    //{
+                    //    AddMessage(LogType.Info, stationNameStr + "_Left_保存加工数据失败");
+                    //}
                 }
                 }
 
 
                 if (direction == "Right")
                 if (direction == "Right")
@@ -6753,10 +6764,10 @@ namespace MainForm
                     string strScrewResults = ShortArrayToString(stPLC_MesData.mesData.nScrewResults);
                     string strScrewResults = ShortArrayToString(stPLC_MesData.mesData.nScrewResults);
                     message = SQLHelper.InsertOp702Data(CarrierBarcode, sn, strMesHeightInfos,
                     message = SQLHelper.InsertOp702Data(CarrierBarcode, sn, strMesHeightInfos,
                         strScrewOrders, strScrewResults, stPLC_MesData.mesData.nRemainCount);
                         strScrewOrders, strScrewResults, stPLC_MesData.mesData.nRemainCount);
-                    if (message.result == false)
-                    {
-                        AddMessage(LogType.Info, stationNameStr + "__Right_保存加工数据失败");
-                    }
+                    //if (message.result == false)
+                    //{
+                    //    AddMessage(LogType.Info, stationNameStr + "__Right_保存加工数据失败");
+                    //}
                 }
                 }
 
 
                 //保存螺丝数据到txt
                 //保存螺丝数据到txt
@@ -6790,7 +6801,9 @@ namespace MainForm
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stopwatch2.ElapsedMilliseconds + "ms");
                 stopwatch2.ElapsedMilliseconds + "ms");
             ProgressState = false;
             ProgressState = false;
-            uuid = "";
+            if (direction == "Left") uuid = "";
+            if (direction == "Right") uuid2 = "";
+
         }
         }
 
 
         #endregion
         #endregion
@@ -7111,7 +7124,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -7369,7 +7382,6 @@ namespace MainForm
                                             tagBaseName + "." + tagMesCommName, stationCode, stationName,
                                             tagBaseName + "." + tagMesCommName, stationCode, stationName,
                                             out ProgressState));
                                             out ProgressState));
                                         stPLC_MesData.mesCommFrmPLC.cmd = 0;
                                         stPLC_MesData.mesCommFrmPLC.cmd = 0;
-                                        uuid = "";
                                     }
                                     }
                                 }
                                 }
                             }
                             }
@@ -7554,7 +7566,7 @@ namespace MainForm
         {
         {
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch1 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
             Stopwatch stopwatch2 = new Stopwatch();
-            test_item_num = 0; //iot 过站明细序号
+            
 
 
             try
             try
             {
             {
@@ -7664,6 +7676,7 @@ namespace MainForm
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stationNameStr + "_出站接口;总用时" + stopwatch1.ElapsedMilliseconds + "ms;写入用时" +
                 stopwatch2.ElapsedMilliseconds + "ms");
                 stopwatch2.ElapsedMilliseconds + "ms");
             ProgressState = false;
             ProgressState = false;
+            uuid = "";
         }
         }
 
 
         #endregion
         #endregion