|
|
@ -68,6 +68,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
@Autowired |
|
|
|
private ISysNoticeService noticeService; |
|
|
|
|
|
|
|
private final String nameClass = "SchBasePoint"; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) { |
|
|
|
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null; |
|
|
@ -240,7 +243,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
|
|
|
|
@Override |
|
|
|
@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); |
|
|
|
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::getPoint_status, pointStatus) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.isNull(seq == 2,SchBasePoint::getVehicles) |
|
|
|
.isNull(seq == 1,SchBasePoint::getVehicle_code) |
|
|
|
.isNull(seq == 2, SchBasePoint::getVehicles) |
|
|
|
.isNull(seq == 1, SchBasePoint::getVehicle_code) |
|
|
|
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code) |
|
|
|
.orderByAsc(seq == 2, SchBasePoint::getIn_order_seq)); |
|
|
|
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null; |
|
|
@ -386,49 +389,59 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
|
|
|
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) { |
|
|
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
|
.isNotNull(SchBasePoint::getVehicles) |
|
|
|
.orderByDesc(SchBasePoint::getIn_order_seq)); |
|
|
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 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; |
|
|
|
} |
|
|
|
synchronized (this.nameClass){ |
|
|
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.isNotNull(SchBasePoint::getVehicle_code)); |
|
|
|
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ |
|
|
|
return schBasePoints.get(0); |
|
|
|
} |
|
|
|
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)); |
|
|
|
/*schBasePoint.setIs_lock(true);*/ |
|
|
|
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)); |
|
|
|
schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
|
.eq(SchBasePoint::getIs_lock, false) |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getPoint_status, pointStatus) |
|
|
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type) |
|
|
|
.eq(SchBasePoint::getRegion_code, region_code) |
|
|
|
.isNotNull(SchBasePoint::getVehicles) |
|
|
|
.orderByDesc(SchBasePoint::getIn_order_seq)); |
|
|
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 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(); |
|
|
|
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)); |
|
|
|
schBasePoint1.setVehicle_code(s); |
|
|
|
return schBasePoint1; |
|
|
|
return null; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@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)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<String> getByRegionCode(String region_code) { |
|
|
|
List<String> list = pointMapper.selectByRegionCode(region_code); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PointMaterialInfo> getStructList(String region_code, String vehicle_type) { |
|
|
|
List<PointMaterialInfo> structList = pointMapper.getStructList(region_code, vehicle_type); |
|
|
|