From 8ad37b1fb75b03f40c4d7e2e8209d266a9f6f0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Sat, 22 Nov 2025 16:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=9C=A8=E7=AB=8B=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gaotao/config/WmsTaskLimitConfig.java | 28 +++++++++++++++++++ .../mapper/WcsIntegrationMapper.java | 10 +++++++ .../impl/WcsIntegrationServiceImpl.java | 15 ++++++++-- src/main/resources/application.yml | 4 +++ .../WcsIntegrationMapper.xml | 16 +++++++++++ 5 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/gaotao/config/WmsTaskLimitConfig.java 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} + + +