|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.gaotao.modules.automatedWarehouse.service.impl; |
|
|
|
|
|
|
|
import com.gaotao.common.utils.AgvClientUtil; |
|
|
|
import com.gaotao.config.WmsTaskLimitConfig; |
|
|
|
import com.gaotao.modules.api.entity.CallPalletRequest; |
|
|
|
import com.gaotao.modules.api.entity.NeedPalletTask; |
|
|
|
import com.gaotao.modules.api.service.WcsApiService; |
|
|
|
@ -40,6 +41,8 @@ public class AutoTaskServiceImpl implements AutoTaskService { |
|
|
|
private AgvClientUtil agvClientUtil; |
|
|
|
@Autowired |
|
|
|
private AgvTaskMapper agvTaskMapper; // 添加AgvTaskMapper注入 - rqrq |
|
|
|
@Autowired |
|
|
|
private WmsTaskLimitConfig wmsTaskLimitConfig; // 注入任务限制配置 - rqrq |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 栈板万能预约任务 - rqrq |
|
|
|
@ -923,10 +926,37 @@ public class AutoTaskServiceImpl implements AutoTaskService { |
|
|
|
else if(StringUtils.hasText(wmsTransportTask.getToArea())){ |
|
|
|
System.out.println("处理指定区域预约任务 - rqrq,toArea=" + wmsTransportTask.getToArea()); |
|
|
|
|
|
|
|
// 如果区域是Z103,采用并发控制策略:允许配置的最大并行数 - rqrq |
|
|
|
if("Z103".equals(wmsTransportTask.getToArea())){ |
|
|
|
System.out.println("Z103区域入库任务,检查并发数量 - rqrq"); |
|
|
|
|
|
|
|
// 从配置中获取最大并行数 - rqrq |
|
|
|
Integer maxParallelTasks = wmsTaskLimitConfig.getMaxParallelInboundTasksZ103(); |
|
|
|
|
|
|
|
// 统计Z103区域运行中的任务数量(状态为"已创建"或"已下发")- rqrq |
|
|
|
Integer runningCount = wcsIntegrationMapper.countRunningTransportTasksByArea( |
|
|
|
wmsTransportTask.getSite(), |
|
|
|
wmsTransportTask.getToArea() |
|
|
|
); |
|
|
|
|
|
|
|
System.out.println("Z103区域当前运行中任务数:" + (runningCount != null ? runningCount : 0) + |
|
|
|
",配置的最大并行数:" + maxParallelTasks + " - rqrq"); |
|
|
|
|
|
|
|
// 如果运行中任务数已达到配置的最大值,返回null等待 - rqrq |
|
|
|
if(runningCount != null && runningCount >= maxParallelTasks){ |
|
|
|
System.out.println("Z103区域运行中任务已达上限(" + maxParallelTasks + "个),等待下次处理 - rqrq"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果运行中任务数小于最大值,返回固定站点D2 - rqrq |
|
|
|
System.out.println("Z103区域运行中任务数未达上限,分配固定站点D2 - rqrq"); |
|
|
|
return "D2"; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果区域不是Z103,按原逻辑查询空闲站点 - rqrq |
|
|
|
// 最多重试3次,防止死循环 - rqrq |
|
|
|
int maxRetries = 3; |
|
|
|
for(int i = 0; i < maxRetries; i++){ |
|
|
|
//如果区域不是Z103 那么查询空闲站点 如果区域是Z103 只要管控同时有几个入库任务就行 |
|
|
|
// 查询该区域下的空闲站点(status_db=0)- rqrq |
|
|
|
String idleStation = wcsIntegrationMapper.findFirstFreeStationByAreaId(wmsTransportTask.getToArea()); |
|
|
|
|
|
|
|
|