use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class CRPDatasetFactory method calculateLoad.
public BigDecimal calculateLoad(Timestamp dateTime, MResource r, String docStatus) {
MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
MUOM uom = MUOM.get(Env.getCtx(), t.getC_UOM_ID());
BigDecimal qtyOpen;
long millis = 0l;
for (MPPOrderNode node : getPPOrderNodes(dateTime, r)) {
if (docStatus != null) {
MPPOrder o = new MPPOrder(node.getCtx(), node.getPP_Order_ID(), node.get_TrxName());
if (!o.getDocStatus().equals(docStatus)) {
continue;
}
}
millis += calculateMillisForDay(dateTime, node, t);
}
// Pre-converts to minutes, because its the lowest time unit of compiere
BigDecimal scale = new BigDecimal(1000 * 60);
BigDecimal minutes = new BigDecimal(millis).divide(scale, 2, BigDecimal.ROUND_HALF_UP);
return convert(minutes);
}
Aggregations