fix:限制下发堆垛机有出入库路线相同的任务
This commit is contained in:
@@ -485,6 +485,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
Integer start = 0;
|
Integer start = 0;
|
||||||
String start_device_code = pathlist.get(start);
|
String start_device_code = pathlist.get(start);
|
||||||
String next_device_code = pathlist.get(start+1);
|
String next_device_code = pathlist.get(start+1);
|
||||||
|
//判断有无出入库任务是相同路线
|
||||||
|
TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code());
|
||||||
|
if (ObjectUtil.isNotEmpty(dto)){
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code);
|
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code);
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
|
|||||||
@@ -388,6 +388,15 @@ public interface TaskService extends CommonService<Task> {
|
|||||||
*/
|
*/
|
||||||
TaskDto findByStartCodeAndReady(String device_code);
|
TaskDto findByStartCodeAndReady(String device_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据起点设备编号查询当前是否有执行中任务
|
||||||
|
*
|
||||||
|
* @param start_code
|
||||||
|
* @param next_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TaskDto findByCodeAndExcute(String start_code,String next_code);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据终点设备编号查询当前是否有就绪任务
|
* 根据终点设备编号查询当前是否有就绪任务
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
public List<TaskDto> findByTaskStatus(String status) {
|
public List<TaskDto> findByTaskStatus(String status) {
|
||||||
List<TaskDto> taskDtoList = new ArrayList<>();
|
List<TaskDto> taskDtoList = new ArrayList<>();
|
||||||
Iterator<TaskDto> iterator = tasks.iterator();
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
if (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
TaskDto task = iterator.next();
|
TaskDto task = iterator.next();
|
||||||
if (StrUtil.equals(task.getTask_status(), status)) {
|
if (StrUtil.equals(task.getTask_status(), status)) {
|
||||||
taskDtoList.add(task);
|
taskDtoList.add(task);
|
||||||
@@ -1077,6 +1077,17 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
return optionalTask.orElse(null);
|
return optionalTask.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskDto findByCodeAndExcute(String start_code, String next_code) {
|
||||||
|
Task task = this.lambdaQuery()
|
||||||
|
.eq(Task::getStart_device_code, start_code)
|
||||||
|
.eq(Task::getNext_device_code, next_code)
|
||||||
|
.eq(Task::getTask_status, TaskStatusEnum.BUSY.getIndex())
|
||||||
|
.one();
|
||||||
|
TaskDto taskDto = BeanUtil.copyProperties(task, TaskDto.class);
|
||||||
|
return taskDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskDto findByEndCodeAndReady(String device_code) {
|
public TaskDto findByEndCodeAndReady(String device_code) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.system.service.quartz.task;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@@ -55,10 +56,14 @@ public class CreateDDJInst {
|
|||||||
Device startDevice = appService.findDeviceByCode(start_device_code);
|
Device startDevice = appService.findDeviceByCode(start_device_code);
|
||||||
String next_device_code = taskDto.getNext_device_code();
|
String next_device_code = taskDto.getNext_device_code();
|
||||||
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
Device nextDevice = appService.findDeviceByCode(next_device_code);
|
||||||
|
//判断有无出入库任务是相同路线
|
||||||
|
TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code);
|
||||||
|
if (ObjectUtil.isNotEmpty(dto)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
|
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
|
||||||
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
|
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
|
||||||
taskDtoList.add(taskDto);
|
taskDtoList.add(taskDto);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(taskDtoList)) {
|
if (CollUtil.isNotEmpty(taskDtoList)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user