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;
}
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;
}
Aggregations