Browse Source

fix:增加日志及安全拦截

wang.sq@aliyun.com 3 weeks ago
parent
commit
22b9a64c3c

+ 8 - 0
IMCS_CCS/CCS.csproj

@@ -6,6 +6,14 @@
     <RootNamespace>IMCS_CCS</RootNamespace>
     <RootNamespace>IMCS_CCS</RootNamespace>
   </PropertyGroup>
   </PropertyGroup>
 
 
+  <ItemGroup>
+    <None Remove="appsettings.json.bak" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="appsettings.json.bak" />
+  </ItemGroup>
+
   <ItemGroup>
   <ItemGroup>
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
     <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
     <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />

+ 2 - 2
IMCS_CCS/Controllers/CcsController.cs

@@ -82,7 +82,7 @@ namespace IMCS.CCS.Controllers
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// CNC刀具库请求上下料动作: POST: api/CutterRobotAction
+        /// CNC刀具库请求上下料动作: POST: api/CutterDeviceTakeOrPutRequest
         /// </summary> 
         /// </summary> 
         /// <returns></returns>
         /// <returns></returns>
         [Route("api/CutterDeviceTakeOrPutRequest")]
         [Route("api/CutterDeviceTakeOrPutRequest")]
@@ -162,7 +162,7 @@ namespace IMCS.CCS.Controllers
         /// <returns></returns>
         /// <returns></returns>
         [Route("api/GetTools")]
         [Route("api/GetTools")]
         [HttpPost]
         [HttpPost]
-        public async Task<ActionResult<List<ResponseToolData>>> GetTools(RequestToolData data)
+        public async Task<ActionResult<ResponseData<List<ResponseToolData>>>> GetTools(RequestToolData data)
         {
         {
             return await _httpRequestService.GetTools(data);
             return await _httpRequestService.GetTools(data);
         }
         }

+ 11 - 0
IMCS_CCS/Controllers/JobTasksController.cs

@@ -109,6 +109,17 @@ namespace IMCS.CCS.Controllers
             return await _taskJobService.CallbackJob8();
             return await _taskJobService.CallbackJob8();
         }
         }
 
 
+
+        /// <summary>
+        /// 数据绑定
+        /// </summary> 
+        /// <returns></returns>
+        [HttpPost("CallbackJob9")]
+        public async Task<string> CallbackJob9()
+        {
+            return await _taskJobService.CallbackJob9();
+        }
+
         /// <summary>
         /// <summary>
         /// 采集数据OPCUA
         /// 采集数据OPCUA
         /// </summary> 
         /// </summary> 

+ 9 - 5
IMCS_CCS/Entitys/CcsAction.cs

@@ -43,11 +43,11 @@ namespace IMCS.CCS.Entitys
     /// </summary>
     /// </summary>
     public enum ActionTypeEnum
     public enum ActionTypeEnum
     {
     {
-        [EnumDescription("机器人动作")]
+        [EnumDescription("机器人动作-地轨")]
         RobotAction,
         RobotAction,
-        [EnumDescription("刀具机器人动作")]
+        [EnumDescription("机器人动作-天轨")]
         CutterRobotAction,
         CutterRobotAction,
-        [EnumDescription("刀具库请求上下料动作")]
+        [EnumDescription("CNC刀具写入上下料请求")]
         CutterCncDeviceAction,
         CutterCncDeviceAction,
         [EnumDescription("上传文件")]
         [EnumDescription("上传文件")]
         UploadFile,
         UploadFile,
@@ -63,14 +63,18 @@ namespace IMCS.CCS.Entitys
         ThreeDimensionalPutStatus,
         ThreeDimensionalPutStatus,
         [EnumDescription("三坐标启动")]
         [EnumDescription("三坐标启动")]
         ThreeDimensionalRun,
         ThreeDimensionalRun,
-        [EnumDescription("偏移量设置")]
+        [EnumDescription("三坐标偏移量设置")]
         WriteDeviationValue,
         WriteDeviationValue,
         [EnumDescription("读取rfid数据")]
         [EnumDescription("读取rfid数据")]
         RfidRead,
         RfidRead,
         [EnumDescription("重置rfid数据")]
         [EnumDescription("重置rfid数据")]
         RfidReset,
         RfidReset,
         [EnumDescription("绑定数据")]
         [EnumDescription("绑定数据")]
-        BindingInfo
+        BindingInfo,
+        [EnumDescription("对刀仪数据写入")]
+        ReadAndWriteTool,
+        [EnumDescription("机床刀具列表获取")]
+        ToolList
     }
     }
 
 
     /// <summary>
     /// <summary>

+ 2 - 0
IMCS_CCS/Entitys/CcsActionAddress.cs

@@ -48,6 +48,8 @@ namespace IMCS.CCS.Entitys
         WRITE_CHECK,
         WRITE_CHECK,
         [EnumDescription("校验")]
         [EnumDescription("校验")]
         CHECK,
         CHECK,
+        [EnumDescription("回调前校验")]
+        CALLBACK_CHECK,
         [EnumDescription("回调")]
         [EnumDescription("回调")]
         CALLBACK,
         CALLBACK,
         [EnumDescription("失败回调")]
         [EnumDescription("失败回调")]

+ 3 - 0
IMCS_CCS/Entitys/RequestData.cs

@@ -362,6 +362,9 @@ namespace IMCS.CCS.Models
         /*准确定义刀具的刀具可用长度*/
         /*准确定义刀具的刀具可用长度*/
         public string lu { get; set; }
         public string lu { get; set; }
 
 
+        /*螺距*/
+        public string pitch { get; set; }
+
 
 
         /*准确定义刀具的刀颈半径*/
         /*准确定义刀具的刀颈半径*/
         public string rn { get; set; }
         public string rn { get; set; }

+ 9 - 0
IMCS_CCS/Entitys/TaskCallback.cs

@@ -66,6 +66,15 @@ namespace IMCS.CCS.Entitys
         [Column("operate_name")]
         [Column("operate_name")]
         public string OperateName { get; set; }
         public string OperateName { get; set; }
 
 
+
+        [Column("call_back_check_address")]
+        public string CallBackCheckAddress { get; set; }
+
+
+        [Column("call_back_check_address_value")]
+        public string CallBackCheckAddressValue { get; set; }
+
+
         [Column("callback_value")]
         [Column("callback_value")]
         public string CallbackValue { get; set; }
         public string CallbackValue { get; set; }
 
 

+ 24 - 1
IMCS_CCS/IMCS.CCS.xml

@@ -231,7 +231,7 @@
         </member>
         </member>
         <member name="M:IMCS.CCS.Controllers.CcsController.CutterDeviceTakeOrPutRequest(IMCS.CCS.Models.RequestData{IMCS.CCS.Models.CutterLocationData})">
         <member name="M:IMCS.CCS.Controllers.CcsController.CutterDeviceTakeOrPutRequest(IMCS.CCS.Models.RequestData{IMCS.CCS.Models.CutterLocationData})">
             <summary>
             <summary>
-            CNC刀具库请求上下料动作: POST: api/CutterRobotAction
+            CNC刀具库请求上下料动作: POST: api/CutterDeviceTakeOrPutRequest
             </summary> 
             </summary> 
             <returns></returns>
             <returns></returns>
         </member>
         </member>
@@ -447,6 +447,12 @@
             </summary> 
             </summary> 
             <returns></returns>
             <returns></returns>
         </member>
         </member>
+        <member name="M:IMCS.CCS.Controllers.JobTasksController.CallbackJob9">
+            <summary>
+            数据绑定
+            </summary> 
+            <returns></returns>
+        </member>
         <member name="M:IMCS.CCS.Controllers.JobTasksController.DataCollectOPCUAJob">
         <member name="M:IMCS.CCS.Controllers.JobTasksController.DataCollectOPCUAJob">
             <summary>
             <summary>
             采集数据OPCUA
             采集数据OPCUA
@@ -1257,6 +1263,11 @@
             刀具使用完毕此刀位可以换刀
             刀具使用完毕此刀位可以换刀
             </summary>
             </summary>
         </member>
         </member>
+        <member name="P:IMCS.CCS.Models.vo.ResponseToolData.isMainShaft">
+            <summary>
+            是否在主轴上
+            </summary>
+        </member>
         <member name="T:IMCS.CCS.Filter.ApiExceptionFilter">
         <member name="T:IMCS.CCS.Filter.ApiExceptionFilter">
             <summary>
             <summary>
             异常过滤器
             异常过滤器
@@ -1671,6 +1682,12 @@
             </summary> 
             </summary> 
             <returns></returns>
             <returns></returns>
         </member>
         </member>
+        <member name="M:IMCS.CCS.Service.Impl.TaskJobService.CallbackJob9">
+            <summary>
+             数据绑定
+            </summary>
+            <returns></returns>
+        </member>
         <member name="T:IMCS.CCS.Service.Impl.TaskService">
         <member name="T:IMCS.CCS.Service.Impl.TaskService">
             <summary>
             <summary>
             任务服务
             任务服务
@@ -1833,6 +1850,12 @@
             </summary>
             </summary>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
+        <member name="M:IMCS.CCS.Service.ITaskJobService.CallbackJob9">
+            <summary>
+            数据绑定
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:IMCS.CCS.Service.ITaskJobService.DataCollectOPCUAJob">
         <member name="M:IMCS.CCS.Service.ITaskJobService.DataCollectOPCUAJob">
             <summary>
             <summary>
             OPCUA采集
             OPCUA采集

+ 3 - 0
IMCS_CCS/Model/vo/ResponseData.cs

@@ -4,6 +4,9 @@ namespace IMCS.CCS.Models.vo
 {
 {
     public class ResponseData<T>
     public class ResponseData<T>
     {
     {
+
+        public string result { get; set; } = "true";
+
         public String Msg { get; set; } = "success";
         public String Msg { get; set; } = "success";
 
 
         public int Code { get; set; } = 200;
         public int Code { get; set; } = 200;

+ 5 - 0
IMCS_CCS/Model/vo/ResponseToolData.cs

@@ -92,5 +92,10 @@ namespace IMCS.CCS.Models.vo
         /// </summary>
         /// </summary>
         public string doc { get; set; }
         public string doc { get; set; }
 
 
+        /// <summary>
+        /// 是否在主轴上
+        /// </summary>
+        public string isMainShaft { get; set; }
+
     }
     }
 }
 }

