|
|
@ -229,13 +229,15 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
|
|
|
|
@Override |
|
|
|
public SchBasePoint selectByRegionCode(String region_code,String vehicleCode) { |
|
|
|
List<SchBasePoint> 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<SchBasePoint> 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<SchBasePoint> 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<SchBasePointMapper, Sch |
|
|
|
schBasePoint.setUpdate_name(nickName); |
|
|
|
schBasePoint.setUpdate_time(now); |
|
|
|
updateById(schBasePoint); |
|
|
|
return collect.get(0); |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
String can_vehicle_type = null; |
|
|
|
for (SchBasePoint schBasePoint : schBasePoints) { |
|
|
|
can_vehicle_type = schBasePoint.getCan_vehicle_type(); |
|
|
|
if(StrUtil.isNotEmpty(can_vehicle_type)) break; |
|
|
|
//分配载具类型相同的站点
|
|
|
|
List<SchBasePoint> 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<SchBasePoint> 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<SchBasePointMapper, Sch |
|
|
|
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 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<SchBasePointMapper, Sch |
|
|
|
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 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(); |
|
|
|