refactor(wms): 完成退火选逻辑库位而不是实际库位

- 修改 WmsFurnacePlanLocationItemBo 中的 actualWarehouseId 字段为 warehouseId
- 更新验证注解消息从"实际库位"改为"逻辑库位"
- 修改 occupyActualWarehouse 方法为 occupyWarehouse 并调整参数
- 替换 ActualWarehouse 相关操作为 Warehouse 操作
- 在占用库位时同步更新 wmsfurnace_plan_coil 表中的逻辑库区信息
- 更新服务实现中所有相关字段引用和方法调用
This commit is contained in:
2026-03-16 16:45:52 +08:00
parent 4c26e708da
commit 95987d352c
2 changed files with 29 additions and 17 deletions

View File

@@ -16,6 +16,6 @@ public class WmsFurnacePlanLocationItemBo {
@NotNull(message = "钢卷ID不能为空")
private Long coilId;
@NotNull(message = "实际库位不能为空")
private Long actualWarehouseId;
@NotNull(message = "逻辑库位不能为空")
private Long warehouseId;
}

View File

@@ -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<Long, Long> 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.<WmsFurnacePlanCoil>lambdaQuery()
.eq(WmsFurnacePlanCoil::getPlanId, planId)
.eq(WmsFurnacePlanCoil::getCoilId, coilId)
//逻辑删除
.eq(WmsFurnacePlanCoil::getDelFlag, 0));
if (wmsFurnacePlanCoil != null && wmsFurnacePlanCoil.getPlanCoilId() != null) {
planCoilMapper.update(null, Wrappers.<WmsFurnacePlanCoil>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);
}