diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java index 129f98e..68c8151 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/dto/AgvDto.java @@ -86,4 +86,6 @@ public class AgvDto implements Serializable { */ private String type = "AGV"; + private Boolean chargingFlag=false; + } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java index a9fde4c..96893ae 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.hand.amb.service.HFHandService; +import org.nl.modules.common.annotation.Limit; import org.nl.modules.logging.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -169,6 +170,7 @@ public class HFHandController { @Log("创建充电任务") @ApiOperation("创建充电任务") @SaIgnore + @Limit(period = 2, count = 1) //@PreAuthorize("@el.check('sect:list')") public ResponseEntity createChargingTask(@RequestBody Map whereJson) { return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK); diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java index 1d9462c..bbf03a1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java @@ -13,6 +13,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.XianGongAgvService; +import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.agv.server.impl.NDCAgvServiceImpl; import org.nl.acs.auto.run.AutoRunService; import org.nl.acs.device.service.DeviceService; @@ -59,6 +60,7 @@ public class HFHandServiceImpl implements HFHandService { private final UserService userService; private final DeviceService deviceService; private final DeviceAppService deviceAppService; + private final NDCAgvService ndcAgvService; InstructionService instructionService = null; @@ -772,6 +774,12 @@ public class HFHandServiceImpl implements HFHandService { } String type = whereJson.get("carno"); + AgvDto agv = ndcAgvService.findByCarNumber(type); + if(agv.getChargingFlag()){ + jo.put("code", "0"); + jo.put("desc", "该车已在充电!"); + return jo; + } NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); try { agvService.createChargingTaskToNDC(type); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/common/aspect/LimitAspect.java b/acs/nladmin-system/src/main/java/org/nl/modules/common/aspect/LimitAspect.java index 7a8118f..4d58c67 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/common/aspect/LimitAspect.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/common/aspect/LimitAspect.java @@ -81,7 +81,7 @@ public class LimitAspect { log.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name()); return joinPoint.proceed(); } else { - throw new BadRequestException("访问次数受限制"); + throw new BadRequestException("请不要重复点击!"); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index 8113883..afa005d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -970,6 +970,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // 状态 AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19])); agv.setState(String.valueOf(ikey)); + }else if (phase == 0x40) { + // 状态 + AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19])); + agv.setChargingFlag(true); + }else if (phase == 0x41) { + // 状态 + AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19])); + agv.setChargingFlag(false); + }else if (phase == 0x42) { + // 状态 + AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19])); + agv.setChargingFlag(false); } if (!ObjectUtil.isEmpty(data)) { write(data);