fix: 海康交互接口-base

This commit is contained in:
2026-01-30 15:43:20 +08:00
parent 9c643d33d8
commit dcadad678c
6 changed files with 55 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ import org.nl.acs.agv.hk.service.data.BaseReq;
public interface AcsToHkService { public interface AcsToHkService {
/** /**
* 生成任务单 * 生成任务单 - 下发任务
* *
* @param type 响应类型 * @param type 响应类型
* @param requestParam * @param requestParam

View File

@@ -1,5 +1,6 @@
package org.nl.acs.agv.hk.service.data; package org.nl.acs.agv.hk.service.data;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@@ -7,18 +8,27 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Description TODO * @Description 下发任务实体
* @Author Gengby * @Author Gengby
* @Date 2024/12/28 * @Date 2024/12/28
*/ */
@Data @Data
@SuperBuilder @SuperBuilder
public class GenAgvSchedulingTaskReq<T> extends BaseReq<T>{ public class GenAgvSchedulingTaskReq<T> extends BaseReq<T>{
/**
* 按需定义
*/
private String taskTyp; private String taskTyp;
private String ctnrTyp; @Builder.Default
private String ctnrTyp = "1";
private String ctnrCode; private String ctnrCode;
/**
* 不是必填
* 载具号
*/
private String ctnrNum; private String ctnrNum;
private String taskMode; @Builder.Default
private String taskMode = "0";
private String wbCode; private String wbCode;
private List<Map<String,String>> positionCodePath; private List<Map<String,String>> positionCodePath;
private String podCode; private String podCode;

View File

@@ -99,15 +99,15 @@ public class HkToAcsServiceImpl implements HkToAcsService {
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
instruction.setUpdate_time(now); instruction.setUpdate_time(now);
instructionService.finish(instruction); instructionService.finish(instruction);
if (StrUtil.equals(instruction.getIs_wait(), "1") && StrUtil.equals(instruction.getInstruction_type(), InstTypeEnum.CTU_OUT_TASK.getCode())) { // if (StrUtil.equals(instruction.getIs_wait(), "1") && StrUtil.equals(instruction.getInstruction_type(), InstTypeEnum.CTU_OUT_TASK.getCode())) {
String ctuWaitTime = Optional.ofNullable(sysParamService.findByCode("ctuWaitTime").getValue()).map(Object::toString).orElse("3600"); // String ctuWaitTime = Optional.ofNullable(sysParamService.findByCode("ctuWaitTime").getValue()).map(Object::toString).orElse("3600");
GenPreScheduleTaskReq gpsReq = GenPreScheduleTaskReq.builder() // GenPreScheduleTaskReq gpsReq = GenPreScheduleTaskReq.builder()
.positionCode(instruction.getStart_device_code()) // .positionCode(instruction.getStart_device_code())
.nextTask(ctuWaitTime) // .nextTask(ctuWaitTime)
.agvTyp("10") // .agvTyp("10")
.build(); // .build();
acsToHkService.genPreScheduleTask(gpsReq, null); // acsToHkService.genPreScheduleTask(gpsReq, null);
} // }
} }
//method 回调3、任务取消cancel //method 回调3、任务取消cancel
else if (StrUtil.equals(method, "cancel")) { else if (StrUtil.equals(method, "cancel")) {

View File

@@ -364,9 +364,5 @@ public class InstructionDto implements Serializable {
*/ */
private String to_device_code; private String to_device_code;
/**
* 任务完成是否等待
*/
private String is_wait;
} }

View File

@@ -17,6 +17,9 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.hk.UnifiedResponse;
import org.nl.acs.agv.hk.service.AcsToHkService;
import org.nl.acs.agv.hk.service.data.GenAgvSchedulingTaskReq;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
@@ -34,6 +37,7 @@ import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService; import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis; import org.nl.acs.instruction.domain.InstructionMybatis;
import org.nl.acs.instruction.enums.InstTypeEnum;
import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.InstructionDto; import org.nl.acs.instruction.service.dto.InstructionDto;
@@ -46,6 +50,8 @@ import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.TaskInstructionLock; import org.nl.acs.task.TaskInstructionLock;
import org.nl.acs.task.domain.Task; import org.nl.acs.task.domain.Task;
import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.mapper.TaskMapper; import org.nl.acs.task.service.mapper.TaskMapper;
@@ -55,6 +61,7 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil; import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.FileUtil; import org.nl.common.utils.FileUtil;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.config.MapOf;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess; import org.nl.config.language.LangProcess;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
@@ -99,6 +106,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
private AcsToLiKuService acsToLiKuService; private AcsToLiKuService acsToLiKuService;
@Autowired @Autowired
private XianGongAgvService xiangGongAgvService; private XianGongAgvService xiangGongAgvService;
@Autowired
private AcsToHkService acsToHkService;
private List<Instruction> instructions = new CopyOnWriteArrayList(); private List<Instruction> instructions = new CopyOnWriteArrayList();
@@ -429,6 +438,24 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
} }
// 下发指令到海康调度
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.Hik_System_Type.getIndex())) {
List<Map<String, String>> positionCodePath = Arrays.asList(MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getNext_parent_code(), "type", "00"));
GenAgvSchedulingTaskReq gasReq = GenAgvSchedulingTaskReq
.builder()
.taskTyp(dto.getInstruction_type())
.positionCodePath(positionCodePath)
.priority(dto.getPriority())
.taskCode(dto.getInstruction_code())
.build();
UnifiedResponse<String> resp = acsToHkService.genAgvSchedulingTask(gasReq, String.class);
if (!resp.isSuccess()) {
dto.setRemark(resp.getMessage());
dto.setSend_status("2");
} else {
dto.setSend_status("1");
}
}
//判断是否是仙工AGV //判断是否是仙工AGV
/* if(CommonFinalParam.ONE.equals(route.getType())){ /* if(CommonFinalParam.ONE.equals(route.getType())){
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);

View File

@@ -21,7 +21,11 @@ public enum AgvSystemTypeEnum {
/** /**
* 仙工AGV系统 * 仙工AGV系统
*/ */
XG_System_Type("3", "3", "仙工AGV系统"); // XG_System_Type("3", "3", "仙工AGV系统");
/**
* 海康调度系统
*/
Hik_System_Type("3", "3", "HIK AGV系统");
/** /**
* 索引 * 索引