#
zjj
2025-07-02 d3f3d4b309cfb285fcbbc48b91c4046111c7e9cd
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -5,31 +5,30 @@
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.TaskOverToWms;
import com.zy.asrs.service.*;
import com.zy.common.utils.HttpHandler;
import com.zy.core.CrnThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
import com.zy.core.enums.*;
import com.zy.core.enums.CommandStatusType;
import com.zy.core.enums.CrnTaskModeType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.CrnSlave;
import com.zy.core.model.Task;
import com.zy.core.model.command.CommandPackage;
import com.zy.core.model.command.CrnCommand;
import com.zy.core.model.protocol.CrnProtocol;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.text.MessageFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 堆垛机线程
@@ -197,9 +196,11 @@
            // 复位信号
            if (crnProtocol.getTaskFinish() == 0) {
                if (resetFlag) {
                    log.info("{}号堆垛机下发复位信号",slave.getId());
                    CrnCommand crnCommand = new CrnCommand();
                    crnCommand.setAckFinish((short)1);
                    if (write(crnCommand)) {
                        log.info("{}堆垛机复位信号下发成功",slave.getId());
                        resetFlag = false;
                    }
@@ -223,6 +224,7 @@
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.deleteDeviceError("crn", slave.getId());
        } else {
            initCrnProtocol();
            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);
@@ -254,6 +256,7 @@
//        crnCommand.setDestinationStaNo(command.getDestinationStaNo());
        crnCommand.setCommand(command.getCommand());
        if (command.getTaskNo() == 0 && command.getAckFinish() == 0 && command.getAuto() != 1) {
            log.error("write写入了9999任务号:{}",command);
            command.setTaskNo((short) 9999);
        }
@@ -409,6 +412,7 @@
//        crnCommand.setDestinationStaNo(command.getDestinationStaNo());
        crnCommand.setCommand(command.getCommand());
        if (command.getTaskNo() == 0 && command.getAckFinish() == 0 && command.getAuto() != 1) {
            log.error("write2写入了9999任务号:{}",command);
            command.setTaskNo((short) 9999);
        }