#
Junjie
12 小时以前 c0df58a6fb50ee32e7336b5901000549700ebc82
src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java
@@ -22,6 +22,7 @@
import com.zy.core.network.DeviceConnectPool;
import com.zy.core.network.ZyCrnV2ConnectDriver;
import com.zy.core.network.entity.ZyCrnStatusEntity;
import com.zy.core.service.WrkCommandRollbackService;
import com.zy.core.thread.CrnThread;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -307,27 +308,35 @@
            response = zyCrnConnectDriver.sendCommand(command);
            return response;
        } finally {
            String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ());
            String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ());
            BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class);
            ZyCrnStatusEntity statusEntity = zyCrnConnectDriver.getStatus();
            BasCrnpOpt basCrnpOpt = new BasCrnpOpt(
                    command.getTaskNo().intValue(),
                    command.getCrnNo(),
                    new Date(),
                    String.valueOf(command.getTaskMode()),
                    sourceLocNo,
                    targetLocNo,
                    null,
                    null,
                    null,
                    JSON.toJSONString(command),
                    JSON.toJSONString(statusEntity),
                    1,
                    JSON.toJSONString(response)
            );
            if (bean != null) {
            if (command != null) {
                String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ());
                String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ());
                BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class);
                ZyCrnStatusEntity statusEntity = zyCrnConnectDriver.getStatus();
                BasCrnpOpt basCrnpOpt = new BasCrnpOpt(
                        command.getTaskNo(),
                        command.getCrnNo(),
                        new Date(),
                        String.valueOf(command.getTaskMode()),
                        sourceLocNo,
                        targetLocNo,
                        null,
                        null,
                        null,
                        JSON.toJSONString(command),
                        JSON.toJSONString(statusEntity),
                        1,
                        JSON.toJSONString(response)
                );
                bean.save(basCrnpOpt);
                try {
                    WrkCommandRollbackService rollbackService = SpringUtils.getBean(WrkCommandRollbackService.class);
                    if (rollbackService != null) {
                        rollbackService.handleSingleCrnSendResult(command, response, "单工位堆垛机V2");
                    }
                } catch (Exception e) {
                    log.error("处理单工位V2命令下发结果失败, wrkNo={}", command.getTaskNo(), e);
                }
            }
        }
    }