#
skyouc
18 小时以前 42ce8de4d9c1608cf9230a996d5887c24a86c1f6
src/main/java/com/zy/core/network/real/ZyDualCrnRealConnect.java
@@ -17,6 +17,8 @@
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.cache.OutputQueue;
import com.zy.core.enums.CrnTaskModeType;
import com.zy.core.enums.DualCrnTaskModeType;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.command.DualCrnCommand;
@@ -97,7 +99,7 @@
                crnStatus.setXDuration((double) siemensNet.getByteTransform().TransSingle(result.Content, 62));
                crnStatus.setYDuration((double) siemensNet.getByteTransform().TransSingle(result.Content, 66));
                if ((crnStatus.getStatus() == 0 || crnStatus.getStatus() == 20) && crnStatus.getTaskReceive() == 0) {
                if (crnStatus.getTaskReceive() == 1) {
                    OperateResultExOne<byte[]> taskResult = siemensNet.Read("DB100.0", (short) 18);
                    if (taskResult.IsSuccess) {
                        short taskNo = siemensNet.getByteTransform().TransInt16(taskResult.Content, 0);
@@ -122,17 +124,28 @@
                            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.0", array);
                                redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3);
                            boolean clear = false;
                            if (taskMode == DualCrnTaskModeType.CONFIRM.id) {
                                if (crnStatus.getStatus() == 0) {
                                    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.0", array);
                                    redisUtil.set(RedisKeyType.CLEAR_DUAL_CRN_TASK_LIMIT.key + deviceConfig.getDeviceNo(), "lock", 3);
                                }
                            }
                        }
                    }
                }
                if ((crnStatus.getStatusTwo() == 0 || crnStatus.getStatusTwo() == 20) && crnStatus.getTaskReceiveTwo() == 0) {
                if (crnStatus.getTaskReceiveTwo() == 1) {
                    OperateResultExOne<byte[]> taskResult = siemensNet.Read("DB100.18", (short) 18);
                    if (taskResult.IsSuccess) {
                        short taskNo = siemensNet.getByteTransform().TransInt16(taskResult.Content, 0);
@@ -157,10 +170,22 @@
                            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);
                            boolean clear = false;
                            if (taskMode == DualCrnTaskModeType.CONFIRM.id) {
                                if (crnStatus.getStatusTwo() == 0) {
                                    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);
                                }
                            }
                        }
                    }