IDEMPIERE-2410 Add Phase parameter to Generate PO from Project process

This commit is contained in:
Chuck Boecking 2015-02-04 09:18:05 -05:00
parent 327abc2269
commit f8b1bc586e
2 changed files with 34 additions and 1 deletions

View File

@ -40,6 +40,8 @@ public class ProjectGenPO extends SvrProcess
/** Project Parameter */
private int m_C_Project_ID = 0;
/** Opt Project Line Parameter */
private int m_C_ProjectPhase_ID = 0;
/** Opt Project Line Parameter */
private int m_C_ProjectLine_ID = 0;
/** Consolidate Document */
private boolean m_ConsolidateDocument = true;
@ -59,6 +61,8 @@ public class ProjectGenPO extends SvrProcess
;
else if (name.equals("C_Project_ID"))
m_C_Project_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("C_ProjectPhase_ID"))
m_C_ProjectPhase_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("C_ProjectLine_ID"))
m_C_ProjectLine_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("ConsolidateDocument"))
@ -82,6 +86,13 @@ public class ProjectGenPO extends SvrProcess
MProject project = new MProject (getCtx(), projectLine.getC_Project_ID(), get_TrxName());
createPO (project, projectLine);
}
else if (m_C_ProjectPhase_ID != 0)
{
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
MProjectLine[] lines = project.getPhaseLines(m_C_ProjectPhase_ID);
for (int i = 0; i < lines.length; i++)
createPO (project, lines[i]);
}
else
{
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
@ -187,7 +198,12 @@ public class ProjectGenPO extends SvrProcess
// update ProjectLine
projectLine.setC_OrderPO_ID(order.getC_Order_ID());
projectLine.saveEx();
addLog (projectLine.getLine(), null, projectLine.getPlannedQty(), order.getDocumentNo());
addLog (order.getC_Order_ID(),
order.getDateOrdered(),
new BigDecimal(orderLine.getLine()),
"Order:"+order.getDocumentNo()+" Line:"+orderLine.getLine(),
order.get_Table_ID(),
order.getC_Order_ID());
} // createPOfromProjectLine
} // ProjectGenPO

View File

@ -214,6 +214,23 @@ public class MProject extends X_C_Project
return retValue;
} // getLines
/**************************************************************************
* Get Project Lines from a Phase
* @return Array of lines from a Phase
*/
public MProjectLine[] getPhaseLines(int phase)
{
final String whereClause = "C_Project_ID=? and C_ProjectPhase_ID=?";
List <MProjectLine> list = new Query(getCtx(), I_C_ProjectLine.Table_Name, whereClause, get_TrxName())
.setParameters(getC_Project_ID(), phase)
.setOrderBy("Line")
.list();
//
MProjectLine[] retValue = new MProjectLine[list.size()];
list.toArray(retValue);
return retValue;
} // getPhaseLines
/**
* Get Project Issues
* @return Array of issues