|
|
@ -27,6 +27,7 @@ import org.nl.acs.device.device.service.DeviceService; |
|
|
|
import org.nl.acs.device.device.service.dto.DeviceAssignedDto; |
|
|
|
import org.nl.acs.device.device.service.impl.DeviceServiceImpl; |
|
|
|
import org.nl.acs.device.driver.DeviceDriverDefination; |
|
|
|
import org.nl.acs.ext.wms.data.req.CommonRequest; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
|
|
import org.nl.acs.instruction.domain.InstructionMybatis; |
|
|
@ -94,8 +95,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
@Autowired |
|
|
|
private AcsToWmsService acstowmsService; |
|
|
|
@Autowired |
|
|
|
private TaskFeedbackService taskFeedbackService; |
|
|
|
@Autowired |
|
|
|
private ISysParamService paramService; |
|
|
|
@Autowired |
|
|
|
private XianGongAgvService agvService; |
|
|
@ -112,12 +111,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
*/ |
|
|
|
private CopyOnWriteArrayList<TaskDto> tasks = new CopyOnWriteArrayList<>(); |
|
|
|
|
|
|
|
/** |
|
|
|
* 烘箱任务类型 |
|
|
|
*/ |
|
|
|
private static final String TASK_TYPE = "8"; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<TaskDto> queryAll(TaskQueryParam query, Pageable pageable) { |
|
|
|
IPage<Task> queryPage = PageUtil.toMybatisPage(pageable); |
|
|
@ -135,32 +128,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
return taskMapper.selectById(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByDeviceCodeAndStatus2(String device_code) { |
|
|
|
List<TaskDto> list = new ArrayList<>(); |
|
|
|
// Iterator<TaskDto> iterator = tasks.iterator();
|
|
|
|
// while (iterator.hasNext()) {
|
|
|
|
// TaskDto task = iterator.next();
|
|
|
|
// if (task.getStart_device_code().equals(device_code)
|
|
|
|
// && StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
|
|
|
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
|
|
|
// if (ObjectUtil.isNotEmpty(instruction)) {
|
|
|
|
// list.add(task);
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Inner_Truss_Task.getIndex()) && StrUtil.isNotEmpty(task.getPut_device_code())) {
|
|
|
|
// Instruction instruction = instructionService.findByDeviceCodeFromCache(task.getNext_device_code());
|
|
|
|
// if (ObjectUtil.isNotEmpty(instruction)) {
|
|
|
|
// if (StrUtil.equals(instruction.getStart_device_code(), device_code)) {
|
|
|
|
// list.add(task);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findById(String id) { |
|
|
@ -274,69 +241,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
return json; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) { |
|
|
|
String task_code = (String) whereJson.get("task_code"); |
|
|
|
String vehicle_code = (String) whereJson.get("vehicle_code"); |
|
|
|
String material_type = (String) whereJson.get("material_type"); |
|
|
|
String status = (String) whereJson.get("status"); |
|
|
|
String point_code = (String) whereJson.get("point_code"); |
|
|
|
String task_type = (String) whereJson.get("task_type"); |
|
|
|
String is_over = (String) whereJson.get("is_over"); |
|
|
|
Integer currentPageNumber = page.getPageNumber() + 1; |
|
|
|
Integer pageMaxSize = page.getPageSize(); |
|
|
|
List<TaskDto> taskList = |
|
|
|
Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(task_code)) { |
|
|
|
return t.getTask_code().contains(task_code); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(vehicle_code)) { |
|
|
|
return t.getVehicle_code().contains(vehicle_code); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(material_type)) { |
|
|
|
return t.getMaterial().contains(material_type); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(status)) { |
|
|
|
return t.getTask_status().contains(status); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(point_code)) { |
|
|
|
return t.getStart_point_code().contains(point_code) || t.getNext_point_code().equals(point_code) || t.getPut_point_code().equals(point_code); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.filter(t -> { |
|
|
|
if (StrUtil.isNotEmpty(task_type)) { |
|
|
|
return t.getTask_type().contains(task_type); |
|
|
|
} |
|
|
|
return true; |
|
|
|
}) |
|
|
|
.sorted((task1, task2) -> DateUtil.compare(DateUtil.parseDate(task1.getCreate_time()), DateUtil.parse(task2.getCreate_time()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
List<TaskDto> skipList = taskList.stream().skip((currentPageNumber - 1) * pageMaxSize) |
|
|
|
.limit(pageMaxSize) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("content", skipList); |
|
|
|
jo.put("totalElements", taskList.size()); |
|
|
|
return jo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getAll(Map whereJson, Pageable page) { |
|
|
|
String task_code = (String) whereJson.get("task_code"); |
|
|
@ -392,14 +296,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryAllUnfinished(Map whereJson) { |
|
|
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper) |
|
|
|
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex()) |
|
|
|
.list(); |
|
|
|
return ConvertUtil.convertList(taskList, TaskDto.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findByCode(String code) { |
|
|
|
Task task = new LambdaQueryChainWrapper<>(taskMapper) |
|
|
@ -408,121 +304,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
return ConvertUtil.convert(task, TaskDto.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByDeviceCode(String device_code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> taskDto.getStart_device_code().equals(device_code) |
|
|
|
&& StrUtil.equals(taskDto.getTask_status(), TaskStatusEnum.READY.getIndex())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByStartDeviceCode(String start_device_code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getTask_type(), "6") |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex()) |
|
|
|
&& (task.getStart_device_code().equals(start_device_code) |
|
|
|
|| task.getStart_device_code2().equals(start_device_code))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByBackDeviceCode(String back_start_device_code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getTask_type(), "6") |
|
|
|
&& task.getStart_device_code().equals(back_start_device_code) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code) { |
|
|
|
|
|
|
|
List<TaskDto> collect = Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> task.getStart_device_code().equals(device_code) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) |
|
|
|
.filter(task -> instructionService.findByTaskcodeAndStatus(task.getTask_code()) != null) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (CollUtil.isEmpty(collect)) { |
|
|
|
tasks.forEach( |
|
|
|
task -> { |
|
|
|
if (TASK_TYPE.equals(task.getTask_type()) && StrUtil.isNotEmpty(task.getPut_device_code())) { |
|
|
|
Instruction instruction = instructionService.findByDeviceCodeFromCache(task.getNext_device_code()); |
|
|
|
if (ObjectUtil.isNotEmpty(instruction)) { |
|
|
|
if (StrUtil.equals(instruction.getStart_device_code(), device_code)) { |
|
|
|
collect.add(task); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
return collect; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getTask_type(), "6") |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex()) |
|
|
|
&& (task.getStart_device_code().equals(head_start_device_code) |
|
|
|
|| task.getStart_device_code2().equals(head_start_device_code))) |
|
|
|
.filter(task -> instructionService.findByTaskcodeAndStatus(task.getTask_code()) != null) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryTaskByNextAndIntStatus(String back_start_device_code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getTask_type(), "6") |
|
|
|
&& task.getStart_device_code().equals(back_start_device_code) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) |
|
|
|
.filter(task -> instructionService.findByTaskcodeAndStatus(task.getTask_code()) != null) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> queryByStauts(String status) { |
|
|
|
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper) |
|
|
|
.eq(Task::getTask_status, status) |
|
|
|
.list(); |
|
|
|
return ConvertUtil.convertList(taskList, TaskDto.class); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> findByTaskStatus(String status) { |
|
|
|
List<TaskDto> taskDtoList = new ArrayList<>(); |
|
|
|
Iterator<TaskDto> iterator = tasks.iterator(); |
|
|
|
if (iterator.hasNext()) { |
|
|
|
TaskDto task = iterator.next(); |
|
|
|
if (StrUtil.equals(task.getTask_status(), status)) { |
|
|
|
taskDtoList.add(task); |
|
|
|
} |
|
|
|
} |
|
|
|
return taskDtoList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void create(TaskDto dto) throws Exception { |
|
|
@ -609,15 +390,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { |
|
|
|
// if (nextdevice.getDeviceDriver() instanceof
|
|
|
|
// XgAgvCarDeviceDriver) {
|
|
|
|
// standardOrdinarySiteDeviceDriver = (XgAgvCarDeviceDriver)
|
|
|
|
// nextdevice.getDeviceDriver();
|
|
|
|
// if (nextdevice.getHas_goods() != 0) {
|
|
|
|
// throw new Exception("任务终点需满足无货!");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
JSONObject jo2 = new JSONObject(); |
|
|
|
if (!StrUtil.isEmpty(dto.getMaterial())) { |
|
|
@ -1066,15 +838,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findReadyByStartDeviceCode(String start_device_code) { |
|
|
|
Optional<TaskDto> optionalTask = tasks.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getStart_device_code(), start_device_code) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) |
|
|
|
.findFirst(); |
|
|
|
return optionalTask.orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findReadyByVehicleCode(String vehicleCode) { |
|
|
|
Optional<TaskDto> optionalTask = tasks.stream() |
|
|
@ -1085,17 +848,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findByEndCodeAndReady(String device_code) { |
|
|
|
Optional<TaskDto> optionalTask = tasks.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getNext_device_code(), device_code) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex()) |
|
|
|
) |
|
|
|
.findFirst(); |
|
|
|
return optionalTask.orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findByStartCode(String device_code) { |
|
|
|
return Optional |
|
|
@ -1442,39 +1194,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> findByStartCodeAndBusy(String deviceCode) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getStart_device_code(), deviceCode) |
|
|
|
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) |
|
|
|
.limit(2) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameOriginTask(String code) { |
|
|
|
return (int) Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(task -> StrUtil.equals(task.getStart_device_code(), code)) |
|
|
|
.count(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameDestinationTask(String code) { |
|
|
|
return Optional |
|
|
|
.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> StrUtil.equals(taskDto.getNext_device_code(), code)) |
|
|
|
.collect(Collectors.toList()) |
|
|
|
.size(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer querySameDeviceReadyTask(String start_device, String next_device, String status) { |
|
|
@ -1492,68 +1211,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String queryAssignedByDeviceCode(String device_code, String task_nextDeice_code) { |
|
|
|
List<DeviceAssignedDto> list = |
|
|
|
deviceAssignedService.queryAssignedByDevice(device_code, task_nextDeice_code); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
DeviceAssignedDto dto = list.get(i); |
|
|
|
String deviceCode = dto.getDevice_code(); |
|
|
|
String inst_nextDevice_code = dto.getInst_nextDevice_code(); |
|
|
|
JSONObject param = JSON.parseObject(dto.getParam()); |
|
|
|
List<String> pathList = this.getPathList(inst_nextDevice_code); |
|
|
|
for (int j = 0; j < pathList.size(); j++) { |
|
|
|
String inst_next_device_code = pathList.get(j); |
|
|
|
String limit = param.getString("limit"); |
|
|
|
Boolean inOut = param.getBoolean("inOut"); |
|
|
|
if (inOut) { |
|
|
|
Device device = deviceAppService.findDeviceByCode(deviceCode); |
|
|
|
if (device != null) { |
|
|
|
if (StrUtil.equals(device.getDevice_type(), DeviceType.storage.toString())) { |
|
|
|
if (instructionService.querySameNextDeviceCodeInstByIn(inst_next_device_code)) { |
|
|
|
return inst_next_device_code; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (instructionService.querySameNextDeviceCodeInstByOut(inst_next_device_code)) { |
|
|
|
return inst_next_device_code; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
Integer sameInstNum = instructionService.querySameDestinationInst(inst_next_device_code); |
|
|
|
if (sameInstNum < Integer.parseInt(limit)) { |
|
|
|
return inst_next_device_code; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findByTaskCode(String task_code) { |
|
|
|
|
|
|
|
List<TaskDto> list = new ArrayList<>(); |
|
|
|
Iterator<TaskDto> iterator = tasks.iterator(); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
TaskDto task = iterator.next(); |
|
|
|
if (StrUtil.equals(task.getTask_code(), task_code)) { |
|
|
|
return task; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findReadyTaskByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode) { |
|
|
|
return Optional.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status())) |
|
|
|
.filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code)) |
|
|
|
.filter(taskDto -> !checkoutStartDeviceCode.contains(taskDto.getStart_device_code())) |
|
|
|
.sorted(Comparator.comparing(TaskDto::getPriority) |
|
|
|
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) |
|
|
|
.filter(taskDto -> taskDto.getTask_code().equals(task_code)) |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
} |
|
|
@ -1586,20 +1250,17 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
TaskDto entity = this.findById(taskDto.getTask_id()); |
|
|
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); |
|
|
|
if (!StrUtil.startWith(taskDto.getTask_code(), CommonFinalParam.HYPHEN_) && StrUtil.equals(hasWms, CommonFinalParam.ONE)) { |
|
|
|
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
|
|
|
// request.setTask_id(taskDto.getExt_task_id());
|
|
|
|
// request.setTask_code(taskDto.getTask_code());
|
|
|
|
// request.setTask_status(taskDto.getTask_status());
|
|
|
|
// request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
|
|
|
// request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
|
|
|
JSONObject feed_jo = new JSONObject(); |
|
|
|
feed_jo.put("task_id", entity.getExt_task_id()); |
|
|
|
feed_jo.put("task_code", entity.getTask_code()); |
|
|
|
feed_jo.put("task_status", entity.getTask_status()); |
|
|
|
JSONArray ja = new JSONArray(); |
|
|
|
ja.add(feed_jo); |
|
|
|
//TODO 有需要根据上位系统反馈的信息再做进一步处理
|
|
|
|
acstowmsService.feedbackTaskStatusToWms(ja); |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
param.put("taskCode", entity.getTask_code()); |
|
|
|
param.put("status", ""); |
|
|
|
CommonRequest request = |
|
|
|
CommonRequest |
|
|
|
.builder() |
|
|
|
.service("Task") |
|
|
|
.type("status") |
|
|
|
.data(param) |
|
|
|
.build(); |
|
|
|
acstowmsService.apply(request); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1631,38 +1292,35 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY) { |
|
|
|
String currentNoY = noY == null ? "" : noY; |
|
|
|
public TaskDto findReadyTaskByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode) { |
|
|
|
return Optional.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code())) |
|
|
|
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code())) |
|
|
|
.filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) |
|
|
|
.filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status())) |
|
|
|
.filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code)) |
|
|
|
.filter(taskDto -> !checkoutStartDeviceCode.contains(taskDto.getStart_device_code())) |
|
|
|
.sorted(Comparator.comparing(TaskDto::getPriority) |
|
|
|
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findReadyTaskByFrontTask(TaskDto frontTaskDto, List<String> xDeviceCodeList, String backNoY) { |
|
|
|
String currentBackNoY = backNoY == null ? "" : backNoY; |
|
|
|
public List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY) { |
|
|
|
String currentNoY = noY == null ? "" : noY; |
|
|
|
return Optional.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> taskDto.getTask_status().equals(TaskStatusEnum.READY.getIndex()) || (ObjectUtil.isEmpty(instructionService.findByTaskCodeFromCache(taskDto.getTask_code())) && taskDto.getTask_status().equals(TaskStatusEnum.BUSY.getIndex()))) |
|
|
|
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getStart_device_code())) |
|
|
|
.filter(taskDto -> xDeviceCodeList.contains(taskDto.getNext_device_code())) |
|
|
|
.filter(taskDto -> !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) |
|
|
|
.filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_x()) == Integer.parseInt(taskDto.getFrom_x())) |
|
|
|
.filter(taskDto -> Integer.parseInt(frontTaskDto.getFrom_z()) == Integer.parseInt(taskDto.getFrom_z())) |
|
|
|
.filter(taskDto -> Integer.parseInt(frontTaskDto.getTo_x()) == Integer.parseInt(taskDto.getTo_x())) |
|
|
|
.filter(taskDto -> Integer.parseInt(frontTaskDto.getTo_z()) == Integer.parseInt(taskDto.getTo_z())) |
|
|
|
.filter(taskDto -> (Integer.parseInt(frontTaskDto.getTo_y()) / 4 == Integer.parseInt(taskDto.getTo_y()) / 4) && (((Integer.parseInt(frontTaskDto.getTo_y()) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 2) || (Integer.parseInt(frontTaskDto.getTo_y()) % 4) + (Integer.parseInt(taskDto.getTo_y()) % 4) == 4)) |
|
|
|
.filter(taskDto -> (Integer.parseInt(frontTaskDto.getFrom_y()) / 4 == Integer.parseInt(taskDto.getFrom_y()) / 4) && (((Integer.parseInt(frontTaskDto.getFrom_y()) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 2) || (Integer.parseInt(frontTaskDto.getFrom_y()) % 4) + (Integer.parseInt(taskDto.getFrom_y()) % 4) == 4)) |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
.filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) |
|
|
|
.sorted(Comparator.comparing(TaskDto::getPriority) |
|
|
|
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public TaskDto findAllBindTask(TaskDto frontTask, String backNoY) { |
|
|
|
String front_task_code = frontTask.getTask_code(); |
|
|
@ -1676,6 +1334,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
return Optional.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> taskDto.getTask_status().equals(TaskStatusEnum.READY.getIndex())) |
|
|
|
.filter(taskDto -> !taskDto.getTask_code().equals(front_task_code)) |
|
|
|
.filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z)) |
|
|
|
.filter(taskDto -> taskDto.getTo_x().equals(front_to_x) && taskDto.getTo_z().equals(front_to_z)) |
|
|
@ -1694,13 +1353,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
String front_from_x = frontTask.getFrom_x(); |
|
|
|
String front_from_y = frontTask.getFrom_y(); |
|
|
|
String front_from_z = frontTask.getFrom_z(); |
|
|
|
String front_to_x = frontTask.getTo_x(); |
|
|
|
String front_to_y = frontTask.getTo_y(); |
|
|
|
String front_to_z = frontTask.getTo_z(); |
|
|
|
String currentBackNoY = backNoY == null ? "" : backNoY; |
|
|
|
return Optional.ofNullable(this.tasks) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(taskDto -> taskDto.getTask_status().equals(TaskStatusEnum.READY.getIndex())) |
|
|
|
.filter(taskDto -> !taskDto.getTask_code().equals(front_task_code)) |
|
|
|
.filter(taskDto -> taskDto.getFrom_x().equals(front_from_x) && taskDto.getFrom_z().equals(front_from_z)) |
|
|
|
.filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentBackNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y())))) |
|
|
@ -1710,4 +1367,28 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void cancelNoSendWms(String task_id) { |
|
|
|
TaskDto entity = this.findById(task_id); |
|
|
|
if (entity == null) { |
|
|
|
throw new BadRequestException(LangProcess.msg("error_sysAuth")); |
|
|
|
} |
|
|
|
|
|
|
|
InstructionDto instdto = instructionService.findByTaskid(task_id, "instruction_status <2 "); |
|
|
|
if (instdto != null) { |
|
|
|
throw new BadRequestException(LangProcess.msg("task_insRun")); |
|
|
|
} |
|
|
|
|
|
|
|
String currentUsername = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
entity.setUpdate_time(now); |
|
|
|
entity.setUpdate_by(currentUsername); |
|
|
|
entity.setTask_status(TaskStatusEnum.CANCEL.getIndex()); |
|
|
|
|
|
|
|
Task task = ConvertUtil.convert(entity, Task.class); |
|
|
|
taskMapper.updateById(task); |
|
|
|
//移除任务缓存信息
|
|
|
|
this.removeByCodeFromCache(entity.getTask_code()); |
|
|
|
} |
|
|
|
} |
|
|
|