IDEMPIERE-570 Doc_Production - production posting problems
This commit is contained in:
parent
234b3caa2a
commit
516b6893c2
|
@ -0,0 +1,28 @@
|
|||
-- Apr 23, 2013 8:44:22 PM COT
|
||||
-- IDEMPIERE-570 Doc_Production - production posting problems
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3609
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:44:35 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6537
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:44:57 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59961
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:45:05 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:45:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4752
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 9:08:12 PM COT
|
||||
UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 9:08:21 PM COT
|
||||
UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=326
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304232046_IDEMPIERE-570.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
-- Apr 23, 2013 8:44:22 PM COT
|
||||
-- IDEMPIERE-570 Doc_Production - production posting problems
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3609
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:44:35 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6537
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:44:57 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59961
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 8:45:05 PM COT
|
||||
UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:45:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4752
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 9:08:12 PM COT
|
||||
UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
|
||||
;
|
||||
|
||||
-- Apr 23, 2013 9:08:21 PM COT
|
||||
UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=326
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304232046_IDEMPIERE-570.sql') FROM dual
|
||||
;
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
|
||||
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet.ext.net@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default"/>
|
||||
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet.ext.net@default:default,org.restlet.ext.ssl@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default"/>
|
||||
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.plugin.utils@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.fitrecorder@default:default,org.w3c.dom.fragment@default:false"/>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.eevolution.model.MPPProductBOMLine;
|
|||
* @author victor.perez@e-evolution.com
|
||||
* @contributor: Carlos Ruiz (globalqss) - review backward compatibility - implement mustBeStocked properly
|
||||
*/
|
||||
@Deprecated // replaced by ProductionProcess
|
||||
public class M_Production_Run extends SvrProcess {
|
||||
|
||||
/** The Record */
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.compiere.process;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MProduction;
|
||||
import org.compiere.model.MProductionLine;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
|
@ -84,7 +85,14 @@ public class ProductionProcess extends SvrProcess {
|
|||
m_production.setProcessed(true);
|
||||
|
||||
m_production.saveEx(get_TrxName());
|
||||
StringBuilder msgreturn = new StringBuilder().append(processed).append(" production lines were processed");
|
||||
|
||||
/* Immediate accounting */
|
||||
if (MClient.isClientAccountingImmediate()) {
|
||||
@SuppressWarnings("unused")
|
||||
String ignoreError = DocumentEngine.postImmediate(getCtx(), getAD_Client_ID(), m_production.get_Table_ID(), m_production.get_ID(), true, get_TrxName());
|
||||
}
|
||||
|
||||
StringBuilder msgreturn = new StringBuilder("@Processed@ #").append(processed);
|
||||
return msgreturn.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -520,12 +520,6 @@ public abstract class Doc
|
|||
p_Status = postLogic ();
|
||||
}
|
||||
}
|
||||
catch (AverageCostingNegativeQtyException e)
|
||||
{
|
||||
if (log.isLoggable(Level.INFO))log.log(Level.INFO, e.getLocalizedMessage(), e);
|
||||
p_Status = STATUS_NotPosted;
|
||||
p_Error = e.toString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
|
|
|
@ -157,59 +157,45 @@ public class Doc_Production extends Doc
|
|||
// Calculate Costs
|
||||
BigDecimal costs = null;
|
||||
|
||||
/* adaxa-pb don't use cost details
|
||||
// MZ Goodwill
|
||||
// if Production CostDetail exist then get Cost from Cost Detail
|
||||
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line.get_ID(), line.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd != null)
|
||||
if (cd != null) {
|
||||
costs = cd.getAmt();
|
||||
else
|
||||
*/
|
||||
{
|
||||
int variedHeader = 0;
|
||||
BigDecimal variance = null;
|
||||
} else {
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
|
||||
if (line.isProductionBOM() && line.getM_Production_ID() != variedHeader )
|
||||
}
|
||||
if (line.isProductionBOM())
|
||||
{
|
||||
// Get BOM Cost - Sum of individual lines
|
||||
BigDecimal bomCost = Env.ZERO;
|
||||
for (int ii = 0; ii < p_lines.length; ii++)
|
||||
{
|
||||
// Get BOM Cost - Sum of individual lines
|
||||
BigDecimal bomCost = Env.ZERO;
|
||||
for (int ii = 0; ii < p_lines.length; ii++)
|
||||
{
|
||||
DocLine line0 = p_lines[ii];
|
||||
if (line0.getM_Production_ID() != line.getM_Production_ID())
|
||||
continue;
|
||||
//pb changed this 20/10/06
|
||||
if (!line0.isProductionBOM())
|
||||
DocLine line0 = p_lines[ii];
|
||||
if (line0.getM_Production_ID() != line.getM_Production_ID())
|
||||
continue;
|
||||
//pb changed this 20/10/06
|
||||
if (!line0.isProductionBOM())
|
||||
bomCost = bomCost.add(line0.getProductCosts(as, line.getAD_Org_ID(), false).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
variance = (costs.setScale(2,BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
|
||||
//TODO use currency precision instead of hardcoded 2
|
||||
// get variance account
|
||||
int validCombination = MAcctSchemaDefault.get(getCtx(),
|
||||
as.get_ID()).getP_RateVariance_Acct();
|
||||
MAccount base = MAccount.get(getCtx(), validCombination);
|
||||
MAccount account = MAccount.get(getCtx(),as.getAD_Client_ID(),as.getAD_Org_ID(),
|
||||
as.get_ID(), base.getAccount_ID(), 0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
//
|
||||
// only post variance if it's not zero
|
||||
if (variance.signum() != 0)
|
||||
{
|
||||
//post variance
|
||||
fl = fact.createLine(line,
|
||||
account,
|
||||
as.getC_Currency_ID(), variance.negate());
|
||||
if (fl == null)
|
||||
{
|
||||
p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
}
|
||||
fl.setQty(Env.ZERO);
|
||||
}
|
||||
// costs = bomCost.negate();
|
||||
}
|
||||
else
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
|
||||
int precision = as.getStdPrecision();
|
||||
BigDecimal variance = (costs.setScale(precision, BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
|
||||
// only post variance if it's not zero
|
||||
if (variance.signum() != 0)
|
||||
{
|
||||
//post variance
|
||||
fl = fact.createLine(line,
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_RateVariance, as),
|
||||
as.getC_Currency_ID(), variance.negate());
|
||||
if (fl == null)
|
||||
{
|
||||
p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
}
|
||||
fl.setQty(Env.ZERO);
|
||||
}
|
||||
// costs = bomCost.negate();
|
||||
}
|
||||
// end MZ
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ public interface I_M_Production
|
|||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - Client - Org
|
||||
/** AccessLevel = 1 - Org
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(3);
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ public interface I_M_ProductionLine
|
|||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - Client - Org
|
||||
/** AccessLevel = 1 - Org
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(3);
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
|
|
|
@ -178,15 +178,15 @@ public class MCost extends X_M_Cost
|
|||
+ ", CostingMethod=" + cm
|
||||
+ ", Percent=" + percent);
|
||||
//
|
||||
if (currentCostPrice.signum() != 0 || currentCostPriceLL.signum() != 0)
|
||||
if (currentCostPrice != null && currentCostPrice.signum() != 0)
|
||||
{
|
||||
if (cm != null)
|
||||
{
|
||||
materialCostEach = materialCostEach.add(currentCostPrice).add(currentCostPriceLL);
|
||||
materialCostEach = materialCostEach.add(currentCostPrice);
|
||||
}
|
||||
else
|
||||
{
|
||||
otherCostEach = otherCostEach.add(currentCostPrice).add(currentCostPriceLL);
|
||||
otherCostEach = otherCostEach.add(currentCostPrice);
|
||||
}
|
||||
}
|
||||
if (percent != null && percent.signum() != 0)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20130317L;
|
||||
private static final long serialVersionUID = 20130423L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_Production (Properties ctx, int M_Production_ID, String trxName)
|
||||
|
@ -63,7 +63,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
|
|||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 3 - Client - Org
|
||||
* @return 1 - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ public class X_M_ProductionLine extends PO implements I_M_ProductionLine, I_Pers
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121031L;
|
||||
private static final long serialVersionUID = 20130423L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_ProductionLine (Properties ctx, int M_ProductionLine_ID, String trxName)
|
||||
|
@ -60,7 +60,7 @@ public class X_M_ProductionLine extends PO implements I_M_ProductionLine, I_Pers
|
|||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 3 - Client - Org
|
||||
* @return 1 - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue