IDEMPIERE-2412 Generate Production from Project with Phase - New Process / peer review - add migration script generated from 2pack provided by Chuck Boecking
This commit is contained in:
parent
ed11e5c626
commit
431c9d6d7d
|
@ -0,0 +1,31 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Feb 4, 2015 9:37:10 AM COT
|
||||
-- IDEMPIERE-2412 Generate Production from Project with Phase - New Process
|
||||
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200077,0,0,'Y',TO_DATE('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,'Generate Production from Project','Generate Production from Project Line(s)','N','C_Project_GenerateProduction','N','org.compiere.process.ProjectGenProduction','1','D',6,6,'N','N','Y','N','542a66f7-afe0-493e-90d4-a91e10f17ac8')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:10 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200118,0,0,'Y',TO_DATE('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,'Project','Financial Project','A Project allows you to track and control internal or external activities.',200077,10,19,'N',0,'Y','C_Project_ID','Y','D',208,'fd3854a0-4d69-46b6-9469-775f8f30a319','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200119,0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',200077,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'9ba5e0b9-e245-4129-9f67-55837f1092e1','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200120,0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Line','Task or step in a project','The Project Line indicates a unique project line.',200077,30,19,'N',174,0,'N','C_ProjectLine_ID','Y','D',1552,'67c806e3-f4ba-4fd2-a26a-3082a6c4ff64','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Menu (AD_Menu_ID,Name,Description,Action,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,AD_Process_ID,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200098,'Generate Production from Project','Generate Production from Project Line(s)','P',0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'N',200077,'N','N','D','Y','47d506b6-e2d4-4ec3-8df2-9b913c0864b0')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_TREENODEMM(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, Parent_ID, SeqNo, AD_Tree_ID, Node_ID)VALUES(0, 0, 0, 0, 160,5, 10, 200098)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201502040937_IDEMPIERE-2412.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
-- Feb 4, 2015 9:37:10 AM COT
|
||||
-- IDEMPIERE-2412 Generate Production from Project with Phase - New Process
|
||||
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200077,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,'Generate Production from Project','Generate Production from Project Line(s)','N','C_Project_GenerateProduction','N','org.compiere.process.ProjectGenProduction','1','D',6,6,'N','N','Y','N','542a66f7-afe0-493e-90d4-a91e10f17ac8')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:10 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200118,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,'Project','Financial Project','A Project allows you to track and control internal or external activities.',200077,10,19,'N',0,'Y','C_Project_ID','Y','D',208,'fd3854a0-4d69-46b6-9469-775f8f30a319','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200119,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',200077,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'9ba5e0b9-e245-4129-9f67-55837f1092e1','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200120,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Line','Task or step in a project','The Project Line indicates a unique project line.',200077,30,19,'N',174,0,'N','C_ProjectLine_ID','Y','D',1552,'67c806e3-f4ba-4fd2-a26a-3082a6c4ff64','N')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_Menu (AD_Menu_ID,Name,Description,"action",AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,AD_Process_ID,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200098,'Generate Production from Project','Generate Production from Project Line(s)','P',0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'N',200077,'N','N','D','Y','47d506b6-e2d4-4ec3-8df2-9b913c0864b0')
|
||||
;
|
||||
|
||||
-- Feb 4, 2015 9:37:11 AM COT
|
||||
INSERT INTO AD_TREENODEMM(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, Parent_ID, SeqNo, AD_Tree_ID, Node_ID)VALUES(0, 0, 0, 0, 160,5, 10, 200098)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201502040937_IDEMPIERE-2412.sql') FROM dual
|
||||
;
|
||||
|
|
@ -1,167 +1,170 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.process;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductPO;
|
||||
import org.compiere.model.MProduction;
|
||||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MProjectLine;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Generate Purchase Order from Project.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: ProjectGenPO.java,v 1.2 2006/07/30 00:51:01 jjanke Exp $
|
||||
*/
|
||||
public class ProjectGenProduction 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;
|
||||
|
||||
/**
|
||||
* Prepare - e.g., get Parameters.
|
||||
*/
|
||||
protected void prepare()
|
||||
{
|
||||
ProcessInfoParameter[] para = getParameter();
|
||||
for (int i = 0; i < para.length; i++)
|
||||
{
|
||||
String name = para[i].getParameterName();
|
||||
if (para[i].getParameter() == null)
|
||||
;
|
||||
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
|
||||
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
|
||||
}
|
||||
} // prepare
|
||||
|
||||
/**
|
||||
* Perform process.
|
||||
* @return Message
|
||||
* @throws Exception if not successful
|
||||
*/
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
if (log.isLoggable(Level.INFO)) log.info("doIt - C_Project_ID=" + m_C_Project_ID + " - C_ProjectLine_ID=" + m_C_ProjectLine_ID);
|
||||
if (m_C_ProjectLine_ID != 0)
|
||||
{
|
||||
MProjectLine projectLine = new MProjectLine(getCtx(), m_C_ProjectLine_ID, get_TrxName());
|
||||
MProject project = new MProject (getCtx(), projectLine.getC_Project_ID(), get_TrxName());
|
||||
createProduction (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++)
|
||||
createProduction (project, lines[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
|
||||
MProjectLine[] lines = project.getLines();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
createProduction (project, lines[i]);
|
||||
}
|
||||
return "";
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
* Create PO from Planned Amt/Qty
|
||||
* @param projectLine project line
|
||||
*/
|
||||
private void createProduction (MProject project, MProjectLine projectLine)
|
||||
{
|
||||
if (projectLine.getM_Product_ID() == 0)
|
||||
{
|
||||
addLog (project.getC_Project_ID(),
|
||||
project.getCreated(),
|
||||
new BigDecimal(0),
|
||||
"ISSUE: Line has no Product - ProjectLine:"+projectLine.getLine()+" Desc:"+projectLine.getDescription(),
|
||||
projectLine.get_Table_ID(),
|
||||
projectLine.getC_ProjectLine_ID());
|
||||
return;
|
||||
}
|
||||
|
||||
MProduct M_Product = new MProduct(getCtx(), projectLine.getM_Product_ID(), get_TrxName());
|
||||
if (!M_Product.isManufactured())
|
||||
{
|
||||
addLog (project.getC_Project_ID(),
|
||||
project.getCreated(),
|
||||
new BigDecimal(0),
|
||||
"ISSUE: Product is not manufactured - ProjectLine:"+projectLine.getLine()+" Desc:"+projectLine.getDescription(),
|
||||
projectLine.get_Table_ID(),
|
||||
projectLine.getC_ProjectLine_ID());
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO - need to add C_ProjectLine.M_Production_ID
|
||||
// if (projectLine.getM_Production_ID() != 0)
|
||||
// {
|
||||
// addLog (projectLine.getLine() ,null,null, "Line was produced previously");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Create to Production
|
||||
MProduction production = null;
|
||||
|
||||
// New Production Header
|
||||
production = new MProduction (projectLine);
|
||||
int AD_Org_ID = projectLine.getAD_Org_ID();
|
||||
if (AD_Org_ID == 0)
|
||||
{
|
||||
log.warning("createProductionfromProjectLine - AD_Org_ID=0");
|
||||
AD_Org_ID = Env.getAD_Org_ID(getCtx());
|
||||
if (AD_Org_ID != 0)
|
||||
projectLine.setAD_Org_ID(AD_Org_ID);
|
||||
}
|
||||
production.setC_BPartner_ID(project.getC_BPartner_ID());
|
||||
production.saveEx();
|
||||
|
||||
// update ProjectLine
|
||||
//TODO - need to add C_ProjectLine.M_Production_ID
|
||||
//projectLine.setM_Production_ID(production.getM_Production_ID());
|
||||
//projectLine.saveEx();
|
||||
|
||||
addLog (production.getM_Production_ID(),
|
||||
production.getMovementDate(),
|
||||
new BigDecimal(0),
|
||||
"Production:"+production.getDocumentNo(),
|
||||
production.get_Table_ID(),
|
||||
production.getM_Production_ID());
|
||||
} // createProductionfromProjectLine
|
||||
|
||||
} // ProjectGenProduction
|
||||
/**********************************************************************
|
||||
* This file is part of iDempiere ERP Open Source *
|
||||
* http://www.idempiere.org *
|
||||
* *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
**********************************************************************/
|
||||
package org.compiere.process;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProduction;
|
||||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MProjectLine;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
* Generate Production from Project.
|
||||
*
|
||||
* @author Chuck Boecking
|
||||
*/
|
||||
public class ProjectGenProduction 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;
|
||||
|
||||
/**
|
||||
* Prepare - e.g., get Parameters.
|
||||
*/
|
||||
protected void prepare()
|
||||
{
|
||||
ProcessInfoParameter[] para = getParameter();
|
||||
for (int i = 0; i < para.length; i++)
|
||||
{
|
||||
String name = para[i].getParameterName();
|
||||
if (para[i].getParameter() == null)
|
||||
;
|
||||
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
|
||||
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
|
||||
}
|
||||
} // prepare
|
||||
|
||||
/**
|
||||
* Perform process.
|
||||
* @return Message
|
||||
* @throws Exception if not successful
|
||||
*/
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
if (log.isLoggable(Level.INFO)) log.info("doIt - C_Project_ID=" + m_C_Project_ID + " - C_ProjectLine_ID=" + m_C_ProjectLine_ID);
|
||||
if (m_C_ProjectLine_ID != 0)
|
||||
{
|
||||
MProjectLine projectLine = new MProjectLine(getCtx(), m_C_ProjectLine_ID, get_TrxName());
|
||||
MProject project = new MProject (getCtx(), projectLine.getC_Project_ID(), get_TrxName());
|
||||
createProduction (project, projectLine);
|
||||
}
|
||||
else if (m_C_ProjectPhase_ID != 0)
|
||||
{
|
||||
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
|
||||
for (MProjectLine line : project.getPhaseLines(m_C_ProjectPhase_ID)) {
|
||||
if (line.isActive()) {
|
||||
createProduction (project, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
|
||||
for (MProjectLine line : project.getLines()) {
|
||||
if (line.isActive()) {
|
||||
createProduction (project, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
* Create PO from Planned Amt/Qty
|
||||
* @param projectLine project line
|
||||
*/
|
||||
private void createProduction (MProject project, MProjectLine projectLine)
|
||||
{
|
||||
if (projectLine.getM_Product_ID() == 0)
|
||||
{
|
||||
addLog (project.getC_Project_ID(),
|
||||
project.getCreated(),
|
||||
new BigDecimal(0),
|
||||
"ISSUE: Line has no Product - ProjectLine:"+projectLine.getLine()+" Desc:"+projectLine.getDescription(),
|
||||
projectLine.get_Table_ID(),
|
||||
projectLine.getC_ProjectLine_ID());
|
||||
return;
|
||||
}
|
||||
|
||||
MProduct M_Product = new MProduct(getCtx(), projectLine.getM_Product_ID(), get_TrxName());
|
||||
if (!M_Product.isManufactured())
|
||||
{
|
||||
addLog (project.getC_Project_ID(),
|
||||
project.getCreated(),
|
||||
new BigDecimal(0),
|
||||
"ISSUE: Product is not manufactured - ProjectLine:"+projectLine.getLine()+" Desc:"+projectLine.getDescription(),
|
||||
projectLine.get_Table_ID(),
|
||||
projectLine.getC_ProjectLine_ID());
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO - need to add C_ProjectLine.M_Production_ID
|
||||
// if (projectLine.getM_Production_ID() != 0)
|
||||
// {
|
||||
// addLog (projectLine.getLine() ,null,null, "Line was produced previously");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Create to Production
|
||||
MProduction production = null;
|
||||
|
||||
// New Production Header
|
||||
production = new MProduction (projectLine);
|
||||
int AD_Org_ID = projectLine.getAD_Org_ID();
|
||||
if (AD_Org_ID == 0)
|
||||
{
|
||||
log.warning("createProductionfromProjectLine - AD_Org_ID=0");
|
||||
AD_Org_ID = Env.getAD_Org_ID(getCtx());
|
||||
if (AD_Org_ID != 0)
|
||||
projectLine.setAD_Org_ID(AD_Org_ID);
|
||||
}
|
||||
production.setC_BPartner_ID(project.getC_BPartner_ID());
|
||||
production.saveEx();
|
||||
|
||||
// update ProjectLine
|
||||
//TODO - need to add C_ProjectLine.M_Production_ID
|
||||
//projectLine.setM_Production_ID(production.getM_Production_ID());
|
||||
//projectLine.saveEx();
|
||||
|
||||
addBufferLog (production.getM_Production_ID(),
|
||||
production.getMovementDate(),
|
||||
new BigDecimal(0),
|
||||
Msg.getElement(Env.getAD_Language(Env.getCtx()), "M_Production_ID", false)+":"+production.getDocumentNo(),
|
||||
production.get_Table_ID(),
|
||||
production.getM_Production_ID());
|
||||
} // createProductionfromProjectLine
|
||||
|
||||
} // ProjectGenProduction
|
||||
|
|
|
@ -26,7 +26,7 @@ public class MProduction extends X_M_Production implements DocAction {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2222265936552140706L;
|
||||
private static final long serialVersionUID = 8047044372956625013L;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -36,7 +36,7 @@ public class MProject extends X_C_Project
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6103964836289951325L;
|
||||
private static final long serialVersionUID = 8631795136761641303L;
|
||||
|
||||
/**
|
||||
* Create new Project by copying
|
||||
|
|
Loading…
Reference in New Issue