diff --git a/klp-wms/src/main/java/com/klp/domain/bo/WmsFurnacePlanLocationItemBo.java b/klp-wms/src/main/java/com/klp/domain/bo/WmsFurnacePlanLocationItemBo.java index d060ff86..2498f498 100644 --- a/klp-wms/src/main/java/com/klp/domain/bo/WmsFurnacePlanLocationItemBo.java +++ b/klp-wms/src/main/java/com/klp/domain/bo/WmsFurnacePlanLocationItemBo.java @@ -16,6 +16,6 @@ public class WmsFurnacePlanLocationItemBo { @NotNull(message = "钢卷ID不能为空") private Long coilId; - @NotNull(message = "实际库位不能为空") - private Long actualWarehouseId; + @NotNull(message = "逻辑库位不能为空") + private Long warehouseId; } diff --git a/klp-wms/src/main/java/com/klp/service/impl/WmsFurnacePlanServiceImpl.java b/klp-wms/src/main/java/com/klp/service/impl/WmsFurnacePlanServiceImpl.java index fa9afaa7..6441c94c 100644 --- a/klp-wms/src/main/java/com/klp/service/impl/WmsFurnacePlanServiceImpl.java +++ b/klp-wms/src/main/java/com/klp/service/impl/WmsFurnacePlanServiceImpl.java @@ -220,6 +220,7 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService { } // 设置逻辑库区名称 if (item.getLogicWarehouseId() != null) { + item.setLogicWarehouseId(item.getLogicWarehouseId()); item.setLogicWarehouseName(logicWarehouseMap.get(item.getLogicWarehouseId())); } }); @@ -317,17 +318,17 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService { throw new ServiceException("计划未绑定钢卷"); } if (locations == null || locations.isEmpty()) { - throw new ServiceException("请先分配实际库位"); + throw new ServiceException("请先分配逻辑库位"); } java.util.Map locationMap = locations.stream() .collect(Collectors.toMap(com.klp.domain.bo.WmsFurnacePlanLocationItemBo::getCoilId, - com.klp.domain.bo.WmsFurnacePlanLocationItemBo::getActualWarehouseId, (a, b) -> a)); + com.klp.domain.bo.WmsFurnacePlanLocationItemBo::getWarehouseId, (a, b) -> a)); for (WmsFurnacePlanCoilVo coil : coils) { Long targetLocation = locationMap.get(coil.getCoilId()); if (targetLocation == null) { throw new ServiceException("钢卷" + coil.getEnterCoilNo() + "未分配库位"); } - occupyActualWarehouse(coil.getCoilId(), targetLocation); + occupyWarehouse(planId, coil.getCoilId(), targetLocation); } Date now = new Date(); WmsFurnacePlan update = new WmsFurnacePlan(); @@ -357,25 +358,36 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService { .set(WmsMaterialCoil::getExclusiveStatus, 2)); } - private void occupyActualWarehouse(Long coilId, Long actualWarehouseId) { - if (actualWarehouseId == null) { - throw new ServiceException("实际库位不能为空"); + private void occupyWarehouse(Long planId, Long coilId, Long warehouseId) { + if (warehouseId == null) { + throw new ServiceException("逻辑库位不能为空"); } - WmsActualWarehouse warehouse = actualWarehouseMapper.selectById(actualWarehouseId); + WmsWarehouse warehouse = warehouseMapper.selectById(warehouseId); if (warehouse == null || warehouse.getDelFlag() != null && warehouse.getDelFlag() == 1) { - throw new ServiceException("实际库位不存在"); + throw new ServiceException("逻辑库位不存在"); } - if (warehouse.getIsEnabled() != null && warehouse.getIsEnabled() == 0) { - throw new ServiceException("实际库位已被占用"); - } - WmsActualWarehouse updateWarehouse = new WmsActualWarehouse(); - updateWarehouse.setActualWarehouseId(actualWarehouseId); + + WmsWarehouse updateWarehouse = new WmsWarehouse(); + updateWarehouse.setWarehouseId(warehouseId); updateWarehouse.setIsEnabled(0); - actualWarehouseMapper.updateById(updateWarehouse); + warehouseMapper.updateById(updateWarehouse); + + // wmsfurnace_plan_coil也要插入这个去向的逻辑库区 + WmsFurnacePlanCoil wmsFurnacePlanCoil = planCoilMapper.selectOne(Wrappers.lambdaQuery() + .eq(WmsFurnacePlanCoil::getPlanId, planId) + .eq(WmsFurnacePlanCoil::getCoilId, coilId) + //逻辑删除 + .eq(WmsFurnacePlanCoil::getDelFlag, 0)); + + if (wmsFurnacePlanCoil != null && wmsFurnacePlanCoil.getPlanCoilId() != null) { + planCoilMapper.update(null, Wrappers.lambdaUpdate() + .eq(WmsFurnacePlanCoil::getPlanCoilId, wmsFurnacePlanCoil.getPlanCoilId()) + .set(WmsFurnacePlanCoil::getLogicWarehouseId, warehouseId)); + } WmsMaterialCoil updateCoil = new WmsMaterialCoil(); updateCoil.setCoilId(coilId); - updateCoil.setActualWarehouseId(actualWarehouseId); + updateCoil.setWarehouseId(warehouseId); updateCoil.setExclusiveStatus(0); materialCoilMapper.updateById(updateCoil); }