BF1991523 CopyFromBOM class not found
This commit is contained in:
parent
01a63d62dc
commit
98903ed276
|
|
@ -0,0 +1,98 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
|
* 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 *
|
||||||
|
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. *
|
||||||
|
* Contributor(s): Victor Perez www.e-evolution.com *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
package org.eevolution.process;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
|
import org.compiere.process.SvrProcess;
|
||||||
|
import org.compiere.util.AdempiereSystemError;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.eevolution.model.MPPProductBOM;
|
||||||
|
import org.eevolution.model.MPPProductBOMLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CopyFromBOM Process
|
||||||
|
* Copies BOM Lines from Selected BOM to the Current BOM
|
||||||
|
* The BOM being copied to must have no pre-existing BOM Lines
|
||||||
|
*
|
||||||
|
* @author Tony Snook
|
||||||
|
* @version $Id: CopyFromBOM.java,v 1.0 2008/07/04 05:24:03 tspc Exp $
|
||||||
|
*/
|
||||||
|
public class CopyFromBOM extends SvrProcess {
|
||||||
|
/** */
|
||||||
|
private int p_Record_ID = 0;
|
||||||
|
private int p_PP_Product_BOM_ID = 0;
|
||||||
|
private int no = 0;
|
||||||
|
private Properties ctx = Env.getCtx();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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("PP_Product_BOM_ID"))
|
||||||
|
p_PP_Product_BOM_ID = para[i].getParameterAsInt();
|
||||||
|
else
|
||||||
|
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
|
||||||
|
}
|
||||||
|
p_Record_ID = getRecord_ID();
|
||||||
|
|
||||||
|
} // prepare
|
||||||
|
|
||||||
|
protected String doIt() throws Exception {
|
||||||
|
|
||||||
|
log.info("From PP_Product_BOM_ID=" + p_PP_Product_BOM_ID + " to " + p_Record_ID);
|
||||||
|
if (p_Record_ID == 0)
|
||||||
|
throw new IllegalArgumentException("Target PP_Product_BOM_ID == 0");
|
||||||
|
if (p_PP_Product_BOM_ID == 0)
|
||||||
|
throw new IllegalArgumentException("Source PP_Product_BOM_ID == 0");
|
||||||
|
|
||||||
|
MPPProductBOM fromBom = new MPPProductBOM(ctx, p_PP_Product_BOM_ID, get_TrxName());
|
||||||
|
MPPProductBOM toBOM = new MPPProductBOM(ctx, p_Record_ID, get_TrxName());
|
||||||
|
if (toBOM.getLines().length > 0)
|
||||||
|
throw new AdempiereSystemError("@Error@ Existing BOM Line(s)");
|
||||||
|
|
||||||
|
MPPProductBOMLine[] frombomlines = fromBom.getLines();
|
||||||
|
for (MPPProductBOMLine frombomline : frombomlines) {
|
||||||
|
MPPProductBOMLine tobomline = new MPPProductBOMLine(ctx, 0, get_TrxName());
|
||||||
|
MPPProductBOMLine.copyValues(frombomline, tobomline);
|
||||||
|
tobomline.setPP_Product_BOM_ID(toBOM.getPP_Product_BOM_ID());
|
||||||
|
tobomline.save();
|
||||||
|
++no;
|
||||||
|
}
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post process actions (outside trx).
|
||||||
|
*
|
||||||
|
* @param success true if the process was success
|
||||||
|
* @since 3.1.4
|
||||||
|
*/
|
||||||
|
protected void postProcess(boolean success) {
|
||||||
|
|
||||||
|
this.addLog("@Copied@=" + no);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
-- Jul 4, 2008 6:11:43 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Process SET Help='This process copies BOM Lines from the Selected BOM to the Current BOM. The BOM being copied to must have any existing BOM Lines',
|
||||||
|
Updated=TO_DATE('2008-07-04 18:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53004
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 5, 2008 4:51:47 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Field SET IsCentrallyMaintained='N', Name='Copy BOM Lines From', Description='Copy BOM Lines from an exising BOM', Help='Copy BOM Lines from an exising BOM. The BOM being copied to, must not have any existing BOM Lines.',Updated=TO_DATE('2008-07-05 16:51:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53480
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 5, 2008 4:51:47 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=53480
|
||||||
|
;
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
-- Jul 4, 2008 6:11:43 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Process SET Help='This process copies BOM Lines from the Selected BOM to the Current BOM. The BOM being copied to must have any existing BOM Lines',
|
||||||
|
Updated=TO_TIMESTAMP('2008-07-04 18:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53004
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 5, 2008 4:51:47 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Field SET IsCentrallyMaintained='N', Name='Copy BOM Lines From', Description='Copy BOM Lines from an exising BOM', Help='Copy BOM Lines from an exising BOM. The BOM being copied to, must not have any existing BOM Lines.',Updated=TO_TIMESTAMP('2008-07-05 16:51:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53480
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 5, 2008 4:51:47 PM EST
|
||||||
|
-- Default comment for updating dictionary
|
||||||
|
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=53480
|
||||||
|
;
|
||||||
Loading…
Reference in New Issue