use of de.metas.bpartner.BPartnerId in project metasfresh-webui-api by metasfresh.
the class ProductsToPickRowsDataFactory method getBestBeforePolicy.
private ShipmentAllocationBestBeforePolicy getBestBeforePolicy(final AllocablePackageable packageable) {
final Optional<ShipmentAllocationBestBeforePolicy> bestBeforePolicy = packageable.getBestBeforePolicy();
if (bestBeforePolicy.isPresent()) {
return bestBeforePolicy.get();
}
final BPartnerId bpartnerId = packageable.getCustomerId();
return bpartnersService.getBestBeforePolicy(bpartnerId);
}
use of de.metas.bpartner.BPartnerId in project metasfresh-webui-api by metasfresh.
the class PickingSlotsClearingViewFactory method createPickingSlotQuery.
private static final PickingSlotQuery createPickingSlotQuery(@NonNull final DocumentFilterList filters) {
final PickingSlotQueryBuilder queryBuilder = PickingSlotQuery.builder();
final BPartnerId bpartnerId = PickingSlotsClearingViewFilters.getBPartnerId(filters);
if (bpartnerId != null) {
queryBuilder.assignedToBPartnerId(bpartnerId);
}
final String barcode = PickingSlotsClearingViewFilters.getPickingSlotBarcode(filters);
if (!Check.isEmpty(barcode, true)) {
queryBuilder.barcode(barcode);
}
return queryBuilder.build();
}
use of de.metas.bpartner.BPartnerId in project metasfresh-webui-api by metasfresh.
the class PickingSlotsClearingViewBasedProcess method createNewHUProducer.
protected final LUTUProducerDestination createNewHUProducer(@NonNull final PickingSlotRow pickingRow, @NonNull final I_M_HU_PI targetHUPI) {
final BPartnerId bpartnerId = BPartnerId.ofRepoIdOrNull(pickingRow.getBPartnerId());
final int bpartnerLocationId = pickingRow.getBPartnerLocationId();
final LocatorId locatorId = pickingRow.getPickingSlotLocatorId();
final I_M_Locator locator = Services.get(IWarehouseDAO.class).getLocatorById(locatorId, I_M_Locator.class);
if (!locator.isAfterPickingLocator()) {
throw new AdempiereException("Picking slot's locator is not an after picking locator: " + locator.getValue());
}
final LUTUProducerDestination lutuProducer = new LUTUProducerDestination();
lutuProducer.setBPartnerId(bpartnerId).setC_BPartner_Location_ID(bpartnerLocationId).setLocatorId(locatorId).setHUStatus(X_M_HU.HUSTATUS_Picked);
final String targetHuType = Services.get(IHandlingUnitsBL.class).getHU_UnitType(targetHUPI);
if (X_M_HU_PI_Version.HU_UNITTYPE_LoadLogistiqueUnit.equals(targetHuType)) {
lutuProducer.setLUPI(targetHUPI);
} else if (X_M_HU_PI_Version.HU_UNITTYPE_TransportUnit.equals(targetHuType)) {
lutuProducer.setNoLU();
lutuProducer.setTUPI(targetHUPI);
}
return lutuProducer;
}
use of de.metas.bpartner.BPartnerId in project metasfresh-webui-api by metasfresh.
the class ViewGeoLocationsRestController method retrieveGeoLocationsForBPartnerId.
private List<JsonViewRowGeoLocation> retrieveGeoLocationsForBPartnerId(final ImmutableSetMultimap<BPartnerId, DocumentId> rowIdsByBPartnerId) {
if (rowIdsByBPartnerId.isEmpty()) {
return ImmutableList.of();
}
final List<JsonViewRowGeoLocation> result = new ArrayList<>();
final ImmutableSet<BPartnerId> bpartnerIds = rowIdsByBPartnerId.keySet();
for (final GeographicalCoordinatesWithBPartnerLocationId bplCoordinates : bpartnersRepo.getGeoCoordinatesByBPartnerIds(bpartnerIds)) {
final BPartnerId bpartnerId = bplCoordinates.getBPartnerId();
final ImmutableSet<DocumentId> rowIds = rowIdsByBPartnerId.get(bpartnerId);
if (rowIds.isEmpty()) {
// shall not happen
logger.warn("Ignored unexpected bpartnerId={}. We have no rows for it.", bpartnerId);
continue;
}
final GeographicalCoordinates coordinate = bplCoordinates.getCoordinate();
for (final DocumentId rowId : rowIds) {
result.add(JsonViewRowGeoLocation.builder().rowId(rowId).latitude(coordinate.getLatitude()).longitude(coordinate.getLongitude()).build());
}
}
return result;
}
use of de.metas.bpartner.BPartnerId in project metasfresh-webui-api by metasfresh.
the class ViewGeoLocationsRestController method extractBPartnerIds.
private static final ImmutableSetMultimap<BPartnerId, DocumentId> extractBPartnerIds(final ViewResult rows, final GeoLocationDocumentDescriptor descriptor) {
final String locationColumnName = descriptor.getLocationColumnName();
final ImmutableSetMultimap.Builder<BPartnerId, DocumentId> rowIdsByBPartnerRepoId = ImmutableSetMultimap.builder();
for (final IViewRow row : rows.getPage()) {
final BPartnerId bpartnerId = BPartnerId.ofRepoIdOrNull(row.getFieldValueAsInt(locationColumnName, -1));
if (bpartnerId == null) {
continue;
}
final DocumentId rowId = row.getId();
rowIdsByBPartnerRepoId.put(bpartnerId, rowId);
}
return rowIdsByBPartnerRepoId.build();
}
Aggregations