|
@ -68,6 +68,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISysNoticeService noticeService; |
|
|
private ISysNoticeService noticeService; |
|
|
|
|
|
|
|
|
|
|
|
private final String nameClass = "SchBasePoint"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) { |
|
|
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) { |
|
|
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null; |
|
|
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null; |
|
@ -240,7 +243,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode,String piont_type) { |
|
|
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) { |
|
|
//查询载具的类型
|
|
|
//查询载具的类型
|
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); |
|
|
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); |
|
|
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); |
|
@ -376,8 +379,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
.isNull(seq == 2,SchBasePoint::getVehicles) |
|
|
.isNull(seq == 2, SchBasePoint::getVehicles) |
|
|
.isNull(seq == 1,SchBasePoint::getVehicle_code) |
|
|
.isNull(seq == 1, SchBasePoint::getVehicle_code) |
|
|
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code) |
|
|
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code) |
|
|
.orderByAsc(seq == 2, SchBasePoint::getIn_order_seq)); |
|
|
.orderByAsc(seq == 2, SchBasePoint::getIn_order_seq)); |
|
|
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null; |
|
|
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null; |
|
@ -386,49 +389,59 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
|
|
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) { |
|
|
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) { |
|
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
synchronized (this.nameClass){ |
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
.isNotNull(SchBasePoint::getVehicles) |
|
|
.isNotNull(SchBasePoint::getVehicle_code)); |
|
|
.orderByDesc(SchBasePoint::getIn_order_seq)); |
|
|
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ |
|
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) { |
|
|
return schBasePoints.get(0); |
|
|
SchBasePoint schBasePoint = schBasePoints.get(0); |
|
|
|
|
|
if (schBasePoints.size() == 1 && isVehicle) { |
|
|
|
|
|
if (schBasePoint.getVehicle_qty() == 1) { |
|
|
|
|
|
task.setRemark("没有多余空笼框,待补充!"); |
|
|
|
|
|
taskService.updateById(task); |
|
|
|
|
|
// 消息通知
|
|
|
|
|
|
noticeService.createNotice("没有多余空笼框,待补充!", task.getConfig_code() + task.getTask_code(), |
|
|
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
Gson gson = new Gson(); |
|
|
schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
Type setType = new TypeToken<List<String>>() { |
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
}.getType(); |
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
List<String> msg = gson.fromJson(schBasePoint.getVehicles(), setType); |
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
Integer vehicle_qty = schBasePoint.getVehicle_qty(); |
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
if (vehicle_qty != msg.size()) throw new BadRequestException("载具数量与载具编码数量不一致!"); |
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
String s = msg.get(msg.size() - 1); |
|
|
.isNotNull(SchBasePoint::getVehicles) |
|
|
schBasePoint.setVehicle_qty(vehicle_qty - 1); |
|
|
.orderByDesc(SchBasePoint::getIn_order_seq)); |
|
|
msg.remove(s); |
|
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) { |
|
|
schBasePoint.setVehicles(JSONUtil.toJsonStr(msg)); |
|
|
SchBasePoint schBasePoint = schBasePoints.get(0); |
|
|
/*schBasePoint.setIs_lock(true);*/ |
|
|
/*if (schBasePoints.size() == 1 && isVehicle) { |
|
|
this.updateById(schBasePoint); |
|
|
if (schBasePoint.getVehicle_qty() <= 1) { |
|
|
if (schBasePoint.getVehicle_qty() == 0) { |
|
|
task.setRemark("没有多余空笼框,待补充!"); |
|
|
update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
taskService.updateById(task); |
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code()) |
|
|
// 消息通知
|
|
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) |
|
|
noticeService.createNotice("没有多余空笼框,待补充!", task.getConfig_code() + task.getTask_code(), |
|
|
.set(SchBasePoint::getVehicles, null)); |
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
Gson gson = new Gson(); |
|
|
|
|
|
Type setType = new TypeToken<List<String>>() { |
|
|
|
|
|
}.getType(); |
|
|
|
|
|
List<String> msg = gson.fromJson(schBasePoint.getVehicles(), setType); |
|
|
|
|
|
Integer vehicle_qty = schBasePoint.getVehicle_qty(); |
|
|
|
|
|
if (vehicle_qty != msg.size()) throw new BadRequestException("载具数量与载具编码数量不一致!"); |
|
|
|
|
|
String s = msg.get(msg.size() - 1); |
|
|
|
|
|
schBasePoint.setVehicle_qty(vehicle_qty - 1); |
|
|
|
|
|
msg.remove(s); |
|
|
|
|
|
schBasePoint.setVehicles(JSONUtil.toJsonStr(msg)); |
|
|
|
|
|
this.updateById(schBasePoint); |
|
|
|
|
|
if (schBasePoint.getVehicle_qty() == 0) { |
|
|
|
|
|
update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code()) |
|
|
|
|
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) |
|
|
|
|
|
.set(SchBasePoint::getVehicles, null)); |
|
|
|
|
|
} |
|
|
|
|
|
SchBasePoint schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1)); |
|
|
|
|
|
schBasePoint1.setVehicle_code(s); |
|
|
|
|
|
return schBasePoint1; |
|
|
} |
|
|
} |
|
|
SchBasePoint schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1)); |
|
|
return null; |
|
|
schBasePoint1.setVehicle_code(s); |
|
|
|
|
|
return schBasePoint1; |
|
|
|
|
|
} |
|
|
} |
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -441,6 +454,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code).set(SchBasePoint::getIs_lock, true)); |
|
|
update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code).set(SchBasePoint::getIs_lock, true)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<String> getByRegionCode(String region_code) { |
|
|
|
|
|
List<String> list = pointMapper.selectByRegionCode(region_code); |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<PointMaterialInfo> getStructList(String region_code, String vehicle_type) { |
|
|
public List<PointMaterialInfo> getStructList(String region_code, String vehicle_type) { |
|
|
List<PointMaterialInfo> structList = pointMapper.getStructList(region_code, vehicle_type); |
|
|
List<PointMaterialInfo> structList = pointMapper.getStructList(region_code, vehicle_type); |
|
|