+ 1 - 1
IMCS_CCS/Service/IHttpRequestService .cs

@@ -70,7 +70,7 @@ namespace IMCS.CCS.Services
         /// <summary>
         /// <summary>
         /// 刀具接口列表
         /// 刀具接口列表
         /// </summary> 
         /// </summary> 
-        Task<List<ResponseToolData>> GetTools(RequestToolData req);
+        Task<ResponseData<List<ResponseToolData>>> GetTools(RequestToolData req);
 
 
 
 
         /// <summary>
         /// <summary>

+ 7 - 0
IMCS_CCS/Service/ITaskJobService.cs

@@ -60,6 +60,13 @@ namespace IMCS.CCS.Service
         /// <returns></returns>
         /// <returns></returns>
         Task<string> CallbackJob8();
         Task<string> CallbackJob8();
 
 
+        /// <summary>
+        /// 数据绑定
+        /// </summary>
+        /// <returns></returns>
+        Task<string> CallbackJob9();
+        
+
         /// <summary>
         /// <summary>
         /// OPCUA采集
         /// OPCUA采集
         /// </summary>
         /// </summary>

+ 256 - 108
IMCS_CCS/Service/Impl/HttpRequestService.cs

@@ -28,6 +28,8 @@ using static Google.Protobuf.Reflection.SourceCodeInfo.Types;
 using Newtonsoft.Json.Linq;
 using Newtonsoft.Json.Linq;
 using static AutoMapper.Internal.ExpressionFactory;
 using static AutoMapper.Internal.ExpressionFactory;
 using Microsoft.EntityFrameworkCore.Internal;
 using Microsoft.EntityFrameworkCore.Internal;
+using Org.BouncyCastle.Asn1.Ocsp;
+using Ubiety.Dns.Core;
 
 
 namespace IMCS.CCS.Services
 namespace IMCS.CCS.Services
 {
 {
@@ -232,6 +234,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> RobotAction(RequestData<LocationData> req)
         public async Task<ResponseECSData> RobotAction(RequestData<LocationData> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                    EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId,"执行成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId,"执行成功");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
             try
             try
@@ -284,7 +289,7 @@ namespace IMCS.CCS.Services
                     if (!callbackData.isSuccess)
                     if (!callbackData.isSuccess)
                     {
                     {
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "====" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
+                        Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "====>" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
                         EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
                         EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = callbackData.msg;
                         responseData.resultMsg = callbackData.msg;
@@ -408,8 +413,8 @@ namespace IMCS.CCS.Services
                 // 查询需要操作的plc的db块
                 // 查询需要操作的plc的db块
                 CcsActionAddress actionAddressQuery = new CcsActionAddress();
                 CcsActionAddress actionAddressQuery = new CcsActionAddress();
                 actionAddressQuery.ActionId = actionInfo.Id;
                 actionAddressQuery.ActionId = actionInfo.Id;
-                List<CcsActionAddress> CcsActionAddresses = _ccsActionAddressService.GetList(actionAddressQuery); 
-               
+                List<CcsActionAddress> CcsActionAddresses = _ccsActionAddressService.GetList(actionAddressQuery);
+
                 //查询出需要检查的地址列表
                 //查询出需要检查的地址列表
                 List<CcsActionAddress> CcsActionAddressChecks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CHECK.ToString()).ToList();
                 List<CcsActionAddress> CcsActionAddressChecks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CHECK.ToString()).ToList();
                 foreach (CcsActionAddress actionAddress in CcsActionAddressChecks)
                 foreach (CcsActionAddress actionAddress in CcsActionAddressChecks)
@@ -417,8 +422,6 @@ namespace IMCS.CCS.Services
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     {
                     {
 
 
-
-
                         string operateResult = "";
                         string operateResult = "";
                         if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.BOOL.ToString()))
                         if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.BOOL.ToString()))
                         {
                         {
@@ -449,6 +452,8 @@ namespace IMCS.CCS.Services
                     }
                     }
                 }
                 }
 
 
+                string baowen = null;
+
                 //查询需要写入地址列表
                 //查询需要写入地址列表
                 List<CcsActionAddress> CcsActionAddressWrites = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE.ToString()).ToList();
                 List<CcsActionAddress> CcsActionAddressWrites = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE.ToString()).ToList();
                 foreach (CcsActionAddress actionAddress in CcsActionAddressWrites)
                 foreach (CcsActionAddress actionAddress in CcsActionAddressWrites)
@@ -462,7 +467,8 @@ namespace IMCS.CCS.Services
                             //区域块为七位,点位为三位
                             //区域块为七位,点位为三位
                             //parValue = req.data.LocationArea.PadRight(7,'0')+ req.data.Location.PadLeft(3, '0') + req.data.DestLocationArea.PadRight(7, '0') + req.data.DestLocation.PadLeft(3, '0');
                             //parValue = req.data.LocationArea.PadRight(7,'0')+ req.data.Location.PadLeft(3, '0') + req.data.DestLocationArea.PadRight(7, '0') + req.data.DestLocation.PadLeft(3, '0');
                             parValue =req.data.Location + req.data.DestLocation;
                             parValue =req.data.Location + req.data.DestLocation;
-                            s7.Write(actionAddress.Address, Convert.ToString(parValue));
+                            baowen = Convert.ToString(parValue);
+                            s7.Write(actionAddress.Address, baowen);
                         }
                         }
                         else if (actionAddress.Sort == 2)
                         else if (actionAddress.Sort == 2)
                         {
                         {
@@ -493,10 +499,13 @@ namespace IMCS.CCS.Services
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.RobotAction.ToString(),
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.RobotAction.ToString(),
                     EnumHelper.GetDescription(ActionTypeEnum.RobotAction), req.taskId, req.taskNodeId);
                     EnumHelper.GetDescription(ActionTypeEnum.RobotAction), req.taskId, req.taskNodeId);
                 taskCallbackData = setCallBackValue(CcsActionAddresses, taskCallbackData);
                 taskCallbackData = setCallBackValue(CcsActionAddresses, taskCallbackData);
-               
+
+                // 回调校验数据改为动态报文
+                taskCallbackData.CallBackCheckAddressValue = baowen;
+
                 // 保存数据
                 // 保存数据
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
-                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.RobotAction) + "取成功===>>" + JsonConvert.SerializeObject(req)
+                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.RobotAction) + "命令下发成功===>>" + JsonConvert.SerializeObject(req)
                    , EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
                    , EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
                 return responseData;
                 return responseData;
             }
             }
@@ -525,6 +534,9 @@ namespace IMCS.CCS.Services
 
 
         public async Task<ResponseECSData> CutterRobotAction(RequestData<CutterLocationData> req)
         public async Task<ResponseECSData> CutterRobotAction(RequestData<CutterLocationData> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "任务接受===>>" + JsonConvert.SerializeObject(req),
+        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
             try
             try
@@ -713,7 +725,23 @@ namespace IMCS.CCS.Services
                 {
                 {
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     {
                     {
-                        string operateResult = s7.ReadBool(actionAddress.Address).Content.ToString();
+                        string operateResult = "";
+                        if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.BOOL.ToString()))
+                        {
+                            operateResult = s7.ReadBool(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.SHORT.ToString()))
+                        {
+                            operateResult = s7.ReadInt16(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.String.ToString()))
+                        {
+                            operateResult = s7.ReadString(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.Byte.ToString()))
+                        {
+                            operateResult = s7.ReadByte(actionAddress.Address).Content.ToString();
+                        }
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
@@ -726,6 +754,9 @@ namespace IMCS.CCS.Services
                     }
                     }
                 }
                 }
 
 
+                // 报文
+                string baowen = null;
+
                 //查询需要写入地址列表
                 //查询需要写入地址列表
                 List<CcsActionAddress> CcsActionAddressWrites = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE.ToString()).ToList();
                 List<CcsActionAddress> CcsActionAddressWrites = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE.ToString()).ToList();
                 foreach (CcsActionAddress actionAddress in CcsActionAddressWrites)
                 foreach (CcsActionAddress actionAddress in CcsActionAddressWrites)
@@ -739,7 +770,8 @@ namespace IMCS.CCS.Services
                             //区域块为七位,点位为三位
                             //区域块为七位,点位为三位
                             //parValue = req.data.LocationArea.PadRight(7,'0')+ req.data.Location.PadLeft(3, '0') + req.data.DestLocationArea.PadRight(7, '0') + req.data.DestLocation.PadLeft(3, '0');
                             //parValue = req.data.LocationArea.PadRight(7,'0')+ req.data.Location.PadLeft(3, '0') + req.data.DestLocationArea.PadRight(7, '0') + req.data.DestLocation.PadLeft(3, '0');
                             parValue = req.data.Location + req.data.DestLocation;
                             parValue = req.data.Location + req.data.DestLocation;
-                            s7.Write(actionAddress.Address, Convert.ToString(parValue));
+                            baowen = Convert.ToString(parValue);
+                            s7.Write(actionAddress.Address, baowen);
                         }
                         }
                         else if (actionAddress.Sort == 2)
                         else if (actionAddress.Sort == 2)
                         {
                         {
@@ -795,9 +827,12 @@ namespace IMCS.CCS.Services
                     EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction), req.taskId, req.taskNodeId);
                     EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction), req.taskId, req.taskNodeId);
                 taskCallbackData = setCallBackValue(CcsActionAddresses, taskCallbackData);
                 taskCallbackData = setCallBackValue(CcsActionAddresses, taskCallbackData);
 
 
+                //比较数据设为动态数据
+                taskCallbackData.CallBackCheckAddressValue = baowen;
+
                 // 保存数据
                 // 保存数据
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
-                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction) + "取成功===>>" + JsonConvert.SerializeObject(req)
+                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction) + "命令下发成功===>>" + JsonConvert.SerializeObject(req)
                    , EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
                    , EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
                 return responseData;
                 return responseData;
             }
             }
