Search in sources :

Example 1 with SaleOrderLineServiceSupplyChain

use of com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain in project axelor-open-suite by axelor.

the class SaleOrderController method updateStockReservationDate.

/**
 * Called from sale order view, on delivery date change. <br>
 * Update stock reservation date for each sale order line by calling {@link
 * SaleOrderLineServiceSupplyChain#updateStockMoveReservationDateTime(SaleOrderLine)}.
 *
 * @param request
 * @param response
 */
public void updateStockReservationDate(ActionRequest request, ActionResponse response) {
    try {
        SaleOrder saleOrder = request.getContext().asType(SaleOrder.class);
        saleOrder = Beans.get(SaleOrderRepository.class).find(saleOrder.getId());
        for (SaleOrderLine saleOrderLine : saleOrder.getSaleOrderLineList()) {
            Beans.get(SaleOrderLineServiceSupplyChain.class).updateStockMoveReservationDateTime(saleOrderLine);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : SaleOrderLineServiceSupplyChain(com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain) SaleOrder(com.axelor.apps.sale.db.SaleOrder) SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) AxelorException(com.axelor.exception.AxelorException)

Example 2 with SaleOrderLineServiceSupplyChain

use of com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain in project axelor-open-suite by axelor.

the class SaleOrderLineController method checkInvoicedOrDeliveredOrderQty.

public void checkInvoicedOrDeliveredOrderQty(ActionRequest request, ActionResponse response) {
    SaleOrderLine saleOrderLine = request.getContext().asType(SaleOrderLine.class);
    SaleOrderLineServiceSupplyChain saleOrderLineService = Beans.get(SaleOrderLineServiceSupplyChain.class);
    BigDecimal qty = saleOrderLineService.checkInvoicedOrDeliveredOrderQty(saleOrderLine);
    saleOrderLineService.updateDeliveryState(saleOrderLine);
    response.setValue("qty", qty);
    response.setValue("deliveryState", saleOrderLine.getDeliveryState());
}
Also used : SaleOrderLineServiceSupplyChain(com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain) SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) BigDecimal(java.math.BigDecimal)

Example 3 with SaleOrderLineServiceSupplyChain

use of com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain in project axelor-open-suite by axelor.

the class SaleOrderLineController method updateReservationDate.

/**
 * Called from sale order line, on desired delivery date change. Call {@link
 * SaleOrderLineServiceSupplyChain#updateStockMoveReservationDateTime(SaleOrderLine)}.
 *
 * @param request
 * @param response
 */
public void updateReservationDate(ActionRequest request, ActionResponse response) {
    try {
        SaleOrderLine saleOrderLine = request.getContext().asType(SaleOrderLine.class);
        saleOrderLine = Beans.get(SaleOrderLineRepository.class).find(saleOrderLine.getId());
        Beans.get(SaleOrderLineServiceSupplyChain.class).updateStockMoveReservationDateTime(saleOrderLine);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : SaleOrderLineServiceSupplyChain(com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain) SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) AxelorException(com.axelor.exception.AxelorException)

Aggregations

SaleOrderLine (com.axelor.apps.sale.db.SaleOrderLine)3 SaleOrderLineServiceSupplyChain (com.axelor.apps.supplychain.service.SaleOrderLineServiceSupplyChain)3 AxelorException (com.axelor.exception.AxelorException)2 SaleOrder (com.axelor.apps.sale.db.SaleOrder)1 BigDecimal (java.math.BigDecimal)1