opt: 二次分配任务优化
This commit is contained in:
@@ -229,43 +229,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchBasePoint selectByRegionCode(String region_code,String vehicleCode) {
|
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);
|
|
||||||
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<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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
|
||||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||||
@@ -306,4 +269,53 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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("载具类型不存在!");
|
||||||
|
//查询满足条件的站点
|
||||||
|
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 = 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<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 = 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user