@@ -825,12 +860,18 @@ namespace IMCS.CCS.Services
         /// <returns></returns>
         /// <returns></returns>
         public async Task<ResponseECSData> CutterDeviceTakeOrPutRequest(RequestData<CutterLocationData> req)
         public async Task<ResponseECSData> CutterDeviceTakeOrPutRequest(RequestData<CutterLocationData> req)
         {
         {
-            Log.Instance.WriteLogAdd("CNC刀具库请求上下料动作===>> " + JsonConvert.SerializeObject(req), "CNC刀具库请求上下料动作");
+            Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "任务接受===>>" + JsonConvert.SerializeObject(req),
+        EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
 
 
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
+            String dizhi = "";
             try
             try
             {
             {
+                dizhi = req.data.Location;
+                if (req.data.Location == null) {
+                    dizhi = req.data.DestLocation;
+                }
 
 
                 // 获取所有在线的设备
                 // 获取所有在线的设备
                 List<Device> devices = _deviceService.GetDeviceList();
                 List<Device> devices = _deviceService.GetDeviceList();
@@ -840,7 +881,7 @@ namespace IMCS.CCS.Services
 
 
                 if (device == null)
                 if (device == null)
                 {
                 {
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "设备已离线===>>" + JsonConvert.SerializeObject(req),
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction+ dizhi + "设备已离线===>>" + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + req.url;
                     responseData.resultMsg = "设备已离线:" + req.url;
@@ -849,7 +890,7 @@ namespace IMCS.CCS.Services
 
 
                 // 根据ip查询设备
                 // 根据ip查询设备
                 CcsAction actionQuery = new CcsAction();
                 CcsAction actionQuery = new CcsAction();
-                actionQuery.OperateType = ActionTypeEnum.CutterCncDeviceAction.ToString();
+                actionQuery.OperateType = ActionTypeEnum.CutterCncDeviceAction.ToString() + dizhi;
                 actionQuery.Ip = req.url;
                 actionQuery.Ip = req.url;
                 CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
                 CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
 
 
@@ -859,10 +900,10 @@ namespace IMCS.CCS.Services
                 if (!ConnectionResult.IsSuccess)
                 if (!ConnectionResult.IsSuccess)
                 {
                 {
                     s7.ConnectClose();
                     s7.ConnectClose();
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + dizhi + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                     responseData.result = "false";
                     responseData.result = "false";
-                    responseData.resultMsg = ActionTypeEnum.CutterCncDeviceAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = ActionTypeEnum.CutterCncDeviceAction + dizhi + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -877,11 +918,29 @@ namespace IMCS.CCS.Services
                 {
                 {
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
                     {
                     {
-                        string operateResult = s7.ReadBool(actionAddress.Address).Content.ToString();
+
+                        string operateResult = "";
+                        if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.BOOL.ToString()))
+                        {
+                            operateResult = s7.ReadBool(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.SHORT.ToString()))
+                        {
+                            operateResult = s7.ReadInt16(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.String.ToString()))
+                        {
+                            operateResult = s7.ReadString(actionAddress.Address).Content.ToString();
+                        }
+                        else if (actionAddress.AddressType.Equals(TagValueReadTypeEnum.Byte.ToString()))
+                        {
+                            operateResult = s7.ReadByte(actionAddress.Address).Content.ToString();
+                        }
+
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
-                            Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
+                            Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + dizhi + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
                             EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                             EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
@@ -945,6 +1004,8 @@ namespace IMCS.CCS.Services
                             await _ccsTagValueService.Update(tagValue);
                             await _ccsTagValueService.Update(tagValue);
                         }
                         }
 
 
+                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "CNC刀具库请求上下料动作数据写入成功===>>" + JsonConvert.SerializeObject(tagValue),
+                            EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
 
 
                         Thread.Sleep(SLEEP_TIME);
                         Thread.Sleep(SLEEP_TIME);
                     }
                     }
@@ -957,9 +1018,9 @@ namespace IMCS.CCS.Services
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 // 记录日志
                 // 记录日志
-                Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.CutterCncDeviceAction + dizhi + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
                     EnumHelper.GetDescription(ActionTypeEnum.CutterCncDeviceAction));
-                responseData.resultMsg = ActionTypeEnum.CutterCncDeviceAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
+                responseData.resultMsg = ActionTypeEnum.CutterCncDeviceAction + dizhi + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
                 responseData.result = "false";
                 responseData.result = "false";
 
 
                 // 关闭plc连接
                 // 关闭plc连接
@@ -979,6 +1040,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> UploadFile(RequestData<UploadFileData> req)
         public async Task<ResponseECSData> UploadFile(RequestData<UploadFileData> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                            EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
 
 
             try
             try
@@ -1045,6 +1109,7 @@ namespace IMCS.CCS.Services
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.UploadFile.ToString(),
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.UploadFile.ToString(),
                 EnumHelper.GetDescription(ActionTypeEnum.UploadFile), req.taskId, req.taskNodeId);
                 EnumHelper.GetDescription(ActionTypeEnum.UploadFile), req.taskId, req.taskNodeId);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
+
                 Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "上传成功===>>" + JsonConvert.SerializeObject(req),
                 Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "上传成功===>>" + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
                     EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
                 return responseData;
                 return responseData;
@@ -1065,6 +1130,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> StartNCProgram(RequestData<StartNCProgramData> req)
         public async Task<ResponseECSData> StartNCProgram(RequestData<StartNCProgramData> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             try
             try
             {
             {
@@ -1155,13 +1223,14 @@ namespace IMCS.CCS.Services
 
 
                     //s7.ConnectClose();
                     //s7.ConnectClose();
 
 
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                        EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));
+
                     RequestHeidhData hdhReq = new RequestHeidhData();
                     RequestHeidhData hdhReq = new RequestHeidhData();
                     hdhReq.ServerUrl = device.ServerUrl;
                     hdhReq.ServerUrl = device.ServerUrl;
                     hdhReq.MachineName = device.UserName;
                     hdhReq.MachineName = device.UserName;
                     hdhReq.Path = req.data.remotePath;
                     hdhReq.Path = req.data.remotePath;
                     hdhReq.Type = OpcUaActionTypeEnum.StartNcProgram.ToString();
                     hdhReq.Type = OpcUaActionTypeEnum.StartNcProgram.ToString();
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "启动参数===>>" + JsonConvert.SerializeObject(hdhReq),
-                        EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));
 
 
                     var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);
                     var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
@@ -1178,8 +1247,9 @@ namespace IMCS.CCS.Services
                     //插入回调
                     //插入回调
                     TaskCallback taskCallbackData = new TaskCallback(actionInfo.PlcIp, ActionTypeEnum.StartNCProgram.ToString(),
                     TaskCallback taskCallbackData = new TaskCallback(actionInfo.PlcIp, ActionTypeEnum.StartNCProgram.ToString(),
                     EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram), req.taskId, req.taskNodeId);
                     EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram), req.taskId, req.taskNodeId);
+
                     await _taskCallbackService.CreateOrUpdateAndCache(setCallBackValue(CcsActionAddresses, taskCallbackData));
                     await _taskCallbackService.CreateOrUpdateAndCache(setCallBackValue(CcsActionAddresses, taskCallbackData));
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "启动成功===>>" + JsonConvert.SerializeObject(req),
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "调用成功===>>" + JsonConvert.SerializeObject(req),
                         EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));                    
                         EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));                    
                     return responseData;
                     return responseData;
                 }
                 }
@@ -1208,6 +1278,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> StartCleanMachine(RequestData<object> req)
         public async Task<ResponseECSData> StartCleanMachine(RequestData<object> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.StartCleanMachine + "任务接受===>>" + JsonConvert.SerializeObject(req),
+    EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             try
             try
             {
             {
@@ -1252,6 +1325,7 @@ namespace IMCS.CCS.Services
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartCleanMachine.ToString(),
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartCleanMachine.ToString(),
                     EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine), req.taskId, req.taskNodeId);
                     EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine), req.taskId, req.taskNodeId);
                 await _taskCallbackService.CreateOrUpdateAndCache(setCallBackValue(CcsActionAddresses, taskCallbackData));
                 await _taskCallbackService.CreateOrUpdateAndCache(setCallBackValue(CcsActionAddresses, taskCallbackData));
+
                 Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine) + "启动成功===>>" + JsonConvert.SerializeObject(req)
                 Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine) + "启动成功===>>" + JsonConvert.SerializeObject(req)
                    , EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine));
                    , EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine));
                 return responseData;
                 return responseData;
@@ -1270,6 +1344,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> StartDryMachine(RequestData<object> req)
         public async Task<ResponseECSData> StartDryMachine(RequestData<object> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.StartDryMachine + "任务接受===>>" + JsonConvert.SerializeObject(req),
+EnumHelper.GetDescription(ActionTypeEnum.StartDryMachine));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             try
             try
             {
             {
@@ -1331,8 +1408,14 @@ namespace IMCS.CCS.Services
         /// <summary>
         /// <summary>
         /// 刀具接口列表
         /// 刀具接口列表
         /// </summary> 
         /// </summary> 
-        public async Task<List<ResponseToolData>> GetTools(RequestToolData req)
+        public async Task<ResponseData<List<ResponseToolData>>> GetTools(RequestToolData req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.ToolList + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.ToolList));
+
+            ResponseData<List<ResponseToolData>> responseData = new ResponseData<List<ResponseToolData>>();
+            responseData.result = "true";
+
             List<Device> devices = _deviceService.GetDeviceList();
             List<Device> devices = _deviceService.GetDeviceList();
 
 
             List<Device> deviceList = devices.Where(x => x.Ip.Equals(req.url) && x.Port.Equals(req.port)).ToList();
             List<Device> deviceList = devices.Where(x => x.Ip.Equals(req.url) && x.Port.Equals(req.port)).ToList();
@@ -1421,21 +1504,38 @@ namespace IMCS.CCS.Services
                     //list = JsonConvert.DeserializeObject<List<ResponseToolData>>(responseFanucData.ToolLife);
                     //list = JsonConvert.DeserializeObject<List<ResponseToolData>>(responseFanucData.ToolLife);
                     list = responseFanucData;
                     list = responseFanucData;
                 }
                 }
