|
|
@ -533,6 +533,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
// s.connect(socketAddress, 2 * 1000);
|
|
|
|
// if (ObjectUtil.isNotEmpty(s)&&s.isConnected()==true) {
|
|
|
|
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); |
|
|
|
dto.setSend_status("1"); |
|
|
|
// } else {
|
|
|
|
// log.error("agv连接出现异常:服务端被关闭");
|
|
|
|
// }
|
|
|
@ -563,17 +564,89 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); |
|
|
|
|
|
|
|
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { |
|
|
|
String interactionJson = task.getInteraction_json(); |
|
|
|
if (StrUtil.isEmpty(interactionJson)) { |
|
|
|
throw new BadRequestException("agv叉车调整长宽参数为空"); |
|
|
|
} |
|
|
|
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); |
|
|
|
//仙工叉车
|
|
|
|
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO); |
|
|
|
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { |
|
|
|
dto.setSend_status("2"); |
|
|
|
// String interactionJson = task.getInteraction_json();
|
|
|
|
// if (StrUtil.isEmpty(interactionJson)) {
|
|
|
|
// throw new BadRequestException("agv叉车调整长宽参数为空");
|
|
|
|
// }
|
|
|
|
// InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
|
|
|
// //仙工叉车
|
|
|
|
// HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO);
|
|
|
|
// if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
|
|
|
// dto.setSend_status("2");
|
|
|
|
// } else {
|
|
|
|
// dto.setSend_status("1");
|
|
|
|
// }
|
|
|
|
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
|
|
|
|
if (!StrUtil.equals(task.getAgv_system_type(), "0") |
|
|
|
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) { |
|
|
|
if (StrUtil.isBlank(dto.getAgv_inst_type())) { |
|
|
|
String agv_system_type = task.getAgv_system_type(); |
|
|
|
String task_type = task.getTask_type(); |
|
|
|
if (!StrUtil.equals(agv_system_type, "1")) { |
|
|
|
// task_type
|
|
|
|
//1、生箔; Itype=1:取空,取满,放空,放满;
|
|
|
|
//2、分切 Itype=3取满、取空、放满、放空;
|
|
|
|
//3、普通任务 Itype=2:取货、放货;
|
|
|
|
//4、叉车任务
|
|
|
|
//5、输送任务
|
|
|
|
//6、行架
|
|
|
|
//7、立库
|
|
|
|
if (StrUtil.equals(task_type, "1")) { |
|
|
|
dto.setAgv_inst_type("1"); |
|
|
|
} else if (StrUtil.equals(task_type, "3")) { |
|
|
|
dto.setAgv_inst_type("2"); |
|
|
|
} else if (StrUtil.equals(task_type, "2")) { |
|
|
|
dto.setAgv_inst_type("3"); |
|
|
|
} else if (StrUtil.equals(task_type, "8")) { |
|
|
|
dto.setAgv_inst_type("2"); |
|
|
|
} else { |
|
|
|
log.info("未找到对应的AGV指令类型,任务号:" + task.getTask_code() + ",task_type:" + task.getTask_type()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
dto.setAgv_inst_type("4"); |
|
|
|
} |
|
|
|
dto.setAgv_system_type(task.getAgv_system_type()); |
|
|
|
} |
|
|
|
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); |
|
|
|
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type() |
|
|
|
+ ",AGV指令类型:" + dto.getInstruction_type()); |
|
|
|
try { |
|
|
|
if (StrUtil.isEmpty(dto.getAgv_inst_type()) || StrUtil.isEmpty(dto.getAgv_system_type())) { |
|
|
|
log.info("sendAgvInstToNDC 指令校验:" + dto.getInstruction_code() + ",inst_type:" + dto.getInstruction_type() |
|
|
|
+ ",inst_system_type:" + dto.getAgv_system_type()); |
|
|
|
} |
|
|
|
// log.info("2楼1区域AGV系统链接开始");
|
|
|
|
// String ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
|
|
|
// int port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
|
|
|
// InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
|
|
|
|
// Socket s = new Socket();
|
|
|
|
// s.connect(socketAddress, 2 * 1000);
|
|
|
|
// if (ObjectUtil.isNotEmpty(s)&&s.isConnected()==true) {
|
|
|
|
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); |
|
|
|
dto.setSend_status("1"); |
|
|
|
// } else {
|
|
|
|
// log.error("agv连接出现异常:服务端被关闭");
|
|
|
|
// }
|
|
|
|
} catch (Exception e) { |
|
|
|
dto.setSend_status("2"); |
|
|
|
dto.setRemark(e.getMessage()); |
|
|
|
e.printStackTrace(); |
|
|
|
log.warn("下发AGV指令异常:" + e); |
|
|
|
LuceneLogDto logDto1 = LuceneLogDto.builder() |
|
|
|
.device_code(start_device_code) |
|
|
|
.content("下发AGV指令异常") |
|
|
|
.build(); |
|
|
|
logDto1.setLog_level(4); |
|
|
|
luceneExecuteLogService.deviceExecuteLog(logDto1); |
|
|
|
} |
|
|
|
} else { |
|
|
|
dto.setSend_status("1"); |
|
|
|
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
|
|
|
Resp resp = acsToLiKuService.sendInst(task.getStorage_task_type(), dto); |
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
dto.setSend_status("1"); |
|
|
|
} else { |
|
|
|
dto.setSend_status("2"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { |
|
|
|
//一楼agv任务创建运单序列
|
|
|
@ -726,18 +799,34 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { |
|
|
|
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); |
|
|
|
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { |
|
|
|
String interactionJson = task.getInteraction_json(); |
|
|
|
if (StrUtil.isEmpty(interactionJson)) { |
|
|
|
throw new BadRequestException("agv叉车调整长宽参数为空"); |
|
|
|
} |
|
|
|
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); |
|
|
|
//仙工叉车
|
|
|
|
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO); |
|
|
|
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { |
|
|
|
dto.setSend_status("2"); |
|
|
|
} else { |
|
|
|
dto.setSend_status("1"); |
|
|
|
// String interactionJson = task.getInteraction_json();
|
|
|
|
// if (StrUtil.isEmpty(interactionJson)) {
|
|
|
|
// throw new BadRequestException("agv叉车调整长宽参数为空");
|
|
|
|
// }
|
|
|
|
// InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
|
|
|
// //仙工叉车
|
|
|
|
// HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO);
|
|
|
|
// if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
|
|
|
// dto.setSend_status("2");
|
|
|
|
// } else {
|
|
|
|
// dto.setSend_status("1");
|
|
|
|
// }
|
|
|
|
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) { |
|
|
|
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
|
|
|
|
if (!StrUtil.equals(task.getAgv_system_type(), "0") |
|
|
|
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) { |
|
|
|
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); |
|
|
|
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); |
|
|
|
} else { |
|
|
|
Resp resp = acsToLiKuService.sendInst(task.getStorage_task_type(), dto); |
|
|
|
if (StrUtil.equals(resp.result, "true")) { |
|
|
|
dto.setSend_status("1"); |
|
|
|
} else { |
|
|
|
dto.setSend_status("2"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { |
|
|
|
//一楼agv任务创建运单序列
|
|
|
|
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); |
|
|
@ -1313,9 +1402,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, |
|
|
|
flag = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type) |
|
|
|
&& !StrUtil.equals(entity.getSend_status(), "2")) { |
|
|
|
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class); |
|
|
|
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code()); |
|
|
|
flag = true; |
|
|
|
// XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
|
|
|
// xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
|
|
|
// flag = true;
|
|
|
|
// NDC agv指令不当场取消指令,需要等agv上报
|
|
|
|
if (!StrUtil.isEmpty(entity.getAgv_jobno())) { |
|
|
|
ndcAgvService.deleteAgvInstToNDC(BeanUtil.copyProperties(entity, Instruction.class)); |
|
|
|
} else { |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
flag = true; |
|
|
|
} |
|
|
|