Search in sources :

Example 1 with ShipmentScheduleUserChangeRequestBuilder

use of de.metas.inoutcandidate.api.ShipmentScheduleUserChangeRequest.ShipmentScheduleUserChangeRequestBuilder in project metasfresh-webui-api by metasfresh.

the class ShipmentCandidateRow method createShipmentScheduleUserChangeRequest.

Optional<ShipmentScheduleUserChangeRequest> createShipmentScheduleUserChangeRequest() {
    final ShipmentScheduleUserChangeRequestBuilder builder = ShipmentScheduleUserChangeRequest.builder().shipmentScheduleId(shipmentScheduleId);
    boolean changes = false;
    if (qtyToDeliverUserEnteredInitial.compareTo(qtyToDeliverUserEntered) != 0) {
        BigDecimal qtyCUsToDeliver = packingInfo.computeQtyCUsByQtyUserEntered(qtyToDeliverUserEntered);
        builder.qtyToDeliverStockOverride(qtyCUsToDeliver);
        changes = true;
    }
    if (qtyToDeliverCatchOverrideIsChanged()) {
        builder.qtyToDeliverCatchOverride(qtyToDeliverCatchOverride);
        changes = true;
    }
    final AttributeSetInstanceId asiId = asi.getIdAs(AttributeSetInstanceId::ofRepoIdOrNone);
    if (!Objects.equals(asiIdInitial, asiId)) {
        builder.asiId(asiId);
        changes = true;
    }
    return changes ? Optional.of(builder.build()) : Optional.empty();
}
Also used : AttributeSetInstanceId(org.adempiere.mm.attributes.AttributeSetInstanceId) ShipmentScheduleUserChangeRequestBuilder(de.metas.inoutcandidate.api.ShipmentScheduleUserChangeRequest.ShipmentScheduleUserChangeRequestBuilder) BigDecimal(java.math.BigDecimal)

Aggregations

ShipmentScheduleUserChangeRequestBuilder (de.metas.inoutcandidate.api.ShipmentScheduleUserChangeRequest.ShipmentScheduleUserChangeRequestBuilder)1 BigDecimal (java.math.BigDecimal)1 AttributeSetInstanceId (org.adempiere.mm.attributes.AttributeSetInstanceId)1