LES下发、LES回传、APP功能、AGV任务

main
huojin\hj 2025-08-11 11:24:42 +08:00
parent ddd46bb868
commit c64cf86d1a
24 changed files with 628 additions and 131 deletions

View File

@ -19,6 +19,14 @@ import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.ParserConfig; import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@ -33,9 +41,11 @@ import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext; import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.RedisSerializer;
import reactor.util.annotation.Nullable; import reactor.util.annotation.Nullable;
@ -99,6 +109,32 @@ public class RedisConfig extends CachingConfigurerSupport {
return template; return template;
} }
@Bean
public RedisCacheManager redisCacheManager(RedisConnectionFactory connectionFactory) {
// 序列化配置
ObjectMapper om = new ObjectMapper();
om.registerModule(new JavaTimeModule())
.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
Jackson2JsonRedisSerializer<Object> serializer = new Jackson2JsonRedisSerializer<>(Object.class);
serializer.setObjectMapper(om);
// 默认配置
RedisCacheConfiguration defaultConfig = RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(Duration.ofDays(7)) // 默认过期时间7天
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new org.springframework.data.redis.serializer.StringRedisSerializer()))
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(serializer))
.disableCachingNullValues();
return RedisCacheManager.builder(connectionFactory)
.cacheDefaults(defaultConfig)
.transactionAware()
.build();
}
/** /**
* key使 * key使
*/ */

View File

@ -0,0 +1,15 @@
package com.youchain.appupdate.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class BindLarge {
@ApiModelProperty(value = "起点", required = true)
String srcPositionCode;
@ApiModelProperty(value = "料箱和dolly", required = true)
List<BoxAndDolly> boxAndDolly;
}

View File

