From aac4bc5bdfd808fa7d33ee04924741a4c03944fc Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期二, 19 九月 2023 11:18:53 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/NyShuttleThread.java | 326 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 282 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java index ef2c24b..6ba944e 100644 --- a/src/main/java/com/zy/core/thread/NyShuttleThread.java +++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java @@ -5,9 +5,12 @@ 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; import com.zy.common.model.NavigateNode; +import com.zy.common.model.NyShuttleOperaResult; import com.zy.common.utils.*; import com.zy.core.News; import com.zy.core.ThreadHandler; @@ -15,17 +18,18 @@ import com.zy.core.cache.OutputQueue; import com.zy.core.cache.SlaveConnection; import com.zy.core.enums.*; +import com.zy.core.model.LiftSlave; 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 com.zy.core.properties.SlaveProperties; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import java.io.IOException; +import java.net.Socket; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; @@ -41,6 +45,7 @@ private ShuttleSlave slave; private NyShuttleProtocol shuttleProtocol; private RedisUtil redisUtil; + private Socket socket; public NyShuttleThread(ShuttleSlave slave,RedisUtil redisUtil) { this.slave = slave; @@ -82,6 +87,10 @@ private void read() { try { + if (this.socket == null || this.socket.isClosed()) { + //閾炬帴鏂紑閲嶆柊閾炬帴 + this.connect(); + } readStatus(); //鍥涘悜绌挎杞︾┖闂层�佹湁浠诲姟銆佹爣璁颁负true銆佸瓨鍦ㄤ换鍔℃寚浠わ紝闇�瑕佹墽琛屼换鍔$殑涓嬩竴鏉℃寚浠� if (shuttleProtocol.getFree() == ShuttleStatusType.IDLE.id @@ -106,9 +115,10 @@ //----------璇诲彇鍥涘悜绌挎杞︾姸鎬�----------- NyShuttleHttpCommand readStatusCommand = NyHttpUtils.getReadStatusCommand(slave.getId()); - JSONObject jsonObject = NyHttpUtils.requestCommand(readStatusCommand); + JSONObject jsonObject = NyHttpUtils.requestCommand(socket, readStatusCommand); if (jsonObject == null) { - OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); + shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.OFFLINE); + OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); }else { //鎵嬪姩鐘舵��/鑷姩鐘舵�� shuttleProtocol.setWorkingMode(jsonObject.getInteger("workingMode")); @@ -157,7 +167,7 @@ errCode.add(Integer.parseInt(o.toString())); } //鏁呴殰鐮� - shuttleProtocol.setErrCode(errCode); + shuttleProtocol.setErrCode(errCode.get(0)); //鎬婚噷绋嬫暟 shuttleProtocol.setStatusSum(jsonObject.getObject("statusSum", NyShuttleProtocol.StatusSumClass.class)); //闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃� @@ -166,6 +176,20 @@ //灏忚溅澶勪簬杩愯涓紝灏嗘爣璁扮疆涓簍rue if (shuttleProtocol.getFree() == 0) { shuttleProtocol.setPakMk(true); + }else { + //灏忚溅澶勪簬绛夊緟纭涓旂┖闂茬姸鎬侊紝濡傛湁宸ヤ綔鍙峰垯娓呯┖璺緞 + if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getProtocolStatusType() == ShuttleProtocolStatusType.WAITING) { + Object o = redisUtil.get("shuttle_wrk_no_" + shuttleProtocol.getTaskNo()); + if (o != null) { + ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); + ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand(); + NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(shuttleProtocol.getCurrentLocNo())); + navigateMapData.writeNavigateNodeToRedisMap(assignCommand.getNodes(), false);//瑙i攣璺緞 + + //鍒犻櫎redis + redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo()); + } + } } //灏嗗洓鍚戠┛姊溅鐘舵�佷繚瀛樿嚦鏁版嵁搴� @@ -234,12 +258,29 @@ } } catch (Exception e) { e.printStackTrace(); - OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); + OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); + try { + this.socket.close(); + this.socket = null; + Thread.sleep(1000); + this.connect(); + } catch (IOException | InterruptedException exception) { + e.printStackTrace(); + } } } @Override public boolean connect() { + try { + Socket socket = new Socket(slave.getIp(),slave.getPort()); + socket.setSoTimeout(60000); + socket.setKeepAlive(true); + this.socket = socket; + log.info(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); + } catch (IOException e) { + OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅Socket閾炬帴澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); + } return true; } @@ -266,7 +307,21 @@ } //鍙戝嚭璇锋眰 - JSONObject result = NyHttpUtils.requestCommand(command); + JSONObject result = null; + try { + result = NyHttpUtils.requestCommand(socket, command); + } catch (IOException e) { + try { + this.socket.close(); + this.socket = null; + Thread.sleep(1000); + this.connect(); + } catch (IOException exception) { + exception.printStackTrace(); + } catch (InterruptedException ex) { + throw new RuntimeException(ex); + } + } if (result == null) { return false;//璇锋眰澶辫触 } @@ -297,34 +352,83 @@ return false; } - WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class); + WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class); Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo); if (o == null) { return false; } + ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); - List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands(); ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand(); + List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands(); //褰撳墠姝ュ簭 int commandStep = redisCommand.getCommandStep(); if (commands.size() == 0) { return false; } + + NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(shuttleProtocol.getCurrentLocNo())); //鍙栧嚭鍛戒护 - NyShuttleHttpCommand command = commands.get(commandStep); + NyShuttleHttpCommand command = commands.get(commandStep);//褰撳墠鍛戒护 + if (commandStep != 0) { + //鍒ゆ柇涓婁竴鏉℃寚浠ゆ槸鍚﹀畬鎴� + NyShuttleHttpCommand lastCommand = commands.get(commandStep - 1); + String requestType = lastCommand.getRequest().getBody().get("requestType").toString(); + if (requestType.equals("move") || requestType.equals("intoLift") || requestType.equals("outLift")) { + //绉诲姩鍛戒护銆佸嚭鍏ユ彁鍗囨満鍛戒护 + NyShuttleProtocol.NyShuttlePointClass target = JSON.parseObject(lastCommand.getRequest().getBody().get("target").toString(), NyShuttleProtocol.NyShuttlePointClass.class); + if (shuttleProtocol.getPoint().equals(target)) { + //涓婁竴鏉℃寚浠ょ殑鐩爣浣嶇疆鍜屽綋鍓嶅皬杞︿綅缃浉鍚岋紝鍒欒瀹氫笂涓�鏉′换鍔″畬鎴� + lastCommand.setComplete(true); + //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰勫拰褰撳墠璺緞 + List<NavigateNode> nodes = lastCommand.getNodes(); + nodes.addAll(command.getNodes()); + navigateMapData.writeNavigateNodeToRedisMap(nodes, false);//瑙i攣璺緞 + } + }else { + lastCommand.setComplete(true);//鍏朵粬鍛戒护榛樿璁や负瀹屾垚 + } + //浠诲姟鏁版嵁淇濆瓨鍒皉edis + redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); + + if (!lastCommand.getComplete()) { + //涓婁竴鏉′换鍔℃湭瀹屾垚锛岀姝笅鍙戝懡浠� + return false; + } + } + + List<NavigateNode> nextNodes = null;//涓嬩竴姝ュ懡浠よ璧拌矾寰� + if (commandStep + 1 < commands.size()) { + NyShuttleHttpCommand nextCommand = commands.get(commandStep + 1);//涓嬩竴姝ュ懡浠� + nextNodes = nextCommand.getNodes();//涓嬩竴姝ュ懡浠よ璧拌矾寰� + } if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) { return false;//灏忚溅鐘舵�佸繖锛岀姝㈡墽琛屽懡浠� } - //妫�娴嬪皬杞︽槸鍚﹁杩涙彁鍗囨満锛屽闇�瑕佽繘鎻愬崌鏈哄垯璋冨害鎻愬崌鏈� - if (!checkLiftStation(wrkNo)) { +// //妫�娴嬪皬杞︽槸鍚﹁杩涙彁鍗囨満锛屽闇�瑕佽繘鎻愬崌鏈哄垯璋冨害鎻愬崌鏈� +// if (!checkLiftStation(wrkNo)) { +// return false; +// } + + //妫�娴嬬┛姊溅鏄惁鍦ㄦ彁鍗囨満鍐� + if (!checkShuttleInTheLift(wrkNo)) { return false; } - //妫�鏌ヨ矾寰勬槸鍚﹀彲琛岃蛋(妫�鏌ヨ矾寰勯攣瀹氱姸鎬侊紝妫�娴嬭矾寰勬槸鍚︽湁鍏朵粬灏忚溅) + //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋 + if (!checkPath(command.getNodes(), nextNodes, redisCommand)) { + return false; + } + //閿佸畾璺緞锛岄攣瀹氬綋鍓嶈矾寰勫拰涓嬩竴姝ヨ矾寰� + List<NavigateNode> nodes = command.getNodes(); + if (nextNodes != null) { + nodes.addAll(nextNodes); + } + navigateMapData.writeNavigateNodeToRedisMap(nodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢� //鍙墽琛屽懡浠� if (!write(command)) { @@ -350,7 +454,8 @@ null, null, JSON.toJSONString(command), - null + null, + JSON.toJSONString(shuttleProtocol) ); shuttleOptService.insert(opt); } @@ -366,22 +471,12 @@ }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()); + //鏈�鍚庝竴娈靛懡浠や负绉诲姩鍛戒护锛屽垯鏆傜紦鍒犻櫎redis绛夊緟娓呴櫎璺緞鏃朵竴娆℃�у垹闄� + //鏈�鍚庝竴娈靛懡浠や负涓嶆槸绉诲姩鍛戒护锛屽垯鍒犻櫎redis + if (!command.getRequest().getBody().get("requestType").equals("move")) { + //鍒犻櫎redis + redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo()); + } if (!assignCommand.getCharge()) { //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting @@ -407,15 +502,7 @@ return false; } - //鎷垮埌鎻愬崌鏈虹嚎绋� - LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1); - if (liftThread == null) { - return false; - } - LiftProtocol liftProtocol = liftThread.getLiftProtocol(); - if (liftProtocol == null) { - return false; - } + WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class); ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); //褰撳墠姝ュ簭 @@ -423,16 +510,167 @@ //妫�娴嬫槸鍚﹀瓨鍦ㄦ彁鍗囨満鍙g殑鎸囦护 List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands(); - if (commands.size() == 0) { + 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, basDevp.getLiftNo()); + if (liftThread == null) { + return false; + } + LiftProtocol liftProtocol = liftThread.getLiftProtocol(); + if (liftProtocol == null) { + return false; + } + if (!liftProtocol.isIdle()) { return false; } - if (!commands.get(commandStep).getMsgType().equals("move")) { - return true;//涓嶆槸琛岃蛋鍛戒护锛岀洿鎺ユ斁琛� + if (liftProtocol.getLev().intValue() == Utils.getLev(shuttleProtocol.getCurrentLocNo())) { + return true;//鎻愬崌鏈鸿揪鍒板皬杞︽ゼ灞傦紝鏀捐 } + //鎼滅储鏄惁鏈夊叾浠栦换鍔″崰鐢ㄤ簡鎻愬崌鏈猴紝濡傛灉鍗犵敤鎻愬崌鏈虹殑浠诲姟鍜屽綋鍓嶄换鍔$浉鍚岋紝鍒欒繍琛屾墽琛� + WrkMast wrkMast1 = wrkMastMapper.selectLiftWrkMast(liftProtocol.getLiftNo().intValue()); + if (wrkMast1 != null && wrkMast1.getWrkNo() != wrkNo.intValue()) { + return false; + } + + //鎻愬崌鏈烘湭鍒拌揪灏忚溅妤煎眰锛屽懠鍙彁鍗囨満 + //鑾峰彇鎻愬崌鏈哄懡浠� + 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;//榛樿涓嶆斁琛� } + /** + * 妫�娴嬬┛姊溅鏄惁鍦ㄦ彁鍗囨満鍐� + * 濡傜┛姊溅鍦ㄦ彁鍗囨満鍐咃紝蹇呴』绛夊緟鎻愬崌鏈虹┖闂叉墠鍙墽琛岀┛姊溅鍛戒护 + */ + private boolean checkShuttleInTheLift(Short wrkNo) { + //璇诲彇redis鏁版嵁 + if (wrkNo == null) { + return false; + } + + Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo); + if (o == null) { + return false; + } + + SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); + BasLiftService liftService = SpringUtils.getBean(BasLiftService.class); + for (LiftSlave liftSlave : slaveProperties.getLift()) { + BasLift basLift = liftService.selectById(liftSlave.getId()); + if (basLift == null) { + continue; + } + Integer liftX = basLift.getPoint$().getX(); + Integer liftY = basLift.getPoint$().getY(); + if (liftX.equals(shuttleProtocol.getPoint().getX()) && liftY.equals(shuttleProtocol.getPoint().getY())) { + //灏忚溅鍦ㄦ彁鍗囨満鍐� + //鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂� + LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId()); + if (liftThread == null) { + return false; + } + LiftProtocol liftProtocol = liftThread.getLiftProtocol(); + if (liftProtocol == null) { + return false; + } + if (liftProtocol.isIdle()) { + //鎻愬崌鏈哄浜庣┖闂诧紝鏀捐 + return true; + } + }else { + return true;//涓嶅湪鎻愬崌鏈哄唴锛屾斁琛� + } + } + return false;//榛樿涓嶆斁琛� + } + + /** + * 妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋 + * 濡傛灉璺緞涓虹洰鏍囧簱浣嶏紝浣嗕笉鍙璧帮紝绯荤粺灏嗗皾璇曢噸鏂拌绠楄矾寰� + */ + private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, ShuttleRedisCommand redisCommand) { + //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋(妫�鏌ヨ矾寰勯攣瀹氱姸鎬侊紝妫�娴嬭矾寰勬槸鍚︽湁鍏朵粬灏忚溅) + //妫�娴嬪綋鍓嶈璧拌矾寰勶紝鍜屼笅涓�姝ヨ矾寰� + boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo())); + if (nextNodes == null) { + if (checkPathIsAvailable) { + return true;//鍙璧� + } + }else { + boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo())); + if (checkPathIsAvailable && checkPathIsAvailable2) { + return true;//鍙璧� + } + } + + ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand(); + NavigateNode currentTarget = currentNodes.get(currentNodes.size() - 1); + String currentLocNo = NavigatePositionConvert.nodeToLocNo(currentTarget); + NavigateNode nextTarget = nextNodes.get(nextNodes.size() - 1); + String nextLocNo = NavigatePositionConvert.nodeToLocNo(nextTarget); + if (assignCommand.getLocNo().equals(currentLocNo) || assignCommand.getLocNo().equals(nextLocNo)) { + //褰撳墠璺緞鏈�鍚庝竴涓妭鐐规槸鐩爣搴撲綅锛岃繘琛岃矾寰勬娴嬶紝濡傛灉涓嶅彲琛岃蛋锛岄噸鏂拌绠楄矾寰� + //涓嶅彲琛岃蛋锛岄噸鏂拌绠楄矾寰� + NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getShuttleNo().intValue(), shuttleProtocol.getTaskNo(), shuttleProtocol.getCurrentLocNo(), assignCommand.getLocNo()); + if (result == null) { + return false;//璺緞璁$畻澶辫触锛屼笉鍙璧� + } + + List<NyShuttleHttpCommand> newCommands = result.getCommands();//鏂拌矾寰� + + //褰撳墠姝ュ簭 + int commandStep = redisCommand.getCommandStep(); + List<NyShuttleHttpCommand> commands = assignCommand.getCommands(); + + commands.remove(commandStep);//绉婚櫎褰撳墠姝ュ簭鎸囦护 + if (assignCommand.getLocNo().equals(currentLocNo)) { + //褰撳墠璺緞锛岄渶瑕佸啀澶氱Щ闄や笅涓�姝ユ寚浠� + commands.remove(commandStep + 1); + } + + //灏嗘柊璺緞娣诲姞杩涙寚浠ら泦鍚� + commands.addAll(commandStep, newCommands); + assignCommand.setCommands(commands); + redisCommand.setAssignCommand(assignCommand); + //浠诲姟鏁版嵁淇濆瓨鍒皉edis + redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); + return false;//褰撳墠涓嶅彲琛岃蛋锛岀瓑寰呬笅涓�娆℃墽琛岃蛋鏂拌矾寰� + } + + return false;//涓嶅彲琛岃蛋 + } + } -- Gitblit v1.9.1