Search in sources :

Example 1 with ProductsProposalRow

use of de.metas.ui.web.order.products_proposal.model.ProductsProposalRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_ProductsProposal_ShowProductsSoldToOtherCustomers method doIt.

@Override
protected String doIt() {
    final ProductsProposalView view = getView();
    final List<ProductsProposalRow> selectedRows = getSelectedRows();
    final ProductsProposalView otherSalesPricesView = otherSalePricesProductsProposalViewFactory.createView(view, selectedRows);
    afterCloseOpenView(otherSalesPricesView.getViewId());
    return MSG_OK;
}
Also used : ProductsProposalRow(de.metas.ui.web.order.products_proposal.model.ProductsProposalRow) ProductsProposalView(de.metas.ui.web.order.products_proposal.view.ProductsProposalView)

Example 2 with ProductsProposalRow

use of de.metas.ui.web.order.products_proposal.model.ProductsProposalRow in project metasfresh-webui-api by metasfresh.

the class OrderLinesFromProductProposalsProducer method produceInTrx.

private void produceInTrx() {
    final Properties ctx = Env.getCtx();
    final I_C_Order order = ordersRepo.getById(orderId);
    final ImmutableMap<OrderLineId, I_C_OrderLine> existingOrderLines = Maps.uniqueIndex(ordersRepo.retrieveOrderLines(orderId, I_C_OrderLine.class), orderLineRecord -> OrderLineId.ofRepoId(orderLineRecord.getC_OrderLine_ID()));
    for (final ProductsProposalRow row : rows) {
        final I_C_OrderLine existingOrderLine = row.getExistingOrderLineId() != null ? existingOrderLines.get(row.getExistingOrderLineId()) : null;
        if (existingOrderLine == null) {
            if (row.isQtySet()) {
                OrderFastInput.addOrderLine(ctx, order, orderLine -> updateOrderLine(order, orderLine, row));
            } else {
            // if qty is not set, don't create the row
            }
        } else {
            if (row.isQtySet()) {
                updateOrderLine(order, existingOrderLine, row);
                ordersRepo.save(existingOrderLine);
            } else {
                ordersRepo.delete(existingOrderLine);
            }
        }
    }
}
Also used : ProductsProposalRow(de.metas.ui.web.order.products_proposal.model.ProductsProposalRow) I_C_Order(org.compiere.model.I_C_Order) OrderLineId(de.metas.order.OrderLineId) Properties(java.util.Properties) I_C_OrderLine(org.compiere.model.I_C_OrderLine)

Aggregations

ProductsProposalRow (de.metas.ui.web.order.products_proposal.model.ProductsProposalRow)2 OrderLineId (de.metas.order.OrderLineId)1 ProductsProposalView (de.metas.ui.web.order.products_proposal.view.ProductsProposalView)1 Properties (java.util.Properties)1 I_C_Order (org.compiere.model.I_C_Order)1 I_C_OrderLine (org.compiere.model.I_C_OrderLine)1