长兴特科拉项目
This commit is contained in:
@@ -229,21 +229,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
action = this.itemProtocol.getAction();
|
||||
container_direction = this.itemProtocol.getContainer_direction();
|
||||
container_type = this.itemProtocol.getContainer_type();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
to_command = this.itemProtocol.getTo_command();
|
||||
to_target = this.itemProtocol.getTotarget();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
to_container_no = this.itemProtocol.getContainer_direction();
|
||||
|
||||
|
||||
if(move==1){
|
||||
if(mode==1){
|
||||
taskAgvService.autoCreate(device_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,16 +167,13 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB600.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "40001", Boolean.valueOf(true)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB601.W1", Boolean.valueOf(true)));
|
||||
// list.add(new ItemDto(item_to_command, "下发命令", "DB601.W1", Boolean.valueOf(true)));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class XgHttpUtil {
|
||||
return new UnifiedResponse<>(false, "未开启连接该系统!");
|
||||
}
|
||||
try {
|
||||
System.out.println(REQUEST_ADAPTER.getUrl());
|
||||
String body = HttpRequest
|
||||
.post(REQUEST_ADAPTER.getUrl() + path)
|
||||
.setConnectionTimeout(10000)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.acs.route.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("acs_routepile_line")
|
||||
public class RoutePileLineEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 取货起点1
|
||||
*/
|
||||
private String start_point_code;
|
||||
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
private String next_point_code;
|
||||
|
||||
/**
|
||||
* 取货起点2
|
||||
*/
|
||||
private String start_point_code2;
|
||||
|
||||
/**
|
||||
* 放货点2
|
||||
*/
|
||||
private String next_point_code2;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
private String device_addr;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.acs.route.service.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.acs.route.service.dao.RouteLineEntity;
|
||||
import org.nl.acs.route.service.dao.RoutePileLineEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface IRoutePileLineServiceMapper extends BaseMapper<RoutePileLineEntity> {
|
||||
}
|
||||
@@ -15,8 +15,11 @@ import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionAgvService;
|
||||
|
||||
import org.nl.acs.instruction.service.dto.QueryInstructionPo;
|
||||
import org.nl.acs.instruction.service.mapper.IInstructionServiceMapper;
|
||||
import org.nl.acs.route.service.dao.RouteLineEntity;
|
||||
import org.nl.acs.route.service.dao.RoutePileLineEntity;
|
||||
import org.nl.acs.route.service.mapper.IRouteLineServiceMapper;
|
||||
import org.nl.acs.route.service.mapper.IRoutePileLineServiceMapper;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.service.TaskAgvService;
|
||||
@@ -48,13 +51,17 @@ import java.util.Objects;
|
||||
public class TaskAgvServiceImpl implements TaskAgvService{
|
||||
|
||||
|
||||
@Autowired
|
||||
private InstructionAgvService instructionService;
|
||||
// @Autowired
|
||||
// private InstructionAgvService instructionService;
|
||||
|
||||
private final IRouteLineServiceMapper routeLineServiceDao;
|
||||
|
||||
private final ITaskAgvServiceMapper taskAgvServiceDao;
|
||||
|
||||
private final IInstructionServiceMapper instructionService;
|
||||
|
||||
private final IRoutePileLineServiceMapper routePileLineServiceMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(QueryTaskPo po) {
|
||||
|
||||
@@ -158,34 +165,27 @@ public class TaskAgvServiceImpl implements TaskAgvService{
|
||||
dto.setStart_device_code(driverCode);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setVehicle_code(driverCode);
|
||||
dto.setTask_code(task_code);
|
||||
// entity.setRoute_plan_code(route_plan_code);
|
||||
dto.setTask_status("0");
|
||||
dto.setCreate_type(TaskTypeEnum.Standard_AGV_Task.getCode());
|
||||
dto.setPriority("1");
|
||||
dto.setStart_point_code("TE-01");
|
||||
dto.setNext_point_code("ZD-01");
|
||||
dto.setStart_point_code2("TE-01");
|
||||
dto.setNext_point_code2("ZD-02");
|
||||
// //判断起点终点设备类型
|
||||
// if (queryRouteLine(dto.getStart_point_code(), dto.getNext_point_code())) {
|
||||
// throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "起点路由不通!");
|
||||
// }
|
||||
// //判断起点2终点2设备类型
|
||||
// if (queryRouteLine(dto.getStart_point_code2(), dto.getNext_point_code2())) {
|
||||
// throw new Exception(dto.getStart_point_code2() + "->" + dto.getNext_point_code2() + "起点2路由不通!");
|
||||
// }
|
||||
RoutePileLineEntity pileLineEntity=queryRouteLine(driverCode);
|
||||
dto.setStart_point_code(pileLineEntity.getStart_point_code());
|
||||
dto.setNext_point_code(pileLineEntity.getNext_point_code());
|
||||
dto.setStart_point_code2(pileLineEntity.getStart_point_code2());
|
||||
dto.setNext_point_code2(pileLineEntity.getNext_point_code2());
|
||||
TaskEntity entity=new TaskEntity();
|
||||
BeanUtils.copyProperties(dto,entity);
|
||||
taskAgvServiceDao.insert(entity);
|
||||
}
|
||||
|
||||
private boolean queryRouteLine(String start_point, String next_point){
|
||||
QueryWrapper<RouteLineEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("device_code", start_point);
|
||||
queryWrapper.eq("next_device_code", next_point);
|
||||
List<RouteLineEntity> list=routeLineServiceDao.selectList(queryWrapper);
|
||||
return list.isEmpty();
|
||||
private RoutePileLineEntity queryRouteLine(String device_code){
|
||||
QueryWrapper<RoutePileLineEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("device_code", device_code);
|
||||
List<RoutePileLineEntity> list=routePileLineServiceMapper.selectList(queryWrapper);
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,13 +208,13 @@ public class TaskAgvServiceImpl implements TaskAgvService{
|
||||
|
||||
@Override
|
||||
public void finish(String id) {
|
||||
QueryInstructionPo po=new QueryInstructionPo();
|
||||
po.setTask_id(id);
|
||||
List<String> statusList=new ArrayList<>();
|
||||
statusList.add(InstructionStatusEnum.READY.getIndex());
|
||||
statusList.add(InstructionStatusEnum.BUSY.getIndex());
|
||||
po.setInstructionAllStatus(statusList);
|
||||
List<InstructionEntity> list=instructionService.queryInstructionList(po);
|
||||
QueryWrapper<InstructionEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("instruction_status",statusList);
|
||||
queryWrapper.eq("task_id",id);
|
||||
List<InstructionEntity> list= instructionService.selectList(queryWrapper);
|
||||
if(!list.isEmpty()){
|
||||
throw new BadRequestException("有指令未完成!");
|
||||
}
|
||||
@@ -231,13 +231,13 @@ public class TaskAgvServiceImpl implements TaskAgvService{
|
||||
|
||||
@Override
|
||||
public void cancel(String id) throws Exception {
|
||||
QueryInstructionPo po=new QueryInstructionPo();
|
||||
po.setTask_id(id);
|
||||
List<String> statusList=new ArrayList<>();
|
||||
statusList.add(InstructionStatusEnum.READY.getIndex());
|
||||
statusList.add(InstructionStatusEnum.BUSY.getIndex());
|
||||
po.setInstructionAllStatus(statusList);
|
||||
List<InstructionEntity> list=instructionService.queryInstructionList(po);
|
||||
QueryWrapper<InstructionEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("instruction_status",statusList);
|
||||
queryWrapper.eq("task_id",id);
|
||||
List<InstructionEntity> list= instructionService.selectList(queryWrapper);
|
||||
if(!list.isEmpty()){
|
||||
throw new BadRequestException("有指令未完成!");
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class AutoCreateAgvInst {
|
||||
BeanUtils.copyProperties(taskEntity,instructionEntity);
|
||||
instructionEntity.setInstruction_type(taskEntity.getTask_type());
|
||||
instructionEntity.setInstruction_id(IdUtil.simpleUUID());
|
||||
instructionEntity.setExecute_device_code(taskEntity.getStart_device_code());
|
||||
String now = DateUtil.now();
|
||||
instructionEntity.setCreate_time(now);
|
||||
instructionEntity.setCreate_by("auto");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
server:
|
||||
port: 8010
|
||||
port: 8011
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.121}:${DB_PORT:3306}/${DB_NAME:yy_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3307}/${DB_NAME:tekela_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
server:
|
||||
port: 8010
|
||||
port: 8011
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.121}:${DB_PORT:3306}/${DB_NAME:yy_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3307}/${DB_NAME:tekela_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -4,7 +4,7 @@ import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-12-03T17:52:04+0800",
|
||||
date = "2024-12-16T17:54:35+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