From d399d1b1975b47097526cab07a0120c56b616200 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 20 九月 2023 16:25:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/ShuttleController.java | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java index ce4aa87..1ddba1b 100644 --- a/src/main/java/com/zy/asrs/controller/ShuttleController.java +++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java @@ -1,6 +1,7 @@ package com.zy.asrs.controller; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; @@ -20,6 +21,7 @@ import com.zy.common.utils.NyHttpUtils; import com.zy.common.utils.NyShuttleOperaUtils; import com.zy.common.utils.RedisUtil; +import com.zy.common.utils.ShuttleDispatchUtils; import com.zy.core.cache.MessageQueue; import com.zy.core.cache.OutputQueue; import com.zy.core.cache.SlaveConnection; @@ -61,11 +63,13 @@ private CommonService commonService; @Autowired private RedisUtil redisUtil; + @Autowired + private ShuttleDispatchUtils shuttleDispatchUtils; @PostMapping("/table/shuttle/state") @ManagerAuth(memo = "鍥涘悜绌挎杞︿俊鎭〃") public R shuttleStateTable(){ - ArrayList<NyShuttleProtocol> list = new ArrayList<>(); + ArrayList<JSONObject> list = new ArrayList<>(); List<BasShuttle> shuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().orderBy("shuttle_no")); for (BasShuttle basShuttle : shuttles) { // 鑾峰彇鍥涘悜绌挎杞︿俊鎭� @@ -74,10 +78,25 @@ continue; } NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); + JSONObject shuttleData = JSON.parseObject(JSON.toJSONString(shuttleProtocol)); if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) { + if (shuttleData != null) { + list.add(shuttleData); + } continue; } - list.add(shuttleProtocol); + + shuttleData.put("moveAdvancePath", null);//绌挎杞﹂璁¤矾寰� + if (shuttleProtocol.getTaskNo() != 0) { + //瀛樺湪浠诲姟锛岃幏鍙栨寚浠� + Object object = redisUtil.get("shuttle_wrk_no_" + shuttleProtocol.getTaskNo()); + if (object != null) { + ShuttleRedisCommand redisCommand = JSON.parseObject(object.toString(), ShuttleRedisCommand.class); + shuttleData.put("moveAdvancePath", redisCommand.getAssignCommand().getNodes());//绌挎杞﹂璁¤矾寰� + } + } + + list.add(shuttleData); } return R.ok().add(list); } @@ -309,7 +328,7 @@ //澶嶄綅 shuttleProtocol.setTaskNo(0);//宸ヤ綔鍙锋竻绌� shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);//浠诲姟鐘舵��-绌洪棽 - shuttleProtocol.setPakMk(true);//浣滀笟鏍囪澶嶄綅 + shuttleProtocol.setPakMk(false);//浣滀笟鏍囪澶嶄綅 return R.ok(); } else if (shuttleTaskModeType == ShuttleTaskModeType.SHUTTLE_CONTROL) { //灏忚溅绠″埗 @@ -323,6 +342,10 @@ ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>(); commands.add(suspendCommand); assignCommand.setCommands(commands); + } else if (shuttleTaskModeType == ShuttleTaskModeType.MOVE_LOC_NO_WRK_MAST) { + //绉诲姩鍒扮洰鏍囧簱浣�(鐢熸垚绉诲姩浠诲姟) + shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), param.getDistLocNo(), param.getShuttleNo()); + return R.ok(); } else { throw new CoolException("鏈煡鍛戒护"); } -- Gitblit v1.9.1