|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
package org.springblade.desk.logistics.utils; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Location; |
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Station; |
|
|
|
|
import org.springblade.desk.logistics.service.ILocationService; |
|
|
|
|
import org.springblade.desk.logistics.service.IStationService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -15,6 +17,9 @@ public class AgvTaskTypeUtil { |
|
|
|
|
@Autowired |
|
|
|
|
IStationService stationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
ILocationService locationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据起点和终点获取AGV任务类型 |
|
|
|
|
@ -40,23 +45,42 @@ public class AgvTaskTypeUtil { |
|
|
|
|
Integer endFloor = null; |
|
|
|
|
|
|
|
|
|
if (!isStartConveyorStart && !isStartConveyorEnd) { |
|
|
|
|
// 起点是站点,查询楼层
|
|
|
|
|
// 起点是站点或梳齿架
|
|
|
|
|
Station startStation = stationService.getByStationCode(startPosition); |
|
|
|
|
if (startStation == null) { |
|
|
|
|
log.error("未找到起点站点信息,站点编码:{}", startPosition); |
|
|
|
|
throw new IllegalArgumentException("无效的起点站点编码:" + startPosition); |
|
|
|
|
|
|
|
|
|
if (startStation != null) { |
|
|
|
|
// 情况1:是站点 - 从站点获取楼层
|
|
|
|
|
startFloor = Integer.parseInt(startStation.getStationPosition()); |
|
|
|
|
log.info("起点是站点,站点编码:{},楼层:{}", startPosition, startFloor); |
|
|
|
|
} else { |
|
|
|
|
// 情况2:不是站点,可能是梳齿架 - 查询库位表
|
|
|
|
|
Location location = locationService.selectByLocationCode(startPosition, 1); |
|
|
|
|
if (null == location) { |
|
|
|
|
log.error("未找到起点信息,站点编码:{}", startPosition); |
|
|
|
|
throw new IllegalArgumentException("无效的起点编码:" + startPosition); |
|
|
|
|
} |
|
|
|
|
// 梳齿架固定在一层
|
|
|
|
|
startFloor = 1; |
|
|
|
|
log.info("起点是梳齿架,固定楼层为1层,位置编码:{}", startPosition); |
|
|
|
|
} |
|
|
|
|
startFloor = Integer.parseInt(startStation.getStationPosition()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isEndConveyorStart && !isEndConveyorEnd) { |
|
|
|
|
// 终点是站点,查询楼层
|
|
|
|
|
Station endStation = stationService.getByStationCode(endPosition); |
|
|
|
|
if (endStation == null) { |
|
|
|
|
log.error("未找到终点站点信息,站点编码:{}", endPosition); |
|
|
|
|
throw new IllegalArgumentException("无效的终点站点编码:" + endPosition); |
|
|
|
|
|
|
|
|
|
if (endStation != null) { |
|
|
|
|
endFloor = Integer.parseInt(endStation.getStationPosition()); |
|
|
|
|
log.info("终点是站点,编码:{},楼层:{}", endPosition, endFloor); |
|
|
|
|
} else { |
|
|
|
|
Location location = locationService.selectByLocationCode(endPosition, 1); |
|
|
|
|
if (null == location) { |
|
|
|
|
log.error("未找到终点信息,站点编码:{}", endPosition); |
|
|
|
|
throw new IllegalArgumentException("无效的终点编码:" + endPosition); |
|
|
|
|
} |
|
|
|
|
endFloor = 1; |
|
|
|
|
log.info("终点是梳齿架,编码:{},固定楼层:1", endPosition); |
|
|
|
|
} |
|
|
|
|
endFloor = Integer.parseInt(endStation.getStationPosition()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 场景1: 站点 <-----> 站点 -> QM
|
|
|
|
|
|