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,43 +229,6 @@ 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); - 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 collect.get(0); - } - String can_vehicle_type = null; - for (SchBasePoint schBasePoint : schBasePoints) { - can_vehicle_type = schBasePoint.getCan_vehicle_type(); - if(StrUtil.isNotEmpty(can_vehicle_type)) break; - } - 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); - } - - @Override - public SchBasePoint selectByPointCode(String start_device_code) { - return getById(start_device_code); - } - - @Override - public SchBasePoint selectByReassign(String region_code,String vehicleCode) { //查询载具的类型 MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); @@ -306,4 +269,53 @@ public class SchBasePointServiceImpl extends ServiceImpl 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 = 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(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + schBasePoint.setUpdate_id(currentUserId); + schBasePoint.setUpdate_name(nickName); + schBasePoint.setUpdate_time(now); + updateById(schBasePoint); + return schBasePoint; + } + //分配载具类型相同的站点 + List 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 = 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(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + schBasePoint.setUpdate_id(currentUserId); + schBasePoint.setUpdate_name(nickName); + schBasePoint.setUpdate_time(now); + updateById(schBasePoint); + return schBasePoint; + } + return null; + } + }