pang.jiabao
2025-09-17 77ee4fbf68b83bf2ff0577d6751bbfbe85312f9f
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -126,6 +126,19 @@
        crnProtocol.setyDistance((short) 0);
        crnProtocol.setxDuration((short) 0);
        crnProtocol.setyDuration((short) 0);
        try{
            // 根据实时信息更新数据库
            BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
            BasCrnp basCrnp = new BasCrnp();
            basCrnp.setCrnErr(crnProtocol.getAlarm()==null?0:crnProtocol.getAlarm().longValue());
            basCrnp.setCrnNo(slave.getId());
            basCrnp.setCrnSts((int)crnProtocol.getMode());
            if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))){
                News.error("MelsecCrn"+" - 4"+" - 堆垛机plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
            }
        } catch (Exception e){
        }
    }
    @Override
@@ -314,7 +327,7 @@
                        || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY())
                        || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX())
                        || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
                        || !command.isTraySize() == one.isTraySize()
                ){
                    try{
                        News.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
@@ -372,14 +385,6 @@
            }
        }
//        if (command.getAckFinish() == 0) {
//            short commandFinish = 1;
//            Thread.sleep(200L);
//            result = siemensNet.Write("DB100.18", commandFinish);
//            log.info("堆垛机commandFinish下发[id:{}] >>>>> {}", slave.getId(), commandFinish);
////            result = siemensNet.Write("DB100.22", commandFinish);
//        }
        try {
            // 日志记录
            BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class);
@@ -404,7 +409,6 @@
        } catch (Exception ignore) {}
        if (result != null && result.IsSuccess) {
            Thread.sleep(200);
            this.readStatus();
            News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));