opt:手持功能优化
This commit is contained in:
@@ -46,7 +46,7 @@ public class PadController {
|
||||
return new ResponseEntity<>(padService.insts(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/instoperation")
|
||||
@PostMapping("/inst")
|
||||
@Log("指令操作")
|
||||
@ApiOperation("指令操作")
|
||||
@SaIgnore
|
||||
|
||||
@@ -35,14 +35,14 @@ public class PadServiceImpl implements PadService {
|
||||
@Override
|
||||
public Map<String, Object> tasks(Map<String, String> whereJson) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String vehicle_code = StrUtil.trimToEmpty(whereJson.get("vehicle_code"));
|
||||
String car_no = StrUtil.trimToEmpty(whereJson.get("car_no"));
|
||||
String device_code = StrUtil.trimToEmpty(whereJson.get("device_code"));
|
||||
List<TaskDto> taskDtos = taskService.queryAllByCache();
|
||||
List<Map<String, Object>> list = (taskDtos == null ? Stream.<TaskDto>empty() : taskDtos.stream())
|
||||
.filter(t -> {
|
||||
if (StrUtil.isEmpty(vehicle_code)) return true;
|
||||
String vc = t.getVehicle_code();
|
||||
return StrUtil.isNotEmpty(vc) && vc.contains(vehicle_code);
|
||||
if (StrUtil.isEmpty(car_no)) return true;
|
||||
String vc = t.getCar_no();
|
||||
return StrUtil.isNotEmpty(vc) && vc.contains(car_no);
|
||||
})
|
||||
.filter(t -> {
|
||||
if (StrUtil.isEmpty(device_code)) return true;
|
||||
@@ -54,17 +54,17 @@ public class PadServiceImpl implements PadService {
|
||||
.map(t -> {
|
||||
Map<String, Object> m = new HashMap<>();
|
||||
m.put("task_id", t.getTask_id());
|
||||
m.put("task_no", t.getTask_code());
|
||||
m.put("task_code", t.getTask_code());
|
||||
m.put("priority", t.getPriority());
|
||||
m.put("start_device_code", t.getStart_device_code());
|
||||
m.put("next_device_code", t.getNext_device_code());
|
||||
m.put("point_code1", t.getStart_device_code());
|
||||
m.put("point_code2", t.getNext_device_code());
|
||||
m.put("inst_status", t.getTask_status());
|
||||
m.put("vehicle_code", t.getVehicle_code());
|
||||
m.put("car_no", t.getCar_no());
|
||||
m.put("create_time", t.getCreate_time());
|
||||
return m;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
resultJson.put("result", list);
|
||||
resultJson.put("data", list);
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("message", "ok");
|
||||
return resultJson;
|
||||
@@ -118,14 +118,14 @@ public class PadServiceImpl implements PadService {
|
||||
@Override
|
||||
public Map<String, Object> insts(Map<String, String> whereJson) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String vehicle_code = whereJson.get("vehicle_code");
|
||||
String car_no = whereJson.get("car_no");
|
||||
String device_code = whereJson.get("device_code");
|
||||
List<Instruction> instructions = instructionService.findAllInstFromCache();
|
||||
List<Map<String, Object>> list = (instructions == null ? Stream.<Instruction>empty() : instructions.stream())
|
||||
.filter(instruction -> {
|
||||
if (StrUtil.isEmpty(vehicle_code)) return true;
|
||||
String vc = instruction.getVehicle_code();
|
||||
return StrUtil.isNotEmpty(vc) && vc.contains(vehicle_code);
|
||||
if (StrUtil.isEmpty(car_no)) return true;
|
||||
String vc = instruction.getCarno();
|
||||
return StrUtil.isNotEmpty(vc) && vc.contains(car_no);
|
||||
})
|
||||
.filter(instruction -> {
|
||||
if (StrUtil.isEmpty(device_code)) return true;
|
||||
@@ -140,8 +140,8 @@ public class PadServiceImpl implements PadService {
|
||||
m.put("instruction_code", instruction.getInstruction_code());
|
||||
m.put("task_no", instruction.getTask_code());
|
||||
m.put("priority", instruction.getPriority());
|
||||
m.put("start_device_code", instruction.getStart_device_code());
|
||||
m.put("next_device_code", instruction.getNext_device_code());
|
||||
m.put("point_code1", instruction.getStart_device_code());
|
||||
m.put("point_code2", instruction.getNext_device_code());
|
||||
m.put("inst_status", instruction.getInstruction_status());
|
||||
m.put("vehicle_code", instruction.getVehicle_code());
|
||||
m.put("car_no", instruction.getCarno());
|
||||
@@ -149,7 +149,7 @@ public class PadServiceImpl implements PadService {
|
||||
return m;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
resultJson.put("result", list);
|
||||
resultJson.put("data", list);
|
||||
resultJson.put("code", "1");
|
||||
resultJson.put("message", "ok");
|
||||
return resultJson;
|
||||
@@ -219,12 +219,7 @@ public class PadServiceImpl implements PadService {
|
||||
resultJson.put("message", "目的库位不存在,请添加目的库位!");
|
||||
return resultJson;
|
||||
}
|
||||
String vehicle_code = whereJson.get("vehicle_code");
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
resultJson.put("code", "0");
|
||||
resultJson.put("message", "托盘号不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setStart_device_code(start_device_code);
|
||||
taskDto.setStart_point_code(start_device_code);
|
||||
@@ -232,7 +227,6 @@ public class PadServiceImpl implements PadService {
|
||||
taskDto.setNext_device_code(next_device_code);
|
||||
taskDto.setNext_point_code(next_device_code);
|
||||
taskDto.setNext_parent_code(next_device_code);
|
||||
taskDto.setVehicle_code(vehicle_code);
|
||||
try {
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user