| | |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | |
| | | public class ZyDualCrnRealConnect implements ZyDualCrnConnectApi { |
| | | |
| | |
| | | short destinationPosY = siemensNet.getByteTransform().TransInt16(taskResult.Content, 12); |
| | | short destinationPosZ = siemensNet.getByteTransform().TransInt16(taskResult.Content, 14); |
| | | short confirm = siemensNet.getByteTransform().TransInt16(taskResult.Content, 16); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("taskNo", taskNo); |
| | | map.put("taskMode", taskMode); |
| | | map.put("sourcePosX", sourcePosX); |
| | | map.put("sourcePosY", sourcePosY); |
| | | map.put("sourcePosZ", sourcePosZ); |
| | | map.put("destinationPosX", destinationPosX); |
| | | map.put("destinationPosY", destinationPosY); |
| | | map.put("destinationPosZ", destinationPosZ); |
| | | map.put("confirm", confirm); |
| | | |
| | | if(taskNo != 0 || taskMode != 0 || sourcePosX != 0 || sourcePosY != 0 || sourcePosZ != 0 || destinationPosX != 0 || destinationPosY != 0 || destinationPosZ != 0 || confirm != 0) { |
| | | short[] array = new short[9]; |
| | |
| | | array[8] = (short) 0; |
| | | |
| | | boolean clear = false; |
| | | if (taskMode == DualCrnTaskModeType.CONFIRM.id && crnStatus.getStatus() == 0) { |
| | | |
| | | if (taskMode == DualCrnTaskModeType.CONFIRM.id) { |
| | | // if (crnStatus.getStatus() == 0) { |
| | | // clear = true; |
| | | // } |
| | | clear = true; |
| | | } else { |
| | | clear = true; |
| | | } |
| | | |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.0", array); |
| | | redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3); |
| | | if (clear) { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.0", array); |
| | | redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3); |
| | | News.info("双工位堆垛机:{}号{}工位命令区域清空,原始数据:{}", deviceConfig.getDeviceNo(), 1, JSON.toJSONString(map)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | short destinationPosY = siemensNet.getByteTransform().TransInt16(taskResult.Content, 12); |
| | | short destinationPosZ = siemensNet.getByteTransform().TransInt16(taskResult.Content, 14); |
| | | short confirm = siemensNet.getByteTransform().TransInt16(taskResult.Content, 16); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("taskNo", taskNo); |
| | | map.put("taskMode", taskMode); |
| | | map.put("sourcePosX", sourcePosX); |
| | | map.put("sourcePosY", sourcePosY); |
| | | map.put("sourcePosZ", sourcePosZ); |
| | | map.put("destinationPosX", destinationPosX); |
| | | map.put("destinationPosY", destinationPosY); |
| | | map.put("destinationPosZ", destinationPosZ); |
| | | map.put("confirm", confirm); |
| | | |
| | | if(taskNo != 0 || taskMode != 0 || sourcePosX != 0 || sourcePosY != 0 || sourcePosZ != 0 || destinationPosX != 0 || destinationPosY != 0 || destinationPosZ != 0 || confirm != 0) { |
| | | short[] array = new short[9]; |
| | |
| | | array[7] = (short) 0; |
| | | array[8] = (short) 0; |
| | | |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.18", array); |
| | | redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3); |
| | | boolean clear = false; |
| | | if (taskMode == DualCrnTaskModeType.CONFIRM.id) { |
| | | // if (crnStatus.getStatusTwo() == 0) { |
| | | // clear = true; |
| | | // } |
| | | clear = true; |
| | | } else { |
| | | clear = true; |
| | | } |
| | | |
| | | if (clear) { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.18", array); |
| | | redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3); |
| | | News.info("双工位堆垛机:{}号{}工位命令区域清空,原始数据:{}", deviceConfig.getDeviceNo(), 2, JSON.toJSONString(map)); |
| | | } |
| | | } |
| | | } |
| | | } |