Browse Source

调用记录

master
常熟吴彦祖 3 months ago
parent
commit
6911705dd7
  1. 13
      src/main/java/com/gaotao/config/WmsTaskLimitConfig.java
  2. 10
      src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
  3. 32
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java
  4. 1
      src/main/resources/application.yml
  5. 9
      src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml

13
src/main/java/com/gaotao/config/WmsTaskLimitConfig.java

@ -17,6 +17,11 @@ public class WmsTaskLimitConfig {
*/
private Integer maxUnfinishedCallTasksPerArea = 3;
/**
* Z103区域允许的最大入库并行任务数量 - rqrq
*/
private Integer maxParallelInboundTasksZ103 = 2;
public Integer getMaxUnfinishedCallTasksPerArea() {
return maxUnfinishedCallTasksPerArea;
}
@ -24,5 +29,13 @@ public class WmsTaskLimitConfig {
public void setMaxUnfinishedCallTasksPerArea(Integer maxUnfinishedCallTasksPerArea) {
this.maxUnfinishedCallTasksPerArea = maxUnfinishedCallTasksPerArea;
}
public Integer getMaxParallelInboundTasksZ103() {
return maxParallelInboundTasksZ103;
}
public void setMaxParallelInboundTasksZ103(Integer maxParallelInboundTasksZ103) {
this.maxParallelInboundTasksZ103 = maxParallelInboundTasksZ103;
}
}

10
src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java

@ -280,6 +280,16 @@ public interface WcsIntegrationMapper {
*/
Integer countUnfinishedCallTasksByArea(@Param("site") String site, @Param("areaType") String areaType);
/**
* @Description 统计指定区域运行中的运输任务数量状态为"已创建""已下达"- rqrq
* @param site 工厂编码
* @param toArea 目标区域
* @return 运行中的运输任务数量
* @author rqrq
* @date 2025/11/27
*/
Integer countRunningTransportTasksByArea(@Param("site") String site, @Param("toArea") String toArea);
/**
* 根据站点代码获取站点信息 - AI制作
*/

32
src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java

@ -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());

1
src/main/resources/application.yml

@ -142,6 +142,7 @@ wms:
task:
limit:
max-unfinished-call-tasks-per-area: 3 # 每个区域允许的最大未完成立库取货call料任务数量
max-parallel-inbound-tasks-z103: 2 # Z103区域允许的最大入库并行任务数量
# 定时任务开关配置
scheduler:

9
src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml

@ -599,6 +599,15 @@
AND wot.source_type = '立库取货'
</select>
<!-- rqrq - 统计指定区域运行中的运输任务数量(状态为"已创建"或"已下达")-->
<select id="countRunningTransportTasksByArea" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM wms_transport_task WITH (NOLOCK)
WHERE site = #{site}
AND to_area = #{toArea}
AND (status = '已创建' OR status = '已下发')
</select>
<!-- 根据站点代码获取站点信息 - AI制作 -->
<select id="getStationInfoByCode" resultType="java.util.Map">
SELECT station_code as stationCode, station_name as stationName,

Loading…
Cancel
Save