diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 73c3f38..7a46bcc 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -229,13 +229,15 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code) - .eq(SchBasePoint::getIs_used, true).isNull(SchBasePoint::getIng_task_code)); - if(CollUtil.isEmpty(schBasePoints)) return null; - //TODO:货位有无货的三种状态: 无货,空料容,有货 - List collect = schBasePoints.stream().filter(schBasePoint -> schBasePoint.getIs_lock().equals(false)).collect(Collectors.toList()); - if(CollUtil.isNotEmpty(collect) && collect.size() > 0){ - SchBasePoint schBasePoint = collect.get(0); + //查询载具的类型 + MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); + if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); + //查询满足条件的站点 + List schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). + isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code) + .eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true)); + if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ + SchBasePoint schBasePoint = schBasePoints.get(0); schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setIs_lock(true); String currentUserId = SecurityUtils.getCurrentUserId(); @@ -245,18 +247,26 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). + isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()) + .eq(SchBasePoint::getIs_used, true)); + if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){ + SchBasePoint schBasePoint = schBasePoints.get(0); + schBasePoint.setVehicle_code(vehicleCode); + schBasePoint.setIs_lock(true); + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + schBasePoint.setUpdate_id(currentUserId); + schBasePoint.setUpdate_name(nickName); + schBasePoint.setUpdate_time(now); + updateById(schBasePoint); + return schBasePoint; } - if(ObjectUtil.isEmpty(can_vehicle_type)) return null; - List schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getCan_vehicle_type, can_vehicle_type) - .eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getIs_lock, true).isNull(SchBasePoint::getIng_task_code)); - if(ObjectUtil.isEmpty(schBasePoints1) || schBasePoints1.size() == 0) return null; - return schBasePoints1.get(0); + return null; } @Override @@ -274,7 +284,8 @@ public class SchBasePointServiceImpl extends ServiceImpl 0){ - SchBasePoint schBasePoint = schBasePoints.get(0); + SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point()); + if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setIs_lock(true); String currentUserId = SecurityUtils.getCurrentUserId(); @@ -291,7 +302,8 @@ public class SchBasePointServiceImpl extends ServiceImpl 0){ - SchBasePoint schBasePoint = schBasePoints.get(0); + SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point()); + if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setIs_lock(true); String currentUserId = SecurityUtils.getCurrentUserId();