-            }else if(device.ProtocolType == ProtocalTypeEnum.HEIDEHAIN.ToString())
+                else {
+                    responseData.result = "false";
+                    responseData.Msg = Result.Message;
+                }
+            }
+            else if(device.ProtocolType == ProtocalTypeEnum.HEIDEHAIN.ToString())
             {
             {
                 RequestHeidhData hdhReq = new RequestHeidhData();
                 RequestHeidhData hdhReq = new RequestHeidhData();
                 hdhReq.ServerUrl = device.ServerUrl;
                 hdhReq.ServerUrl = device.ServerUrl;
                 hdhReq.MachineName = device.UserName;
                 hdhReq.MachineName = device.UserName;
-                hdhReq.Type = "ToolList";
-                var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);                
+                hdhReq.Type = ActionTypeEnum.ToolList.ToString();
+                var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);
                 if (Result.IsSuccess)
                 if (Result.IsSuccess)
                 {
                 {
-                    ResponseHeidhData responseData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
-                    list = JsonConvert.DeserializeObject<List<ResponseToolData>>(responseData.toolsInfo);
+                    ResponseHeidhData response = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
+                    list = JsonConvert.DeserializeObject<List<ResponseToolData>>(response.toolsInfo);
+
+                }
+                else
+                {
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.ToolList + "任务执行失败===>>" + JsonConvert.SerializeObject(Result),
+    EnumHelper.GetDescription(ActionTypeEnum.ToolList));
+
+                    responseData.result = "false";
+                    responseData.Msg = Result.Message;
                 }
                 }
             }
             }
 
 
-            return list;
+            responseData.Data = list;
+            responseData.Total = list.Count;
+
+            return responseData;
         }
         }
 
 
       
       
@@ -1503,9 +1603,24 @@ namespace IMCS.CCS.Services
         //设置回调值
         //设置回调值
         private TaskCallback setCallBackValue(List<CcsActionAddress> CcsActionAddresses, TaskCallback taskCallbackData)
         private TaskCallback setCallBackValue(List<CcsActionAddress> CcsActionAddresses, TaskCallback taskCallbackData)
         {
         {
+
+            List<CcsActionAddress> CcsActionAddressCallBackChecks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CALLBACK_CHECK.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBacks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CALLBACK.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBacks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CALLBACK.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBackFails = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CALLBACK_FAIL.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBackFails = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.CALLBACK_FAIL.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBackResets = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.RESET.ToString()).ToList();
             List<CcsActionAddress> CcsActionAddressCallBackResets = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.RESET.ToString()).ToList();
+
+            // 回调检查项
+            foreach (var item in CcsActionAddressCallBackChecks)
+            {
+                if (item.Sort == 1)
+                {
+                    taskCallbackData.CallBackCheckAddress = item.Address;
+                    taskCallbackData.CallBackCheckAddressValue = item.Value;
+                }
+
+            }
+
+
             foreach (CcsActionAddress actionAddress in CcsActionAddressCallBacks)
             foreach (CcsActionAddress actionAddress in CcsActionAddressCallBacks)
             {
             {
                 if (actionAddress.Sort == 1)
                 if (actionAddress.Sort == 1)
@@ -1561,7 +1676,9 @@ namespace IMCS.CCS.Services
 
 
         public async Task<ResponseECSData> PushPushToMachine(RequestData<CutterTestData> req)
         public async Task<ResponseECSData> PushPushToMachine(RequestData<CutterTestData> req)
         {
         {
-            Log.Instance.WriteLogAdd("机外对刀仪数据接受===>> "+ JsonConvert.SerializeObject(req),"机外对刀仪");
+            Log.Instance.WriteLogAdd(ActionTypeEnum.ReadAndWriteTool + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.ReadAndWriteTool));
+
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
 
 
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId);
@@ -1573,10 +1690,10 @@ namespace IMCS.CCS.Services
 
 
                 if (device == null)
                 if (device == null)
                 {
                 {
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.StartCleanMachine + "设备已离线===>>" + JsonConvert.SerializeObject(req),
-                    EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine));
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.ReadAndWriteTool + "设备已离线===>>" + JsonConvert.SerializeObject(req),
+                    EnumHelper.GetDescription(ActionTypeEnum.ReadAndWriteTool));
                     responseData.result = "false";
                     responseData.result = "false";
-                    responseData.resultMsg = ActionTypeEnum.StartCleanMachine + "设备已离线===>>" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = ActionTypeEnum.ReadAndWriteTool + "设备已离线===>>" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -1586,7 +1703,7 @@ namespace IMCS.CCS.Services
                     RequestHeidhData hdhReq = new RequestHeidhData();
                     RequestHeidhData hdhReq = new RequestHeidhData();
                     hdhReq.ServerUrl = device.ServerUrl;
                     hdhReq.ServerUrl = device.ServerUrl;
                     hdhReq.MachineName = device.UserName;
                     hdhReq.MachineName = device.UserName;
-                    hdhReq.Type = "ReadAndWriteTool";
+                    hdhReq.Type = ActionTypeEnum.ReadAndWriteTool.ToString();
                     hdhReq.CutterData = JsonConvert.SerializeObject(req.data);
                     hdhReq.CutterData = JsonConvert.SerializeObject(req.data);
 
 
                     var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);
                     var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, hdhUrlContext, hdhReq, null);
@@ -1595,7 +1712,9 @@ namespace IMCS.CCS.Services
                     
                     
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     {
                     {
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "机外对刀仪数据上传异常===>>" + JsonConvert.SerializeObject(req)+"======结果数据:"+ Result, "机外对刀仪");
+                        Log.Instance.WriteLogAdd(ActionTypeEnum.ReadAndWriteTool + "机外对刀仪数据上传异常1===>>" +  Result,
+                            EnumHelper.GetDescription(ActionTypeEnum.ReadAndWriteTool));
+
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = jsonObject.GetValue("msg").ToString();
                         responseData.resultMsg = jsonObject.GetValue("msg").ToString();
                     }
                     }
@@ -1609,7 +1728,9 @@ namespace IMCS.CCS.Services
 
 
                         }
                         }
                         else {
                         else {
-                            Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "机外对刀仪数据上传异常===>>" + JsonConvert.SerializeObject(req) + "======结果数据:" + Result, "机外对刀仪");
+                            Log.Instance.WriteLogAdd(ActionTypeEnum.ReadAndWriteTool + "机外对刀仪数据上传异常2===>>" + Result,
+                                EnumHelper.GetDescription(ActionTypeEnum.ReadAndWriteTool));
+
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = jsonObject.GetValue("msg").ToString();
                             responseData.resultMsg = jsonObject.GetValue("msg").ToString();
                         }
                         }
@@ -1621,9 +1742,9 @@ namespace IMCS.CCS.Services
                 }
                 }
             }
             }
             catch (Exception ex) {
             catch (Exception ex) {
+                Log.Instance.WriteLogAdd(ActionTypeEnum.ReadAndWriteTool + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                    EnumHelper.GetDescription(ActionTypeEnum.ReadAndWriteTool));
 
 
-                Log.Instance.WriteLogAdd(ActionTypeEnum.StartDryMachine + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
-                    EnumHelper.GetDescription(ActionTypeEnum.StartDryMachine));
                 responseData.result = "false";
                 responseData.result = "false";
                 responseData.resultMsg = ex.Message;
                 responseData.resultMsg = ex.Message;
                 return responseData;
                 return responseData;
@@ -1639,9 +1760,10 @@ namespace IMCS.CCS.Services
         /// 查询三坐标是否允许取
         /// 查询三坐标是否允许取
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> GetMiddleThreeCoordinates(RequestData<RequestToolData> req) {
         public async Task<ResponseECSData> GetMiddleThreeCoordinates(RequestData<RequestToolData> req) {
-            Log.Instance.WriteLogAdd("查询三坐标是否允许取===>> " + JsonConvert.SerializeObject(req), "机外对刀仪");
-            // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
+            Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
 
 
+            // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许下料");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许下料");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
             try
             try
@@ -1673,8 +1795,7 @@ namespace IMCS.CCS.Services
                 if (!ConnectionResult.IsSuccess)
                 if (!ConnectionResult.IsSuccess)
                 {
                 {
                     s7.ConnectClose();
                     s7.ConnectClose();
-                    Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
-                    EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
+                    Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),"三坐标");
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
                     responseData.resultMsg = ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
@@ -1713,7 +1834,8 @@ namespace IMCS.CCS.Services
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
                             Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
                             Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
-                            EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
+                                EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
+
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             return responseData;
                             return responseData;
@@ -1728,8 +1850,9 @@ namespace IMCS.CCS.Services
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 s7.ConnectClose();
                 s7.ConnectClose();
-                Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalTakeStatus + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req), 
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalTakeStatus));
+
                 responseData.result = "false";
                 responseData.result = "false";
                 responseData.resultMsg = ex.Message;
                 responseData.resultMsg = ex.Message;
                 return responseData;
                 return responseData;
@@ -1743,9 +1866,10 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> QueryThreeCoordinatesFreePos(RequestData<RequestToolData> req) {
         public async Task<ResponseECSData> QueryThreeCoordinatesFreePos(RequestData<RequestToolData> req) {
 
 
-            Log.Instance.WriteLogAdd("查询三坐标是否允许放===>> " + JsonConvert.SerializeObject(req), "机外对刀仪");
-            // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
+            Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalPutStatus + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalPutStatus));
 
 
+            // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许上料");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许上料");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
             try
             try
@@ -1818,6 +1942,7 @@ namespace IMCS.CCS.Services
                             s7.ConnectClose();
                             s7.ConnectClose();
                             Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalPutStatus + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
                             Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalPutStatus + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
                             EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalPutStatus));
                             EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalPutStatus));
+
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             return responseData;
                             return responseData;
@@ -1836,6 +1961,7 @@ namespace IMCS.CCS.Services
 
 
                 Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalPutStatus + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                 Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalPutStatus + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalPutStatus));
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalPutStatus));
+
                 responseData.result = "false";
                 responseData.result = "false";
                 responseData.resultMsg = ex.Message;
                 responseData.resultMsg = ex.Message;
                 return responseData;
                 return responseData;
