no message
parent
614c1847db
commit
3e709816a9
|
|
@ -71,7 +71,6 @@ public interface AgvTaskMapper extends BaseMapper<AgvTask> {
|
||||||
/**
|
/**
|
||||||
* 每个出库工作站和任务数
|
* 每个出库工作站和任务数
|
||||||
*/
|
*/
|
||||||
@Select(value = "select end_code,count(end_code) from data_agv_task where type='OUTBOUND' and status in (1,2) and agv_vendor='TES' group by end_code")
|
|
||||||
List<Map<String, Integer>> pointTaskCountMap();
|
List<Map<String, Integer>> pointTaskCountMap();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -82,4 +81,13 @@ public interface AgvTaskMapper extends BaseMapper<AgvTask> {
|
||||||
*/
|
*/
|
||||||
@Select(value = "select * from data_agv_task where type in ('INBOUND','OUTBOUND') and status=2 LIMIT 5")
|
@Select(value = "select * from data_agv_task where type in ('INBOUND','OUTBOUND') and status=2 LIMIT 5")
|
||||||
List<AgvTask> queryExecuteTopFive();
|
List<AgvTask> queryExecuteTopFive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据起点编码验证AGV任务是否存在
|
||||||
|
*
|
||||||
|
* @param startCode 起点
|
||||||
|
*/
|
||||||
|
@Select(value = "select 1 from data_agv_task where start_code = #{startCode} and status in (1,2,3) and type = 'OUTBOUND' LIMIT 1 ")
|
||||||
|
Integer existsOutAgv(@Param("startCode") String startCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,19 @@
|
||||||
AND p.order_type in (4,5)
|
AND p.order_type in (4,5)
|
||||||
AND agv.status IN (1, 2, 3)
|
AND agv.status IN (1, 2, 3)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="pointTaskCountMap" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
bp.point_code,
|
||||||
|
COUNT(agv.end_code) as task_count
|
||||||
|
FROM base_area ba
|
||||||
|
JOIN base_point bp ON bp.area_id = ba.id
|
||||||
|
LEFT JOIN data_agv_task agv ON agv.end_code = bp.point_code
|
||||||
|
AND agv.type = 'OUTBOUND'
|
||||||
|
AND agv.status IN (1,2)
|
||||||
|
AND agv.agv_vendor = 'TES'
|
||||||
|
WHERE ba.area_code = 'CK_DOCK'
|
||||||
|
AND bp.iz_active=1
|
||||||
|
GROUP BY bp.point_code
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -260,7 +260,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
||||||
//获取所有出库单明细
|
//获取所有出库单明细
|
||||||
List<Long> pickDetailId = taskList.stream().map(Task::getPickDetailId).distinct().toList();
|
List<Long> pickDetailId = taskList.stream().map(Task::getPickDetailId).distinct().toList();
|
||||||
Map<Long, PickDetail> pickDetailMap = pickDetailService.queryByPickDetailIdsToMap(pickDetailId);
|
Map<Long, PickDetail> pickDetailMap = pickDetailService.queryByPickDetailIdsToMap(pickDetailId);
|
||||||
List<Point> outPoints;
|
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
//起点
|
//起点
|
||||||
Point fromPoint = fromPointMap.get(task.getFromPointId());
|
Point fromPoint = fromPointMap.get(task.getFromPointId());
|
||||||
|
|
@ -269,8 +268,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
||||||
//选择最优且任务数最少的工作站
|
//选择最优且任务数最少的工作站
|
||||||
Point bestOutPoint;
|
Point bestOutPoint;
|
||||||
if(Set.of(4, 5, 6, 7).contains(pick.getOrderType())){
|
if(Set.of(4, 5, 6, 7).contains(pick.getOrderType())){
|
||||||
outPoints=outCpPoints;
|
bestOutPoint = selectBestAvailableOutboundPoint(fromPoint, outCpPoints, pointTaskCountMap);
|
||||||
bestOutPoint = selectBestAvailableOutboundPoint(fromPoint, outPoints, pointTaskCountMap);
|
|
||||||
}else{
|
}else{
|
||||||
bestOutPoint=outMjPoints.get(0);
|
bestOutPoint=outMjPoints.get(0);
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +324,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
||||||
.filter(point -> pointTaskCountMap.getOrDefault(point.getPointCode(), 0) < 3)
|
.filter(point -> pointTaskCountMap.getOrDefault(point.getPointCode(), 0) < 3)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!availablePoints.isEmpty()) {
|
if (CollectionUtils.isNotEmpty(availablePoints)) {
|
||||||
// 在任务数小于3的工作站中选择最优的
|
// 在任务数小于3的工作站中选择最优的
|
||||||
return getBestOutboundPoint(fromPoint, availablePoints);
|
return getBestOutboundPoint(fromPoint, availablePoints);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.cpte.modules.shipping.service.processor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
||||||
import org.cpte.modules.base.entity.*;
|
import org.cpte.modules.base.entity.*;
|
||||||
import org.cpte.modules.base.mapper.AreaMapper;
|
import org.cpte.modules.base.mapper.AreaMapper;
|
||||||
import org.cpte.modules.base.mapper.ItemKeyMapper;
|
import org.cpte.modules.base.mapper.ItemKeyMapper;
|
||||||
|
|
@ -62,6 +63,9 @@ public class AllocateProcessor {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryMapper inventoryMapper;
|
private InventoryMapper inventoryMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AgvTaskMapper agvTaskMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IItemService itemService;
|
private IItemService itemService;
|
||||||
|
|
||||||
|
|
@ -946,6 +950,7 @@ public class AllocateProcessor {
|
||||||
public List<Task> buildMoveTask(List<Point> movePoints) {
|
public List<Task> buildMoveTask(List<Point> movePoints) {
|
||||||
List<Task> moveList = new ArrayList<>();
|
List<Task> moveList = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<Long,Point> pointMap = movePoints.stream().collect(Collectors.toMap(Point::getId, point -> point));
|
||||||
//库存
|
//库存
|
||||||
List<Long> pointIds = movePoints.stream().map(Point::getId).toList();
|
List<Long> pointIds = movePoints.stream().map(Point::getId).toList();
|
||||||
List<Inventory> moveInventoryList = inventoryMapper.queryByPointIds(pointIds);
|
List<Inventory> moveInventoryList = inventoryMapper.queryByPointIds(pointIds);
|
||||||
|
|
@ -967,6 +972,11 @@ public class AllocateProcessor {
|
||||||
|
|
||||||
for (Inventory inv : moveInventoryList) {
|
for (Inventory inv : moveInventoryList) {
|
||||||
try {
|
try {
|
||||||
|
//如果移位库位已有出库任务则不需要生成移位任务
|
||||||
|
Point movePoint = pointMap.get(inv.getPointId());
|
||||||
|
if (agvTaskMapper.existsOutAgv(movePoint.getPointCode())!=null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Item moveItem = moveItemMap.get(inv.getItemId());
|
Item moveItem = moveItemMap.get(inv.getItemId());
|
||||||
Point fromPoint = fromPointMap.get(inv.getPointId());
|
Point fromPoint = fromPointMap.get(inv.getPointId());
|
||||||
Stock stock = stockMap.get(inv.getStockId());
|
Stock stock = stockMap.get(inv.getStockId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue