From c1ef2d1fc4c0dae2bc8452924dcd77a0ff3a1ef5 Mon Sep 17 00:00:00 2001 From: cpT <1@123> Date: 星期四, 19 六月 2025 15:02:52 +0800 Subject: [PATCH] #改造 --- src/main/java/com/zy/asrs/controller/RgvController.java | 66 ++++++++++++++++++++++++-------- 1 files changed, 49 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java index 4dca465..112568f 100644 --- a/src/main/java/com/zy/asrs/controller/RgvController.java +++ b/src/main/java/com/zy/asrs/controller/RgvController.java @@ -2,9 +2,11 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.ManagerAuth; +import com.core.common.Cools; import com.core.common.R; import com.zy.asrs.entity.BasDevpPosition; import com.zy.asrs.service.BasDevpPositionService; +import com.zy.core.cache.RgvErrCache; import com.zy.core.cache.RgvStatusCache; import com.zy.core.cache.SlaveConnection; import com.zy.core.cache.TaskProtocolCache; @@ -46,6 +48,7 @@ map2.put("rgvPos", rgvProtocol.getRgvPos()); map2.put("rgvPosDestination", rgvProtocol.getRgvPosDestination()); map2.put("loaded", rgvProtocol.getLoaded().equals((short)-1)? "鏈煡":rgvProtocol.getLoaded()==1? "鏈夌墿":"鏃犵墿"); + map2.put("errorRgv", RgvErrCache.getErrorDev(rgvProtocol.getRgvNo())); res.add(map2); } return R.ok().add(res); @@ -76,7 +79,7 @@ } @PostMapping("/run/del")//Take Put Walk - @ManagerAuth(memo = "灏忚溅琛岃蛋") + @ManagerAuth(memo = "娓呯┖浠诲姟") public R rgvRunDel(@RequestParam(defaultValue = "0") Integer rgvNo ) { if (rgvNo==null || rgvNo==0){ @@ -101,21 +104,21 @@ @PostMapping("/run/walk")//Take Put Walk @ManagerAuth(memo = "灏忚溅琛岃蛋") public R rgvRunWalk(@RequestParam(defaultValue = "0") Integer rgvNo, - @RequestParam(defaultValue = "0") Integer taskNo, + @RequestParam(defaultValue = "9999") Integer taskNo, @RequestParam(defaultValue = "0") Integer rgvStaNoPut, @RequestParam(defaultValue = "0") Long rgvPosDestination ) { if (rgvNo==null || rgvNo==0){ return R.error("璇烽�夋嫨灏忚溅"); } - if (taskNo==null || taskNo==0){ - return R.error("浣滀笟鍙疯濉啓"); - } if ((rgvStaNoPut == null || rgvStaNoPut == 0) && (rgvPosDestination==null || rgvPosDestination==0L)){ return R.error("鐩爣绔欑偣璇峰~鍐�"); } if (rgvPosDestination == null || rgvPosDestination == 0){ BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); + if (Cools.isEmpty(basDevpPosition)){ + return R.error("鐩爣绔欑偣涓嶅瓨鍦�"); + } rgvPosDestination = basDevpPosition.getPlcPosition(); } RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); @@ -149,15 +152,12 @@ @PostMapping("/run/put")//Take Put Walk @ManagerAuth(memo = "灏忚溅鏀捐揣") public R rgvPutWalk(@RequestParam(defaultValue = "0") Integer rgvNo, - @RequestParam(defaultValue = "0") Integer taskNo, + @RequestParam(defaultValue = "9999") Integer taskNo, @RequestParam(defaultValue = "0") Integer rgvStaNoPut, @RequestParam(defaultValue = "0") Long rgvPosDestination ) { if (rgvNo==null || rgvNo==0){ return R.error("璇烽�夋嫨灏忚溅"); - } - if (taskNo==null || taskNo==0){ - return R.error("浣滀笟鍙疯濉啓"); } if (rgvStaNoPut == null || rgvStaNoPut == 0){ return R.error("鐩爣绔欑偣璇峰~鍐�"); @@ -174,9 +174,14 @@ } BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); + if (Cools.isEmpty(basDevpPosition)){ + return R.error("鐩爣绔欑偣涓嶅瓨鍦�"); + } //鎵ц issuedPut.setTaskNo(Long.valueOf(taskNo)); issuedPut.setTaskStatus(3); + issuedPut.setTargetPositionStaNo(basDevpPosition.getDevNo()); + issuedPut.setTargetPositionStaNoPlcId(basDevpPosition.getPlcId()); issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); issuedPut.setTargetPosition(basDevpPosition.getPlcPosition()); issuedPut.setIsRunning(1); @@ -193,15 +198,12 @@ @PostMapping("/run/take")//Take Put Walk @ManagerAuth(memo = "灏忚溅鍙栬揣") public R rgvTakeWalk(@RequestParam(defaultValue = "0") Integer rgvNo, - @RequestParam(defaultValue = "0") Integer taskNo, + @RequestParam(defaultValue = "9999") Integer taskNo, @RequestParam(defaultValue = "0") Integer rgvStaNoTake, @RequestParam(defaultValue = "0") Long rgvPosDestination ) { if (rgvNo==null || rgvNo==0){ return R.error("璇烽�夋嫨灏忚溅"); - } - if (taskNo==null || taskNo==0){ - return R.error("浣滀笟鍙疯濉啓"); } if (rgvStaNoTake == null || rgvStaNoTake == 0){ return R.error("鍙栬揣绔欑偣璇峰~鍐�"); @@ -217,9 +219,14 @@ } BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); + if (Cools.isEmpty(basDevpPosition)){ + return R.error("鍙栬揣绔欑偣涓嶅瓨鍦�"); + } //鎵ц issuedTake.setTaskNo(Long.valueOf(taskNo)); issuedTake.setTaskStatus(2); + issuedTake.setTargetPositionStaNo(basDevpPosition.getDevNo()); + issuedTake.setTargetPositionStaNoPlcId(basDevpPosition.getPlcId()); issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus())); issuedTake.setTargetPosition(basDevpPosition.getPlcPosition()); issuedTake.setIsRunning(1); @@ -236,16 +243,13 @@ @PostMapping("/run/TakeAndPut")//Take Put Walk @ManagerAuth(memo = "灏忚溅鍙栬揣") public R rgvTakeAndPut(@RequestParam(defaultValue = "0") Integer rgvNo, - @RequestParam(defaultValue = "0") Integer taskNo, + @RequestParam(defaultValue = "9999") Integer taskNo, @RequestParam(defaultValue = "0") Integer rgvStaNoTake, @RequestParam(defaultValue = "0") Integer rgvStaNoPut, @RequestParam(defaultValue = "0") Long rgvPosDestination ) { if (rgvNo==null || rgvNo==0){ return R.error("璇烽�夋嫨灏忚溅"); - } - if (taskNo==null || taskNo==0){ - return R.error("浣滀笟鍙疯濉啓"); } if (rgvStaNoTake == null || rgvStaNoTake == 0){ return R.error("鍙栬揣绔欑偣璇峰~鍐�"); @@ -265,18 +269,28 @@ } BasDevpPosition basDevpPositionTake = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); + if (Cools.isEmpty(basDevpPositionTake)){ + return R.error("鍙栬揣绔欑偣涓嶅瓨鍦�"); + } //鎵ц issuedTake.setTaskNo(Long.valueOf(taskNo)); issuedTake.setTaskStatus(2); + issuedTake.setTargetPositionStaNo(basDevpPositionTake.getDevNo()); + issuedTake.setTargetPositionStaNoPlcId(basDevpPositionTake.getPlcId()); issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus())); issuedTake.setTargetPosition(basDevpPositionTake.getPlcPosition()); issuedTake.setIsRunning(1); issuedTake.setDirection(basDevpPositionTake.getRgvSign()==1); BasDevpPosition basDevpPositionPut = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); + if (Cools.isEmpty(basDevpPositionPut)){ + return R.error("鐩爣绔欑偣涓嶅瓨鍦�"); + } //鎵ц issuedPut.setTaskNo(Long.valueOf(taskNo)); issuedPut.setTaskStatus(3); + issuedPut.setTargetPositionStaNo(basDevpPositionPut.getDevNo()); + issuedPut.setTargetPositionStaNoPlcId(basDevpPositionPut.getPlcId()); issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); issuedPut.setTargetPosition(basDevpPositionPut.getPlcPosition()); issuedPut.setIsRunning(1); @@ -291,4 +305,22 @@ return R.ok("浠诲姟鐢熸垚鎴愬姛"); } + + @PostMapping("/run/delRgvTask")//Take Put Walk + @ManagerAuth(memo = "灏忚溅鍙栬揣") + public R rgvDelRgvTask(@RequestParam(defaultValue = "0") Integer rgvNo + ) { + if (rgvNo==null || rgvNo==0){ + return R.error("璇烽�夋嫨灏忚溅"); + } + + try { + RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); + rgvThread.setDelRgvTask(); + } catch (Exception e) { + return R.error("浠诲姟鐢熸垚澶辫触"+e.getMessage()); + } + + return R.ok("浠诲姟鐢熸垚鎴愬姛"); + } } -- Gitblit v1.9.1