|
|
@ -1020,6 +1020,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
instdto.setTask_id(acsTask.getTask_id()); |
|
|
|
instdto.setTask_code(acsTask.getTask_code()); |
|
|
|
instdto.setVehicle_code(acsTask.getVehicle_code()); |
|
|
|
instdto.setVehicle_type(acsTask.getVehicle_type()); |
|
|
|
String now = DateUtil.now(); |
|
|
|
instdto.setCreate_time(now); |
|
|
|
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); |
|
|
@ -1030,6 +1031,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
instdto.setPriority(acsTask.getPriority()); |
|
|
|
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); |
|
|
|
instdto.setExecute_device_code(dto.getNext_device_code()); |
|
|
|
if (StrUtil.equals(instdto.getStart_device_code(),"3204")){ |
|
|
|
instdto.setInstruction_type(InstTypeEnum.CTU_IN_TASK.getCode()); |
|
|
|
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode()); |
|
|
|
} |
|
|
|
try { |
|
|
|
this.create(instdto); |
|
|
|
} catch (Exception e) { |
|
|
@ -1584,14 +1589,69 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void init(String id) { |
|
|
|
InstructionDto inst = this.findById(id); |
|
|
|
Instruction inst = Optional.ofNullable(this.instructions).orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(instruction -> instruction.getInstruction_id().equals(id)) |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
if (inst == null) { |
|
|
|
throw new BadRequestException("指令不存在或已删除"); |
|
|
|
throw new BadRequestException("指令不存在"); |
|
|
|
} |
|
|
|
if (!StrUtil.equals(inst.getSend_status(),"2")){ |
|
|
|
throw new BadRequestException("该指令已成功执行,重新下发失败!"); |
|
|
|
} |
|
|
|
if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.XG_SYSTEM_TYPE.getCode())){ |
|
|
|
UnifiedResponse<JSONObject> resp = xiangGongAgvService.sendOrderSequencesToXZ(inst); |
|
|
|
if (!resp.isSuccess()) { |
|
|
|
inst.setRemark(resp.getMessage()); |
|
|
|
inst.setSend_status("2"); |
|
|
|
} else { |
|
|
|
inst.setSend_status("1"); |
|
|
|
} |
|
|
|
} else if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode())){ |
|
|
|
List<Map<String, String>> positionCodePath = new ArrayList<>(); |
|
|
|
if (StrUtil.equals(InstTypeEnum.CTU_IN_TASK.getCode(), inst.getInstruction_type())) { |
|
|
|
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code())); |
|
|
|
if (ObjectUtil.isEmpty(storageCell)) { |
|
|
|
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code()); |
|
|
|
} |
|
|
|
positionCodePath = Arrays.asList(MapOf.of("positionCode", inst.getStart_point_code(), "type", "05"), MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05")); |
|
|
|
} else if (StrUtil.equals(InstTypeEnum.CTU_OUT_TASK.getCode(), inst.getInstruction_type())) { |
|
|
|
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code())); |
|
|
|
if (ObjectUtil.isEmpty(storageCell)) { |
|
|
|
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code()); |
|
|
|
} |
|
|
|
positionCodePath = Arrays.asList(MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", inst.getNext_point_code(), "type", "05")); |
|
|
|
} else if (StrUtil.equals(InstTypeEnum.CTU_MOVE_TASK.getCode(), inst.getInstruction_type())) { |
|
|
|
StorageCell startStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code())); |
|
|
|
if (ObjectUtil.isEmpty(startStorageCell)) { |
|
|
|
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code()); |
|
|
|
} |
|
|
|
StorageCell nextStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code())); |
|
|
|
if (ObjectUtil.isEmpty(nextStorageCell)) { |
|
|
|
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code()); |
|
|
|
} |
|
|
|
positionCodePath = Arrays.asList(MapOf.of("positionCode", startStorageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", nextStorageCell.getParent_storage_code(), "type", "05")); |
|
|
|
} |
|
|
|
GenAgvSchedulingTaskReq gasReq = GenAgvSchedulingTaskReq |
|
|
|
.builder() |
|
|
|
.taskTyp(inst.getInstruction_type()) |
|
|
|
.ctnrTyp(inst.getVehicle_type()) |
|
|
|
.positionCodePath(positionCodePath) |
|
|
|
.priority(inst.getPriority()) |
|
|
|
.taskCode(inst.getInstruction_code()) |
|
|
|
.build(); |
|
|
|
UnifiedResponse<String> resp = acsToHkService.genAgvSchedulingTask(gasReq, String.class); |
|
|
|
if (!resp.isSuccess()) { |
|
|
|
inst.setRemark(resp.getMessage()); |
|
|
|
inst.setSend_status("2"); |
|
|
|
} else { |
|
|
|
inst.setSend_status("1"); |
|
|
|
} |
|
|
|
if (InstructionStatusEnum.FINISHED.getIndex().equals(inst.getInstruction_status())) { |
|
|
|
throw new BadRequestException("指令已经完成"); |
|
|
|
} |
|
|
|
this.update(inst); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -2278,7 +2338,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code) { |
|
|
|
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code, String getLinkDeviceCode) { |
|
|
|
if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) { |
|
|
|
return Optional.ofNullable(this.instructions) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
@ -2287,6 +2347,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
.filter(inst -> !inst.getStart_device_code().equals(start_device_code)) |
|
|
|
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code())) |
|
|
|
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code())) |
|
|
|
.filter(inst -> inst.getStart_device_code().equals(getLinkDeviceCode)) |
|
|
|
.sorted(Comparator.comparing(Instruction::getPriority) |
|
|
|
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) |
|
|
|
.findFirst().orElse(null); |
|
|
|