|
|
@ -75,6 +75,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
|
|
|
|
private final Object lock = new Object(); |
|
|
|
|
|
|
|
private final Object lock2 = new Object(); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) { |
|
|
@ -249,42 +251,44 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) { |
|
|
|
//查询载具的类型
|
|
|
|
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::getPoint_type, piont_type) |
|
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_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); |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0); |
|
|
|
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!"); |
|
|
|
//分配载具类型相同的站点
|
|
|
|
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
|
.isNull(SchBasePoint::getVehicle_code) |
|
|
|
.eq(SchBasePoint::getPoint_type, piont_type) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); |
|
|
|
schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq()))); |
|
|
|
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) { |
|
|
|
SchBasePoint schBasePoint = schBasePoints1.get(0); |
|
|
|
schBasePoint.setVehicle_code(vehicleCode); |
|
|
|
schBasePoint.setIs_lock(true); |
|
|
|
return schBasePoint; |
|
|
|
synchronized (lock2) { |
|
|
|
//查询载具的类型
|
|
|
|
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::getPoint_type, piont_type) |
|
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_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); |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0); |
|
|
|
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!"); |
|
|
|
//分配载具类型相同的站点
|
|
|
|
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
|
.isNull(SchBasePoint::getVehicle_code) |
|
|
|
.eq(SchBasePoint::getPoint_type, piont_type) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); |
|
|
|
schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq()))); |
|
|
|
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) { |
|
|
|
SchBasePoint schBasePoint = schBasePoints1.get(0); |
|
|
|
schBasePoint.setVehicle_code(vehicleCode); |
|
|
|
schBasePoint.setIs_lock(true); |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -391,7 +395,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
|
.eq(SchBasePoint::getPoint_type, "1") |
|
|
|
.eq(StrUtil.isNotBlank(vehicle_type),SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.eq(StrUtil.isNotBlank(vehicle_type), SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.isNull(seq == 2, SchBasePoint::getVehicles) |
|
|
|
.isNull(seq == 1, SchBasePoint::getVehicle_code) |
|
|
|
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code) |
|
|
@ -428,10 +432,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
List<String> msg = new ArrayList<>(); |
|
|
|
String vehicles = schBasePoint.getVehicles(); |
|
|
|
boolean contains = vehicles.contains(","); |
|
|
|
if(contains){ |
|
|
|
if (contains) { |
|
|
|
String[] split = vehicles.split(","); |
|
|
|
msg = Arrays.asList(split); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
msg.add(vehicles); |
|
|
|
} |
|
|
|
Integer vehicle_qty = schBasePoint.getVehicle_qty(); |
|
|
@ -448,12 +452,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
.set(SchBasePoint::getVehicles, null)); |
|
|
|
} |
|
|
|
SchBasePoint schBasePoint1 = null; |
|
|
|
if(vehicle_qty == 1){ |
|
|
|
if (vehicle_qty == 1) { |
|
|
|
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1)); |
|
|
|
} |
|
|
|
if(ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("该货位不存在!"); |
|
|
|
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("该货位不存在!"); |
|
|
|
schBasePoint1.setVehicle_code(s); |
|
|
|
return schBasePoint1; |
|
|
|
} |
|
|
@ -523,7 +527,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
//查询满足条件的站点
|
|
|
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). |
|
|
|
isNotNull(SchBasePoint::getVehicle_code) |
|
|
|
.eq(StrUtil.isNotEmpty(region_code),SchBasePoint::getRegion_code, region_code) |
|
|
|
.eq(StrUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code) |
|
|
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue()) |
|
|
|
.in(SchBasePoint::getCan_vehicle_type, vehicleType) |
|
|
|
.eq(SchBasePoint::getIs_used, true)); |
|
|
|