Prevent pickup

I use Shipment to solve multiple trips for vehicle.
Now jsprit return solution like this:

pickupShipment
pickupShipment
pickupShipment
pickupShipment
deliverShipment
deliverShipment
pickupShipment
pickupShipment
deliverShipment
deliverShipment
deliverShipment
deliverShipment

I try to prevent return to depot with HardActivityConstraint

if (isPickup(newAct) && isDepot(newAct.getLocation().getId()) && isDelivery(prevAct)) {
if (prevCapacity.get(WEIGHT_INDEX) != 0) {
return ConstraintsStatus.NOT_FULFILLED;
}
}
return ConstraintsStatus.FULFILLED;

but it not work…
Is there any way to limit pickup if vehicle has goods on board?

I have faced similar problem. I think it is simpler to just post-process the solution.\

i.e: If your solution is pickup1-pickup2-pickup3-delivery1-delivery3-pickup4-delivery4-delivery2
then move pickup2:
pickup1-pickup3-delivery1-delivery3-pickup4-pickup2-delivery4-delivery2