Fix get_Value part [ 1983672 ] Manufacturing: Don't use PO set/get methods

Safer approach
This commit is contained in:
Carlos Ruiz 2008-06-03 20:29:48 +00:00
parent a2b7c5c2dd
commit c291cc3a1b
10 changed files with 22 additions and 64 deletions

View File

@ -84,8 +84,8 @@ public class CreateGLAsset extends SvrProcess
pstmt = null; pstmt = null;
pstmt = DB.prepareStatement(sql,get_TrxName()); pstmt = DB.prepareStatement(sql,get_TrxName());
if(asset.getA_Asset_ID()==0) { if(asset.getA_Asset_ID()==0) {
Number groupId = (Number)JVLine.getA_Asset_Group_ID(); int groupId = JVLine.getA_Asset_Group_ID();
pstmt.setInt(1, groupId != null ? groupId.intValue() : 0); pstmt.setInt(1, groupId);
} else } else
pstmt.setInt(1, asset.getA_Asset_Group_ID()); pstmt.setInt(1, asset.getA_Asset_Group_ID());
ResultSet rs2 = pstmt.executeQuery(); ResultSet rs2 = pstmt.executeQuery();

View File

@ -102,8 +102,8 @@ public class CreateInvoicedAsset extends SvrProcess
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
pstmt1 = DB.prepareStatement(sqla,get_TrxName()); pstmt1 = DB.prepareStatement(sqla,get_TrxName());
if(asset.getA_Asset_ID()==0) { if(asset.getA_Asset_ID()==0) {
Number groupId = (Number)InvoiceLine.getA_Asset_Group_ID(); int groupId = InvoiceLine.getA_Asset_Group_ID();
pstmt1.setInt(1, groupId != null ? groupId.intValue() : 0); pstmt1.setInt(1, groupId);
} else } else
pstmt1.setInt(1, asset.getA_Asset_Group_ID()); pstmt1.setInt(1, asset.getA_Asset_Group_ID());
ResultSet rs2 = pstmt1.executeQuery(); ResultSet rs2 = pstmt1.executeQuery();

View File

@ -58,7 +58,7 @@ public class MAlertRecipient extends X_AD_AlertRecipient
*/ */
public int getAD_User_ID () public int getAD_User_ID ()
{ {
Integer ii = super.getAD_User_ID(); Integer ii = (Integer)get_Value("AD_User_ID");
if (ii == null) if (ii == null)
return -1; return -1;
return ii.intValue(); return ii.intValue();
@ -71,7 +71,7 @@ public class MAlertRecipient extends X_AD_AlertRecipient
*/ */
public int getAD_Role_ID () public int getAD_Role_ID ()
{ {
Integer ii = super.getAD_Role_ID(); Integer ii = (Integer)get_Value("AD_Role_ID");
if (ii == null) if (ii == null)
return -1; return -1;
return ii.intValue(); return ii.intValue();

View File

@ -94,11 +94,11 @@ public class MPInstancePara extends X_AD_PInstance_Para
if (getP_String_To() != null) if (getP_String_To() != null)
sb.append(" - ").append(getP_String_To()); sb.append(" - ").append(getP_String_To());
} }
BigDecimal bd = getP_Number(); BigDecimal bd = (BigDecimal)get_Value("P_Number");
if (bd != null) if (bd != null)
{ {
sb.append("(n)=").append(bd); sb.append("(n)=").append(bd);
BigDecimal bd2 = getP_Number_To(); BigDecimal bd2 = (BigDecimal)get_Value("P_Number_To");
if (bd2 != null) if (bd2 != null)
sb.append(" - ").append(bd2); sb.append(" - ").append(bd2);
} }

View File

@ -58,24 +58,4 @@ public class MXIFAJournal extends X_I_FAJournal {
return bd; return bd;
} }
/**
* Set Currency Type. Currency Conversion Rate Type
*/
public void setC_ConversionType_ID(int C_ConversionType_ID) {
if (C_ConversionType_ID == 0)
set_Value("C_ConversionType_ID", null);
else
set_Value("C_ConversionType_ID", new Integer(C_ConversionType_ID));
}
/**
* Get Currency Type. Currency Conversion Rate Type
*/
public int getC_ConversionType_ID() {
Integer ii = getC_ConversionType_ID();
if (ii == null)
return 0;
return ii.intValue();
}
} }

