From ba8f13b8f6e8a2898e50e2191b4928a4b548b6f7 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: Fri, 31 Oct 2025 16:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=86=E6=8B=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/WcsIntegrationMapper.java | 10 +++++++++ .../service/impl/AutoTaskServiceImpl.java | 21 +++++++++++++++++++ .../WcsIntegrationMapper.xml | 11 ++++++++++ 3 files changed, 42 insertions(+) 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 0b3ce71..64bf98d 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java @@ -796,6 +796,16 @@ public interface WcsIntegrationMapper { */ int checkPalletTaskExists(@Param("site") String site, @Param("palletId") String palletId, @Param("sourceBillNo") String sourceBillNo, @Param("stationCode") String stationCode); + /** + * @Description 查询栈板是否存在未完成的运输任务 - rqrq + * @param site 工厂编码 + * @param palletId 栈板编码 + * @return 未完成任务的任务编号(如果存在),不存在则返回null + * @author rqrq + * @date 2025/10/31 + */ + String getUnfinishedTaskByPalletId(@Param("site") String site, @Param("palletId") String palletId); + /** * @Description 检查栈板是否放满(根据pallet_type_area的点位数和max_layer判断) - rqrq * @param site 工厂编码 diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java index 944a214..fb5a093 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AutoTaskServiceImpl.java @@ -62,6 +62,18 @@ public class AutoTaskServiceImpl implements AutoTaskService { if(getAgvStationStatus!=0){ throw new RuntimeException("参数验证失败:站点不是空闲状态"); } + + // 如果指定了栈板,验证栈板是否已有未完成任务 - rqrq + if(StringUtils.hasText(inData.getPalletId())){ + String unfinishedTaskNo = wcsIntegrationMapper.getUnfinishedTaskByPalletId( + inData.getSite(), + inData.getPalletId() + ); + if(StringUtils.hasText(unfinishedTaskNo)){ + throw new RuntimeException("栈板【" + inData.getPalletId() + "】已存在未完成的运输任务【" + unfinishedTaskNo + "】,不能重复创建"); + } + } + // 生成运输任务编号 TransNoControl transData = transNoService.getTransNo(inData.getSite(), "WTT", 10); Date currentTime = new Date(); @@ -321,6 +333,15 @@ public class AutoTaskServiceImpl implements AutoTaskService { throw new RuntimeException("栈板状态异常:栈板正在被调用中,无法创建新任务"); } + // 验证栈板是否已有未完成任务(更严格的检查)- rqrq + String unfinishedTaskNo = wcsIntegrationMapper.getUnfinishedTaskByPalletId( + inData.getSite(), + inData.getPalletId() + ); + if(StringUtils.hasText(unfinishedTaskNo)){ + throw new RuntimeException("栈板【" + inData.getPalletId() + "】已存在未完成的运输任务【" + unfinishedTaskNo + "】,不能重复创建"); + } + // 校验栈板是否在当前站点上 - rqrq if(!inData.getFromLocation().equals(pallet.getLocationCode())){ throw new RuntimeException("栈板位置异常:栈板不在指定的起始站点【" + inData.getFromLocation() + "】上,实际位置为【" + pallet.getLocationCode() + "】"); diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml index de6d312..8f47827 100644 --- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml +++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml @@ -1543,6 +1543,17 @@ AND to_location = #{stationCode} + + +