From 6fe9d166be361dd8a3c0075149aa0464c783867b Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期二, 01 八月 2023 16:13:09 +0800 Subject: [PATCH] 小车进提升机检测方案 --- src/main/java/com/zy/core/thread/NyShuttleThread.java | 75 +++++++++++++++++++++++-------------- 1 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java index ddd71bb..b2c39da 100644 --- a/src/main/java/com/zy/core/thread/NyShuttleThread.java +++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java @@ -5,6 +5,7 @@ import com.core.common.DateUtils; import com.core.common.SpringUtils; import com.zy.asrs.entity.*; +import com.zy.asrs.mapper.WrkMastMapper; import com.zy.asrs.service.*; import com.zy.asrs.utils.Utils; @@ -18,10 +19,7 @@ import com.zy.core.enums.*; import com.zy.core.model.ShuttleSlave; import com.zy.core.model.Task; -import com.zy.core.model.command.NyShuttleHttpCommand; -import com.zy.core.model.command.ShuttleAssignCommand; -import com.zy.core.model.command.ShuttleCommand; -import com.zy.core.model.command.ShuttleRedisCommand; +import com.zy.core.model.command.*; import com.zy.core.model.protocol.LiftProtocol; import com.zy.core.model.protocol.NyShuttleProtocol; import lombok.Data; @@ -410,20 +408,6 @@ }else { //宸叉墽琛屽畬鎴� -// if (redisCommand.getLiftSecurityMk()) { -// //鏇鹃攣瀹氳繃鎻愬崌鏈猴紝闇�瑕佽繘琛岃В閿� -// if (liftProtocol != null) { -// liftProtocol.setSecurityMk(false); -// } -// } - -// String locNo = shuttleProtocol.getLocNo() == null ? shuttleProtocol.getSourceLocNo() : shuttleProtocol.getLocNo(); -// if (locNo != null) { -// //瑙i櫎閿佸畾鐨勫簱浣嶈矾寰� -// NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(locNo)); -// navigateMapData.writeNavigateNodeToRedisMap(redisCommand.getAssignCommand().getNodes(), false); -// } - //鍒犻櫎redis redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo()); @@ -451,8 +435,33 @@ return false; } + ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); + //褰撳墠姝ュ簭 + int commandStep = redisCommand.getCommandStep(); + + //妫�娴嬫槸鍚﹀瓨鍦ㄦ彁鍗囨満鍙g殑鎸囦护 + List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands(); + if (commands.isEmpty()) { + return false; + } + NyShuttleHttpCommand command = commands.get(commandStep);//褰撳墠鍛戒护 + if (!command.getMsgType().equals("intoLift")) { + return true;//涓嶆槸鍏ユ彁鍗囨満鍛戒护锛岀洿鎺ユ斁琛� + } + + //鑾峰彇璧风偣(杈撻�佺珯鐐�) + NyShuttleProtocol.NyShuttlePointClass start = JSON.parseObject(command.getRequest().getBody().get("start").toString(), NyShuttleProtocol.NyShuttlePointClass.class); + //灏嗙墰鐪煎潗鏍囪浆鎹㈡垚WCS搴撲綅鍙� + String startLocNo = NavigatePositionConvert.nyXyzToLocNo(start.getX(), start.getY(), start.getZ()); + + BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); + BasDevp basDevp = basDevpService.queryByLocNo(startLocNo); + if (basDevp == null) { + return false;//鏌ヤ笉鍒扮珯鐐癸紝绂佹涓嬪彂 + } + //鎷垮埌鎻愬崌鏈虹嚎绋� - LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1); + LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo()); if (liftThread == null) { return false; } @@ -460,21 +469,29 @@ if (liftProtocol == null) { return false; } - - ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); - //褰撳墠姝ュ簭 - int commandStep = redisCommand.getCommandStep(); - - //妫�娴嬫槸鍚﹀瓨鍦ㄦ彁鍗囨満鍙g殑鎸囦护 - List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands(); - if (commands.size() == 0) { + if (!liftProtocol.isIdle()) { return false; } - if (!commands.get(commandStep).getMsgType().equals("move")) { - return true;//涓嶆槸琛岃蛋鍛戒护锛岀洿鎺ユ斁琛� + if (liftProtocol.getLev().intValue() == Utils.getLev(shuttleProtocol.getCurrentLocNo())) { + return true;//鎻愬崌鏈鸿揪鍒板皬杞︽ゼ灞傦紝鏀捐 } + //鎻愬崌鏈烘湭鍒拌揪灏忚溅妤煎眰锛屽懠鍙彁鍗囨満 + //鑾峰彇鎻愬崌鏈哄懡浠� + NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, null, basDevp.getDevNo(), wrkNo.intValue()); + ArrayList<NyLiftCommand> liftCommands = new ArrayList<>(); + liftCommands.add(liftCommand); + + //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔 + LiftAssignCommand assignCommand = new LiftAssignCommand(); + assignCommand.setCommands(liftCommands); + assignCommand.setLiftNo(liftProtocol.getLiftNo()); + assignCommand.setTaskNo(wrkNo); + assignCommand.setTaskMode(NyLiftTaskModelType.MOVE_CAR.id.shortValue()); + + //涓嬪彂浠诲姟 + MessageQueue.offer(SlaveType.Lift, liftProtocol.getLiftNo().intValue(), new Task(3, assignCommand)); return false;//榛樿涓嶆斁琛� } -- Gitblit v1.9.1