Search in sources :

Example 6 with I_M_HU_PI_Item_Product

use of de.metas.handlingunits.model.I_M_HU_PI_Item_Product in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_PickQtyToNewHU method getParameterDefaultValue.

/**
 * Returns the {@code qtyToDeliver} value of the currently selected shipment schedule, or {@code null}.
 */
@Override
public Object getParameterDefaultValue(@NonNull final IProcessDefaultParameter parameter) {
    if (Objects.equals(PARAM_QTY_CU, parameter.getColumnName())) {
        // can't be null
        final I_M_ShipmentSchedule shipmentSchedule = getView().getCurrentShipmentSchedule();
        final BigDecimal qtyPickedPlanned = Services.get(IPackagingDAO.class).retrieveQtyPickedPlannedOrNull(shipmentSchedule);
        if (qtyPickedPlanned == null) {
            return BigDecimal.ZERO;
        }
        final BigDecimal qtyToPick = shipmentSchedule.getQtyToDeliver().subtract(qtyPickedPlanned);
        return qtyToPick.signum() > 0 ? qtyToPick : BigDecimal.ZERO;
    } else if (Objects.equals(PARAM_M_HU_PI_Item_Product_ID, parameter.getColumnName())) {
        final I_M_ShipmentSchedule shipmentSchedule = getView().getCurrentShipmentSchedule();
        final I_M_HU_PI_Item_Product huPIItemProduct = shipmentSchedule.getM_HU_PI_Item_Product();
        if (huPIItemProduct == null) {
            return IProcessDefaultParametersProvider.DEFAULT_VALUE_NOTAVAILABLE;
        }
        return IntegerLookupValue.of(huPIItemProduct.getM_HU_PI_Item_Product_ID(), huPIItemProduct.getName());
    }
    return DEFAULT_VALUE_NOTAVAILABLE;
}
Also used : IPackagingDAO(de.metas.inoutcandidate.api.IPackagingDAO) I_M_HU_PI_Item_Product(de.metas.handlingunits.model.I_M_HU_PI_Item_Product) I_M_ShipmentSchedule(de.metas.handlingunits.model.I_M_ShipmentSchedule) BigDecimal(java.math.BigDecimal)

Example 7 with I_M_HU_PI_Item_Product

use of de.metas.handlingunits.model.I_M_HU_PI_Item_Product in project metasfresh-webui-api by metasfresh.

the class ForecastLineQuickInputProcessor method createAndInitHuPackingAware.

private PlainHUPackingAware createAndInitHuPackingAware(@NonNull final I_M_Forecast forecast, @NonNull final IForecastLineQuickInput quickInput) {
    final PlainHUPackingAware huPackingAware = new PlainHUPackingAware();
    huPackingAware.setC_BPartner(forecast.getC_BPartner());
    huPackingAware.setDateOrdered(forecast.getDatePromised());
    huPackingAware.setInDispute(false);
    final ProductAndAttributes productAndAttributes = ProductLookupDescriptor.toProductAndAttributes(quickInput.getM_Product_ID());
    final I_M_Product product = load(productAndAttributes.getProductId(), I_M_Product.class);
    huPackingAware.setM_Product_ID(product.getM_Product_ID());
    huPackingAware.setC_UOM(product.getC_UOM());
    huPackingAware.setM_AttributeSetInstance_ID(createASI(productAndAttributes));
    final I_M_HU_PI_Item_Product piItemProduct = quickInput.getM_HU_PI_Item_Product();
    huPackingAware.setM_HU_PI_Item_Product(piItemProduct);
    return huPackingAware;
}
Also used : PlainHUPackingAware(de.metas.adempiere.gui.search.impl.PlainHUPackingAware) I_M_Product(org.compiere.model.I_M_Product) I_M_HU_PI_Item_Product(de.metas.handlingunits.model.I_M_HU_PI_Item_Product) ProductAndAttributes(de.metas.ui.web.window.descriptor.sql.ProductLookupDescriptor.ProductAndAttributes)

Aggregations

I_M_HU_PI_Item_Product (de.metas.handlingunits.model.I_M_HU_PI_Item_Product)7 PlainHUPackingAware (de.metas.adempiere.gui.search.impl.PlainHUPackingAware)2 I_M_HU_PI (de.metas.handlingunits.model.I_M_HU_PI)2 I_M_HU_PI_Item (de.metas.handlingunits.model.I_M_HU_PI_Item)2 ProductAndAttributes (de.metas.ui.web.window.descriptor.sql.ProductLookupDescriptor.ProductAndAttributes)2 BigDecimal (java.math.BigDecimal)2 I_M_Product (org.compiere.model.I_M_Product)2 IHUPIItemProductDAO (de.metas.handlingunits.IHUPIItemProductDAO)1 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)1 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)1 I_M_HU_PI_Version (de.metas.handlingunits.model.I_M_HU_PI_Version)1 I_M_ShipmentSchedule (de.metas.handlingunits.model.I_M_ShipmentSchedule)1 IPackagingDAO (de.metas.inoutcandidate.api.IPackagingDAO)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1 ISysConfigBL (org.adempiere.service.ISysConfigBL)1