fix : 排列层校验
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package org.nl.acs.task.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskIdAndStatusDTO;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -52,10 +56,21 @@ public class TaskController {
|
||||
@Log("新增任务")
|
||||
//@SaCheckPermission("task:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TaskDto dto) throws Exception {
|
||||
//校验排列层为空
|
||||
checkYZ(dto);
|
||||
taskService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
private static void checkYZ(TaskDto dto) {
|
||||
if (dto.getTask_type().equals(TaskTypeEnum.AGV_Task.getIndex())){
|
||||
if ((dto.getNext_point_code().startsWith("L")&&(StrUtil.isEmpty(dto.getTo_y()) || StrUtil.isEmpty(dto.getTo_z()))) || (dto.getStart_point_code().startsWith("L")&&(StrUtil.isEmpty(dto.getFrom_y()) || StrUtil.isEmpty(dto.getFrom_z())))){
|
||||
throw new BadRequestException(LangProcess.msg("point_null"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/adds")
|
||||
@Log("常规任务保存")
|
||||
//@PreAuthorize("@el.check('task:add')")
|
||||
|
||||
@@ -1252,13 +1252,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String from_z = null;
|
||||
String to_y = null;
|
||||
String to_z = null;
|
||||
//校验排列层为空
|
||||
if (task.getTask_type().equals(TaskTypeEnum.AGV_Task.getIndex())){
|
||||
if ((next_point_code.startsWith("L")&&(StrUtil.isEmpty(task.getTo_y()) || StrUtil.isEmpty(task.getTo_z()))) || (start_point_code.startsWith("L")&&(StrUtil.isEmpty(task.getFrom_y()) || StrUtil.isEmpty(task.getFrom_z())))){
|
||||
throw new BadRequestException(LangProcess.msg("point_null"));
|
||||
}
|
||||
|
||||
}
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
|
||||
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
|
||||
|
||||
Reference in New Issue
Block a user