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