#
Junjie
2024-05-10 a42ae1ffc20459dc46a88590bc4a94f9280f2d3d
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -10,6 +10,7 @@
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.domain.param.ShuttleMoveLocParam;
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -184,6 +185,7 @@
                    basShuttle.setStatus(1);
                    basShuttle.setDeleted(0);
                    basShuttle.setHostId(device.getHostId());
                    basShuttle.setDeviceId(device.getId().intValue());
                    shuttleService.save(basShuttle);
                }
                //任务号
@@ -217,10 +219,15 @@
    @Override
    public ShuttleProtocol getStatus() {
        return getStatus(true);
    }
    @Override
    public ShuttleProtocol getStatus(boolean clone) {
        if (this.shuttleProtocol == null) {
            return null;
        }
        return this.shuttleProtocol.clone();
        return clone ? this.shuttleProtocol.clone() : this.shuttleProtocol;
    }
    @Override
@@ -257,11 +264,11 @@
                NavigateNode targetPath = sectionNodes.get(sectionNodes.size() - 1);
                if (ShuttleRunDirection.get(startPath.getDirection()) == ShuttleRunDirection.LEFT
                        || ShuttleRunDirection.get(startPath.getDirection()) == ShuttleRunDirection.RIGHT) {
                    //母轨方向
                    oper = 5;
                } else {
                    //子轨方向
                    oper = 6;
                } else {
                    //母轨方向
                    oper = 5;
                }
                for (int i = 0; i < sectionNodes.size(); i++) {
@@ -299,7 +306,11 @@
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            Integer code = jsonObject.getInteger("code");
            System.out.println("路径下发" + taskNo);
            System.out.println(JSON.toJSONString(jsonObject));
            System.out.println(JSON.toJSONString(param));
            if (code.equals(200)) {
                System.out.println("路径下发" + taskNo);
                return true;
            }
        } catch (Exception e) {
@@ -329,6 +340,7 @@
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            Integer code = jsonObject.getInteger("code");
            System.out.println(JSON.toJSONString(command.getBody()));
            if (code.equals(200)) {
                this.shuttleProtocol.setSendTime(System.currentTimeMillis());//指令下发时间
                return true;
@@ -608,6 +620,19 @@
    }
    @Override
    public boolean enableMoveLoc(ShuttleMoveLocParam param) {
        shuttleProtocol.setMoveLoc(true);//开启跑库
        shuttleProtocol.setMoveType(param.getMoveType());
        shuttleProtocol.setXStart(param.getStartX());
        shuttleProtocol.setXTarget(param.getTargetX());
        shuttleProtocol.setXCurrent(param.getStartX());
        shuttleProtocol.setYStart(param.getStartY());
        shuttleProtocol.setYTarget(param.getTargetY());
        shuttleProtocol.setYCurrent(param.getStartY());
        return true;
    }
    @Override
    public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
        HashMap<String, Object> body = new HashMap<>();
        body.put("messageName", "runOrder");