package com.zy.common.properties;
|
|
import lombok.Data;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.context.annotation.Configuration;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* AGV配置属性
|
*
|
* @author system
|
*/
|
@Data
|
@Configuration
|
@ConfigurationProperties(prefix = "agv")
|
public class AgvProperties {
|
|
/**
|
* 是否发送任务
|
*/
|
private boolean sendTask = false;
|
|
/**
|
* 东侧配置
|
*/
|
private RobotGroupConfig east = new RobotGroupConfig();
|
|
/**
|
* 西侧配置
|
*/
|
private RobotGroupConfig west = new RobotGroupConfig();
|
|
/**
|
* whs_type映射配置
|
* 1: 入库区(东侧),2: 缓存区(西侧)
|
*/
|
private WhsTypeMapping whsTypeMapping = new WhsTypeMapping();
|
|
/**
|
* 站点分配策略配置
|
*/
|
private SiteAllocationStrategy siteAllocation = new SiteAllocationStrategy();
|
|
/**
|
* whs_type映射配置内部类
|
*/
|
@Data
|
public static class WhsTypeMapping {
|
/**
|
* 入库区对应的whs_type值(默认1)
|
*/
|
private Long inboundArea = 1L;
|
|
/**
|
* 缓存区对应的whs_type值(默认2)
|
*/
|
private Long cacheArea = 2L;
|
}
|
|
/**
|
* 机器人组配置内部类
|
*/
|
@Data
|
public static class RobotGroupConfig {
|
/**
|
* 机器人组编号
|
*/
|
private String robotGroup = "";
|
|
/**
|
* 站点列表
|
*/
|
private List<String> stations = new ArrayList<>();
|
}
|
|
/**
|
* 获取东侧站点列表(兼容旧代码)
|
*/
|
public List<String> getEastStations() {
|
return east != null ? east.getStations() : new ArrayList<>();
|
}
|
|
/**
|
* 获取西侧站点列表(兼容旧代码)
|
*/
|
public List<String> getWestStations() {
|
return west != null ? west.getStations() : new ArrayList<>();
|
}
|
|
/**
|
* 获取东侧机器人组编号(兼容旧代码)
|
*/
|
public String getRobotGroupEast() {
|
return east != null && east.getRobotGroup() != null && !east.getRobotGroup().isEmpty()
|
? east.getRobotGroup() : "Group-001";
|
}
|
|
/**
|
* 获取西侧机器人组编号(兼容旧代码)
|
*/
|
public String getRobotGroupWest() {
|
return west != null && west.getRobotGroup() != null && !west.getRobotGroup().isEmpty()
|
? west.getRobotGroup() : "Group-002";
|
}
|
|
/**
|
* 站点分配策略配置内部类
|
*/
|
@Data
|
public static class SiteAllocationStrategy {
|
/**
|
* 分配策略类型
|
* round-robin: 轮询分配(平均分配)
|
* least-task: 最少任务优先(默认)
|
* random: 随机分配
|
*/
|
private String strategy = "least-task";
|
|
/**
|
* 是否启用平均分配
|
* true: 当多个站点任务数相同时,使用轮询分配
|
* false: 总是选择第一个(任务最少的)
|
*/
|
private boolean enableRoundRobin = true;
|
}
|
}
|