From 5a48925a97565eeaa953f059e1de27b518db1df0 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 4 Aug 2025 15:52:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(wms):=20=E4=BF=AE=E5=A4=8D=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8C=BA=E5=9F=9F=E5=89=8D=E6=9C=AA=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在删除区域信息前,增加对库位的校验 - 如果区域已绑定库位,则禁止删除,并抛出异常提示 - 优化了删除操作的安全性和数据完整性 --- .../wms/service/impl/WmsBaseAreaServiceImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsBaseAreaServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsBaseAreaServiceImpl.java index 1583592..601290f 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsBaseAreaServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsBaseAreaServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.toolkit.JoinWrappers; import com.github.yulichang.wrapper.MPJLambdaWrapper; import lombok.RequiredArgsConstructor; +import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.Utils.UniqueCodeUtils; @@ -12,8 +13,11 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.wms.domain.WmsBaseArea; import org.dromara.wms.domain.WmsBaseWarehouse; import org.dromara.wms.domain.bo.WmsBaseAreaBo; +import org.dromara.wms.domain.bo.WmsBaseLocationBo; import org.dromara.wms.domain.vo.WmsBaseAreaVo; +import org.dromara.wms.domain.vo.WmsBaseLocationVo; import org.dromara.wms.mapper.WmsBaseAreaMapper; +import org.dromara.wms.mapper.WmsBaseLocationMapper; import org.dromara.wms.mapper.WmsBaseWarehouseMapper; import org.dromara.wms.service.IWmsBaseAreaService; import org.springframework.stereotype.Service; @@ -36,6 +40,9 @@ public class WmsBaseAreaServiceImpl implements IWmsBaseAreaService { private final WmsBaseWarehouseMapper wmsBaseWarehouseMapper; + private final WmsBaseLocationServiceImpl wmsBaseLocationService; + private final WmsBaseLocationMapper wmsBaseLocationMapper; + /** * 查询区域基础信息 * @@ -168,6 +175,14 @@ public class WmsBaseAreaServiceImpl implements IWmsBaseAreaService { public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 + for (Long id : ids){ + WmsBaseLocationBo qurey = new WmsBaseLocationBo(); + qurey.setAreaId(id); + List wmsBaseLocationVos = wmsBaseLocationService.queryList(qurey); + if ( ! wmsBaseLocationVos.isEmpty()){ + throw new ServiceException("区域已绑定库位,请先取消绑定"); + } + } } return baseMapper.deleteByIds(ids) > 0; }