rev:更新

This commit is contained in:
2025-11-25 20:13:59 +08:00
parent 28a81fd254
commit 14d2329a57
6 changed files with 27 additions and 66 deletions

View File

@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_weight.StandardWeightSiteDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_weight.StandardWeightSiteDeviceDriver;
import org.nl.acs.ext.hk.service.AcsToHkService; import org.nl.acs.ext.hk.service.AcsToHkService;
import org.nl.acs.ext.hk.service.HkToAcsService; import org.nl.acs.ext.hk.service.HkToAcsService;
@@ -19,8 +18,6 @@ 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.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.storage_cell.service.StorageCellService;
import org.nl.acs.storage_cell.service.dto.StorageCellDto;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -48,15 +45,12 @@ public class HkToAcsServiceImpl implements HkToAcsService {
@Autowired @Autowired
private ISysParamService sysParamService; private ISysParamService sysParamService;
@Autowired @Autowired
private StorageCellService storageCellService;
@Autowired
private AcsToWmsService acsToWmsService; private AcsToWmsService acsToWmsService;
@Override @Override
public JSONObject agvCallback(JSONObject requestParam) { public JSONObject agvCallback(JSONObject requestParam) {
JSONObject resp = new JSONObject(); JSONObject resp = new JSONObject();
String reqCode = requestParam.getString("reqCode"); String reqCode = requestParam.getString("reqCode");
String currentPositionCode = requestParam.getString("currentPositionCode");
String robotCode = requestParam.getString("robotCode"); String robotCode = requestParam.getString("robotCode");
String taskCode = requestParam.getString("taskCode"); String taskCode = requestParam.getString("taskCode");
String method = requestParam.getString("method"); String method = requestParam.getString("method");
@@ -67,20 +61,13 @@ public class HkToAcsServiceImpl implements HkToAcsService {
resp.put("reqCode", reqCode); resp.put("reqCode", reqCode);
return resp; return resp;
} }
StorageCellDto storageCellDto = storageCellService.getByParentCode(currentPositionCode);
if (ObjectUtil.isEmpty(storageCellDto)) {
resp.put("code", "1");
resp.put("message", "请求失败,外部系统编码不存在,外部系编码:" + currentPositionCode);
resp.put("reqCode", reqCode);
return resp;
}
String now = DateUtil.now(); String now = DateUtil.now();
//method 回调1、任务开始start //method 回调1、任务开始start
if (StrUtil.equals(method, "start")) { if (StrUtil.equals(method, "start")) {
//修改指令状态执行中并修改CTU车号 //修改指令状态执行中并修改CTU车号
instruction.setCarno(robotCode); instruction.setCarno(robotCode);
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setExecute_device_code(storageCellDto.getStorage_code()); instruction.setExecute_device_code(instruction.getStart_point_code());
instruction.setUpdate_time(now); instruction.setUpdate_time(now);
instructionService.update(instruction); instructionService.update(instruction);
@@ -92,13 +79,15 @@ public class HkToAcsServiceImpl implements HkToAcsService {
} }
//method 回调2、任务完成/结束end //method 回调2、任务完成/结束end
else if (StrUtil.equals(method, "end")) { else if (StrUtil.equals(method, "end")) {
if (instruction.getInstruction_type().equals(InstTypeEnum.AGV_THREE_TASK.getCode())){
instruction.setExecute_device_code(instruction.getStart_point_code());
}
//修改指令状态完成 //修改指令状态完成
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
instruction.setExecute_device_code(storageCellDto.getStorage_code());
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("600"); 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)
@@ -114,9 +103,9 @@ public class HkToAcsServiceImpl implements HkToAcsService {
instruction.setUpdate_time(now); instruction.setUpdate_time(now);
instructionService.update(instruction); instructionService.update(instruction);
} }
//method 回调4、取放料箱申请apply //method 回调4、取放料箱申请inApply
else if (StrUtil.equals(method, "inApply")) { else if (StrUtil.equals(method, "inApply")) {
Device device = deviceAppService.findDeviceByCode(storageCellDto.getStorage_code()); Device device = deviceAppService.findDeviceByCode(instruction.getStart_device_code());
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
resp.put("code", "1"); resp.put("code", "1");
resp.put("message", "请求失败,请求位置编号不存在!"); resp.put("message", "请求失败,请求位置编号不存在!");
@@ -124,7 +113,6 @@ public class HkToAcsServiceImpl implements HkToAcsService {
return resp; return resp;
} }
StandardWeightSiteDeviceDriver standardWeightSiteDeviceDriver; StandardWeightSiteDeviceDriver standardWeightSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//CTU取货申请 //CTU取货申请
//如果请求位置编号与指令起点一致并且是输送线则是取货申请 //如果请求位置编号与指令起点一致并且是输送线则是取货申请
if (device.getDeviceDriver() instanceof StandardWeightSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardWeightSiteDeviceDriver) {
@@ -132,25 +120,17 @@ public class HkToAcsServiceImpl implements HkToAcsService {
standardWeightSiteDeviceDriver.setReqTakeRequireSuccess(true); standardWeightSiteDeviceDriver.setReqTakeRequireSuccess(true);
standardWeightSiteDeviceDriver.setReqTakeInstCode(taskCode); standardWeightSiteDeviceDriver.setReqTakeInstCode(taskCode);
} }
// else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskCode);
// standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
// }
} }
//method 回调5、inApplyOk //method 回调5、inApplyOk
// else if (StrUtil.equals(method, "inApplyOk")) { else if (StrUtil.equals(method, "inApplyOk")) {
// Device device = deviceAppService.findDeviceByCode(storageCellDto.getStorage_code()); //TODO 调用WMS取货完成通知接口
// if (ObjectUtil.isEmpty(device)) { }
// resp.put("code", "1");
// resp.put("message", "请求失败,请求位置编号不存在!");
// resp.put("reqCode", reqCode);
// return resp;
// }
// }
//method 回调6、放料箱申请outApply //method 回调6、放料箱申请outApply
else if (StrUtil.equals(method, "outApply")) { else if (StrUtil.equals(method, "outApply")) {
Device device = deviceAppService.findDeviceByCode(storageCellDto.getStorage_code()); Device device = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
if (instruction.getInstruction_type().equals(InstTypeEnum.AGV_THREE_TASK.getCode())){
device = deviceAppService.findDeviceByCode(instruction.getStart_device_code());
}
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
resp.put("code", "1"); resp.put("code", "1");
resp.put("message", "请求失败,请求位置编号不存在!"); resp.put("message", "请求失败,请求位置编号不存在!");
@@ -158,8 +138,6 @@ public class HkToAcsServiceImpl implements HkToAcsService {
return resp; return resp;
} }
StandardWeightSiteDeviceDriver standardWeightSiteDeviceDriver; StandardWeightSiteDeviceDriver standardWeightSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//CTU取货申请 //CTU取货申请
//如果请求位置编号与指令起点一致并且是输送线则是取货申请 //如果请求位置编号与指令起点一致并且是输送线则是取货申请
if (device.getDeviceDriver() instanceof StandardWeightSiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardWeightSiteDeviceDriver) {
@@ -167,11 +145,6 @@ public class HkToAcsServiceImpl implements HkToAcsService {
standardWeightSiteDeviceDriver.setReqTakeRequireSuccess(true); standardWeightSiteDeviceDriver.setReqTakeRequireSuccess(true);
standardWeightSiteDeviceDriver.setReqTakeInstCode(taskCode); standardWeightSiteDeviceDriver.setReqTakeInstCode(taskCode);
} }
// else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setReqTakeInstCode(taskCode);
// standardOrdinarySiteDeviceDriver.setReqTakeRequireSuccess(true);
// }
} }
resp.put("code", "0"); resp.put("code", "0");
resp.put("message", "成功"); resp.put("message", "成功");

View File

@@ -252,10 +252,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONObject resp = new JSONObject(); JSONObject resp = new JSONObject();
//1 确认取货 //1 确认取货
if (ConfirmEnum.GET_CONFIRM.getCode().equals(type)) { if (ConfirmEnum.GET_CONFIRM.getCode().equals(type)) {
Map<String, Object> nextPositionCode = null;
if (StrUtil.equals(inst.getInstruction_type(), InstTypeEnum.AGV_THREE_TASK.getCode())) {
nextPositionCode = MapOf.of("positionCode", inst.getStart_parent_code(), "type", "00");
}
//调用AGV继续执行任务接口,如果是两点任务不需要下一站点信息,如果是三点任务,需要下一站点信息 //调用AGV继续执行任务接口,如果是两点任务不需要下一站点信息,如果是三点任务,需要下一站点信息
ContinueTaskReq req = ContinueTaskReq.builder() ContinueTaskReq req = ContinueTaskReq.builder()
.taskCode(inst.getInstruction_code()) .taskCode(inst.getInstruction_code())
@@ -271,7 +267,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
//调用AGV继续执行任务接口,需要下一站点信息 //调用AGV继续执行任务接口,需要下一站点信息
ContinueTaskReq req = ContinueTaskReq.builder() ContinueTaskReq req = ContinueTaskReq.builder()
.taskCode(inst.getInstruction_code()) .taskCode(inst.getInstruction_code())
// .nextPositionCode(MapOf.of("positionCode", inst.getNext_parent_code(), "type", "00"))
.build(); .build();
UnifiedResponse unifiedResponse = acsToHkService.continueTask(req); UnifiedResponse unifiedResponse = acsToHkService.continueTask(req);
if (!unifiedResponse.isSuccess()) { if (!unifiedResponse.isSuccess()) {

View File

@@ -12,14 +12,14 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum InstTypeEnum { public enum InstTypeEnum {
CTU_IN_TASK("1", "1", "CTU入库任务"), CTU_IN_TASK("A031", "A031", "CTU入库任务"),
CTU_OUT_TASK("2", "2", "CTU出库任务"), CTU_OUT_TASK("A032", "A032", "CTU出库任务"),
CTU_MOVE_TASK("3", "3", "CTU移库任务"), CTU_MOVE_TASK("A033", "A033", "CTU移库任务"),
AGV_TWO_TASK("A012", "A012", "AGV两点任务(称重位到库外站点)"), AGV_TWO_TASK("A012", "A012", "AGV两点任务(称重位到库外站点)"),
AGV_TWO2_TASK("A021", "A021", "AGV两点任务(库外站点到库外站点)"), AGV_TWO2_TASK("A021", "A021", "AGV两点任务(库外站点到库外站点)"),
AGV_TWO3_TASK("A013", "A013", "AGV两点任务(库外站点到称重位)"), AGV_TWO3_TASK("A013", "A013", "AGV两点任务(库外站点到称重位)"),
AGV_THREE_TASK("A011", "A011", "AGV三点任务(称重位到库外站点到称重位)"), AGV_THREE_TASK("A011", "A011", "AGV三点任务(称重位到库外站点到称重位)"),
OTHER_TASK("8", "9", "其他任务类型"); OTHER_TASK("8", "8", "其他任务类型");
/** /**

View File

@@ -1,23 +1,19 @@
package org.nl.acs.instruction.service.impl; package org.nl.acs.instruction.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
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.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
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.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
@@ -42,8 +38,6 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; 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.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.StorageCellService;
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.AgvSystemTypeEnum;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
@@ -66,7 +60,6 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.config.MapOf; import org.nl.config.MapOf;
import org.nl.config.language.LangProcess; import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
import org.nl.common.utils.CodeUtil; import org.nl.common.utils.CodeUtil;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
@@ -353,16 +346,16 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.builder() .builder()
.taskTyp(dto.getInstruction_type()) .taskTyp(dto.getInstruction_type())
.ctnrTyp("1") .ctnrTyp("1")
.ctnrCode(dto.getVehicle_code()) //.ctnrCode(dto.getVehicle_code())
.positionCodePath(positionCodePath) .positionCodePath(positionCodePath)
.priority(dto.getPriority()) .priority(dto.getPriority())
.taskCode(dto.getInstruction_code()) .taskCode(dto.getInstruction_code())
.build(); .build();
} else if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.AGV_TASK.getCode())) { } else if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.AGV_TASK.getCode())) {
if (StrUtil.equals(dto.getInstruction_type(), InstTypeEnum.AGV_TWO_TASK.getCode())) { if (StrUtil.equals(dto.getInstruction_type(), InstTypeEnum.AGV_THREE_TASK.getCode())) {
positionCodePath = Arrays.asList(MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getNext_parent_code(), "type", "00"));
} else if (StrUtil.equals(dto.getInstruction_type(), InstTypeEnum.AGV_THREE_TASK.getCode())) {
positionCodePath = Arrays.asList(MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getNext_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00")); positionCodePath = Arrays.asList(MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getNext_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"));
} else {
positionCodePath = Arrays.asList(MapOf.of("positionCode", dto.getStart_parent_code(), "type", "00"), MapOf.of("positionCode", dto.getNext_parent_code(), "type", "00"));
} }
gasReq = GenAgvSchedulingTaskReq gasReq = GenAgvSchedulingTaskReq
.builder() .builder()

View File

@@ -10,9 +10,9 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_acs_97}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:123456} password: ${DB_PWD:P@ssw0rd.}
# password: ${DB_PWD:p@ssw0rd} # password: ${DB_PWD:p@ssw0rd}
# 初始连接数 # 初始连接数
initial-size: 20 initial-size: 20
@@ -74,7 +74,7 @@ spring:
baseline-on-migrate: true baseline-on-migrate: true
redis: redis:
#数据库索引 #数据库索引
database: ${REDIS_DB:2} database: ${REDIS_DB:11}
host: ${REDIS_HOST:127.0.0.1} host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
# password: ${REDIS_PWD:} # password: ${REDIS_PWD:}
@@ -126,7 +126,7 @@ file:
avatarMaxSize: 5 avatarMaxSize: 5
logging: logging:
file: file:
path: D:\acs_log # /Users/onepiece/myFile/acs_logs path: C:\acs_log # /Users/onepiece/myFile/acs_logs
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
lucene: lucene:
index: index:

View File

@@ -157,5 +157,5 @@ mybatis-plus:
lucene: lucene:
index: index:
path: lucene/index path: C:\acs\lucene\index