From fcb71b8fc63f74cd00d3faa76c73f4c5566ee352 Mon Sep 17 00:00:00 2001 From: zc <zc@123> Date: 星期三, 07 五月 2025 23:23:09 +0800 Subject: [PATCH] 解决提升机在本层,而没有锁提升机的问题 --- src/main/java/com/zy/asrs/controller/OpenController.java | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 234 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java index 97a2e4f..36213ba 100644 --- a/src/main/java/com/zy/asrs/controller/OpenController.java +++ b/src/main/java/com/zy/asrs/controller/OpenController.java @@ -1,10 +1,17 @@ package com.zy.asrs.controller; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.R; -import com.zy.asrs.domain.NotifyDto; +import com.zy.asrs.domain.ShuttleGatherResult; import com.zy.asrs.domain.enums.NotifyMsgType; import com.zy.asrs.domain.param.*; +import com.zy.asrs.entity.ApiLog; +import com.zy.asrs.entity.LocMast; +import com.zy.asrs.service.ApiLogService; +import com.zy.asrs.service.LocMastService; import com.zy.asrs.utils.NotifyUtils; +import com.zy.common.annotations.OpenApiLog; import com.zy.common.service.CommonService; import com.zy.core.cache.SlaveConnection; import com.zy.core.dispatcher.ShuttleDispatchUtils; @@ -21,7 +28,9 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; +import java.util.List; @Slf4j @RestController @@ -36,13 +45,34 @@ private NotifyUtils notifyUtils; @Autowired private SlaveProperties slaveProperties; + @Autowired + private ApiLogService apiLogService; + @Autowired + private LocMastService locMastService; @PostMapping("/createMoveTask") + @OpenApiLog(memo = "灏忚溅绉诲姩浠诲姟") public R createMoveTask(@RequestBody CreateMoveTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } - boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(null, param.getLocNo(), param.getShuttleNo()); + boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(null, param.getSourceLocNo(), param.getLocNo(), param.getShuttleNo(), param.getFlag()); + apiLogService.insert(new ApiLog( + null + , "灏忚溅绉诲姩浠诲姟" + , "/createMoveTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , dispatchShuttle ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (dispatchShuttle) { return R.ok(); } @@ -51,11 +81,28 @@ //绉诲簱浠诲姟 @PostMapping("/createLocMoveTask") + @OpenApiLog(memo = "绉诲簱浠诲姟") public R createLocMoveTask(@RequestBody CreateLocMoveTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } boolean result = commonService.createLocMoveTask(param); + apiLogService.insert(new ApiLog( + null + , "绉诲簱浠诲姟" + , "/createLocMoveTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , result ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (result) { return R.ok(); } @@ -64,11 +111,28 @@ //鍏ュ簱浠诲姟 @PostMapping("/createInTask") + @OpenApiLog(memo = "鍏ュ簱浠诲姟") public R createInTask(@RequestBody CreateInTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } boolean result = commonService.createInTask(param); + apiLogService.insert(new ApiLog( + null + , "鍏ュ簱浠诲姟" + , "/createInTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , result ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (result) { return R.ok(); } @@ -77,11 +141,28 @@ //鍑哄簱浠诲姟 @PostMapping("/createOutTask") + @OpenApiLog(memo = "鍑哄簱浠诲姟") public R createOutTask(@RequestBody CreateOutTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } boolean result = commonService.createOutTask(param); + apiLogService.insert(new ApiLog( + null + , "鍑哄簱浠诲姟" + , "/createOutTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , result ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (result) { return R.ok(); } @@ -89,11 +170,28 @@ } @PostMapping("/completeTask") + @OpenApiLog(memo = "浠诲姟瀹屾垚") public R completeTask(@RequestBody CompleteTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } boolean completeTask = commonService.completeTask(param); + apiLogService.insert(new ApiLog( + null + , "浠诲姟瀹屾垚" + , "/completeTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , completeTask ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (completeTask) { return R.ok(); } @@ -101,11 +199,28 @@ } @PostMapping("/cancelTask") + @OpenApiLog(memo = "浠诲姟鍙栨秷") public R cancelTask(@RequestBody CancelTaskParam param) { if (param == null) { return R.error("鍙傛暟涓嶈兘涓虹┖"); } boolean completeTask = commonService.cancelTask(param); + apiLogService.insert(new ApiLog( + null + , "浠诲姟鍙栨秷" + , "/cancelTask" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , completeTask ? 1 : 0 + , 1 + , new Date() + , null + , null + )); if (completeTask) { return R.ok(); } @@ -113,6 +228,7 @@ } @PostMapping("/deviceStatus") + @OpenApiLog(memo = "鑾峰彇璁惧鐘舵��") public R getDeviceStatus() { HashMap<String, Object> map = new HashMap<>(); //鑾峰彇灏忚溅鏁版嵁 @@ -147,13 +263,127 @@ map.put("shuttle", shuttleProtocols); map.put("forkLift", forkLiftProtocols); + + apiLogService.insert(new ApiLog( + null + , "鑾峰彇璁惧鐘舵��" + , "/deviceStatus" + , null + , null + , null + , null + , JSON.toJSONString(map) + , null + , null + , 1 + , new Date() + , null + , null + )); + return R.ok().add(map); + } + + @PostMapping("/getLocInformation") + @OpenApiLog(memo = "鑾峰彇鎸囧畾搴撲綅淇℃伅") + public R getLocInformation(@RequestBody GetLocInformationParam param) { + if (param == null) { + return R.error("鍙傛暟涓嶈兘涓虹┖"); + } + LocMast locMast = locMastService.queryByLoc(param.getLocNo()); + if (locMast == null) { + return R.error("搴撲綅淇℃伅涓嶅瓨鍦�"); + } + + HashMap<String, Object> map = new HashMap<>(); + map.put("locNo", locMast.getLocNo()); + map.put("locSts", locMast.getLocSts()); + + apiLogService.insert(new ApiLog( + null + , "鑾峰彇鎸囧畾搴撲綅淇℃伅" + , "/getLocInformation" + , null + , null + , null + , JSON.toJSONString(param) + , JSON.toJSONString(map) + , null + , null + , 1 + , new Date() + , null + , null + )); + + return R.ok().add(map); + } + + @PostMapping("/getAllLocInformation") + @OpenApiLog(memo = "鑾峰彇鍏ㄩ儴搴撲綅淇℃伅") + public R getAllLocInformation() { + List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()); + if (locMasts.isEmpty()) { + return R.error("搴撲綅淇℃伅涓嶅瓨鍦�"); + } + + ArrayList<HashMap<String, Object>> list = new ArrayList<>(); + for (LocMast locMast : locMasts) { + HashMap<String, Object> map = new HashMap<>(); + map.put("locNo", locMast.getLocNo()); + map.put("locSts", locMast.getLocSts()); + list.add(map); + } + + apiLogService.insert(new ApiLog( + null + , "鑾峰彇鎸囧畾搴撲綅淇℃伅" + , "/getLocInformation" + , null + , null + , null + , null + , JSON.toJSONString(list) + , null + , null + , 1 + , new Date() + , null + , null + )); + + return R.ok().add(list); + } + + @PostMapping("/shuttleGather") + @OpenApiLog(memo = "灏忚溅闆嗗悎") + public R shuttleGather(@RequestBody ShuttleGatherParam param) { + List<ShuttleGatherResult> shuttleGather = shuttleDispatchUtils.shuttleGather(param); + + apiLogService.insert(new ApiLog( + null + , "鑾峰彇鎸囧畾搴撲綅淇℃伅" + , "/getLocInformation" + , null + , null + , null + , null + , JSON.toJSONString(shuttleGather) + , null + , null + , 1 + , new Date() + , null + , null + )); + + return R.ok().add(shuttleGather); } @GetMapping("/test") public R test() { - notifyUtils.notify("task", 1, "9999", NotifyMsgType.SHUTTLE_MOVING, "data"); - notifyUtils.notify(String.valueOf(SlaveType.Shuttle), 2, "9999", NotifyMsgType.SHUTTLE_MOVE_COMPLETE); + notifyUtils.notify("task", 1, "9999", "W9999", NotifyMsgType.SHUTTLE_MOVING, "data"); + notifyUtils.notify(String.valueOf(SlaveType.Shuttle), 2, "9999", "W9999", NotifyMsgType.SHUTTLE_MOVE_COMPLETE); return R.ok(); } -- Gitblit v1.9.1