View File

@ -698,20 +698,12 @@ public class MPPOrder extends X_PP_Order implements DocAction {
PP_Order_Workflow.setPP_Order_ID(getPP_Order_ID()); PP_Order_Workflow.setPP_Order_ID(getPP_Order_ID());
PP_Order_Workflow.setPriority(AD_Workflow.getPriority()); PP_Order_Workflow.setPriority(AD_Workflow.getPriority());
PP_Order_Workflow.setValidateWorkflow(AD_Workflow.getValidateWorkflow()); PP_Order_Workflow.setValidateWorkflow(AD_Workflow.getValidateWorkflow());
//4Layers - bug
PP_Order_Workflow.setPP_Order_Node_ID(AD_Workflow.getAD_WF_Node_ID()); PP_Order_Workflow.setPP_Order_Node_ID(AD_Workflow.getAD_WF_Node_ID());
/*PP_Order_Workflow.setS_Resource_ID(AD_Workflow.getS_Resource_ID());
PP_Order_Workflow.setQueuingTime(AD_Workflow.getQueuingTime());
PP_Order_Workflow.setSetupTime(AD_Workflow.getSetupTime());
PP_Order_Workflow.setMovingTime(AD_Workflow.getMovingTime());
PP_Order_Workflow.setProcessType(AD_Workflow.getProcessType()); */
PP_Order_Workflow.setS_Resource_ID(AD_Workflow.getS_Resource_ID()); PP_Order_Workflow.setS_Resource_ID(AD_Workflow.getS_Resource_ID());
PP_Order_Workflow.setQueuingTime(AD_Workflow.getQueuingTime()); PP_Order_Workflow.setQueuingTime(AD_Workflow.getQueuingTime());
PP_Order_Workflow.setSetupTime(AD_Workflow.getSetupTime()); PP_Order_Workflow.setSetupTime(AD_Workflow.getSetupTime());
PP_Order_Workflow.setMovingTime(AD_Workflow.getMovingTime()); PP_Order_Workflow.setMovingTime(AD_Workflow.getMovingTime());
PP_Order_Workflow.setProcessType(AD_Workflow.getProcessType()); PP_Order_Workflow.setProcessType(AD_Workflow.getProcessType());
// 4Layers
PP_Order_Workflow.save(get_TrxName()); PP_Order_Workflow.save(get_TrxName());
//PP_Order_Workflow.set //PP_Order_Workflow.set
@ -728,16 +720,12 @@ public class MPPOrder extends X_PP_Order implements DocAction {
//if (AD_WF_Node[g].getValidFrom() != null ) //if (AD_WF_Node[g].getValidFrom() != null )
if (AD_WF_Node[g].getValidFrom() != null) if (AD_WF_Node[g].getValidFrom() != null)
{ {
//ValidFromNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidFrom()) >= 0 ? true : false; ValidFromNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidFrom()) >= 0 ? true : false;
ValidFromNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidFrom()) >= 0 ? true : false;
} }
//if (AD_WF_Node[g].getValidTo() != null )
if (AD_WF_Node[g].getValidTo() != null ) if (AD_WF_Node[g].getValidTo() != null )
{ {
//ValidToNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidTo()) <= 0 ? true : false; ValidToNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidTo()) <= 0 ? true : false;
ValidToNode = getDateStartSchedule().compareTo(AD_WF_Node[g].getValidTo()) <= 0 ? true : false;
} }
if (ValidFromNode && ValidToNode) if (ValidFromNode && ValidToNode)
@ -760,23 +748,17 @@ public class MPPOrder extends X_PP_Order implements DocAction {
PP_Order_Node.setSplitElement(AD_WF_Node[g].getSplitElement()); // X PP_Order_Node.setSplitElement(AD_WF_Node[g].getSplitElement()); // X
PP_Order_Node.setSubflowExecution (AD_WF_Node[g].getSubflowExecution()); PP_Order_Node.setSubflowExecution (AD_WF_Node[g].getSubflowExecution());
PP_Order_Node.setValue(AD_WF_Node[g].getValue()); PP_Order_Node.setValue(AD_WF_Node[g].getValue());
//PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID());
PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID()); PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID());
//PP_Order_Node.setSetupTime(AD_WF_Node[g].getSetupTime());
PP_Order_Node.setSetupTime(AD_WF_Node[g].getSetupTime()); PP_Order_Node.setSetupTime(AD_WF_Node[g].getSetupTime());
//PP_Order_Node.setSetupTimeRequiered(AD_WF_Node[g].getSetupTime());
PP_Order_Node.setSetupTimeRequiered(AD_WF_Node[g].getSetupTime()); PP_Order_Node.setSetupTimeRequiered(AD_WF_Node[g].getSetupTime());
BigDecimal time = new BigDecimal(AD_WF_Node[g].getDuration()).multiply(getQtyOrdered()); BigDecimal time = new BigDecimal(AD_WF_Node[g].getDuration()).multiply(getQtyOrdered());
PP_Order_Node.setDurationRequiered(time.intValue()); PP_Order_Node.setDurationRequiered(time.intValue());
//PP_Order_Node.setMovingTime(AD_WF_Node[g].getMovingTime());
PP_Order_Node.setMovingTime(AD_WF_Node[g].getMovingTime()); PP_Order_Node.setMovingTime(AD_WF_Node[g].getMovingTime());
PP_Order_Node.setWaitingTime(AD_WF_Node[g].getWaitingTime()); PP_Order_Node.setWaitingTime(AD_WF_Node[g].getWaitingTime());
PP_Order_Node.setWorkingTime(AD_WF_Node[g].getWorkingTime());; PP_Order_Node.setWorkingTime(AD_WF_Node[g].getWorkingTime());;
//PP_Order_Node.setQueuingTime(AD_WF_Node[g].getQueuingTime());
PP_Order_Node.setQueuingTime(AD_WF_Node[g].getQueuingTime()); PP_Order_Node.setQueuingTime(AD_WF_Node[g].getQueuingTime());
PP_Order_Node.setXPosition(AD_WF_Node[g].getXPosition()); //e-evolution generatemodel PP_Order_Node.setXPosition(AD_WF_Node[g].getXPosition());
PP_Order_Node.setYPosition(AD_WF_Node[g].getYPosition()); //e-evolution generatemodel PP_Order_Node.setYPosition(AD_WF_Node[g].getYPosition());
//PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID());
PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID()); PP_Order_Node.setS_Resource_ID(AD_WF_Node[g].getS_Resource_ID());
PP_Order_Node.setDocAction(AD_WF_Node[g].getDocAction()); PP_Order_Node.setDocAction(AD_WF_Node[g].getDocAction());
PP_Order_Node.save(get_TrxName()); PP_Order_Node.save(get_TrxName());
@ -1395,8 +1377,7 @@ public class MPPOrder extends X_PP_Order implements DocAction {
PP_Order_Cost.setC_AcctSchema_ID(cost[j].getC_AcctSchema_ID()); PP_Order_Cost.setC_AcctSchema_ID(cost[j].getC_AcctSchema_ID());
PP_Order_Cost.setCumulatedAmt(cost[j].getCumulatedAmt()); PP_Order_Cost.setCumulatedAmt(cost[j].getCumulatedAmt());
PP_Order_Cost.setCumulatedQty(cost[j].getCumulatedQty()); PP_Order_Cost.setCumulatedQty(cost[j].getCumulatedQty());
//PP_Order_Cost.setCurrentCostPriceLL(cost[j].getCurrentCostPriceLL()); PP_Order_Cost.setCurrentCostPriceLL(cost[j].getCurrentCostPrice());
PP_Order_Cost.setCurrentCostPriceLL((BigDecimal)cost[j].get_Value("CurrentCostPriceLL")); // column doesn't exist !!!
PP_Order_Cost.setCurrentCostPrice(cost[j].getCurrentCostPrice()); PP_Order_Cost.setCurrentCostPrice(cost[j].getCurrentCostPrice());
PP_Order_Cost.setM_Product_ID(getM_Product_ID()); PP_Order_Cost.setM_Product_ID(getM_Product_ID());
PP_Order_Cost.setM_AttributeSetInstance_ID(cost[j].getM_AttributeSetInstance_ID()); PP_Order_Cost.setM_AttributeSetInstance_ID(cost[j].getM_AttributeSetInstance_ID());
@ -1423,8 +1404,7 @@ public class MPPOrder extends X_PP_Order implements DocAction {
PP_Order_Cost.setC_AcctSchema_ID(cost[j].getC_AcctSchema_ID()); PP_Order_Cost.setC_AcctSchema_ID(cost[j].getC_AcctSchema_ID());
PP_Order_Cost.setCumulatedAmt(cost[j].getCumulatedAmt()); PP_Order_Cost.setCumulatedAmt(cost[j].getCumulatedAmt());
PP_Order_Cost.setCumulatedQty(cost[j].getCumulatedQty()); PP_Order_Cost.setCumulatedQty(cost[j].getCumulatedQty());
//PP_Order_Cost.setCurrentCostPriceLL(cost[j].getCurrentCostPriceLL()); PP_Order_Cost.setCurrentCostPriceLL(cost[j].getCurrentCostPrice());
PP_Order_Cost.setCurrentCostPriceLL((BigDecimal)cost[j].get_Value("CurrentCostPriceLL"));
PP_Order_Cost.setCurrentCostPrice(cost[j].getCurrentCostPrice()); PP_Order_Cost.setCurrentCostPrice(cost[j].getCurrentCostPrice());
PP_Order_Cost.setM_Product_ID(getM_Product_ID()); PP_Order_Cost.setM_Product_ID(getM_Product_ID());
PP_Order_Cost.setM_AttributeSetInstance_ID(cost[j].getM_AttributeSetInstance_ID()); PP_Order_Cost.setM_AttributeSetInstance_ID(cost[j].getM_AttributeSetInstance_ID());

View File

@ -63,8 +63,7 @@ public class MPPOrderCost extends X_PP_Order_Cost
setCumulatedAmt(m_cost.getCumulatedAmt()); setCumulatedAmt(m_cost.getCumulatedAmt());
setCumulatedQty(m_cost.getCumulatedQty()); setCumulatedQty(m_cost.getCumulatedQty());
setCurrentCostPrice(m_cost.getCurrentCostPrice()); setCurrentCostPrice(m_cost.getCurrentCostPrice());
//setCurrentCostPriceLL(m_cost.getCurrentCostPriceLL()); setCurrentCostPriceLL(m_cost.getCurrentCostPrice());
setCurrentCostPriceLL((BigDecimal)m_cost.get_Value("CurrentCostPriceLL"));
setM_Product_ID(m_cost.getM_Product_ID()); setM_Product_ID(m_cost.getM_Product_ID());
setM_CostElement_ID(m_cost.getM_CostElement_ID()); setM_CostElement_ID(m_cost.getM_CostElement_ID());
setM_AttributeSetInstance_ID(m_cost.getM_AttributeSetInstance_ID()); setM_AttributeSetInstance_ID(m_cost.getM_AttributeSetInstance_ID());

View File

@ -199,11 +199,9 @@ public class RollupWorkflow extends SvrProcess
for (int i = 0 ; i < nodes.length ; i ++ ) for (int i = 0 ; i < nodes.length ; i ++ )
{ {
MWFNode node = (MWFNode) nodes[i]; MWFNode node = (MWFNode) nodes[i];
//BigDecimal rate = getRate(CostElementType , node.getS_Resource_ID() , AD_Org_ID , C_AcctSchema_ID , M_CostType_ID);
BigDecimal rate = getRate(CostElementType, node.getS_Resource_ID(), AD_Org_ID , C_AcctSchema_ID , M_CostType_ID); BigDecimal rate = getRate(CostElementType, node.getS_Resource_ID(), AD_Org_ID , C_AcctSchema_ID , M_CostType_ID);
String sql = "SELECT CASE WHEN ow.DurationUnit = 's' THEN 1 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'm' THEN 60 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'h' THEN 3600 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'Y' THEN 31536000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'M' THEN 2592000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'D' THEN 86400 * ((onode.SetupTime/ow.QtyBatchSize) + onode.Duration) END AS load FROM AD_WF_Node onode INNER JOIN AD_Workflow ow ON (ow.AD_Workflow_ID = onode.AD_Workflow_ID) WHERE onode.AD_WF_Node_ID = ? AND onode.AD_Client_ID = ?" ; String sql = "SELECT CASE WHEN ow.DurationUnit = 's' THEN 1 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'm' THEN 60 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'h' THEN 3600 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'Y' THEN 31536000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'M' THEN 2592000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'D' THEN 86400 * ((onode.SetupTime/ow.QtyBatchSize) + onode.Duration) END AS load FROM AD_WF_Node onode INNER JOIN AD_Workflow ow ON (ow.AD_Workflow_ID = onode.AD_Workflow_ID) WHERE onode.AD_WF_Node_ID = ? AND onode.AD_Client_ID = ?" ;
int seconds = DB.getSQLValue(null,sql,node.getAD_WF_Node_ID(),node.getAD_Client_ID()); int seconds = DB.getSQLValue(null,sql,node.getAD_WF_Node_ID(),node.getAD_Client_ID());
//int C_UOM_ID = DB.getSQLValue(null,"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , node.getS_Resource_ID());
int C_UOM_ID = DB.getSQLValue(null,"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , node.getS_Resource_ID()); int C_UOM_ID = DB.getSQLValue(null,"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , node.getS_Resource_ID());
MUOM oum = new MUOM(getCtx(),C_UOM_ID,null); MUOM oum = new MUOM(getCtx(),C_UOM_ID,null);
if (oum.isHour()) if (oum.isHour())

View File

@ -85,13 +85,11 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null); MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
//BigDecimal utilization = r.getPercentUtilization(); BigDecimal utilization = r.getPercentUtilization();
BigDecimal utilization = r.getPercentUtilization();
BigDecimal dailyCapacity = null; BigDecimal dailyCapacity = null;
if(BigDecimal.ZERO.compareTo(utilization) < 0) { if(BigDecimal.ZERO.compareTo(utilization) < 0) {
//dailyCapacity = r.getDailyCapacity().divide(utilization.divide(new BigDecimal(100)), 8, BigDecimal.ROUND_HALF_DOWN); dailyCapacity = r.getDailyCapacity().divide(utilization.divide(new BigDecimal(100)), 8, BigDecimal.ROUND_HALF_DOWN);
dailyCapacity = (r.getDailyCapacity()).divide(utilization.divide(new BigDecimal(100)), 8, BigDecimal.ROUND_HALF_DOWN);
} }
else { else {
@ -274,8 +272,7 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
protected BigDecimal getMaxRange(MResource r) { protected BigDecimal getMaxRange(MResource r) {
//return r.getDailyCapacity().divide(r.getPercentUtilization().divide(new BigDecimal(100))); return r.getDailyCapacity().divide(r.getPercentUtilization().divide(new BigDecimal(100)));
return (r.getDailyCapacity()).divide((r.getPercentUtilization()).divide(new BigDecimal(100)));
} }

View File

@ -118,6 +118,8 @@ public class Desktop extends Window implements MenuListener
{ {
MClient client = MClient.get(Env.getCtx()); MClient client = MClient.get(Env.getCtx());
String defaultUrl = "http://www.adempiere.com"; String defaultUrl = "http://www.adempiere.com";
/* [ 1983672 ] Column AD_Client.WebSiteURL doesn't exist
String url = (String)client.get_Value("WebSiteURL"); String url = (String)client.get_Value("WebSiteURL");
if (url == null) if (url == null)
@ -129,6 +131,8 @@ public class Desktop extends Window implements MenuListener
logger.log(Level.SEVERE, "Website URL provided for the client is not valid!!!"); logger.log(Level.SEVERE, "Website URL provided for the client is not valid!!!");
url = defaultUrl; url = defaultUrl;
} }
*/
String url = defaultUrl;
return url; return url;
} }