@ -1,12 +1,12 @@
package com.youchain.appupdate.inputJson; package com.youchain.appupdate.request;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class SmallRequest { public class BindSmall {
@ApiModelProperty(value = "起点", required = true) @ApiModelProperty(value = "起点", required = true)
String pointCode; String srcPositionCode;
@ApiModelProperty(value = "上线单号",required = true) @ApiModelProperty(value = "上线单号",required = true)
String onlineNo; String onlineNo;

View File

@ -0,0 +1,13 @@
package com.youchain.appupdate.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BoxAndDolly {
@ApiModelProperty(value = "料箱号", required = true)
String boxNo;
@ApiModelProperty(value = "dolly码", required = true)
String dolly;
}

View File

@ -0,0 +1,10 @@
package com.youchain.appupdate.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class LinePoint {
@ApiModelProperty(value = "线边库位", required = true)
String dstPositionCode;
}

View File

@ -0,0 +1,19 @@
package com.youchain.appupdate.request;
import com.youchain.appupdate.response.LesTask;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class Online {
@ApiModelProperty(value = "料箱号", required = true)
String boxNo;
@ApiModelProperty(value = "库位号", required = true)
String dstPositionCode;
@ApiModelProperty(value = "任务信息", required = true)
List<LesTask> data;
}

View File

@ -0,0 +1,37 @@
package com.youchain.appupdate.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LesTask {
//id
Long id;
//上线单号
String onlineNo;
//日期
Date createTime;
//编组/线路
String routeCode;
//目标库位
String dstPositionCode;
//料箱号
String boxNo;
//物料号
String materialCode;
//箱内零件数量
Double caseNum;
}

View File

@ -2,11 +2,16 @@ package com.youchain.appupdate.rest;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.appupdate.inputJson.SmallRequest; import com.youchain.appupdate.request.BindLarge;
import com.youchain.appupdate.request.LinePoint;
import com.youchain.appupdate.request.BindSmall;
import com.youchain.appupdate.request.Online;
import com.youchain.appupdate.service.NioF3AppService; import com.youchain.appupdate.service.NioF3AppService;
import com.youchain.businessdata.inputJson.LesRequest; import com.youchain.appupdate.response.LesTask;
import com.youchain.businessdata.inputJson.UpdateTuggerTrailerInfo;
import com.youchain.businessdata.service.KMReService;
import com.youchain.exception.handler.ApiResult; import com.youchain.exception.handler.ApiResult;
import com.youchain.exception.handler.LesResult; import com.youchain.utils.UrlApi;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -18,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -27,13 +34,67 @@ public class NioF3AppController {
private final NioF3AppService nioF3AppService; private final NioF3AppService nioF3AppService;
@PostMapping("/smallConfirm") private final KMReService kmReService;
@Log("小件扫描确认")
@ApiOperation("小件扫描确认") @PostMapping("/bindSmallItemPicking")
@Log("小件拣选绑定")
@ApiOperation("小件拣选绑定")
@AnonymousAccess @AnonymousAccess
public ResponseEntity<Object> smallConfirm(@RequestBody SmallRequest smallRequest) { public ResponseEntity<Object> bindSmallItemPicking(@RequestBody BindSmall bindSmall) {
try { try {
nioF3AppService.smallConfirm(smallRequest); nioF3AppService.bindSmallItemPicking(bindSmall);
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}
}
@PostMapping("/bindLargeItemPicking")
@Log("大件拣选绑定")
@ApiOperation("大件拣选绑定")
@AnonymousAccess
public ResponseEntity<Object> bindLargeItemPicking(@RequestBody BindLarge bindLarge) {
try {
nioF3AppService.bindLargeItemPicking(bindLarge);
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}
}
@PostMapping("/findByLinePoint")
@Log("线边库位查询")
@ApiOperation("线边库位查询")
@AnonymousAccess
public ResponseEntity<Object> findByLinePoint(@RequestBody LinePoint linePoint) {
try {
List<LesTask> lesList = nioF3AppService.findByLinePoint(linePoint.getDstPositionCode());
return new ResponseEntity<>(ApiResult.success(lesList), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}
}
@PostMapping("/onlineConfirm")
@Log("线边上线确认")
@ApiOperation("线边上线确认")
@AnonymousAccess
public ResponseEntity<Object> onlineConfirm(@RequestBody Online online) {
try {
nioF3AppService.onlineConfirm(online);
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
}
}
@PostMapping("/updateTuggerTrailerInfo")
@Log("更新器具规格")
@ApiOperation("更新器具规格")
@AnonymousAccess
public ResponseEntity<Object> updateTuggerTrailerInfo(@RequestBody UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
try {
kmReService.sendAgvTaskToContainer(UrlApi.updateTuggerTrailerInfo(),kmReService.updateTuggerTrailerInfo(updateTuggerTrailerInfo));
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK); return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
} catch (Exception e) { } catch (Exception e) {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST); return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);

View File

@ -1,17 +1,36 @@
package com.youchain.appupdate.service; package com.youchain.appupdate.service;
import com.youchain.appupdate.inputJson.SmallRequest; import com.youchain.appupdate.request.BindLarge;
import com.youchain.appupdate.request.BindSmall;
import com.youchain.appupdate.request.Online;
import com.youchain.appupdate.response.LesTask;
import java.util.List;
public interface NioF3AppService { public interface NioF3AppService {
/** /**
* *
* @param smallRequest * @param bindSmall
*/ */
void smallConfirm(SmallRequest smallRequest); void bindSmallItemPicking(BindSmall bindSmall);
/** /**
* *
* @param bindLarge
*/ */
void LargeConfirm(); void bindLargeItemPicking(BindLarge bindLarge);
/**
* 线
* @param dstPositionCode
* @return List<LesTask>
*/
List<LesTask> findByLinePoint(String dstPositionCode);
/**
* 线线
* @param online
*/
void onlineConfirm(Online online);
} }

View File

@ -1,14 +1,18 @@
package com.youchain.appupdate.service.impl; package com.youchain.appupdate.service.impl;
import com.youchain.appupdate.inputJson.SmallRequest; import com.youchain.appupdate.request.BindLarge;
import com.youchain.appupdate.request.BindSmall;
import com.youchain.appupdate.request.BoxAndDolly;
import com.youchain.appupdate.request.Online;
import com.youchain.appupdate.service.NioF3AppService; import com.youchain.appupdate.service.NioF3AppService;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.PointService; import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.domain.Les; import com.youchain.businessdata.domain.Les;
import com.youchain.businessdata.repository.LesRepository; import com.youchain.businessdata.repository.LesRepository;
import com.youchain.businessdata.service.AgvTaskService; import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.businessdata.service.KMReService; import com.youchain.businessdata.service.KMReService;
import com.youchain.appupdate.response.LesTask;
import com.youchain.businessdata.service.LesService;
import com.youchain.exception.BadRequestException; import com.youchain.exception.BadRequestException;
import com.youchain.utils.BizStatus; import com.youchain.utils.BizStatus;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -17,7 +21,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@ -25,39 +32,34 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class NioF3AppServiceImpl implements NioF3AppService { public class NioF3AppServiceImpl implements NioF3AppService {
private final LesRepository lesRepository; private final LesRepository lesRepository;
private final LesService lesService;
private final PointService pointService; private final PointService pointService;
private final AgvTaskService agvTaskService; private final AgvTaskService agvTaskService;
private final KMReService kmReService; private final KMReService kmReService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void smallConfirm(SmallRequest smallRequest) { public void bindSmallItemPicking(BindSmall bindSmall) {
//验证参数 //验证参数
validateParams(smallRequest); validateParams(bindSmall);
//起点
String pointCode = smallRequest.getPointCode();
//上线单号
String onlineNo = smallRequest.getOnlineNo();
//验证起点
pointService.validatePoint(pointCode);
//验证Les任务 //验证Les任务
List<Les> lesList = validateLes(pointCode, onlineNo); List<Les> lesList = validateLes(bindSmall.getSrcPositionCode(), bindSmall.getOnlineNo());
//验证起点是否有Agv任务 //验证起点是否有Agv任务
validateAgvTask(pointCode); validateAgvTask(bindSmall.getSrcPositionCode());
//获取目标点位 //获取目标点位
String endPointCode = getEndPointCode(lesList); String endPointCode = getEndPointCode(lesList);
//生成Agv任务 //生成Agv任务
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, pointCode, endPointCode, "TUGGER"); AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindSmall.getSrcPositionCode(), endPointCode, "TUGGER");
//绑定任务
bindLesTask(lesList, agvTask.getId());
//下发任务 //下发任务
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskQYCJson(agvTask, smallRequest.getShooter(),null)); kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskQYCJson(agvTask, bindSmall.getShooter(), null));
} }
/** /**
@ -65,34 +67,37 @@ public class NioF3AppServiceImpl implements NioF3AppService {
* *
* @param smallRequest -> * @param smallRequest ->
*/ */
private void validateParams(SmallRequest smallRequest) { private void validateParams(BindSmall smallRequest) {
if (StringUtils.isEmpty(smallRequest.getPointCode())) { if (StringUtils.isEmpty(smallRequest.getSrcPositionCode())) {
throw new BadRequestException("pointCode必填"); throw new BadRequestException("起点必填");
} }
if (StringUtils.isEmpty(smallRequest.getOnlineNo())) { if (StringUtils.isEmpty(smallRequest.getOnlineNo())) {
throw new BadRequestException("onlineNo必填"); throw new BadRequestException("上线单号必填");
} }
//验证起点
pointService.validatePoint(smallRequest.getSrcPositionCode());
} }
/** /**
* Les * Les
* *
* @param pointCode -> * @param pointCode ->
* @param onlineNo -> 线 * @param onlineNo -> 线
*/ */
private List<Les> validateLes(String pointCode, String onlineNo) { private List<Les> validateLes(String pointCode, String onlineNo) {
List<Les> lesList = lesRepository.findByOnlineNo(pointCode,onlineNo); List<Les> lesList = lesRepository.findByOnlineNo(pointCode, onlineNo);
if (lesList.isEmpty()) { if (lesList.isEmpty()) {
throw new BadRequestException("系统未识别到任务"); throw new BadRequestException("PDA扫描的起点和上线单号未匹配LES任务");
} }
return lesList; return lesList;
} }
private void validateAgvTask(String pointCode) { private void validateAgvTask(String pointCode) {
Boolean bool = agvTaskService.findByStartSlotCode(pointCode, "TUGGER_MOVE", "TUGGER"); Boolean bool = agvTaskService.findByStartSlotCode(pointCode, "MOVE", "TUGGER");
if (bool) { if (bool) {
throw new BadRequestException(String.format("该点位:%s有任务请勿重复下发", pointCode)); throw new BadRequestException(pointCode + "点位有任务,请勿重复下发");
} }
} }
@ -103,9 +108,166 @@ public class NioF3AppServiceImpl implements NioF3AppService {
.collect(Collectors.joining(",")); // 用逗号拼接字符串 .collect(Collectors.joining(",")); // 用逗号拼接字符串
} }
@Transactional(rollbackFor = Exception.class)
public void bindLesTask(List<Les> lesList, Long agvTaskId) {
//获取Les
for (Les les : lesList) {
les.setAgvTaskId(agvTaskId);
}
lesRepository.saveAll(lesList);
}
@Override @Override
public void LargeConfirm() { @Transactional(rollbackFor = Exception.class)
public void bindLargeItemPicking(BindLarge bindLarge) {
//验证参数
validateParams(bindLarge);
//获取所有扫描的料箱号
List<String> boxNos = bindLarge.getBoxAndDolly().stream()
.map(BoxAndDolly::getBoxNo)
.collect(Collectors.toList());
//验证Les任务
List<Les> lesList = validateLes(bindLarge.getSrcPositionCode(), boxNos);
//验证料箱号
validateBoxNos(lesList, boxNos);
//验证起点是否有Agv任务
validateAgvTask(bindLarge.getSrcPositionCode());
//获取目标点位
String endPointCode = getEndPointCode(lesList);
//生成Agv任务
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.OPEN, null, bindLarge.getSrcPositionCode(), endPointCode, "TUGGER");
//绑定任务
bindLesTask(lesList, agvTask.getId());
//下发任务
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskQYCJson(agvTask, boxNos.size(), boxNos));
}
/**
*
*
* @param bindLarge ->
*/
private void validateParams(BindLarge bindLarge) {
if (StringUtils.isEmpty(bindLarge.getSrcPositionCode())) {
throw new BadRequestException("起点必填");
}
if (bindLarge.getBoxAndDolly().isEmpty()) {
throw new BadRequestException("料箱和Dolly未扫描绑定");
}
//验证起点
pointService.validatePoint(bindLarge.getSrcPositionCode());
}
public void validateBoxNos(List<Les> lesList, List<String> boxNos) {
// 1.检查料箱是否有重复
Set<String> seen = new HashSet<>();
Set<String> duplicates = new HashSet<>();
for (String boxNo : boxNos) {
if (!seen.add(boxNo)) {
duplicates.add(boxNo);
}
}
if (!duplicates.isEmpty()) {
throw new BadRequestException("PDA扫描的料箱号重复:明细见下列" + duplicates);
}
// 2.匹配料箱任务
Set<String> lesBoxNos = lesList.stream()
.map(Les::getBoxNo)
.collect(Collectors.toSet());
// 2. 找出 boxNos 中不在 lesBoxNos 的料箱号(缺失的料箱)
Set<String> missingBoxNos = boxNos.stream()
.filter(boxNo -> !lesBoxNos.contains(boxNo))
.collect(Collectors.toSet());
if (!missingBoxNos.isEmpty()) {
throw new BadRequestException("PDA扫描起点与料箱号未匹配LES任务:明细见下列" + missingBoxNos);
}
}
/**
* Les
*
* @param srcPositionCode ->
* @param boxNos ->
*/
private List<Les> validateLes(String srcPositionCode, List<String> boxNos) {
List<Les> lesList = lesRepository.findByBoxNoAndPoint(srcPositionCode, boxNos);
if (lesList.isEmpty()) {
throw new BadRequestException("PDA扫描的起点及全部料箱号均与LES任务不匹配");
}
return lesList;
}
@Override
public List<LesTask> findByLinePoint(String dstPositionCode) {
List<LesTask> lesList = lesRepository.findByLinePoint(dstPositionCode);
if (lesList.isEmpty()) {
throw new BadRequestException("PDA扫描的停靠点未匹配到LES任务");
}
return lesList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void onlineConfirm(Online online) {
//验证参数
validateParams(online);
//根据料箱号、库位号匹配任务
Long lesId = getLesTask(online);
//获取Les
Les les = lesRepository.findById(lesId).orElseGet(Les::new);
//回传LES
lesService.lesCallBack(les, lesService.lesCallBackJson(les.getDstPositionCode(), les.getTaskCode()));
}
/**
*
*
* @param online ->
*/
private void validateParams(Online online) {
if (StringUtils.isEmpty(online.getBoxNo())) {
throw new BadRequestException("料箱号必填");
}
if (StringUtils.isEmpty(online.getDstPositionCode())) {
throw new BadRequestException("库位号必填");
}
if (online.getData().isEmpty()) {
throw new BadRequestException("任务信息必填");
}
}
private Long getLesTask(Online online) {
List<LesTask> lesTaskList = online.getData().stream()
.filter(task ->
Objects.equals(online.getBoxNo(), task.getBoxNo()) &&
Objects.equals(online.getDstPositionCode(), task.getDstPositionCode())
)
.collect(Collectors.toList());
if (lesTaskList.isEmpty()) {
throw new BadRequestException("PDA扫描的料箱号和库位号未匹配LES任务");
}
return lesTaskList.stream()
.map(LesTask::getId)
.collect(Collectors.toList()).get(0);
} }
} }

