Junjie
2023-05-22 6e65e575aedd776432cda5a88f7434320f42e3f4
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -9,8 +9,11 @@
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasCrnOpt;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.service.BasCrnOptService;
import com.zy.asrs.service.BasCrnpService;
import com.zy.asrs.service.CommandInfoService;
import com.zy.asrs.service.DeviceErrorService;
import com.zy.core.CrnThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -122,6 +125,8 @@
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】堆垛机plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
            log.error("堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.addDeviceError("crn", slave.getId(), "堆垛机plc连接失败");
        }
        siemensNet.ConnectClose();
        return result;
@@ -336,9 +341,13 @@
                }
            } catch (Exception ignore){}
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.deleteDeviceError("crn", slave.getId());
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
            log.error("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.addDeviceError("crn", slave.getId(), "读取堆垛机plc状态信息失败");
        }
    }
@@ -353,6 +362,16 @@
        if (command.getTaskNo() == 0 && command.getAckFinish() == 0) {
            command.setTaskNo((short) 9999);
        }
        CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class);
        CommandInfo commandInfo = new CommandInfo();
        commandInfo.setWrkNo(command.getTaskNo().intValue());
        commandInfo.setCommandStatus(1);
        commandInfo.setStartTime(new Date());
        commandInfo.setDevice("crn");
        commandInfo.setCommand(JSON.toJSONString(command));
        commandInfoService.insert(commandInfo);
        command.setCrnNo(slave.getId());
        short[] array = new short[9];
        if (command.getAckFinish() == 0) {