@@ -1851,6 +1977,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> SendThreeCoordinates(RequestData<ThreeDimensional> req)
         public async Task<ResponseECSData> SendThreeCoordinates(RequestData<ThreeDimensional> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalRun + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
             SiemensS7Net s7 = null;
             SiemensS7Net s7 = null;
             try
             try
@@ -1962,16 +2091,16 @@ namespace IMCS.CCS.Services
 
 
                 // 保存数据
                 // 保存数据
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
-                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun) + "成功===>>" + JsonConvert.SerializeObject(req)
+                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun) + "命令下发成功===>>" + JsonConvert.SerializeObject(req)
                    , EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun));
                    , EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun));
                 return responseData;
                 return responseData;
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 // 记录日志
                 // 记录日志
-                Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalRun + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.ThreeDimensionalRun + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun));
                     EnumHelper.GetDescription(ActionTypeEnum.ThreeDimensionalRun));
-                responseData.resultMsg = ActionTypeEnum.ThreeDimensionalRun + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
+                responseData.resultMsg = ActionTypeEnum.ThreeDimensionalRun + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
                 responseData.result = "false";
                 responseData.result = "false";
 
 
                 // 关闭plc连接
                 // 关闭plc连接
@@ -1990,6 +2119,9 @@ namespace IMCS.CCS.Services
         /// </summary> 
         /// </summary> 
         public async Task<ResponseECSData> SendOffsetSetting(RequestData<ThreeDimensionalOffset> req)
         public async Task<ResponseECSData> SendOffsetSetting(RequestData<ThreeDimensionalOffset> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "任务接受===>>"+ JsonConvert.SerializeObject(req),
+    EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId,"设置成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId,"设置成功");
 
 
             try
             try
@@ -2021,7 +2153,9 @@ namespace IMCS.CCS.Services
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     {
                     {
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "坐标系偏差值设置失败===>>" + JsonConvert.SerializeObject(req) + "======结果数据:" + Result, "机外对刀仪");
+                        Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "坐标系偏差值设置失败===>>" + JsonConvert.SerializeObject(req) + "======结果数据:" + Result,
+                            EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
+
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = Result.Message;
                         responseData.resultMsg = Result.Message;
                         return responseData;
                         return responseData;
@@ -2044,24 +2178,29 @@ namespace IMCS.CCS.Services
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.WriteDeviationValue.ToString(),
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.WriteDeviationValue.ToString(),
                 EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue), req.taskId, req.taskNodeId);
                 EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue), req.taskId, req.taskNodeId);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
-                Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "设置成功===>>" + JsonConvert.SerializeObject(req),
+
+                Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "任务执行成功===>>" + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
                     EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
+
+
                 return responseData;
                 return responseData;
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
                     EnumHelper.GetDescription(ActionTypeEnum.WriteDeviationValue));
-                responseData.resultMsg = ActionTypeEnum.WriteDeviationValue + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
+
+                responseData.resultMsg = ActionTypeEnum.WriteDeviationValue + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
                 responseData.result = "false";
                 responseData.result = "false";
                 return responseData;
                 return responseData;
             }
             }
         }
         }
 
 
         public async Task<ResponseECSData> findRfidData(RequestData<RequestToolData> reqs)
         public async Task<ResponseECSData> findRfidData(RequestData<RequestToolData> reqs)
-
         {
         {
-            Log.Instance.WriteLogAdd("查询rfid数据===>> " + JsonConvert.SerializeObject(reqs), "查询rfid数据");
+            Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "任务接受===>>" + JsonConvert.SerializeObject(reqs),
+                EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
+
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
 
 
             ResponseECSData responseData = new ResponseECSData(reqs.taskId, reqs.taskNodeId, "执行成功");
             ResponseECSData responseData = new ResponseECSData(reqs.taskId, reqs.taskNodeId, "执行成功");
@@ -2079,6 +2218,7 @@ namespace IMCS.CCS.Services
                 {
                 {
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "设备已离线===>>" + JsonConvert.SerializeObject(reqs),
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "设备已离线===>>" + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
+
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + reqs.url;
                     responseData.resultMsg = "设备已离线:" + reqs.url;
                     return responseData;
                     return responseData;
@@ -2098,6 +2238,7 @@ namespace IMCS.CCS.Services
                     s7.ConnectClose();
                     s7.ConnectClose();
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs),
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
+
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = ActionTypeEnum.RfidRead + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs);
                     responseData.resultMsg = ActionTypeEnum.RfidRead + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs);
                     return responseData;
                     return responseData;
@@ -2119,8 +2260,9 @@ namespace IMCS.CCS.Services
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
-                            Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(reqs),
-                            EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                            Log.Instance.WriteLogAdd("查询RFID异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(reqs),
+                                EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
+
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             return responseData;
                             return responseData;
@@ -2207,9 +2349,10 @@ namespace IMCS.CCS.Services
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 s7.ConnectClose();
                 s7.ConnectClose();
-                Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.RfidRead + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidRead));
-                responseData.resultMsg = ActionTypeEnum.RfidRead + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs);
+
+                responseData.resultMsg = ActionTypeEnum.RfidRead + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs);
                 responseData.result = "false";
                 responseData.result = "false";
                 return responseData;
                 return responseData;
             }
             }
@@ -2219,7 +2362,9 @@ namespace IMCS.CCS.Services
 
 
         public async Task<ResponseECSData> rfidReset(RequestData<RequestToolData> reqs)
         public async Task<ResponseECSData> rfidReset(RequestData<RequestToolData> reqs)
         {
         {
-            Log.Instance.WriteLogAdd("rfid重置===>> " + JsonConvert.SerializeObject(reqs), "查询rfid数据");
+            Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "任务接受===>>" + JsonConvert.SerializeObject(reqs)
+               , EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
+
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
 
 
             ResponseECSData responseData = new ResponseECSData(reqs.taskId, reqs.taskNodeId, "执行成功");
             ResponseECSData responseData = new ResponseECSData(reqs.taskId, reqs.taskNodeId, "执行成功");
@@ -2237,6 +2382,7 @@ namespace IMCS.CCS.Services
                 {
                 {
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "设备已离线===>>" + JsonConvert.SerializeObject(reqs),
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "设备已离线===>>" + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
+
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + reqs.url;
                     responseData.resultMsg = "设备已离线:" + reqs.url;
                     return responseData;
                     return responseData;
@@ -2256,6 +2402,7 @@ namespace IMCS.CCS.Services
                     s7.ConnectClose();
                     s7.ConnectClose();
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs),
                     Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
+
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = ActionTypeEnum.RfidReset + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs);
                     responseData.resultMsg = ActionTypeEnum.RfidReset + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(reqs);
                     return responseData;
                     return responseData;
@@ -2302,8 +2449,8 @@ namespace IMCS.CCS.Services
                 }
                 }
 
 
                 s7.ConnectClose();
                 s7.ConnectClose();
-                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.RfidReset) + "取成功===>>" + JsonConvert.SerializeObject(reqs)
-                   , EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
+                Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.RfidReset) + "任务成功===>>" + JsonConvert.SerializeObject(reqs),
+                    EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
 
 
                 return responseData;
                 return responseData;
 
 
@@ -2311,9 +2458,10 @@ namespace IMCS.CCS.Services
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 s7.ConnectClose();
                 s7.ConnectClose();
-                Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.RfidReset + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs),
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
                     EnumHelper.GetDescription(ActionTypeEnum.RfidReset));
-                responseData.resultMsg = ActionTypeEnum.RfidReset + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs);
+
+                responseData.resultMsg = ActionTypeEnum.RfidReset + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(reqs);
                 responseData.result = "false";
                 responseData.result = "false";
                 return responseData;
                 return responseData;
             }
             }
