Browse Source

ccs业务代码

oyq28 2 years ago
parent
commit
c9b63faf54
1 changed files with 13 additions and 13 deletions
  1. 13 13
      IMCS_CCS/Service/Impl/TaskJobService.cs

+ 13 - 13
IMCS_CCS/Service/Impl/TaskJobService.cs

@@ -1349,7 +1349,7 @@ namespace IMCS.CCS.Service.Impl
 
                 }
                 //变化的修改 并且更新缓存
-               /* if (changeEquipmentMonitors.Count > 0)
+                if (changeEquipmentMonitors.Count > 0)
                 {
                     List<ProductionStatus> productionStatusList = new List<ProductionStatus>();
                     foreach (EquipmentMonitor changeEquipment in changeEquipmentMonitors)
@@ -1426,7 +1426,7 @@ namespace IMCS.CCS.Service.Impl
                     //主动推送同步状态数据接口
                     RequestSynStatusData requestData = new RequestSynStatusData();
                     requestData.productionStatus = JsonConvert.SerializeObject(productionStatusList);
-                    String synStatusUrl = ecsRootUrlContext + "api/authority/synStatus/synProductionStatus";
+                    String synStatusUrl = ecsRootUrlContext + "/api/authority/synStatus/synProductionStatus";
                     var result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, synStatusUrl, requestData, null);
                     //解析回调数据结果
                     ResponseECSCallbackData responseECSCallback = JsonConvert.DeserializeObject<ResponseECSCallbackData>(result.Message);
@@ -1438,7 +1438,7 @@ namespace IMCS.CCS.Service.Impl
                     {
                         Log.Instance.WriteLogAdd("同步设备状态操作失败:" + responseECSCallback.msg, LOG_TITLE_CALLBACK);
                     }
-                }*/
+                }
                 return message;
             }
             catch (Exception ex)
@@ -1486,7 +1486,7 @@ namespace IMCS.CCS.Service.Impl
                             if (s7.IsConnected != true)
                             {
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (oldDevice.State)
+                                if (oldDevice != null && oldDevice.State)
                                 {
                                     device.State = false;
                                     await _deviceService.UpdateDevice(device);
@@ -1515,7 +1515,7 @@ namespace IMCS.CCS.Service.Impl
                         catch (Exception s7ex)
                         {
                             Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                            if (oldDevice.State)
+                            if (oldDevice != null && oldDevice.State)
                             {
                                 device.State = false;
                                 await _deviceService.UpdateDevice(device);
@@ -1541,7 +1541,7 @@ namespace IMCS.CCS.Service.Impl
                             {
                                 device.State = false;
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (oldDevice.State)
+                                if (oldDevice!= null && oldDevice.State)
                                 {
                                     await _deviceService.UpdateDevice(device);
                                     changeDevices.Add(device);
@@ -1562,7 +1562,7 @@ namespace IMCS.CCS.Service.Impl
                         catch (Exception opcex)
                         {
                             Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                            if (oldDevice.State)
+                            if (oldDevice != null && oldDevice.State)
                             {
                                 device.State = false;
                                 await _deviceService.UpdateDevice(device);
@@ -1583,7 +1583,7 @@ namespace IMCS.CCS.Service.Impl
                             if (Result.IsSuccess && Result.Message == "0")
                             {
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (!oldDevice.State)
+                                if (oldDevice!= null && !oldDevice.State)
                                 {
                                     oldDevice.State = true;
                                     await _deviceService.UpdateDevice(oldDevice);
@@ -1595,7 +1595,7 @@ namespace IMCS.CCS.Service.Impl
                             else
                             {
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (oldDevice.State)
+                                if (oldDevice != null && oldDevice.State)
                                 {
                                     oldDevice.State = false;
                                     await _deviceService.UpdateDevice(oldDevice);
@@ -1609,7 +1609,7 @@ namespace IMCS.CCS.Service.Impl
                         catch (Exception opcex)
                         {
                             Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                            if (oldDevice.State)
+                            if (oldDevice != null && oldDevice.State)
                             {
                                 oldDevice.State = false;
                                 await _deviceService.UpdateDevice(oldDevice);
@@ -1633,7 +1633,7 @@ namespace IMCS.CCS.Service.Impl
                             if (!Result.IsSuccess || !responseData.result)
                             {
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (oldDevice.State)
+                                if (oldDevice != null && oldDevice.State)
                                 {
                                     oldDevice.State = false;
                                     await _deviceService.UpdateDevice(oldDevice);
@@ -1646,7 +1646,7 @@ namespace IMCS.CCS.Service.Impl
                             else
                             {
                                 Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                                if (!oldDevice.State)
+                                if (oldDevice != null && !oldDevice.State)
                                 {
                                     oldDevice.State = true;
                                     await _deviceService.UpdateDevice(oldDevice);
@@ -1659,7 +1659,7 @@ namespace IMCS.CCS.Service.Impl
                         catch (Exception opcex)
                         {
                             Device oldDevice = await _deviceService.GetDeviceById(device.Id);
-                            if (oldDevice.State)
+                            if (oldDevice != null && oldDevice.State)
                             {
                                 oldDevice.State = false;
                                 await _deviceService.UpdateDevice(oldDevice);