use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class PPOrderLinesLoader method createRowsForIssueProductSourceHUs.
private List<PPOrderLineRow> createRowsForIssueProductSourceHUs(WarehouseId warehouseId, @NonNull final List<PPOrderLineRow> bomLineRows) {
final ImmutableSet<ProductId> issueProductIds = bomLineRows.stream().filter(PPOrderLineRow::isIssue).map(PPOrderLineRow::getProductId).collect(ImmutableSet.toImmutableSet());
final ImmutableList.Builder<PPOrderLineRow> result = ImmutableList.builder();
final MatchingSourceHusQuery sourceHusQuery = MatchingSourceHusQuery.builder().productIds(issueProductIds).warehouseId(warehouseId).build();
for (final HuId sourceHUId : SourceHUsService.get().retrieveMatchingSourceHUIds(sourceHusQuery)) {
final HUEditorRow huEditorRow = huEditorRepo.retrieveForHUId(sourceHUId);
result.add(createRowForSourceHU(huEditorRow));
}
return result.build();
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class PickingSlotsClearingViewBasedProcess method retrieveQtyCU.
protected final BigDecimal retrieveQtyCU(@NonNull final I_M_HU hu) {
final IHUContext huContext = huContextFactory.createMutableHUContext();
final IHUStorage fromHUStorage = huContext.getHUStorageFactory().getStorage(hu);
final ProductId productId = fromHUStorage.getSingleProductIdOrNull();
if (productId == null) {
return BigDecimal.ZERO;
}
final IHUProductStorage productStorage = fromHUStorage.getProductStorage(productId);
return productStorage.getQty().toBigDecimal();
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class PackingInfoProcessParams method getM_HU_PI_Item_Products.
/**
* @return a list of PI item products that match the selected CU's product and partner, sorted by name.
*/
public LookupValuesList getM_HU_PI_Item_Products() {
final I_M_HU_LUTU_Configuration defaultLUTUConfig = getDefaultLUTUConfig();
final ProductId productId = ProductId.ofRepoId(defaultLUTUConfig.getM_Product_ID());
final BPartnerId bpartnerId = ILUTUConfigurationFactory.extractBPartnerIdOrNull(defaultLUTUConfig);
final boolean includeVirtualItem = !enforcePhysicalTU;
final LookupValuesList huPIItemProducts = WEBUI_ProcessHelper.retrieveHUPIItemProducts(Env.getCtx(), productId, bpartnerId, includeVirtualItem);
return huPIItemProducts;
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class PackingInfoProcessParams method insertPhysicalFallbackTU.
private void insertPhysicalFallbackTU(@NonNull final I_M_HU_LUTU_Configuration defaultLUTUConfig) {
final BPartnerId bpartnerId = ILUTUConfigurationFactory.extractBPartnerIdOrNull(defaultLUTUConfig);
final ProductId productId = ProductId.ofRepoId(defaultLUTUConfig.getM_Product_ID());
final List<I_M_HU_PI_Item_Product> availableHUPIItemProductRecords = WEBUI_ProcessHelper.retrieveHUPIItemProductRecords(Env.getCtx(), productId, bpartnerId, // includeVirtualItem == false
false);
Check.errorIf(availableHUPIItemProductRecords.isEmpty(), "There is no non-virtual M_HU_PI_Item_Product value for the given product and bPartner; product={}; bPartner={}", productId, bpartnerId);
final I_M_HU_PI_Item_Product pip = availableHUPIItemProductRecords.get(0);
defaultLUTUConfig.setM_HU_PI_Item_Product_ID(pip.getM_HU_PI_Item_Product_ID());
defaultLUTUConfig.setM_TU_HU_PI_ID(pip.getM_HU_PI_Item().getM_HU_PI_Version().getM_HU_PI_ID());
defaultLUTUConfig.setQtyCU(pip.getQty());
final List<I_M_HU_PI_Item> luPIItems = getAvailableLuPIItems(pip, bpartnerId);
if (luPIItems.isEmpty()) {
defaultLUTUConfig.setM_LU_HU_PI_Item(null);
defaultLUTUConfig.setM_LU_HU_PI(null);
} else {
final I_M_HU_PI_Item luPiItem = luPIItems.get(0);
defaultLUTUConfig.setM_LU_HU_PI_Item(luPiItem);
defaultLUTUConfig.setQtyTU(luPiItem.getQty());
defaultLUTUConfig.setM_LU_HU_PI_ID(luPiItem.getM_HU_PI_Version().getM_HU_PI_ID());
}
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class SqlHUEditorViewRepository method getSingleProductStorage.
private IHUProductStorage getSingleProductStorage(final I_M_HU hu) {
final IHUStorage huStorage = Services.get(IHandlingUnitsBL.class).getStorageFactory().getStorage(hu);
final ProductId productId = huStorage.getSingleProductIdOrNull();
if (productId == null) {
return null;
}
final IHUProductStorage productStorage = huStorage.getProductStorage(productId);
return productStorage;
}
Aggregations