@@ -2325,8 +2473,7 @@ namespace IMCS.CCS.Services
         /// <returns></returns>
         /// <returns></returns>
         public async Task<ResponseECSData> getCutterDeviceIsTake(RequestData<RequestToolData> req)
         public async Task<ResponseECSData> getCutterDeviceIsTake(RequestData<RequestToolData> req)
         {
         {
-
-            Log.Instance.WriteLogAdd("查询刀具上下料站、机床刀具位是否允许取===>> " + JsonConvert.SerializeObject(req), "刀具取放状态");
+            Log.Instance.WriteLogAdd("查询刀具上下料站、机床刀具位是否允许取===>> " + JsonConvert.SerializeObject(req), "CNC刀具取放状态");
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
 
 
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许下料");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "允许下料");
@@ -2341,8 +2488,8 @@ namespace IMCS.CCS.Services
 
 
                 if (device == null)
                 if (device == null)
                 {
                 {
-                    Log.Instance.WriteLogAdd("CutterTake" + req.data.location + "设备已离线===>>" + JsonConvert.SerializeObject(req),
-                    "刀具取放状态");
+                    Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "设备已离线===>>" + JsonConvert.SerializeObject(req),
+                    "CNC刀具取放状态");
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + req.url;
                     responseData.resultMsg = "设备已离线:" + req.url;
                     return responseData;
                     return responseData;
@@ -2356,10 +2503,10 @@ namespace IMCS.CCS.Services
 
 
                 if (actionInfo == null)
                 if (actionInfo == null)
                 {
                 {
-                    Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
-                    "刀具取放状态");
+                    Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
+                    "CNC刀具取放状态");
                     responseData.result = "true";
                     responseData.result = "true";
-                    responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = "取==CutterTake" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -2369,10 +2516,10 @@ namespace IMCS.CCS.Services
                 if (!ConnectionResult.IsSuccess)
                 if (!ConnectionResult.IsSuccess)
                 {
                 {
                     s7.ConnectClose();
                     s7.ConnectClose();
-                    Log.Instance.WriteLogAdd("CutterTake" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
-                    "刀具取放状态");
+                    Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
+                    "CNC刀具取放状态");
                     responseData.result = "false";
                     responseData.result = "false";
-                    responseData.resultMsg = "CutterTake" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = "取==CutterTake" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -2400,8 +2547,7 @@ namespace IMCS.CCS.Services
                     {
                     {
                         s7.Write(xialiaoqingqiuDB, true);
                         s7.Write(xialiaoqingqiuDB, true);
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====已发送下料请求,等待下料允许====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("取==已发送下料请求,等待下料允许====" + JsonConvert.SerializeObject(req), "CNC刀具取放状态");
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已发送下料请求,等待下料允许";
                         responseData.resultMsg = "已发送下料请求,等待下料允许";
                         return responseData;
                         return responseData;
@@ -2409,8 +2555,7 @@ namespace IMCS.CCS.Services
                     else if (shangliaoqingqiu == "True" && xialiaoqingqiu == "False")
                     else if (shangliaoqingqiu == "True" && xialiaoqingqiu == "False")
                     {
                     {
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====状态不对,现在上料请求状态,等待上料任务完成====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("取==状态不对,现在上料请求状态,等待上料任务完成====" + JsonConvert.SerializeObject(req), "CNC刀具取放状态"); ;
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已被上料请求占用,等待上料任务完成";
                         responseData.resultMsg = "已被上料请求占用,等待上料任务完成";
                         return responseData;
                         return responseData;
@@ -2418,8 +2563,7 @@ namespace IMCS.CCS.Services
                     else if (xialiaoqingqiu == "True" && xialiaoyunxu == "False")
                     else if (xialiaoqingqiu == "True" && xialiaoyunxu == "False")
                     {
                     {
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====已经发送下料请求,下料允许状态不满足====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("取==已经发送下料请求,下料允许状态不满足====" + JsonConvert.SerializeObject(req), "CNC刀具取放状态"); ;
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已经发送下料请求,下料允许状态不满足";
                         responseData.resultMsg = "已经发送下料请求,下料允许状态不满足";
                         return responseData;
                         return responseData;
@@ -2460,8 +2604,8 @@ namespace IMCS.CCS.Services
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
-                            Log.Instance.WriteLogAdd("CutterTake" + req.data.location + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
-                            "刀具取放状态");
+                            Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
+                            "CNC刀具取放状态");
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             return responseData;
                             return responseData;
@@ -2478,12 +2622,13 @@ namespace IMCS.CCS.Services
                 //  关闭连接
                 //  关闭连接
                 s7.ConnectClose();
                 s7.ConnectClose();
 
 
-                Log.Instance.WriteLogAdd("CutterTake" + req.data.location + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
-                    "刀具取放状态");
+                Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                    "CNC刀具取放状态");
                 responseData.result = "false";
                 responseData.result = "false";
                 responseData.resultMsg = ex.Message;
                 responseData.resultMsg = ex.Message;
                 return responseData;
                 return responseData;
             }
             }
+            Log.Instance.WriteLogAdd("取==CutterTake" + req.data.location + "结果===>>" + JsonConvert.SerializeObject(responseData),  "CNC刀具取放状态");
 
 
             return responseData;
             return responseData;
         }
         }
@@ -2510,7 +2655,7 @@ namespace IMCS.CCS.Services
 
 
                 if (device == null)
                 if (device == null)
                 {
                 {
-                    Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "设备已离线===>>" + JsonConvert.SerializeObject(req),
+                    Log.Instance.WriteLogAdd("放==CutterPut" + req.data.location + "设备已离线===>>" + JsonConvert.SerializeObject(req),
                     "刀具取放状态");
                     "刀具取放状态");
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + req.url;
                     responseData.resultMsg = "设备已离线:" + req.url;
@@ -2526,10 +2671,10 @@ namespace IMCS.CCS.Services
                 CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
                 CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
 
 
                 if (actionInfo == null) {
                 if (actionInfo == null) {
-                    Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
-                    "刀具取放状态");
+                   /* Log.Instance.WriteLogAdd("放==CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
+                    "刀具取放状态");*/
                     responseData.result = "true";
                     responseData.result = "true";
-                    responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = "放==CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -2540,10 +2685,10 @@ namespace IMCS.CCS.Services
                 if (!ConnectionResult.IsSuccess)
                 if (!ConnectionResult.IsSuccess)
                 {
                 {
                     s7.ConnectClose();
                     s7.ConnectClose();
-                    Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
+                    Log.Instance.WriteLogAdd("放==CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
                     "刀具取放状态");
                     "刀具取放状态");
                     responseData.result = "false";
                     responseData.result = "false";
-                    responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
+                    responseData.resultMsg = "放==CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
                     return responseData;
                     return responseData;
                 }
                 }
 
 
@@ -2568,8 +2713,7 @@ namespace IMCS.CCS.Services
                     {
                     {
                         s7.Write(shangliaoqingqiuDB, true);
                         s7.Write(shangliaoqingqiuDB, true);
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====已发送上料请求,等待上料允许====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("放==已发送上料请求,等待上料允许====" + JsonConvert.SerializeObject(req), "刀具取放状态");
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已发送上料请求,等待上料允许";
                         responseData.resultMsg = "已发送上料请求,等待上料允许";
                         return responseData;
                         return responseData;
@@ -2577,8 +2721,7 @@ namespace IMCS.CCS.Services
                     else if (shangliaoqingqiu == "False" && xialiaoqingqiu == "True")
                     else if (shangliaoqingqiu == "False" && xialiaoqingqiu == "True")
                     {
                     {
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====状态不对,现在下料请求状态,等待下料任务完成====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("放==状态不对,现在下料请求状态,等待下料任务完成====" + JsonConvert.SerializeObject(req), "刀具取放状态");
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已被下料请求占用,等待下料任务完成";
                         responseData.resultMsg = "已被下料请求占用,等待下料任务完成";
                         return responseData;
                         return responseData;
@@ -2586,8 +2729,7 @@ namespace IMCS.CCS.Services
                     else if (shangliaoqingqiu == "True" && shangliaoyunxu == "False")
                     else if (shangliaoqingqiu == "True" && shangliaoyunxu == "False")
                     {
                     {
                         s7.ConnectClose();
                         s7.ConnectClose();
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====已经发送上料请求,上料允许状态不满足====" + JsonConvert.SerializeObject(req),
-                        EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
+                        Log.Instance.WriteLogAdd("放 == 已经发送上料请求,上料允许状态不满足====" + JsonConvert.SerializeObject(req), "刀具取放状态");
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = "已经发送上料请求,上料允许状态不满";
                         responseData.resultMsg = "已经发送上料请求,上料允许状态不满";
                         return responseData;
                         return responseData;
@@ -2629,7 +2771,7 @@ namespace IMCS.CCS.Services
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
                         {
                         {
                             s7.ConnectClose();
                             s7.ConnectClose();
-                            Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
+                            Log.Instance.WriteLogAdd("放==CutterPut" + req.data.location + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
                             "刀具取放状态");
                             "刀具取放状态");
                             responseData.result = "false";
                             responseData.result = "false";
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
                             responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
@@ -2647,10 +2789,10 @@ namespace IMCS.CCS.Services
 
 
                 //  关闭连接
                 //  关闭连接
                 s7.ConnectClose();
                 s7.ConnectClose();
-                Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd("放==CutterPut" + req.data.location + "任务下发异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     "刀具取放状态");
                     "刀具取放状态");
                 responseData.result = "false";
                 responseData.result = "false";
-                responseData.resultMsg = ex.Message;
+                responseData.resultMsg = "异常错误"+ex.Message;
                 return responseData;
                 return responseData;
             }
             }
 
 
@@ -2659,10 +2801,10 @@ namespace IMCS.CCS.Services
 
 
         public async Task<ResponseECSData> setWriteTakeCutter(RequestData<CutterTestData> req)
         public async Task<ResponseECSData> setWriteTakeCutter(RequestData<CutterTestData> req)
         {
         {
-            Log.Instance.WriteLogAdd("设置刀具取状态===>> " + JsonConvert.SerializeObject(req), "设置刀具取状态");
+            Log.Instance.WriteLogAdd("刀具取状态设置===>> " + JsonConvert.SerializeObject(req), "刀具取状态设置");
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
             // 1、根据url查询设备信息   2、调用httpserveer 发送执行消息
 
 
-            ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "设置刀具取状态");
+            ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "刀具取状态设置");
             try
             try
             {
             {
                 // 获取所有在线的设备
                 // 获取所有在线的设备
@@ -2674,7 +2816,7 @@ namespace IMCS.CCS.Services
                 if (device == null)
                 if (device == null)
                 {
                 {
                     Log.Instance.WriteLogAdd("设备已离线===>>" + JsonConvert.SerializeObject(req),
                     Log.Instance.WriteLogAdd("设备已离线===>>" + JsonConvert.SerializeObject(req),
-                    "设置刀具取状态");
+                    "刀具取状态设置");
                     responseData.result = "false";
                     responseData.result = "false";
                     responseData.resultMsg = "设备已离线:" + req.url;
                     responseData.resultMsg = "设备已离线:" + req.url;
                     return responseData;
                     return responseData;
@@ -2693,7 +2835,7 @@ namespace IMCS.CCS.Services
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
                     ResponseHeidhData responseHeidhData = JsonConvert.DeserializeObject<ResponseHeidhData>(Result.Message);
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     if (!Result.IsSuccess || !responseHeidhData.result)
                     {
                     {
-                        Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "设置失败===>>" + JsonConvert.SerializeObject(req) + "======结果数据:" + Result, "设置刀具取状态");
+                        Log.Instance.WriteLogAdd(ActionTypeEnum.WriteDeviationValue + "设置失败===>>" + JsonConvert.SerializeObject(req) + "======结果数据:" + Result, "刀具取状态设置");
                         responseData.result = "false";
                         responseData.result = "false";
                         responseData.resultMsg = Result.Message;
                         responseData.resultMsg = Result.Message;
                         return responseData;
                         return responseData;
@@ -2712,7 +2854,7 @@ namespace IMCS.CCS.Services
             {
             {
                 //  关闭连接
                 //  关闭连接
                 Log.Instance.WriteLogAdd("任务执行异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                 Log.Instance.WriteLogAdd("任务执行异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
-                    "设置刀具取状态");
+                    "刀具取状态设置");
                 responseData.result = "false";
                 responseData.result = "false";
                 responseData.resultMsg = ex.Message;
                 responseData.resultMsg = ex.Message;
             }
             }
@@ -2722,6 +2864,9 @@ namespace IMCS.CCS.Services
 
 
         public async Task<ResponseECSData> sendTheBindingInfo(RequestData<BindInfo> req)
         public async Task<ResponseECSData> sendTheBindingInfo(RequestData<BindInfo> req)
         {
         {
+            Log.Instance.WriteLogAdd(ActionTypeEnum.BindingInfo + "任务接受===>>" + JsonConvert.SerializeObject(req),
+                EnumHelper.GetDescription(ActionTypeEnum.BindingInfo));
+
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "设置成功");
             ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "设置成功");
 
 
             try
             try
@@ -2776,15 +2921,18 @@ namespace IMCS.CCS.Services
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.BindingInfo.ToString(),
                 TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.BindingInfo.ToString(),
                 EnumHelper.GetDescription(ActionTypeEnum.BindingInfo), req.taskId, req.taskNodeId);
                 EnumHelper.GetDescription(ActionTypeEnum.BindingInfo), req.taskId, req.taskNodeId);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
                 await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
-                Log.Instance.WriteLogAdd(ActionTypeEnum.BindingInfo + "设置成功===>>" + JsonConvert.SerializeObject(req),
+
+                Log.Instance.WriteLogAdd(ActionTypeEnum.BindingInfo + "任务成功===>>" + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.BindingInfo));
                     EnumHelper.GetDescription(ActionTypeEnum.BindingInfo));
+
                 return responseData;
                 return responseData;
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                Log.Instance.WriteLogAdd(ActionTypeEnum.BindingInfo + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
+                Log.Instance.WriteLogAdd(ActionTypeEnum.BindingInfo + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
                     EnumHelper.GetDescription(ActionTypeEnum.BindingInfo));
                     EnumHelper.GetDescription(ActionTypeEnum.BindingInfo));
-                responseData.resultMsg = ActionTypeEnum.BindingInfo + "设置异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
+
+                responseData.resultMsg = ActionTypeEnum.BindingInfo + "任务异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
                 responseData.result = "false";
                 responseData.result = "false";
                 return responseData;
                 return responseData;
             }
             }

+ 194 - 34
IMCS_CCS/Service/Impl/TaskJobService.cs

@@ -18,6 +18,7 @@ using System.Threading.Tasks;
 using IMCS.CCS.Models;
 using IMCS.CCS.Models;
 using System.Net.NetworkInformation;
 using System.Net.NetworkInformation;
 using IMCS_CCS.Model;
 using IMCS_CCS.Model;
+using MySqlX.XDevAPI.Common;
 
 
 namespace IMCS.CCS.Service.Impl
 namespace IMCS.CCS.Service.Impl
 {
 {
@@ -443,15 +444,18 @@ namespace IMCS.CCS.Service.Impl
         {
         {
             List<TaskCallback> list = new List<TaskCallback>();
             List<TaskCallback> list = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                list = await _taskCallbackService.GetAllList();
+                list = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (list.Count == 0)
             {
             {
-                list = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                list = await _taskCallbackService.GetAllList();
+
             }
             }
 
 
+
             TaskCallback task = list.Where(x => x.OperateType.Equals(ActionTypeEnum.UploadFile.ToString())).FirstOrDefault();
             TaskCallback task = list.Where(x => x.OperateType.Equals(ActionTypeEnum.UploadFile.ToString())).FirstOrDefault();
             if (task == null)
             if (task == null)
             {
             {
@@ -504,17 +508,20 @@ namespace IMCS.CCS.Service.Impl
         /// <returns></returns>
         /// <returns></returns>
         public async Task<string> CallbackJob2()
         public async Task<string> CallbackJob2()
         {
         {
+
             List<TaskCallback> taskList = new List<TaskCallback>();
             List<TaskCallback> taskList = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            // 判断redis是否有数据,没有则查询表中是否有没有完成任务
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                taskList = await _taskCallbackService.GetAllList();
+                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (taskList.Count == 0)
             {
             {
-                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                taskList = await _taskCallbackService.GetAllList();
+
             }
             }
+
             //在线设备 
             //在线设备 
             List<Device> deviceList = await getDeviceList(); 
             List<Device> deviceList = await getDeviceList(); 
 
 
@@ -535,6 +542,24 @@ namespace IMCS.CCS.Service.Impl
                     
                     
                     // 查询出采集的数据
                     // 查询出采集的数据
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
+                    // 检索出,校验的数据
+                    CcsTagValue callBackCheckValue = tagValues.Where(o => o.Address == task.CallBackCheckAddress).FirstOrDefault();
+                    if (callBackCheckValue!=null && task.CallBackCheckAddress != null ) {
+                        if (callBackCheckValue.TagValue != task.CallBackCheckAddressValue) { 
+                            //请求成功,任务状态改成结束
+                            task.State = true;
+                            task.UpdateTime = DateTime.Now;
+                            task.Description = "状态不满足,所需" + task.CallBackCheckAddress+"为:" + task.CallBackCheckAddressValue +"采集的为:"+ callBackCheckValue.TagValue;
+                            await _taskCallbackService.CreateOrUpdateAndCache(task);
+                            message = task.OperateName + "==>taskId:" + task.TaskId + ",taskNodeId:" + task.TaskNodeId + ",请求结果:状态不满足,所需" + task.CallBackCheckAddress + "为:" + task.CallBackCheckAddressValue + "采集的为:" + callBackCheckValue.TagValue + ";";
+                            Log.Instance.WriteLogAdd(message, LOG_TITLE_CALLBACK);
+
+                            continue;
+                        }
+
+                    }
+
+                    // 检索比较的数据
                     CcsTagValue callBacktagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
                     CcsTagValue callBacktagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
 
 
                     // ①比较采集的数据值与回调的值是否相等,
                     // ①比较采集的数据值与回调的值是否相等,
@@ -661,15 +686,17 @@ namespace IMCS.CCS.Service.Impl
         {
         {
             List<TaskCallback> taskList = new List<TaskCallback>();
             List<TaskCallback> taskList = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                taskList = await _taskCallbackService.GetAllList();
+                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (taskList.Count == 0)
             {
             {
-                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                taskList = await _taskCallbackService.GetAllList();
+
             }
             }
-            
+
             List<Device> deviceList = await getDeviceList();
             List<Device> deviceList = await getDeviceList();
             //在线设备
             //在线设备
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartDryMachine.ToString()) && x.State).ToList();
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartDryMachine.ToString()) && x.State).ToList();
@@ -797,14 +824,17 @@ namespace IMCS.CCS.Service.Impl
         {
         {
             List<TaskCallback> taskList = new List<TaskCallback>();
             List<TaskCallback> taskList = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                taskList = await _taskCallbackService.GetAllList();
+                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (taskList.Count == 0)
             {
             {
-                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                taskList = await _taskCallbackService.GetAllList();
+
             }
             }
+
             List<Device> deviceList = await getDeviceList();
             List<Device> deviceList = await getDeviceList();
             //在线设备 
             //在线设备 
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartNCProgram.ToString()) && x.State &&  deviceList.Any(device => device.Ip == x.IP)).ToList();
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartNCProgram.ToString()) && x.State &&  deviceList.Any(device => device.Ip == x.IP)).ToList();
@@ -928,14 +958,17 @@ namespace IMCS.CCS.Service.Impl
         {
         {
             List<TaskCallback> taskList = new List<TaskCallback>();
             List<TaskCallback> taskList = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                taskList = await _taskCallbackService.GetAllList();
+                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (taskList.Count == 0)
             {
             {
-                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                taskList = await _taskCallbackService.GetAllList();
+
             }
             }
+
             List<Device> deviceList = await getDeviceList();
             List<Device> deviceList = await getDeviceList();
             //在线设备
             //在线设备
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartCleanMachine.ToString()) && x.State && deviceList.Any(device => device.Ip == x.IP)).ToList();
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.StartCleanMachine.ToString()) && x.State && deviceList.Any(device => device.Ip == x.IP)).ToList();
@@ -955,7 +988,10 @@ namespace IMCS.CCS.Service.Impl
                     //tagValueQuery.Address = task.Address;
                     //tagValueQuery.Address = task.Address;
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
                     CcsTagValue tagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
                     CcsTagValue tagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
-                    if (tagValue != null && tagValue.TagValue == task.CallbackValue)
+
+                    double a = currentTime.Subtract(task.CreateTime).TotalSeconds;
+
+                    if (tagValue != null && tagValue.TagValue == task.CallbackValue && a > 10)
                     //临时处理以解决ecs配置问题
                     //临时处理以解决ecs配置问题
                     //if(currentTime.Subtract(task.CreateTime).TotalSeconds > 10)
                     //if(currentTime.Subtract(task.CreateTime).TotalSeconds > 10)
                     {
                     {
@@ -1051,17 +1087,19 @@ namespace IMCS.CCS.Service.Impl
         /// <returns></returns>
         /// <returns></returns>
         public async Task<string> CallbackJob6()
         public async Task<string> CallbackJob6()
         {
         {
-
             List<TaskCallback> taskList = new List<TaskCallback>();
             List<TaskCallback> taskList = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                taskList = await _taskCallbackService.GetAllList();
+                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (taskList.Count == 0)
             {
             {
-                taskList = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                taskList = await _taskCallbackService.GetAllList();
+
             }
             }
+
             List<Device> deviceList = await getDeviceList();
             List<Device> deviceList = await getDeviceList();
             //在线设备 
             //在线设备 
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.ThreeDimensionalRun.ToString()) && x.State && deviceList.Any(device => device.Ip == x.IP)).ToList();
             taskList = taskList.Where(x => x.OperateType.Equals(ActionTypeEnum.ThreeDimensionalRun.ToString()) && x.State && deviceList.Any(device => device.Ip == x.IP)).ToList();
@@ -1079,6 +1117,27 @@ namespace IMCS.CCS.Service.Impl
                     tagValueQuery.Ip = task.IP;
                     tagValueQuery.Ip = task.IP;
                     //tagValueQuery.Address = task.Address;
                     //tagValueQuery.Address = task.Address;
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery);
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery);
+
+                    // 检索出,校验的数据
+                    CcsTagValue callBackCheckValue = tagValues.Where(o => o.Address == task.CallBackCheckAddress).FirstOrDefault();
+                    if (callBackCheckValue != null && task.CallBackCheckAddress != null)
+                    {
+                        if (callBackCheckValue.TagValue != task.CallBackCheckAddressValue)
+                        {
+                            //请求成功,任务状态改成结束
+                            task.State = true;
+                            task.UpdateTime = DateTime.Now;
+                            task.Description = "状态不满足,所需" + task.CallBackCheckAddress + "为:" + task.CallBackCheckAddressValue + "采集的为:" + callBackCheckValue.TagValue;
+                            await _taskCallbackService.CreateOrUpdateAndCache(task);
+                            message = task.OperateName + "==>taskId:" + task.TaskId + ",taskNodeId:" + task.TaskNodeId + ",请求结果:状态不满足,所需" + task.CallBackCheckAddress + "为:" + task.CallBackCheckAddressValue + "采集的为:" + callBackCheckValue.TagValue + ";";
+                            Log.Instance.WriteLogAdd(message, LOG_TITLE_CALLBACK);
+
+                            continue;
+                        }
+
+                    }
+
+                    // 检索执行结果数据
                     CcsTagValue tagValue = tagValues.Where(o => o.Address == task.Address.Trim()).FirstOrDefault();
                     CcsTagValue tagValue = tagValues.Where(o => o.Address == task.Address.Trim()).FirstOrDefault();
                     
                     
                     // ① 比较采集的数据值与回调设置的值是否一致
                     // ① 比较采集的数据值与回调设置的值是否一致
@@ -1707,15 +1766,19 @@ namespace IMCS.CCS.Service.Impl
 
 
             List<TaskCallback> list = new List<TaskCallback>();
             List<TaskCallback> list = new List<TaskCallback>();
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
             var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
-            if (taskCallbackListData.IsNullOrEmpty)
+            if (!taskCallbackListData.IsNullOrEmpty)
             {
             {
-                list = await _taskCallbackService.GetAllList();
+                list = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
             }
             }
-            else
+
+            if (list.Count == 0)
             {
             {
-                list = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+                list = await _taskCallbackService.GetAllList();
+
             }
             }
 
 
+
+
             List<TaskCallback> tasks = list.Where(x => x.OperateType.Equals(ActionTypeEnum.WriteDeviationValue.ToString())).ToList();
             List<TaskCallback> tasks = list.Where(x => x.OperateType.Equals(ActionTypeEnum.WriteDeviationValue.ToString())).ToList();
             if (tasks.Count <=0)
             if (tasks.Count <=0)
             {
             {
@@ -1730,7 +1793,7 @@ namespace IMCS.CCS.Service.Impl
                 {
                 {
 
 
                     DateTime currentTime = DateTime.Now;
                     DateTime currentTime = DateTime.Now;
-                    if (currentTime.Subtract(task.CreateTime).TotalSeconds > 5)
+                    if (currentTime.Subtract(task.CreateTime).TotalSeconds > 10)
                     {
                     {
                         CallBackRequestData requestData = new CallBackRequestData();
                         CallBackRequestData requestData = new CallBackRequestData();
                         requestData.taskId = long.Parse(task.TaskId);
                         requestData.taskId = long.Parse(task.TaskId);
@@ -1786,7 +1849,8 @@ namespace IMCS.CCS.Service.Impl
 
 
             }
             }
 
 
-            if (taskList.Count == 0) {
+            if (taskList.Count == 0)
+            {
                 taskList = await _taskCallbackService.GetAllList();
                 taskList = await _taskCallbackService.GetAllList();
 
 
             }
             }
@@ -1811,6 +1875,26 @@ namespace IMCS.CCS.Service.Impl
 
 
                     // 查询出采集的数据
                     // 查询出采集的数据
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
                     List<CcsTagValue> tagValues = _ccsTagValueService.GetList(tagValueQuery).ToList();
+
+                    // 检索出,校验的数据
+                    CcsTagValue callBackCheckValue = tagValues.Where(o => o.Address == task.CallBackCheckAddress).FirstOrDefault();
+                    if (callBackCheckValue != null && task.CallBackCheckAddress != null)
+                    {
+                        if (callBackCheckValue.TagValue != task.CallBackCheckAddressValue)
+                        {
+                            //请求成功,任务状态改成结束
+                            task.State = true;
+                            task.UpdateTime = DateTime.Now;
+                            task.Description = "状态不满足,所需" + task.CallBackCheckAddress + "为:" + task.CallBackCheckAddressValue + "采集的为:" + callBackCheckValue.TagValue;
+                            await _taskCallbackService.CreateOrUpdateAndCache(task);
+                            message = task.OperateName + "==>taskId:" + task.TaskId + ",taskNodeId:" + task.TaskNodeId + ",请求结果:状态不满足,所需" + task.CallBackCheckAddress + "为:" + task.CallBackCheckAddressValue + "采集的为:" + callBackCheckValue.TagValue + ";";
+                            Log.Instance.WriteLogAdd(message, LOG_TITLE_CALLBACK);
+
+                            continue;
+                        }
+
+                    }
+
                     CcsTagValue callBacktagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
                     CcsTagValue callBacktagValue = tagValues.Where(o => o.Address == task.Address).FirstOrDefault();
 
 
                     // ①比较采集的数据值与回调的值是否相等,
                     // ①比较采集的数据值与回调的值是否相等,
@@ -1929,5 +2013,81 @@ namespace IMCS.CCS.Service.Impl
             }
             }
         }
         }
 
 
+        /// <summary>
+        ///  数据绑定
+        /// </summary>
+        /// <returns></returns>
+        public async Task<string> CallbackJob9()
+        {
+
+            List<TaskCallback> list = new List<TaskCallback>();
+            var taskCallbackListData = await _redisService.Database.StringGetAsync(imcs_redis_key + RedisKeyEnum.CallbackTaskList);
+            if (!taskCallbackListData.IsNullOrEmpty)
+            {
+                list = JsonConvert.DeserializeObject<List<TaskCallback>>(taskCallbackListData);
+            }
+
+            if (list.Count == 0)
+            {
+                list = await _taskCallbackService.GetAllList();
+
+            }
+
+
+            List<TaskCallback> tasks = list.Where(x => x.OperateType.Equals(ActionTypeEnum.BindingInfo.ToString())).ToList();
+            if (tasks.Count <= 0)
+            {
+                return "无回调任务";
+            }
+
+            // 对于多个绑定数据设置回调
+            foreach (var task in tasks)
+            {
+                string message = "";
+                try
+                {
+
+                    DateTime currentTime = DateTime.Now;
+                    if (currentTime.Subtract(task.CreateTime).TotalSeconds > 10)
+                    {
+                        CallBackRequestData requestData = new CallBackRequestData();
+                        requestData.taskId = long.Parse(task.TaskId);
+                        requestData.taskNodeId = long.Parse(task.TaskNodeId);
+                        var result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, ecsUrlContext, requestData, null);
+                        ResponseECSCallbackData responseECSCallback = JsonConvert.DeserializeObject<ResponseECSCallbackData>(result.Message);
+                        if (result.IsSuccess && responseECSCallback.code == 0)
+                        {
+                            task.State = false;
+                            task.UpdateTime = DateTime.Now;
+                            task.Description = result.Message;
+                            await _taskCallbackService.CreateOrUpdateAndCache(task);
+                            message = task.OperateName + "==>taskId:" + task.TaskId + ",taskNodeId:" + task.TaskNodeId + ",请求结果:" + result.Message + ";";
+                            Log.Instance.WriteLogAdd(message, LOG_TITLE_CALLBACK);
+                        }
+                        else
+                        {
+                            task.UpdateTime = DateTime.Now;
+                            task.Description = result.Message;
+                            await _taskCallbackService.CreateOrUpdateAndCache(task);
+                            message = message + JsonConvert.SerializeObject(task) + ",数据绑定结果失败! WebApi 返回结果" + ";";
+                            Log.Instance.WriteLogAdd("数据绑定结果失败,请求接口失败" + JsonConvert.SerializeObject(result), LOG_TITLE_CALLBACK);
+                        }
+
+                    }
+
+                    return string.IsNullOrEmpty(message) ? "无回调任务" : message;
+                }
+                catch (Exception ex)
+                {
+                    Log.Instance.WriteLogAdd("回调异常===>>" + ex.Message, LOG_TITLE_CALLBACK);
+                    return "回调异常" + ex.Message;
+                }
+            }
+
+            return "回调异常";
+
+        }
+
+
     }
     }
 }
 }

+ 1 - 0
IMCS_CCS/appsettings.json

@@ -23,6 +23,7 @@
   //"RedisConnectionString": "192.168.0.106:6379,password=123456,defaultDatabase=0",
   //"RedisConnectionString": "192.168.0.106:6379,password=123456,defaultDatabase=0",
   "RedisConnectionString": "192.168.50.111:6379,password=123456,defaultDatabase=0",
   "RedisConnectionString": "192.168.50.111:6379,password=123456,defaultDatabase=0",
   "ConnectionStrings": {
   "ConnectionStrings": {
+    //"mysqlContext": "server=192.168.0.106;port=3306;database=ccs_331;uid=root;pwd=1qaz@WSX;CharSet=utf8;Allow Zero Datetime=True",
     "mysqlContext": "server=127.0.0.1;port=3306;database=ccs_331;uid=root;pwd=123456;CharSet=utf8;Allow Zero Datetime=True",
     "mysqlContext": "server=127.0.0.1;port=3306;database=ccs_331;uid=root;pwd=123456;CharSet=utf8;Allow Zero Datetime=True",
     //"ecsUrlContext": "http://localhost:80/api/authority/taskNode/taskNodeCallback",
     //"ecsUrlContext": "http://localhost:80/api/authority/taskNode/taskNodeCallback",
     "ecsUrlContext": "http://localhost:9099/api/authority/taskNode/taskNodeCallback",
     "ecsUrlContext": "http://localhost:9099/api/authority/taskNode/taskNodeCallback",

File diff suppressed because it is too large
+ 0 - 0
IMCS_CCS/wwwroot/db/Tasks.json


Some files were not shown because too many files changed in this diff