refactor(wms): 完成退火选逻辑库位而不是实际库位
- 修改 WmsFurnacePlanLocationItemBo 中的 actualWarehouseId 字段为 warehouseId - 更新验证注解消息从"实际库位"改为"逻辑库位" - 修改 occupyActualWarehouse 方法为 occupyWarehouse 并调整参数 - 替换 ActualWarehouse 相关操作为 Warehouse 操作 - 在占用库位时同步更新 wmsfurnace_plan_coil 表中的逻辑库区信息 - 更新服务实现中所有相关字段引用和方法调用
This commit is contained in:
@@ -16,6 +16,6 @@ public class WmsFurnacePlanLocationItemBo {
|
|||||||
@NotNull(message = "钢卷ID不能为空")
|
@NotNull(message = "钢卷ID不能为空")
|
||||||
private Long coilId;
|
private Long coilId;
|
||||||
|
|
||||||
@NotNull(message = "实际库位不能为空")
|
@NotNull(message = "逻辑库位不能为空")
|
||||||
private Long actualWarehouseId;
|
private Long warehouseId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
|||||||
}
|
}
|
||||||
// 设置逻辑库区名称
|
// 设置逻辑库区名称
|
||||||
if (item.getLogicWarehouseId() != null) {
|
if (item.getLogicWarehouseId() != null) {
|
||||||
|
item.setLogicWarehouseId(item.getLogicWarehouseId());
|
||||||
item.setLogicWarehouseName(logicWarehouseMap.get(item.getLogicWarehouseId()));
|
item.setLogicWarehouseName(logicWarehouseMap.get(item.getLogicWarehouseId()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -317,17 +318,17 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
|||||||
throw new ServiceException("计划未绑定钢卷");
|
throw new ServiceException("计划未绑定钢卷");
|
||||||
}
|
}
|
||||||
if (locations == null || locations.isEmpty()) {
|
if (locations == null || locations.isEmpty()) {
|
||||||
throw new ServiceException("请先分配实际库位");
|
throw new ServiceException("请先分配逻辑库位");
|
||||||
}
|
}
|
||||||
java.util.Map<Long, Long> locationMap = locations.stream()
|
java.util.Map<Long, Long> locationMap = locations.stream()
|
||||||
.collect(Collectors.toMap(com.klp.domain.bo.WmsFurnacePlanLocationItemBo::getCoilId,
|
.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) {
|
for (WmsFurnacePlanCoilVo coil : coils) {
|
||||||
Long targetLocation = locationMap.get(coil.getCoilId());
|
Long targetLocation = locationMap.get(coil.getCoilId());
|
||||||
if (targetLocation == null) {
|
if (targetLocation == null) {
|
||||||
throw new ServiceException("钢卷" + coil.getEnterCoilNo() + "未分配库位");
|
throw new ServiceException("钢卷" + coil.getEnterCoilNo() + "未分配库位");
|
||||||
}
|
}
|
||||||
occupyActualWarehouse(coil.getCoilId(), targetLocation);
|
occupyWarehouse(planId, coil.getCoilId(), targetLocation);
|
||||||
}
|
}
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
WmsFurnacePlan update = new WmsFurnacePlan();
|
WmsFurnacePlan update = new WmsFurnacePlan();
|
||||||
@@ -357,25 +358,36 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
|||||||
.set(WmsMaterialCoil::getExclusiveStatus, 2));
|
.set(WmsMaterialCoil::getExclusiveStatus, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void occupyActualWarehouse(Long coilId, Long actualWarehouseId) {
|
private void occupyWarehouse(Long planId, Long coilId, Long warehouseId) {
|
||||||
if (actualWarehouseId == null) {
|
if (warehouseId == null) {
|
||||||
throw new ServiceException("实际库位不能为空");
|
throw new ServiceException("逻辑库位不能为空");
|
||||||
}
|
}
|
||||||
WmsActualWarehouse warehouse = actualWarehouseMapper.selectById(actualWarehouseId);
|
WmsWarehouse warehouse = warehouseMapper.selectById(warehouseId);
|
||||||
if (warehouse == null || warehouse.getDelFlag() != null && warehouse.getDelFlag() == 1) {
|
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("实际库位已被占用");
|
WmsWarehouse updateWarehouse = new WmsWarehouse();
|
||||||
}
|
updateWarehouse.setWarehouseId(warehouseId);
|
||||||
WmsActualWarehouse updateWarehouse = new WmsActualWarehouse();
|
|
||||||
updateWarehouse.setActualWarehouseId(actualWarehouseId);
|
|
||||||
updateWarehouse.setIsEnabled(0);
|
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();
|
WmsMaterialCoil updateCoil = new WmsMaterialCoil();
|
||||||
updateCoil.setCoilId(coilId);
|
updateCoil.setCoilId(coilId);
|
||||||
updateCoil.setActualWarehouseId(actualWarehouseId);
|
updateCoil.setWarehouseId(warehouseId);
|
||||||
updateCoil.setExclusiveStatus(0);
|
updateCoil.setExclusiveStatus(0);
|
||||||
materialCoilMapper.updateById(updateCoil);
|
materialCoilMapper.updateById(updateCoil);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user