diff --git a/src/main/java/com/gaotao/config/WmsTaskLimitConfig.java b/src/main/java/com/gaotao/config/WmsTaskLimitConfig.java
new file mode 100644
index 0000000..a802b1b
--- /dev/null
+++ b/src/main/java/com/gaotao/config/WmsTaskLimitConfig.java
@@ -0,0 +1,28 @@
+package com.gaotao.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description WMS任务限制配置类 - rqrq
+ * @Author rqrq
+ * @Date 2025/11/22
+ */
+@Component
+@ConfigurationProperties(prefix = "wms.task.limit")
+public class WmsTaskLimitConfig {
+
+ /**
+ * 每个区域允许的最大未完成立库取货call料任务数量 - rqrq
+ */
+ private Integer maxUnfinishedCallTasksPerArea = 3;
+
+ public Integer getMaxUnfinishedCallTasksPerArea() {
+ return maxUnfinishedCallTasksPerArea;
+ }
+
+ public void setMaxUnfinishedCallTasksPerArea(Integer maxUnfinishedCallTasksPerArea) {
+ this.maxUnfinishedCallTasksPerArea = maxUnfinishedCallTasksPerArea;
+ }
+}
+
diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
index 4ffa31c..b06d876 100644
--- a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
+++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
@@ -255,6 +255,16 @@ public interface WcsIntegrationMapper {
*/
void updateTransportTaskStatusByTaskNo(@Param("taskNo") String taskNo, @Param("status") String status);
+ /**
+ * @Description 统计指定区域未完成的立库取货call料任务数量 - rqrq
+ * @param site 工厂编码
+ * @param areaType 区域类型
+ * @return 未完成的call料任务数量
+ * @author rqrq
+ * @date 2025/11/22
+ */
+ Integer countUnfinishedCallTasksByArea(@Param("site") String site, @Param("areaType") String areaType);
+
/**
* 根据站点代码获取站点信息 - AI制作
*/
diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
index f946964..c48a306 100644
--- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
+++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
@@ -49,6 +49,8 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService {
@Autowired
private com.gaotao.modules.automatedWarehouse.service.AutoTaskService autoTaskService;
@Autowired
+ private com.gaotao.config.WmsTaskLimitConfig wmsTaskLimitConfig; // 任务限制配置 - rqrq
+ @Autowired
private com.gaotao.modules.notify.mapper.NewIssureMapper newIssureMapper;
@Autowired
private DeliveryTaskService deliveryTaskService;
@@ -2317,8 +2319,17 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService {
throw new RuntimeException("目标区域不能为空");
}
- //1.5 判断下 如果同一个区域已经有3个未完成的call料单据 那么就不让下达新的
-
+ // 1.5 判断区域未完成的立库取货call料任务数量是否超限 - rqrq
+ System.out.println("开始检查区域未完成call料任务数量 - rqrq,targetArea=" + targetArea);
+ Integer unfinishedCount = wcsIntegrationMapper.countUnfinishedCallTasksByArea(site, targetArea);
+ Integer maxLimit = wmsTaskLimitConfig.getMaxUnfinishedCallTasksPerArea();
+ System.out.println("区域【" + targetArea + "】当前未完成的立库取货call料任务数量:" + unfinishedCount +
+ ",配置的最大限制:" + maxLimit + " - rqrq");
+ if (unfinishedCount != null && unfinishedCount >= maxLimit) {
+ throw new RuntimeException("区域【" + targetArea + "】已有" + unfinishedCount +
+ "个未完成的立库取货call料任务(配置限制:" + maxLimit + "个),请等待任务完成后再下达新任务");
+ }
+ System.out.println("区域未完成任务数量检查通过 - rqrq");
// 2. 确定目标站点(自动分配或指定站点)- rqrq
String finalTargetStation = targetStation;
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index c425195..3310d1c 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -138,6 +138,10 @@ wms:
key-prefix: "wms:queue:"
status-prefix: "wms:message:status:"
status-expire: 86400 # 状态过期时间(秒) 24小时
+ # 任务限制配置 - rqrq
+ task:
+ limit:
+ max-unfinished-call-tasks-per-area: 3 # 每个区域允许的最大未完成立库取货call料任务数量
# 定时任务开关配置
scheduler:
diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml
index 882b962..a7f7d58 100644
--- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml
+++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml
@@ -549,6 +549,22 @@
WHERE task_no = #{taskNo}
+
+
+