Browse Source

是否在立库

master
常熟吴彦祖 3 months ago
parent
commit
8ad37b1fb7
  1. 28
      src/main/java/com/gaotao/config/WmsTaskLimitConfig.java
  2. 10
      src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
  3. 15
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
  4. 4
      src/main/resources/application.yml
  5. 16
      src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml

28
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;
}
}

10
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制作
*/

15
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;

4
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:

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

@ -549,6 +549,22 @@
WHERE task_no = #{taskNo}
</update>
<!-- rqrq - 统计指定区域未完成的立库取货call料任务数量 -->
<select id="countUnfinishedCallTasksByArea" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT wtt.task_no)
FROM wms_transport_task wtt WITH (NOLOCK)
INNER JOIN wms_order_task wot WITH (NOLOCK)
ON wtt.source_bill_no = wot.task_no
AND wtt.site = wot.site
AND wtt.source_line_id = wot.item_no
INNER JOIN agv_station ast WITH (NOLOCK)
ON wtt.to_location = ast.station_code
WHERE wtt.site = #{site}
AND ast.area_type = #{areaType}
AND wtt.status != '已完成'
AND wot.source_type = '立库取货'
</select>
<!-- 根据站点代码获取站点信息 - AI制作 -->
<select id="getStationInfoByCode" resultType="java.util.Map">
SELECT station_code as stationCode, station_name as stationName,

Loading…
Cancel
Save