View File

@ -126,7 +126,7 @@ public class PointServiceImpl implements PointService {
public Point validatePoint(String position) { public Point validatePoint(String position) {
Point point = pointRepository.findByCode(position); Point point = pointRepository.findByCode(position);
if (point == null) { if (point == null) {
throw new BadRequestException("点位不存在或已失效"); throw new BadRequestException(position + "点位不存在或已失效");
} }
return point; return point;
} }
@ -152,9 +152,9 @@ public class PointServiceImpl implements PointService {
@Override @Override
public Point queryPoint(String code, String status, String type, String areaName) { public Point queryPoint(String code, String status, String type, String areaName) {
List<Point> pointList= pointRepository.queryPoints(code, status, type, areaName); List<Point> pointList = pointRepository.queryPoints(code, status, type, areaName);
if(pointList.isEmpty()){ if (pointList.isEmpty()) {
throw new BadRequestException(code+"点位不存在或已失效"); throw new BadRequestException(code + "点位不存在或已失效");
} }
return pointList.get(0); return pointList.get(0);
} }

View File

@ -35,6 +35,14 @@ public class Les extends BaseEntity implements Serializable {
@ApiModelProperty(value = "任务类型") @ApiModelProperty(value = "任务类型")
private String taskType; private String taskType;
@Column(name = "`status`")
@ApiModelProperty(value = "状态")
private String status;
@Column(name = "`case_num`")
@ApiModelProperty(value = "箱内零件数量")
private Double caseNum=0D;
@Column(name = "`material_code`") @Column(name = "`material_code`")
@ApiModelProperty(value = "物料号") @ApiModelProperty(value = "物料号")
private String materialCode; private String materialCode;
@ -75,6 +83,18 @@ public class Les extends BaseEntity implements Serializable {
@ApiModelProperty(value = "到达时间") @ApiModelProperty(value = "到达时间")
private Timestamp arrivedTime; private Timestamp arrivedTime;
@Column(name = "`req_message`")
@ApiModelProperty(value = "请求报文")
private String reqMessage;
@Column(name = "`rep_message`")
@ApiModelProperty(value = "响应报文")
private String repMessage;
@Column(name = "return_time")
@ApiModelProperty(value = "回传时间")
private Timestamp returnTime;
public void copy(Les source){ public void copy(Les source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }

View File

@ -0,0 +1,10 @@
package com.youchain.businessdata.inputJson;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class Dolly {
@ApiModelProperty(value = "车码")
String dolly;
}

View File

@ -21,6 +21,9 @@ public class LesRequest {
@ApiModelProperty(value = "任务类型",required = true, example = "bmfeed") @ApiModelProperty(value = "任务类型",required = true, example = "bmfeed")
String taskType; String taskType;
@ApiModelProperty(value = "箱内零件数量", example = "0")
String caseNum;
@ApiModelProperty(value = "物料代码", example = "物料代码") @ApiModelProperty(value = "物料代码", example = "物料代码")
String materialCode; String materialCode;

View File

@ -1,4 +1,4 @@
package com.youchain.appupdate.inputJson; package com.youchain.businessdata.inputJson;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -0,0 +1,16 @@
package com.youchain.businessdata.inputJson;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class UpdateTuggerTrailerInfo {
@ApiModelProperty(value = "点位")
String srcPositionCode;
@ApiModelProperty(value = "车码")
List<Dolly> dollyList;
}

View File

@ -1,6 +1,7 @@
package com.youchain.businessdata.repository; package com.youchain.businessdata.repository;
import com.youchain.businessdata.domain.Les; import com.youchain.businessdata.domain.Les;
import com.youchain.appupdate.response.LesTask;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
@ -12,9 +13,21 @@ public interface LesRepository extends JpaRepository<Les, Long>, JpaSpecificatio
@Query(value = " from Les les where les.taskCode=:taskCode ") @Query(value = " from Les les where les.taskCode=:taskCode ")
Les findByTaskCode(String taskCode); Les findByTaskCode(String taskCode);
@Query(value = " from Les les where les.agvTaskId is null and les.onlineNo=:onlineNo and les.srcPositionCode=:pointCode ") @Query(value = " from Les les where les.agvTaskId is null and les.onlineNo=:onlineNo and les.srcPositionCode=:srcPositionCode ")
List<Les> findByOnlineNo(String pointCode,String onlineNo); List<Les> findByOnlineNo(String srcPositionCode, String onlineNo);
@Query(value = " from Les les where les.agvTaskId=:agvTaskId and les.dstPositionCode=:currentPositionCode ") @Query(value = " from Les les where les.agvTaskId=:agvTaskId and les.dstPositionCode=:currentPositionCode and les.status='OPEN' ")
List<Les> findByAgvTaskId(Long agvTaskId, String currentPositionCode); List<Les> findByAgvTaskId(Long agvTaskId, String currentPositionCode);
@Query(value = "select " +
"new com.youchain.appupdate.response.LesTask(les.id,les.onlineNo,les.createTime," +
"les.routeCode,les.dstPositionCode,les.boxNo,les.materialCode,les.caseNum) " +
"from Les les " +
"where les.agvTaskId > 0 " +
"and les.dstPositionCode = :dstPositionCode " +
"and les.status = 'ARRIVED'")
List<LesTask> findByLinePoint(String dstPositionCode);
@Query(value = " from Les les where les.agvTaskId is null and les.srcPositionCode=:srcPositionCode and les.boxNo in (:boxNos) ")
List<Les> findByBoxNoAndPoint(String srcPositionCode, List<String> boxNos);
} }

View File

@ -2,8 +2,8 @@ package com.youchain.businessdata.rest;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.appupdate.inputJson.MissionStateCallback;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.inputJson.MissionStateCallback;
import com.youchain.businessdata.service.AgvTaskService; import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.businessdata.service.KMReService; import com.youchain.businessdata.service.KMReService;
import com.youchain.exception.handler.ApiResult; import com.youchain.exception.handler.ApiResult;
@ -18,9 +18,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.OK;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@Api(tags = "KMReS") @Api(tags = "KMReS")
@ -48,4 +45,6 @@ public class KMReSController {
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST); return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.youchain.businessdata.service; package com.youchain.businessdata.service;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.inputJson.UpdateTuggerTrailerInfo;
import java.util.List; import java.util.List;
@ -102,5 +103,5 @@ public interface KMReService {
/** /**
* *
*/ */
String updateTuggerTrailerInfo(List<String> tugModels); String updateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo);
} }

View File

@ -76,12 +76,19 @@ public interface LesService {
void genAgvSchedulingTask( LesRequest lesRequest); void genAgvSchedulingTask( LesRequest lesRequest);
/** /**
* LES * LESJson
* @param currentPositionCode * @param currentPositionCode
* @param taskCode * @param taskCode
* @return json * @return json
*/ */
String lesCallBack(String currentPositionCode,String taskCode); String lesCallBackJson(String currentPositionCode,String taskCode);
/**
* LES
* @param les les
* @param json
*/
void lesCallBack(Les les,String json);
/** /**
* *
@ -89,4 +96,6 @@ public interface LesService {
* @param currentPositionCode * @param currentPositionCode
*/ */
void arrivedLes(Long agvTaskId,String currentPositionCode); void arrivedLes(Long agvTaskId,String currentPositionCode);
} }

View File

@ -4,7 +4,6 @@ import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
@Data @Data
public class LesDto { public class LesDto {
private Long id; private Long id;
@ -12,9 +11,15 @@ public class LesDto {
//LES产生的任务号 //LES产生的任务号
private String taskCode; private String taskCode;
//任务类型" //任务类型
private String taskType; private String taskType;
//状态
private String status;
//箱内零件数量
private Double caseNum;
//物料代码 //物料代码
private String materialCode; private String materialCode;

View File

@ -9,6 +9,7 @@ import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.StockService; import com.youchain.basicdata.service.StockService;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.domain.Task; import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.inputJson.UpdateTuggerTrailerInfo;
import com.youchain.businessdata.service.*; import com.youchain.businessdata.service.*;
import com.youchain.exception.BadRequestException; import com.youchain.exception.BadRequestException;
import com.youchain.modules.quartz.utils.TimeNumberUtils; import com.youchain.modules.quartz.utils.TimeNumberUtils;
@ -17,6 +18,7 @@ import com.youchain.modules.system.repository.DictRepository;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -317,7 +319,7 @@ public class KMReServiceImpl implements KMReService {
} }
@Override @Override
public String sendAgvTaskQYCJson(AgvTask agvTask ,int tugCount, List<String> tugModels) { public String sendAgvTaskQYCJson(AgvTask agvTask, int tugCount, List<String> tugModels) {
JSONObject jsonObject = new JSONObject(true); JSONObject jsonObject = new JSONObject(true);
String requestId = TimeNumberUtils.getGTTaskCode(); String requestId = TimeNumberUtils.getGTTaskCode();
Map<String, Object> objMap = new LinkedHashMap<>(); Map<String, Object> objMap = new LinkedHashMap<>();
@ -339,10 +341,10 @@ public class KMReServiceImpl implements KMReService {
Map<String, Object> missionDataMap = new LinkedHashMap<>(); Map<String, Object> missionDataMap = new LinkedHashMap<>();
Point point = pointService.validatePoint(agvTask.getStartSlotCode()); Point point = pointService.validatePoint(agvTask.getStartSlotCode());
String areaCode = point.getArea().getCode(); String areaCode = point.getArea().getCode();
if("XJQ".equals(areaCode)){ if ("XJQ".equals(areaCode)) {
tugModels=Arrays.asList("modelA", "modelB"); tugModels = Arrays.asList("modelA", "modelB");
}else{ } else {
tugCount=tugModels.size(); tugCount = tugModels.size();
} }
missionDataMap.put("sequence", 1);//序号 missionDataMap.put("sequence", 1);//序号
missionDataMap.put("type", "NODE_POINT");//作业类型:点位NODE_POINT;区域NODE_AREA missionDataMap.put("type", "NODE_POINT");//作业类型:点位NODE_POINT;区域NODE_AREA
@ -354,14 +356,14 @@ public class KMReServiceImpl implements KMReService {
missionDataObj.putAll(missionDataMap); missionDataObj.putAll(missionDataMap);
missionDataArray.add(missionDataObj); missionDataArray.add(missionDataObj);
String [] endSlotCodes =agvTask.getEndSlotCode().split(","); String[] endSlotCodes = agvTask.getEndSlotCode().split(",");
int sum=1; int sum = 1;
for (int i = 0; i < endSlotCodes.length; i++) { for (int i = 0; i < endSlotCodes.length; i++) {
JSONObject missionDataObj2 = new JSONObject(true); JSONObject missionDataObj2 = new JSONObject(true);
Map<String, Object> missionDataMap2 = new LinkedHashMap<>(); Map<String, Object> missionDataMap2 = new LinkedHashMap<>();
missionDataMap2.put("sequence", (sum + (i + 1)));//序号 missionDataMap2.put("sequence", (sum + (i + 1)));//序号
missionDataMap2.put("type", "NODE_POINT");//作业类型:点位NODE_POINT;区域NODE_AREA missionDataMap2.put("type", "NODE_POINT");//作业类型:点位NODE_POINT;区域NODE_AREA
missionDataMap2.put("position", endSlotCodes[i]);//终点 missionDataMap2.put("position", endSlotCodes[i]);//终点
missionDataMap2.put("actionType", "TUGGER_DETACH");//动作TUGGER_ATTACH挂钩TUGGER_DETACH脱钩 missionDataMap2.put("actionType", "TUGGER_DETACH");//动作TUGGER_ATTACH挂钩TUGGER_DETACH脱钩
missionDataMap2.put("passStrategy", "AUTO");//当前任务点结束后放行策略:自动AUTO;手动MANUAL missionDataMap2.put("passStrategy", "AUTO");//当前任务点结束后放行策略:自动AUTO;手动MANUAL
missionDataMap2.put("waitingMillis", 0);//自动触发离开当前任务节点的时间,默认单位:毫秒 missionDataMap2.put("waitingMillis", 0);//自动触发离开当前任务节点的时间,默认单位:毫秒
@ -415,7 +417,7 @@ public class KMReServiceImpl implements KMReService {
break; break;
case "ARRIVED": case "ARRIVED":
//容器到达 //容器到达
handleArrivedContainer(agvTask,currentPosition); handleArrivedContainer(agvTask, currentPosition);
break; break;
case "COMPLETED": case "COMPLETED":
//任务完成 //任务完成
@ -447,7 +449,13 @@ public class KMReServiceImpl implements KMReService {
} }
@Override @Override
public String updateTuggerTrailerInfo(List<String> tugModels) { public String updateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
if (StringUtils.isEmpty(updateTuggerTrailerInfo.getSrcPositionCode())) {
throw new BadRequestException("起点必填");
}
if (CollectionUtils.isEmpty(updateTuggerTrailerInfo.getDollyList())) {
throw new BadRequestException("器具必填");
}
JSONObject jsonObject = new JSONObject(true); JSONObject jsonObject = new JSONObject(true);
//请求 id //请求 id
String requestId = String.valueOf(System.currentTimeMillis()); String requestId = String.valueOf(System.currentTimeMillis());
@ -457,9 +465,9 @@ public class KMReServiceImpl implements KMReService {
//当前执行任务的小车号 //当前执行任务的小车号
jsonObject.put("robotId", ""); jsonObject.put("robotId", "");
//拖挂车数量 //拖挂车数量
jsonObject.put("tugCount", tugModels.size()); jsonObject.put("tugCount", updateTuggerTrailerInfo.getDollyList().size());
//拖挂车类型集 //拖挂车类型集
jsonObject.put("tugModels", tugModels); jsonObject.put("tugModels", updateTuggerTrailerInfo.getDollyList());
//是否同步继续(放行)任务 //是否同步继续(放行)任务
jsonObject.put("resumeMission", true); jsonObject.put("resumeMission", true);
return jsonObject.toString(); return jsonObject.toString();

View File

@ -2,6 +2,7 @@ package com.youchain.businessdata.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.domain.Les; import com.youchain.businessdata.domain.Les;
import com.youchain.businessdata.inputJson.LesRequest; import com.youchain.businessdata.inputJson.LesRequest;
@ -38,6 +39,8 @@ public class LesServiceImpl implements LesService {
private final DictRepository dictRepository; private final DictRepository dictRepository;
private final PointService pointService;
private final LesMapper lesMapper; private final LesMapper lesMapper;
@Override @Override
@ -109,6 +112,7 @@ public class LesServiceImpl implements LesService {
//验证任务是否存在 //验证任务是否存在
validateLes(lesRequest.getTaskCode()); validateLes(lesRequest.getTaskCode());
String materialCode = lesRequest.getMaterialCode();//物料代码 String materialCode = lesRequest.getMaterialCode();//物料代码
//有物料走料箱上线场景;无物料走其余场景 //有物料走料箱上线场景;无物料走其余场景
@ -121,7 +125,7 @@ public class LesServiceImpl implements LesService {
} }
@Override @Override
public String lesCallBack(String currentPositionCode, String taskCode) { public String lesCallBackJson(String currentPositionCode, String taskCode) {
JSONObject jsonObject = new JSONObject(true); JSONObject jsonObject = new JSONObject(true);
String guid = String.valueOf(System.currentTimeMillis()); String guid = String.valueOf(System.currentTimeMillis());
//LES任务的业务单号不一定唯一 //LES任务的业务单号不一定唯一
@ -146,11 +150,44 @@ public class LesServiceImpl implements LesService {
return jsonObject.toString(); return jsonObject.toString();
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void lesCallBack(Les les, String json) {
Dict dict = dictRepository.findDictByName("OPEN");
String resultJson = "";
if (dict != null) {
resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), json);
if (StringUtils.isEmpty(resultJson)) {
throw new BadRequestException("LES返回信息:LES回传接口调用失败!");
}
JSONObject resulObject = JSON.parseObject(resultJson);
if (resulObject == null) {
throw new BadRequestException("LES返回信息:LES回传接口返回为空!");
}
String resultCode = resulObject.getString("resultCode");
String displayMsg = resulObject.getString("displayMsg");
if (!"2000".equals(resultCode)) {
throw new BadRequestException("LES返回消息:" + displayMsg);
}
}
les.setStatus(BizStatus.CLOSE);
les.setRepMessage(resultJson);
les.setReqMessage(json);
les.setReturnTime(new Timestamp(System.currentTimeMillis()));
lesRepository.save(les);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void arrivedLes(Long agvTaskId, String currentPositionCode) { public void arrivedLes(Long agvTaskId, String currentPositionCode) {
List<Les> lesList = lesRepository.findByAgvTaskId(agvTaskId, currentPositionCode); List<Les> lesList = lesRepository.findByAgvTaskId(agvTaskId, currentPositionCode);
if (lesList.isEmpty()) {
throw new BadRequestException("系统未识别到任务");
}
for (Les les : lesList) { for (Les les : lesList) {
les.setStatus(BizStatus.ARRIVED);
les.setArrivedTime(new Timestamp(new Date().getTime())); les.setArrivedTime(new Timestamp(new Date().getTime()));
} }
if (!lesList.isEmpty()) { if (!lesList.isEmpty()) {
@ -165,25 +202,34 @@ public class LesServiceImpl implements LesService {
*/ */
private void validateParams(LesRequest lesRequest) { private void validateParams(LesRequest lesRequest) {
if (StringUtils.isEmpty(lesRequest.getTaskCode())) { if (StringUtils.isEmpty(lesRequest.getTaskCode())) {
throw new BadRequestException("taskCode必填"); throw new BadRequestException("任务号必填");
} }
//物料有值;说明是料箱上线场景 //物料有值;说明是料箱上线场景
if (StringUtils.isNotEmpty(lesRequest.getMaterialCode())) { if (StringUtils.isNotEmpty(lesRequest.getMaterialCode())) {
if (StringUtils.isEmpty(lesRequest.getRouteCode())) { if (StringUtils.isEmpty(lesRequest.getRouteCode())) {
throw new BadRequestException("routeCode必填"); throw new BadRequestException("编组/线路必填");
} }
if (StringUtils.isEmpty(lesRequest.getBoxNo())) { if (StringUtils.isEmpty(lesRequest.getBoxNo())) {
throw new BadRequestException("boxNo必填"); throw new BadRequestException("料箱号必填");
} }
if (StringUtils.isEmpty(lesRequest.getOnlineNo())) { if (StringUtils.isEmpty(lesRequest.getOnlineNo())) {
throw new BadRequestException("onlineNo必填"); throw new BadRequestException("上线单号必填");
} }
if (lesRequest.getPositionCodePath() == null || lesRequest.getPositionCodePath().isEmpty() || lesRequest.getPositionCodePath().size() < 2) { if (lesRequest.getPositionCodePath() == null || lesRequest.getPositionCodePath().isEmpty() || lesRequest.getPositionCodePath().size() < 2) {
throw new BadRequestException("节点不能为空且长度至少为2"); throw new BadRequestException("节点不能为空且长度至少为2");
} }
//节点集合
List<PositionCodeRequest> positionCodes = lesRequest.getPositionCodePath();
//验证起点
PositionCodeRequest srcPosition = positionCodes.get(0);
pointService.validatePoint(srcPosition.getPositionCode());
//验证目标库位
PositionCodeRequest dstPosition = positionCodes.get(1);
pointService.validatePoint(dstPosition.getPositionCode());
} }
} }
@ -195,7 +241,7 @@ public class LesServiceImpl implements LesService {
private void validateLes(String taskCode) { private void validateLes(String taskCode) {
Les les = lesRepository.findByTaskCode(taskCode); Les les = lesRepository.findByTaskCode(taskCode);
if (les != null) { if (les != null) {
throw new BadRequestException(taskCode + "任务号系统已接收,请勿重复请求"); throw new BadRequestException(taskCode + "任务号系统已接收,请勿重复操作");
} }
} }
@ -211,6 +257,8 @@ public class LesServiceImpl implements LesService {
Les les = Les.builder() Les les = Les.builder()
.taskCode(lesRequest.getTaskCode()) .taskCode(lesRequest.getTaskCode())
.taskType(lesRequest.getTaskType()) .taskType(lesRequest.getTaskType())
.status(BizStatus.OPEN)
.caseNum(Double.parseDouble(lesRequest.getCaseNum()))
.materialCode(lesRequest.getMaterialCode()) .materialCode(lesRequest.getMaterialCode())
.routeCode(lesRequest.getRouteCode()) .routeCode(lesRequest.getRouteCode())
.boxNo(lesRequest.getBoxNo()) .boxNo(lesRequest.getBoxNo())

View File

@ -1,73 +1,66 @@
package com.youchain.utils; package com.youchain.utils;
import com.youchain.modules.system.service.impl.ApiDictServiceImpl; import com.youchain.modules.system.service.impl.ApiDictServiceImpl;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class UrlApi { public class UrlApi {
private static RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); private static final String URL_SUFFIX = "_url";
private static ApiDictServiceImpl apiDictServiceImpl = SpringContextHolder.getBean(ApiDictServiceImpl.class);
public static String getByKey(String key){ private static final RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String re= (String)redisUtils.get(key); private static final ApiDictServiceImpl apiDictServiceImpl = SpringContextHolder.getBean(ApiDictServiceImpl.class);
if(re==null||re.length()<=0||"".equals(re.trim())){
apiDictServiceImpl.queryAllToSave(); public static String getByKey(String key) {
re= (String)redisUtils.get(key); String re = null;
try {
re = (String) redisUtils.get(key);
} catch (Exception e) {
// 记录日志或处理异常
log.error("redisUtils.get error:", e);
}
if (StringUtils.isBlank(re)) {
synchronized (UrlApi.class) {
try {
re = (String) redisUtils.get(key);
if (StringUtils.isBlank(re)) {
apiDictServiceImpl.queryAllToSave();
re = (String) redisUtils.get(key);
}
} catch (Exception e) {
// 记录日志或处理异常
log.error("redisUtils.get error:", e);
}
}
} }
return re; return re;
};
public static String submitMission(){
return (String)getByKey("submitMission"+"_url");
} }
public static String containerIn(){ //任务下发
return (String)getByKey("containerIn"+"_url"); public static String submitMission() {
return getByKey("submitMission" + URL_SUFFIX);
} }
public static String containerOut(){ //容器入场
return (String)getByKey("containerOut"+"_url"); public static String containerIn() {
return getByKey("containerIn" + URL_SUFFIX);
} }
public static String containerQuery(){ //容器出场
return (String)getByKey("containerQuery"+"_url"); public static String containerOut() {
} return getByKey("containerOut" + URL_SUFFIX);
public static String querypoint(){
return (String)getByKey("querypoint"+"_url");
}
public static String QueryCount(){
return (String)getByKey("QueryCount"+"_url");
} }
/* *//** //任务放行
* public static String operationFeedback() {
*//* return getByKey("operationFeedback" + URL_SUFFIX);
public static String submitMission = "http://10.177.202.230:10870/interfaces/api/amr/submitMission"; }
*//** //更新牵引车拖挂车信息
* public static String updateTuggerTrailerInfo() {
*//* return getByKey("updateTuggerTrailerInfo" + URL_SUFFIX);
public static String containerIn = "http://10.177.202.230:10870/interfaces/api/amr/containerIn"; }
*//**
*
*//*
public static String containerOut = "http://10.177.202.230:10870/interfaces/api/amr/containerOut";
*//**
*
*//*
public static String containerQuery = "http://10.177.202.230:10870/interfaces/api/amr/containerQuery";
*//**
* 线
*//*
public static String querypoint="http://10.177.188.11:4080/webapi/mes/querypoint";
*//**
* 线
*//*
public static String QueryCount="http://10.177.188.11:4080/webapi/mes/QueryCount";
*/
} }