长兴特科拉项目
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.agv.server;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
|
||||
@@ -30,4 +31,11 @@ public interface AGVSchedulingService {
|
||||
*/
|
||||
public <T> UnifiedResponse<T> queryXZAgvInstStatusByCode(String instCode, Class<T> type);
|
||||
|
||||
/**
|
||||
* 请求取货放货
|
||||
* @param requestParam
|
||||
* @return
|
||||
*/
|
||||
JSONObject xgAGVWaitPointRequest(JSONObject requestParam) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.agv.server.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -11,11 +12,16 @@ import org.nl.acs.ext.RequestAdapter;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.ext.xg.XgHttpUtil;
|
||||
import org.nl.acs.ext.xg.XgRequestAdapter;
|
||||
import org.nl.acs.instruction.dao.InstructionNumLogEntity;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.mapper.IInstructionNumLogServiceMapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -27,6 +33,8 @@ public class AGVSchedulingServiceImpl implements AGVSchedulingService {
|
||||
@Value("${agvToAcs.addr}")
|
||||
private String addr;
|
||||
|
||||
private final IInstructionNumLogServiceMapper instructionNumLogServiceMapper;
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> sendAGVOrderSequences(Instruction inst) {
|
||||
JSONObject reqParam = new JSONObject();
|
||||
@@ -52,6 +60,34 @@ public class AGVSchedulingServiceImpl implements AGVSchedulingService {
|
||||
return xgHttpUtil.sendGetRequest(path, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) throws Exception {
|
||||
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
||||
String address = requestParam.getString("address");
|
||||
log.info("AGV取货前等待30s...");
|
||||
String id = requestParam.getString("task_code");
|
||||
InstructionNumLogEntity inst=instructionNumLogServiceMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
InstructionNumLogEntity entity=new InstructionNumLogEntity();
|
||||
entity.setId(id);
|
||||
entity.setCreate_time(new Date());
|
||||
instructionNumLogServiceMapper.insert(entity);
|
||||
}else {
|
||||
Date time=inst.getCreate_time();
|
||||
long startTime = time.getTime();
|
||||
long endTime= System.currentTimeMillis();
|
||||
long diffTime=endTime - startTime;
|
||||
long seconds=diffTime/1000;
|
||||
if( seconds>30L){
|
||||
log.info("允许取货,点位 - {}", address);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许取货!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
throw new BadRequestException("不允许取货!");
|
||||
}
|
||||
|
||||
|
||||
private JSONArray createBlocksData(Instruction inst) {
|
||||
@@ -70,7 +106,7 @@ public class AGVSchedulingServiceImpl implements AGVSchedulingService {
|
||||
block.put("operation", "JackUnload");
|
||||
blocks.add(block);
|
||||
|
||||
// 起点2
|
||||
// 起点2取货等待
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code2() + "INGET");
|
||||
@@ -88,6 +124,12 @@ public class AGVSchedulingServiceImpl implements AGVSchedulingService {
|
||||
scriptArgs.put("protocol", "HTTP");
|
||||
block.put("script_args", scriptArgs);
|
||||
blocks.add(block);
|
||||
// 起点2
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code2());
|
||||
block.put("operation", "JackLoad");
|
||||
blocks.add(block);
|
||||
// 终点2
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
|
||||
@@ -21,9 +21,11 @@ import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.dao.InstructionNumLogEntity;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.InteractionJsonDTO;
|
||||
import org.nl.acs.instruction.service.mapper.IInstructionNumLogServiceMapper;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.task.enums.ActionTypeEnum;
|
||||
@@ -41,6 +43,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -70,6 +73,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppservice;
|
||||
|
||||
private final IInstructionNumLogServiceMapper instructionNumLogServiceMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private AgvWaitUtil agvWaitUtil;
|
||||
@@ -739,8 +744,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
@Override
|
||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) throws Exception{
|
||||
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
||||
String inst_code = requestParam.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
|
||||
//String address = requestParam.getString("address");
|
||||
/*Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
|
||||
if (ObjectUtil.isEmpty(instructionDto)) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.content("请求失败,未找到指令!" + inst_code)
|
||||
@@ -758,14 +763,25 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
throw new BadRequestException("请求失败,地址为空!");
|
||||
}*/
|
||||
/*log.info("AGV取货前等待30s...");
|
||||
String id = requestParam.getString("task_code");
|
||||
InstructionNumLogEntity inst=instructionNumLogServiceMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
InstructionNumLogEntity entity=new InstructionNumLogEntity();
|
||||
entity.setId(id);
|
||||
entity.setCreate_time(new Date());
|
||||
instructionNumLogServiceMapper.insert(entity);
|
||||
}else {
|
||||
Date time=inst.getCreate_time();
|
||||
LocalDateTime startTime=new Date();
|
||||
}
|
||||
log.info("AGV取货前等待30s...");
|
||||
Thread.sleep(30000L);
|
||||
log.info("允许取货,点位 - {}", instructionDto.getStart_point_code2());
|
||||
log.info("允许取货,点位 - {}", address);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许取货!");
|
||||
return map;
|
||||
return map;*/
|
||||
// if (address.contains("IN") || address.contains("WAIT")) {
|
||||
// String task_code = instructionDto.getTask_code();
|
||||
// String deviceCodeNow;
|
||||
@@ -866,7 +882,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||
}
|
||||
|
||||
private String applyCCAgvTask(String task_code, Instruction instructionDto) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.acs.instruction.dao;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("acs_instruction_num_log")
|
||||
public class InstructionNumLogEntity implements Serializable {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
private Date create_time;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -495,4 +495,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
List<Instruction> findByNextCode(String nextDeviceCode);
|
||||
|
||||
List<Instruction> findReadyIns();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class InstructionAgvServiceImpl implements InstructionAgvService {
|
||||
if (Objects.nonNull(po.getInstructionAllStatus())) {
|
||||
queryWrapper.in("instruction_status", po.getInstructionAllStatus());
|
||||
}
|
||||
if (Objects.nonNull(po.getInstructionAllStatus())) {
|
||||
if (Objects.nonNull(po.getTask_id())) {
|
||||
queryWrapper.eq("task_id", po.getTask_id());
|
||||
}
|
||||
return instructionService.selectList(queryWrapper);
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.instruction.service.dto.InteractionJsonDTO;
|
||||
import org.nl.acs.instruction.service.mapper.IInstructionNumLogServiceMapper;
|
||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.acs.instruction.service.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.acs.instruction.dao.InstructionNumLogEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface IInstructionNumLogServiceMapper extends BaseMapper<InstructionNumLogEntity> {
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-12-16T17:54:35+0800",
|
||||
date = "2025-01-08T15:07:56+0800",
|
||||
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_291 (Oracle Corporation)"
|
||||
)
|
||||
public class RedisConvertImpl implements RedisConvert {
|
||||
|
||||
Reference in New Issue
Block a user