From a42ae1ffc20459dc46a88590bc4a94f9280f2d3d Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期五, 10 五月 2024 15:31:28 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java | 62 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 10 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java index e4becd3..55d704e 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java +++ b/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; @@ -403,7 +415,9 @@ @Override public synchronized boolean reset(ShuttleCommand command) { - return false; + setSyncTaskNo(0); + setProtocolStatus(ShuttleProtocolStatusType.IDLE); + return true; } @Override @@ -414,10 +428,12 @@ @Override public boolean isIdle(ExecuteSupport support) { if (null != support) { - if (!support.judgement()) { - return false; + Boolean judgement = support.judgement(); + if (judgement != null && !judgement) { + return true; } } + if (this.shuttleProtocol.getDeviceStatus() == null || this.shuttleProtocol.getPakMk() == null || this.shuttleProtocol.getErrorCode() == null @@ -429,13 +445,26 @@ boolean res = (this.shuttleProtocol.getDeviceStatus() == 3 || this.shuttleProtocol.getDeviceStatus() == 11) && this.shuttleProtocol.getPakMk() && this.shuttleProtocol.getErrorCode().equals("0") - && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id) - ; + && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id + || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id + || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.CHARGING_WAITING.id); return res; } @Override public boolean isDeviceIdle() { + return isDeviceIdle(null); + } + + @Override + public boolean isDeviceIdle(ExecuteSupport support) { + if (null != support) { + Boolean judgement = support.judgement(); + if (judgement != null && !judgement) { + return true; + } + } + if (this.shuttleProtocol.getDeviceStatus() == null || this.shuttleProtocol.getPakMk() == null || this.shuttleProtocol.getErrorCode() == null @@ -591,7 +620,20 @@ } @Override - public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed) { + 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"); body.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); -- Gitblit v1.9.1