wudingsheng 1 tydzień temu
rodzic
commit
c6a5aac3f2

+ 2 - 1
IMCS_CCS/Service/Impl/HttpRequestService.cs

@@ -30,6 +30,7 @@ using MySqlX.XDevAPI.Common;
 using Newtonsoft.Json.Linq;
 using StackExchange.Redis;
 using IMCS.CCS.Common.Redis;
+using Microsoft.AspNetCore.Mvc;
 
 namespace IMCS.CCS.Services
 {
@@ -1979,7 +1980,7 @@ namespace IMCS.CCS.Services
             {
                 s7.ConnectClose();
                 responseData.result = "false";
-                responseData.msg = "PLC连接不上";
+                responseData.msg = "PLC连接不上,"+ ConnectionResult.ErrorCode+","+ ConnectionResult.Message;
                 return responseData;
             }
             List<ResponseEcsPoint> responseEcsPointList = new List<ResponseEcsPoint>();

+ 8 - 5
IMCS_CCS/Service/Impl/TaskJobService.cs

@@ -252,7 +252,7 @@ namespace IMCS.CCS.Service.Impl
             }
             catch (Exception ex)
             {
-                Log.Instance.WriteLogAdd("S7采集异常===>>" + ex.Message, LOG_TITLE_S7);
+                Log.Instance.WriteLogAdd("S7采集异常===>>" + ex, LOG_TITLE_S7);
                 return "S7采集失败";
             }
         }
@@ -1761,7 +1761,7 @@ namespace IMCS.CCS.Service.Impl
        
                     s7.ConnectClose();
                     Log.Instance.WriteLogAdd("S7心跳写入异常,plc连不上==>" + "10.161.30.248", LOG_HEART_PLC);
-                    return "心跳写入失败,plc连不上";
+                    return "心跳写入失败,plc连不上,"+ ConnectionResult.Message+ ConnectionResult.ErrorCode;
                 }
                 else
                 {
@@ -1781,7 +1781,7 @@ namespace IMCS.CCS.Service.Impl
             }catch (Exception ex)
             {
                 Log.Instance.WriteLogAdd("心跳写入异常" + ex.Message, LOG_HEART_PLC);
-               // Console.WriteLine("心跳写入异常");
+                // Console.WriteLine("心跳写入异常");
                 return "心跳写入异常" + ex.Message;
             }
             Log.Instance.WriteLogAdd("心跳写入成功" , LOG_HEART_PLC);
@@ -1795,9 +1795,9 @@ namespace IMCS.CCS.Service.Impl
         /// <returns></returns>
         public async Task<string> MonitorEquipmentStatusJob2()
         {
+            SiemensS7Net s7 = DevicePlcS7.SiemensS7("10.161.30.248");
             try
             {
-                SiemensS7Net s7 = DevicePlcS7.SiemensS7("10.161.30.248");
                 OperateResult ConnectionResult = s7.ConnectServer();
                 if (!ConnectionResult.IsSuccess)
                 {
@@ -1884,9 +1884,12 @@ namespace IMCS.CCS.Service.Impl
             catch (Exception ex)
             {
                 Log.Instance.WriteLogAdd("MonitorEquipmentStatusJob:" + ex.Message, LOG_RESOURCE_STATE);
-
                 return "MonitorEquipmentStatusJob : " + ex.Message;
             }
+            finally
+            {
+                s7.ConnectClose();
+            }
         }
 
 

Plik diff jest za duży
+ 0 - 0
IMCS_CCS/wwwroot/db/Tasks.json


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików