|
|
|
|
@ -207,8 +207,6 @@ public class PlcEventTask { |
|
|
|
|
log.info("无匹配的设备类型"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -261,65 +259,57 @@ public class PlcEventTask { |
|
|
|
|
BusinPlcStatus businPlcStatus = new BusinPlcStatus(); |
|
|
|
|
for (WcsPlcProperty property : propertyList) { |
|
|
|
|
plcId = property.getPlcId(); |
|
|
|
|
|
|
|
|
|
String pointType = property.getPointType(); |
|
|
|
|
String address = property.getAddress(); |
|
|
|
|
String devCode = property.getRelPoint(); |
|
|
|
|
if (pointType.equals("run")){ |
|
|
|
|
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ |
|
|
|
|
if (devCode.equals("dps")){ |
|
|
|
|
businPlcStatus.setDpsRun(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("stk")){ |
|
|
|
|
switch (pointType) { |
|
|
|
|
case "stkRun": |
|
|
|
|
businPlcStatus.setStkRun(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("dts")){ |
|
|
|
|
businPlcStatus.setDtsRun(pointMap.get(address).toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pointType.equals("wait")){ |
|
|
|
|
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ |
|
|
|
|
if (devCode.equals("dps")){ |
|
|
|
|
businPlcStatus.setDpsWait(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("stk")){ |
|
|
|
|
break; |
|
|
|
|
case "stkWait": |
|
|
|
|
businPlcStatus.setStkWait(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("dts")){ |
|
|
|
|
businPlcStatus.setDtsWait(pointMap.get(address).toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pointType.equals("pause")){ |
|
|
|
|
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ |
|
|
|
|
if (devCode.equals("dps")){ |
|
|
|
|
businPlcStatus.setDpsPause(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("stk")){ |
|
|
|
|
businPlcStatus.setStkPause(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("dts")){ |
|
|
|
|
businPlcStatus.setDtsPause(pointMap.get(address).toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pointType.equals("fault")){ |
|
|
|
|
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){ |
|
|
|
|
if (devCode.equals("dps")){ |
|
|
|
|
businPlcStatus.setDpsFault(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("stk")){ |
|
|
|
|
break; |
|
|
|
|
case "stkStop": |
|
|
|
|
businPlcStatus.setStkStop(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "stkFault": |
|
|
|
|
businPlcStatus.setStkFault(pointMap.get(address).toString()); |
|
|
|
|
}else if (devCode.equals("dts")){ |
|
|
|
|
businPlcStatus.setDtsFault(pointMap.get(address).toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "stkPowerOn": |
|
|
|
|
businPlcStatus.setStkPowerOn(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "oneDpsRun": |
|
|
|
|
businPlcStatus.setOneDpsRun(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "oneDpsWait": |
|
|
|
|
businPlcStatus.setOneDpsWait(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "oneDpsStop": |
|
|
|
|
businPlcStatus.setOneDpsStop(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "oneDpsFault": |
|
|
|
|
businPlcStatus.setOneDpsFault(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "oneDpsPowerOn": |
|
|
|
|
businPlcStatus.setOneDpsPowerOn(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "twoDpsRun": |
|
|
|
|
businPlcStatus.setTwoDpsRun(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "twoDpsWait": |
|
|
|
|
businPlcStatus.setTwoDpsWait(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "twoDpsStop": |
|
|
|
|
businPlcStatus.setTwoDpsStop(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "twoDpsFault": |
|
|
|
|
businPlcStatus.setTwoDpsFault(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
case "twoDpsPowerOn": |
|
|
|
|
businPlcStatus.setTwoDpsPowerOn(pointMap.get(address).toString()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
//log.info("处理设备状态的Id:"+plcId);
|
|
|
|
|
if (plcId.toString().equals("48")){ |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisStkStatus,businPlcStatus ); |
|
|
|
|
}else { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus,30,TimeUnit.SECONDS ); |
|
|
|
|
}catch (Exception e ){ |
|
|
|
|
log.error("处理设备状态{}"+e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|