11 changed files with 417 additions and 1172 deletions
@ -1,431 +0,0 @@ |
|||||
package org.nl.system.service.quartz.task; |
|
||||
|
|
||||
import cn.hutool.core.collection.CollUtil; |
|
||||
import cn.hutool.core.date.DateUtil; |
|
||||
import cn.hutool.core.util.IdUtil; |
|
||||
import cn.hutool.core.util.ObjectUtil; |
|
||||
import cn.hutool.core.util.StrUtil; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.apache.commons.lang3.ObjectUtils; |
|
||||
import org.nl.acs.common.base.CommonFinalParam; |
|
||||
import org.nl.acs.device.domain.Device; |
|
||||
import org.nl.acs.device.enums.DeviceType; |
|
||||
import org.nl.acs.device.service.DeviceExtraService; |
|
||||
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; |
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; |
|
||||
import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; |
|
||||
import org.nl.acs.instruction.domain.Instruction; |
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum; |
|
||||
import org.nl.acs.instruction.service.InstructionService; |
|
||||
import org.nl.acs.opc.DeviceAppService; |
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
||||
import org.nl.acs.route.service.RouteLineService; |
|
||||
import org.nl.acs.route.service.dto.RouteLineDto; |
|
||||
import org.nl.acs.task.enums.TaskStatusEnum; |
|
||||
import org.nl.acs.task.service.TaskService; |
|
||||
import org.nl.acs.task.service.dto.TaskDto; |
|
||||
import org.nl.common.exception.BadRequestException; |
|
||||
import org.nl.common.utils.SecurityUtils; |
|
||||
import org.nl.config.SpringContextHolder; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.Arrays; |
|
||||
import java.util.Collections; |
|
||||
import java.util.List; |
|
||||
|
|
||||
@Slf4j |
|
||||
@Component |
|
||||
public class CreateDDJInst { |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 定时查询堆垛机任务 |
|
||||
*/ |
|
||||
public void run() { |
|
||||
log.info("定时查询堆垛机任务"+DateUtil.now()); |
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class); |
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); |
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); |
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
||||
List<TaskDto> taskDtos = taskserver.findByTaskStatus("0"); |
|
||||
List<TaskDto> taskDtoList = new ArrayList<>(); |
|
||||
if (CollUtil.isEmpty(taskDtos) || taskDtos.size() < 1) { |
|
||||
} else { |
|
||||
for (TaskDto taskDto : taskDtos) { |
|
||||
String start_device_code = taskDto.getStart_device_code(); |
|
||||
Device startDevice = appService.findDeviceByCode(start_device_code); |
|
||||
String next_device_code = taskDto.getNext_device_code(); |
|
||||
Device nextDevice = appService.findDeviceByCode(next_device_code); |
|
||||
//判断有无出入库任务是相同路线
|
|
||||
// TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code);
|
|
||||
// if (ObjectUtil.isNotEmpty(dto)) {
|
|
||||
// continue;
|
|
||||
// }
|
|
||||
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && |
|
||||
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { |
|
||||
taskDtoList.add(taskDto); |
|
||||
} |
|
||||
} |
|
||||
if (CollUtil.isNotEmpty(taskDtoList)) { |
|
||||
taskDtoList = sortInst(taskDtoList); |
|
||||
for (TaskDto taskDto : taskDtoList) { |
|
||||
Device nextDevice = null; |
|
||||
List<String> pathlist; |
|
||||
Device deviceByCode = null; |
|
||||
String taskid = taskDto.getTask_id(); |
|
||||
String taskcode = taskDto.getTask_code(); |
|
||||
String task_type = taskDto.getTask_type(); |
|
||||
String vehiclecode = taskDto.getVehicle_code(); |
|
||||
String vehiclecode2 = taskDto.getVehicle_code2(); |
|
||||
String priority = taskDto.getPriority(); |
|
||||
|
|
||||
String start_device_code = taskDto.getStart_device_code(); |
|
||||
Device startDevice = appService.findDeviceByCode(start_device_code); |
|
||||
String start_point_code = taskDto.getStart_point_code(); |
|
||||
|
|
||||
String put_device_code = taskDto.getPut_device_code(); |
|
||||
String put_point_code = taskDto.getPut_point_code(); |
|
||||
String next_device_code = taskDto.getNext_device_code(); |
|
||||
nextDevice = appService.findDeviceByCode(next_device_code); |
|
||||
String next_point_code = taskDto.getNext_point_code(); |
|
||||
|
|
||||
String start_point_code2 = taskDto.getStart_point_code2(); |
|
||||
String start_device_code2 = taskDto.getStart_device_code2(); |
|
||||
|
|
||||
String next_point_code2 = taskDto.getNext_point_code2(); |
|
||||
String next_device_code2 = taskDto.getNext_device_code2(); |
|
||||
|
|
||||
String route_plan_code = taskDto.getRoute_plan_code(); |
|
||||
String vehicleType = taskDto.getVehicle_type(); |
|
||||
String agv_system_type = taskDto.getAgv_system_type(); |
|
||||
|
|
||||
String start_height = taskDto.getStart_height(); |
|
||||
String next_height = taskDto.getNext_height(); |
|
||||
//同排的货位移库任务
|
|
||||
if (StrUtil.equals(taskDto.getStart_device_code(), taskDto.getNext_device_code())) { |
|
||||
//通过起点找路由
|
|
||||
List<RouteLineDto> list = |
|
||||
routeLineService.getShortPathLinesByCode( |
|
||||
taskDto.getStart_device_code(), taskDto.getRoute_plan_code()); |
|
||||
if (ObjectUtils.isEmpty(list)) { |
|
||||
throw new BadRequestException("路由不通"); |
|
||||
} |
|
||||
RouteLineDto routeLineDto = list.get(0); |
|
||||
String[] path = routeLineDto.getPath().split("->"); |
|
||||
pathlist = Arrays.asList(path); |
|
||||
deviceByCode = appService.findDeviceByCode(pathlist.get(1)); |
|
||||
if (ObjectUtils.isEmpty(deviceByCode)) { |
|
||||
log.error("没有找到DDJ设备"); |
|
||||
continue; |
|
||||
} |
|
||||
StandardStackerDeviceDriver standardStackerDeviceDriver; |
|
||||
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { |
|
||||
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver(); |
|
||||
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) { |
|
||||
log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code()); |
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); |
|
||||
continue; |
|
||||
} |
|
||||
} |
|
||||
next_device_code = start_device_code; |
|
||||
nextDevice = appService.findDeviceByCode(next_device_code); |
|
||||
} else { |
|
||||
List<RouteLineDto> list = |
|
||||
routeLineService.getShortPathLines( |
|
||||
taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code()); |
|
||||
if (ObjectUtils.isEmpty(list)) { |
|
||||
throw new BadRequestException("路由不通"); |
|
||||
} |
|
||||
RouteLineDto routeLineDto = list.get(0); |
|
||||
String[] path = routeLineDto.getPath().split("->"); |
|
||||
pathlist = Arrays.asList(path); |
|
||||
deviceByCode = appService.findDeviceByCode(pathlist.get(1)); |
|
||||
|
|
||||
if (ObjectUtils.isEmpty(deviceByCode)) { |
|
||||
log.error("没有找到DDJ设备"); |
|
||||
continue; |
|
||||
} |
|
||||
StandardStackerDeviceDriver standardStackerDeviceDriver; |
|
||||
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { |
|
||||
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver(); |
|
||||
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) { |
|
||||
log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code()); |
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); |
|
||||
continue; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
next_device_code = taskDto.getNext_device_code(); |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 开始平均分配 |
|
||||
*/ |
|
||||
String this_coevice_code = taskserver.queryAssignedByDeviceCode(start_device_code, next_device_code); |
|
||||
if (StrUtil.isEmpty(this_coevice_code)) { |
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); |
|
||||
RouteLineDto routeLineDto1 = shortPathsList.get(0); |
|
||||
|
|
||||
String path1 = routeLineDto1.getPath(); |
|
||||
String[] str = path1.split("->"); |
|
||||
|
|
||||
List<String> pathlist1 = Arrays.asList(str); |
|
||||
int index = 0; |
|
||||
for (int m = 0; m < pathlist1.size(); m++) { |
|
||||
String deviceType1 = appService.findDeviceByCode(pathlist1.get(m)).getDevice_type(); |
|
||||
if (deviceType1.equals(DeviceType.stacker.name())) { |
|
||||
index = m + 1; |
|
||||
break; |
|
||||
} |
|
||||
/*if (pathlist1.get(m).equals(start_device_code)) { |
|
||||
|
|
||||
}*/ |
|
||||
} |
|
||||
next_device_code = pathlist1.get(index); |
|
||||
} else { |
|
||||
next_device_code = this_coevice_code; |
|
||||
} |
|
||||
//校验路由关系
|
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); |
|
||||
if (ObjectUtils.isEmpty(shortPathsList) || shortPathsList.size() < 1) { |
|
||||
throw new RuntimeException("路由不通!"); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { |
|
||||
next_point_code = next_device_code + "-" + taskDto.getTo_y() + "-" + taskDto.getTo_z(); |
|
||||
} else { |
|
||||
next_point_code = next_device_code; |
|
||||
} |
|
||||
|
|
||||
nextDevice = appService.findDeviceByCode(next_device_code); |
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver; |
|
||||
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { |
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); |
|
||||
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { |
|
||||
log.error("输送机,{}未联机或执行中", next_device_code); |
|
||||
((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7"); |
|
||||
continue; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//单台堆垛机最多只能创建固定数量指令
|
|
||||
Instruction instruction = new Instruction(); |
|
||||
instruction.setInstruction_status(CommonFinalParam.ONE); |
|
||||
List<Instruction> byDeviceCodes = instructionService.findByDeviceCodes(instruction, true); |
|
||||
Instruction instdto = new Instruction(); |
|
||||
if (CollUtil.isEmpty(byDeviceCodes)) { |
|
||||
//判断有没有DDJ对接位出入库的指令,只判断终点
|
|
||||
List<Instruction> byCodeAndExcute = instructionService.findByNextCode(next_device_code); |
|
||||
if (CollUtil.isNotEmpty(byCodeAndExcute)){ |
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令"); |
|
||||
continue; |
|
||||
} |
|
||||
instdto.setInstruction_type(task_type); |
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID()); |
|
||||
instdto.setRoute_plan_code(route_plan_code); |
|
||||
instdto.setRemark(taskDto.getRemark()); |
|
||||
instdto.setMaterial(taskDto.getMaterial()); |
|
||||
instdto.setQuantity(taskDto.getQuantity()); |
|
||||
instdto.setTask_id(taskid); |
|
||||
instdto.setTask_code(taskcode); |
|
||||
instdto.setVehicle_code(vehiclecode); |
|
||||
instdto.setVehicle_code2(vehiclecode2); |
|
||||
String now = DateUtil.now(); |
|
||||
instdto.setCreate_time(now); |
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); |
|
||||
|
|
||||
instdto.setStart_device_code(start_device_code); |
|
||||
instdto.setStart_point_code(start_point_code); |
|
||||
instdto.setPut_device_code(put_device_code); |
|
||||
instdto.setPut_point_code(put_point_code); |
|
||||
instdto.setNext_device_code(next_device_code); |
|
||||
instdto.setNext_point_code(next_point_code); |
|
||||
|
|
||||
instdto.setStart_point_code2(start_point_code2); |
|
||||
instdto.setStart_device_code2(start_device_code2); |
|
||||
instdto.setNext_point_code2(next_point_code2); |
|
||||
instdto.setNext_device_code2(next_device_code2); |
|
||||
|
|
||||
instdto.setPriority(priority); |
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); |
|
||||
instdto.setExecute_device_code(start_point_code); |
|
||||
instdto.setVehicle_type(vehicleType); |
|
||||
instdto.setAgv_system_type(agv_system_type); |
|
||||
instdto.setStart_height(start_height); |
|
||||
instdto.setNext_height(next_height); |
|
||||
if (ObjectUtil.isNotNull(startDevice) && startDevice.getDevice_type().equals(DeviceType.storage.name())) { |
|
||||
instdto.setFrom_x(taskDto.getFrom_x()); |
|
||||
instdto.setFrom_z(taskDto.getFrom_z()); |
|
||||
instdto.setFrom_y(taskDto.getFrom_y()); |
|
||||
} |
|
||||
if (ObjectUtil.isNotNull(nextDevice) && nextDevice.getDevice_type().equals(DeviceType.storage.name())) { |
|
||||
instdto.setTo_x(taskDto.getTo_x()); |
|
||||
instdto.setTo_z(taskDto.getTo_z()); |
|
||||
instdto.setTo_y(taskDto.getTo_y()); |
|
||||
} |
|
||||
try { |
|
||||
instructionService.create(instdto); |
|
||||
} catch (Exception e) { |
|
||||
taskDto.setRemark(e.getMessage()); |
|
||||
taskserver.update(taskDto); |
|
||||
return; |
|
||||
} |
|
||||
//创建指令后修改任务状态
|
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); |
|
||||
taskserver.update(taskDto); |
|
||||
} else { |
|
||||
List<Instruction> insts = new ArrayList<>(); |
|
||||
for (Instruction byDeviceCode : byDeviceCodes) { |
|
||||
String nextDeviceCode = byDeviceCode.getNext_device_code(); |
|
||||
Device nextdevice = appService.findDeviceByCode(nextDeviceCode); |
|
||||
String startDeviceCode = byDeviceCode.getStart_device_code(); |
|
||||
Device startDevice1 = appService.findDeviceByCode(startDeviceCode); |
|
||||
if (startDevice1.getDevice_type().equals(DeviceType.storage.name()) && |
|
||||
(nextdevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextdevice.getDevice_type().equals(DeviceType.storage.name()))) { |
|
||||
insts.add(byDeviceCode); |
|
||||
} |
|
||||
} |
|
||||
int max = 0; |
|
||||
//非同排的路径
|
|
||||
for (Instruction inst : insts) { |
|
||||
List<RouteLineDto> shortPathLines =new ArrayList<>(); |
|
||||
if (!(inst.getStart_device_code().equals(inst.getNext_device_code()))) { |
|
||||
shortPathLines = routeLineService.getShortPathLines(inst.getStart_device_code(), inst.getNext_device_code(), |
|
||||
inst.getRoute_plan_code()); |
|
||||
if (CollUtil.isEmpty(shortPathLines) || shortPathLines.size() < 1) { |
|
||||
log.error("没有此路由"); |
|
||||
throw new BadRequestException("路由不通"); |
|
||||
} |
|
||||
}else { |
|
||||
//同排路径
|
|
||||
shortPathLines = routeLineService.getShortPathLinesByCode(inst.getStart_device_code(), inst.getRoute_plan_code()); |
|
||||
if (CollUtil.isEmpty(shortPathLines) || shortPathLines.size() < 1) { |
|
||||
log.error("没有此路由"); |
|
||||
throw new BadRequestException("路由不通"); |
|
||||
} |
|
||||
} |
|
||||
RouteLineDto routeLineDto1 = (RouteLineDto) shortPathLines.get(0); |
|
||||
String[] path1 = routeLineDto1.getPath().split("->"); |
|
||||
List<String> pathlist1 = Arrays.asList(path1); |
|
||||
if (pathlist1.get(1).equals(pathlist.get(1))) { |
|
||||
max++; |
|
||||
} |
|
||||
} |
|
||||
/*List<DeviceExtra> deviceExtras = deviceExtra.list(Wrappers.lambdaQuery(DeviceExtra.class). |
|
||||
eq(DeviceExtra::getDevice_code, pathlist.get(1)).orderByDesc(DeviceExtra::getCreate_time));*/ |
|
||||
String count = deviceByCode.getExtraValue().get("count").toString(); |
|
||||
if (StrUtil.isNotEmpty(count)) { |
|
||||
if (max <= Integer.parseInt(count)) { |
|
||||
//判断有没有DDJ对接位出入库的指令,只判断终点
|
|
||||
List<Instruction> byCodeAndExcute = instructionService.findByNextCode(next_device_code); |
|
||||
if (CollUtil.isNotEmpty(byCodeAndExcute)){ |
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令"); |
|
||||
continue; |
|
||||
} |
|
||||
instdto.setInstruction_type(task_type); |
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID()); |
|
||||
instdto.setRoute_plan_code(route_plan_code); |
|
||||
instdto.setRemark(taskDto.getRemark()); |
|
||||
instdto.setMaterial(taskDto.getMaterial()); |
|
||||
instdto.setQuantity(taskDto.getQuantity()); |
|
||||
instdto.setTask_id(taskid); |
|
||||
instdto.setTask_code(taskcode); |
|
||||
instdto.setVehicle_code(vehiclecode); |
|
||||
instdto.setVehicle_code2(vehiclecode2); |
|
||||
String now = DateUtil.now(); |
|
||||
instdto.setCreate_time(now); |
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); |
|
||||
|
|
||||
instdto.setStart_device_code(start_device_code); |
|
||||
instdto.setStart_point_code(start_point_code); |
|
||||
instdto.setPut_device_code(put_device_code); |
|
||||
instdto.setPut_point_code(put_point_code); |
|
||||
instdto.setNext_device_code(next_device_code); |
|
||||
instdto.setNext_point_code(next_point_code); |
|
||||
|
|
||||
instdto.setStart_point_code2(start_point_code2); |
|
||||
instdto.setStart_device_code2(start_device_code2); |
|
||||
instdto.setNext_point_code2(next_point_code2); |
|
||||
instdto.setNext_device_code2(next_device_code2); |
|
||||
|
|
||||
instdto.setPriority(priority); |
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); |
|
||||
instdto.setExecute_device_code(start_point_code); |
|
||||
instdto.setVehicle_type(vehicleType); |
|
||||
instdto.setAgv_system_type(agv_system_type); |
|
||||
instdto.setStart_height(start_height); |
|
||||
instdto.setNext_height(next_height); |
|
||||
if (ObjectUtil.isNotNull(startDevice) && startDevice.getDevice_type().equals(DeviceType.storage.name())) { |
|
||||
instdto.setFrom_x(taskDto.getFrom_x()); |
|
||||
instdto.setFrom_z(taskDto.getFrom_z()); |
|
||||
instdto.setFrom_y(taskDto.getFrom_y()); |
|
||||
} |
|
||||
if (ObjectUtil.isNotNull(nextDevice) && nextDevice.getDevice_type().equals(DeviceType.storage.name())) { |
|
||||
instdto.setTo_x(taskDto.getTo_x()); |
|
||||
instdto.setTo_z(taskDto.getTo_z()); |
|
||||
instdto.setTo_y(taskDto.getTo_y()); |
|
||||
} |
|
||||
//判断agv系统
|
|
||||
//1、1楼叉车系统
|
|
||||
//2、2楼1区域AGV系统
|
|
||||
//3、2楼2区域AGV系统 -已废弃
|
|
||||
if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) { |
|
||||
// task_type
|
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
|
||||
//3、普通任务 Itype=2:取货、放货;
|
|
||||
//4、叉车任务
|
|
||||
//5、输送任务
|
|
||||
//6、行架
|
|
||||
//7、立库
|
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { |
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE); |
|
||||
} else if (StrUtil.equals(task_type, "3")) { |
|
||||
instdto.setAgv_inst_type("2"); |
|
||||
} else if (StrUtil.equals(task_type, "2")) { |
|
||||
instdto.setAgv_inst_type("3"); |
|
||||
} else if (StrUtil.equals(task_type, "8")) { |
|
||||
instdto.setAgv_inst_type("2"); |
|
||||
} else { |
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type()); |
|
||||
} |
|
||||
} else { |
|
||||
instdto.setAgv_inst_type("4"); |
|
||||
} |
|
||||
try { |
|
||||
instructionService.create(instdto); |
|
||||
} catch (Exception e) { |
|
||||
taskDto.setRemark(e.getMessage()); |
|
||||
taskserver.updateByCodeFromCache(taskDto); |
|
||||
} |
|
||||
//创建指令后修改任务状态
|
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); |
|
||||
taskserver.update(taskDto); |
|
||||
continue; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
//单台堆垛机只能出四五
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private List<TaskDto> sortInst(List<TaskDto> taskDtos) { |
|
||||
Collections.sort(taskDtos, (t1, t2) -> { |
|
||||
//优先级从大到小
|
|
||||
int i = t1.getPriority().compareTo(t2.getPriority()); |
|
||||
//如果优先级相等
|
|
||||
if (i == 0) { |
|
||||
//时间从早到晚
|
|
||||
i = t1.getCreate_time().compareTo(t2.getCreate_time()); |
|
||||
} |
|
||||
return i; |
|
||||
}); |
|
||||
return taskDtos; |
|
||||
} |
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue