use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class OtherSalePricesProductsProposalViewFactory method createView.
public final ProductsProposalView createView(@NonNull final ProductsProposalView parentView, @NonNull final List<ProductsProposalRow> selectedRows) {
final ImmutableSet<ProductId> productIds = selectedRows.stream().map(ProductsProposalRow::getProductId).collect(ImmutableSet.toImmutableSet());
final ProductsProposalRowsData rowsData = RowsLoader.builder().bpartnerProductStatsService(bpartnerProductStatsService).moneyService(moneyService).excludeBPartnerId(parentView.getBpartnerId().orElse(null)).productIds(productIds).build().load();
final ProductsProposalView view = ProductsProposalView.builder().windowId(getWindowId()).rowsData(rowsData).processes(getRelatedProcessDescriptors()).initialViewId(parentView.getInitialViewId()).build();
put(view);
return view;
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class ProductsToPickSourceStorage method retrieveStorage.
private ReservableStorage retrieveStorage(final ReservableStorageKey key) {
final ProductId productId = key.getProductId();
final I_M_HU hu = getHU(key.getHuId());
final IHUProductStorage huProductStorage = handlingUnitsBL.getStorageFactory().getStorage(hu).getProductStorageOrNull(productId);
if (huProductStorage == null) {
final I_C_UOM uom = productBL.getStockUOM(productId);
return new ReservableStorage(productId, Quantity.zero(uom));
} else {
final Quantity qtyFreeToReserve = huProductStorage.getQty();
return new ReservableStorage(productId, qtyFreeToReserve);
}
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class WEBUI_Picking_PickQtyToNewHU method getM_HU_PI_Item_Products.
/**
* @return a list of PI item products that match the selected shipment schedule's product and partner, sorted by name.
*/
@ProcessParamLookupValuesProvider(parameterName = PARAM_M_HU_PI_Item_Product_ID, dependsOn = {}, numericKey = true, lookupTableName = I_M_HU_PI_Item_Product.Table_Name)
private LookupValuesList getM_HU_PI_Item_Products() {
final Properties ctx = getCtx();
final I_M_ShipmentSchedule shipmentSchedule = getCurrentShipmentSchedule();
final ProductId productId = ProductId.ofRepoId(shipmentSchedule.getM_Product_ID());
return WEBUI_ProcessHelper.retrieveHUPIItemProducts(ctx, productId, Services.get(IShipmentScheduleEffectiveBL.class).getBPartnerId(shipmentSchedule), // includeVirtualItem = true..similar case as with production
true);
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class CableSalesOrderLineQuickInputProcessor method getBOMProductId.
private ProductId getBOMProductId(ICablesOrderLineQuickInput quickInputModel) {
final ProductId plugProduct1Id = ProductId.ofRepoId(quickInputModel.getPlug1_Product_ID());
final ProductId plugProduct2Id = ProductId.ofRepoId(quickInputModel.getPlug2_Product_ID());
final ProductId cableProductId = ProductId.ofRepoId(quickInputModel.getCable_Product_ID());
final IProductBOMDAO productBOMsRepo = Services.get(IProductBOMDAO.class);
final List<I_PP_Product_BOM> boms = productBOMsRepo.retrieveBOMsContainingExactProducts(plugProduct1Id.getRepoId(), cableProductId.getRepoId(), plugProduct2Id.getRepoId());
if (boms.isEmpty()) {
throw new AdempiereException("@NotFound@ @PP_Product_BOM_ID@");
} else if (boms.size() > 1) {
final String bomValues = boms.stream().map(I_PP_Product_BOM::getValue).collect(Collectors.joining(", "));
throw new AdempiereException("More than one BOMs found: " + bomValues);
} else {
final I_PP_Product_BOM bom = boms.get(0);
return ProductId.ofRepoId(bom.getM_Product_ID());
}
}
use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class CableSalesOrderLineQuickInputProcessor method updateOrderLine_CableProduct.
private final void updateOrderLine_CableProduct(final I_C_OrderLine newOrderLine, final ICablesOrderLineQuickInput fromQuickInputModel) {
final ProductId productId = getBOMProductId(fromQuickInputModel);
final BigDecimal cableLength = fromQuickInputModel.getCableLength();
if (cableLength.signum() <= 0) {
throw new FillMandatoryException(ICablesOrderLineQuickInput.COLUMNNAME_CableLength);
}
final BigDecimal qty = fromQuickInputModel.getQty();
if (qty.signum() <= 0) {
throw new FillMandatoryException(ICablesOrderLineQuickInput.COLUMNNAME_Qty);
}
final I_M_AttributeSetInstance asi = asiBL.createASIWithASFromProductAndInsertAttributeSet(productId, ImmutableAttributeSet.builder().attributeValue(CablesConstants.ATTRIBUTE_CableLength, cableLength).build());
newOrderLine.setM_Product_ID(productId.getRepoId());
newOrderLine.setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
newOrderLine.setQtyEntered(qty);
}
Aggregations