Search in sources :

Example 1 with I_C_OrderLine

use of org.compiere.model.I_C_OrderLine in project adempiere by adempiere.

the class GenerateInOutBound method createBasedOnDemand.

private void createBasedOnDemand(MWMInOutBound outBoundOrder, List<MPPMRP> demands) {
    demands.stream().forEach(demand -> {
        MWMInOutBoundLine outBoundOrderLine = new MWMInOutBoundLine(outBoundOrder);
        outBoundOrderLine.setLine(getLineNo(outBoundOrder));
        outBoundOrderLine.setMovementQty(demand.getQty());
        outBoundOrderLine.setDescription(demand.getDescription());
        outBoundOrderLine.setPP_MRP_ID(demand.getPP_MRP_ID());
        outBoundOrderLine.setM_Product_ID(demand.getM_Product_ID());
        if (MPPMRP.ORDERTYPE_SalesOrder.equals(demand.getOrderType())) {
            I_C_OrderLine orderLine = demand.getC_OrderLine();
            outBoundOrderLine.setC_OrderLine_ID(demand.getC_OrderLine_ID());
            outBoundOrderLine.setC_Order_ID(demand.getC_Order_ID());
            outBoundOrderLine.setC_UOM_ID(orderLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderLine.getM_AttributeSetInstance_ID());
        }
        if (MPPMRP.ORDERTYPE_DistributionOrder.equals(demand.getOrderType())) {
            I_DD_OrderLine orderLine = demand.getDD_OrderLine();
            outBoundOrderLine.setDD_Order_ID(demand.getDD_Order_ID());
            outBoundOrderLine.setDD_OrderLine_ID(demand.getDD_OrderLine_ID());
            outBoundOrderLine.setC_UOM_ID(orderLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderLine.getM_AttributeSetInstance_ID());
        }
        if (MPPMRP.ORDERTYPE_ManufacturingOrder.equals(demand.getOrderType())) {
            I_PP_Order_BOMLine orderBomLine = demand.getPP_Order_BOMLine();
            outBoundOrderLine.setPP_Order_ID(demand.getPP_Order_ID());
            outBoundOrderLine.setPP_Order_BOMLine_ID(demand.getPP_Order_BOMLine_ID());
            outBoundOrderLine.setC_UOM_ID(orderBomLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderBomLine.getM_AttributeSetInstance_ID());
        }
        outBoundOrderLine.setPickDate(outBoundOrder.getPickDate());
        outBoundOrderLine.setShipDate(outBoundOrder.getShipDate());
        outBoundOrderLine.saveEx();
    });
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) I_C_OrderLine(org.compiere.model.I_C_OrderLine) I_DD_OrderLine(org.eevolution.model.I_DD_OrderLine) I_PP_Order_BOMLine(org.eevolution.model.I_PP_Order_BOMLine)

Example 2 with I_C_OrderLine

use of org.compiere.model.I_C_OrderLine in project adempiere by adempiere.

the class AbstractCostingMethod method createCostDetails.

protected List<MCostDetail> createCostDetails() {
    final String idColumnName;
    if (model instanceof MMatchPO) {
        idColumnName = I_C_OrderLine.COLUMNNAME_C_OrderLine_ID;
    } else if (model instanceof MMatchInv) {
        idColumnName = I_C_InvoiceLine.COLUMNNAME_C_InvoiceLine_ID;
    } else {
        idColumnName = model.get_TableName() + "_ID";
    }
    List<MCostDetail> list = new ArrayList<MCostDetail>();
    if (model.isSOTrx() == true || model instanceof MInventoryLine || model instanceof MMovementLine) {
        List<CostComponent> costComponents = getCalculatedCosts();
        for (CostComponent costComponent : costComponents) {
            MCostDetail cost = new MCostDetail(transaction, accountSchema.getC_AcctSchema_ID(), dimension.getM_CostType_ID(), dimension.getM_CostElement_ID(), costComponent.getAmount(), Env.ZERO, costComponent.getQty(), model.get_TrxName());
            if (!cost.set_ValueOfColumnReturningBoolean(idColumnName, model.get_ID()))
                throw new AdempiereException("Cannot set " + idColumnName);
            StringBuilder description = new StringBuilder();
            if (!Util.isEmpty(model.getDescription(), true))
                description.append(model.getDescription());
            if (model.isSOTrx() != false) {
                description.append(model.isSOTrx() ? "(|->)" : "(|<-)");
            }
            if (// TODO: need evaluate anca
            model.isSOTrx() != false)
                cost.setIsSOTrx(model.isSOTrx());
            else
                cost.setIsSOTrx(model.isSOTrx());
            cost.setM_Transaction_ID(transaction.get_ID());
            cost.setDescription(description.toString());
            cost.saveEx();
            list.add(cost);
        }
    } else // qty and amt is take from documentline
    {
        MCostDetail cost = new MCostDetail(transaction, accountSchema.getC_AcctSchema_ID(), dimension.getM_CostType_ID(), dimension.getM_CostElement_ID(), costThisLevel.multiply(model.getMovementQty()), Env.ZERO, model.getMovementQty(), model.get_TrxName());
        int id;
        if (model instanceof MMatchPO) {
            I_M_InOutLine inOutLine = transaction.getM_InOutLine();
            I_C_OrderLine orderLine = inOutLine.getC_OrderLine();
            id = orderLine.getC_OrderLine_ID();
        } else {
            id = model.get_ID();
        }
        if (!cost.set_ValueOfColumnReturningBoolean(idColumnName, id))
            throw new AdempiereException("Cannot set " + idColumnName);
        if (model.isSOTrx() != false)
            cost.setIsSOTrx(model.isSOTrx());
        else
            cost.setIsSOTrx(model.isSOTrx());
        cost.setM_Transaction_ID(transaction.get_ID());
        cost.saveEx();
        list.add(cost);
    }
    return list;
}
Also used : MMatchPO(org.compiere.model.MMatchPO) MInventoryLine(org.compiere.model.MInventoryLine) I_M_InOutLine(org.compiere.model.I_M_InOutLine) ArrayList(java.util.ArrayList) I_C_OrderLine(org.compiere.model.I_C_OrderLine) AdempiereException(org.adempiere.exceptions.AdempiereException) MMatchInv(org.compiere.model.MMatchInv) MCostDetail(org.compiere.model.MCostDetail) MMovementLine(org.compiere.model.MMovementLine)

Aggregations

I_C_OrderLine (org.compiere.model.I_C_OrderLine)2 ArrayList (java.util.ArrayList)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 I_M_InOutLine (org.compiere.model.I_M_InOutLine)1 MCostDetail (org.compiere.model.MCostDetail)1 MInventoryLine (org.compiere.model.MInventoryLine)1 MMatchInv (org.compiere.model.MMatchInv)1 MMatchPO (org.compiere.model.MMatchPO)1 MMovementLine (org.compiere.model.MMovementLine)1 I_DD_OrderLine (org.eevolution.model.I_DD_OrderLine)1 I_PP_Order_BOMLine (org.eevolution.model.I_PP_Order_BOMLine)1 MWMInOutBoundLine (org.eevolution.model.MWMInOutBoundLine)1