[ 2408898 ] Implement Cost Collector Type

http://sourceforge.net/tracker/?func=detail&atid=879335&aid=2408898&group_id=176962

* fix typo error logic
* don't use "==" when comparing String
This commit is contained in:
teo_sarca 2008-12-09 17:19:53 +00:00
parent 55dc5bff35
commit c7f8e13b7b
1 changed files with 24 additions and 6 deletions

View File

@ -213,8 +213,9 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
QtyReceipt = Qty.negate(); QtyReceipt = Qty.negate();
} }
//
// Update Order Line // Update Order Line
if(getCostCollectorType() == MPPCostCollector.COSTCOLLECTORTYPE_ActivityControlReport) if(!isCostCollectorType(COSTCOLLECTORTYPE_ActivityControlReport))
{ {
// Stock Movement // Stock Movement
MProduct product = MProduct.get(getCtx(), getM_Product_ID()); MProduct product = MProduct.get(getCtx(), getM_Product_ID());
@ -321,8 +322,9 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
log.fine("Order -> Delivered=" + order.getQtyDelivered()); log.fine("Order -> Delivered=" + order.getQtyDelivered());
} }
} }
//
// Operation Activity // Operation Activity
if(getCostCollectorType() == MPPCostCollector.COSTCOLLECTORTYPE_ActivityControlReport) else // isCostCollectorType(COSTCOLLECTORTYPE_ActivityControlReport)
{ {
MPPOrderNode onodeact = getPP_Order_Node(); MPPOrderNode onodeact = getPP_Order_Node();
onodeact.setDocStatus(DOCSTATUS_Completed); onodeact.setDocStatus(DOCSTATUS_Completed);
@ -572,7 +574,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
private void closeNew(int PP_Order_ID, int PP_Order_Node_ID) private void closeNew(int PP_Order_ID, int PP_Order_Node_ID)
{ {
if(getCostCollectorType()==MPPCostCollector.COSTCOLLECTORTYPE_ActivityControlReport) if(isCostCollectorType(COSTCOLLECTORTYPE_ActivityControlReport))
{ {
String whereClause = COLUMNNAME_PP_Order_ID+"=?"; String whereClause = COLUMNNAME_PP_Order_ID+"=?";
List<MPPCostCollector> list = new Query(getCtx(), Table_Name, whereClause, get_TrxName()) List<MPPCostCollector> list = new Query(getCtx(), Table_Name, whereClause, get_TrxName())
@ -590,7 +592,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
protected void completeNew(int PP_Order_ID) protected void completeNew(int PP_Order_ID)
{ {
if(getCostCollectorType()==MPPCostCollector.COSTCOLLECTORTYPE_ActivityControlReport) if(isCostCollectorType(COSTCOLLECTORTYPE_ActivityControlReport))
{ {
String whereClause = COLUMNNAME_PP_Order_ID+"=?" String whereClause = COLUMNNAME_PP_Order_ID+"=?"
+" AND "+COLUMNNAME_DocStatus+"<>'"+DOCSTATUS_Completed+"'" +" AND "+COLUMNNAME_DocStatus+"<>'"+DOCSTATUS_Completed+"'"
@ -796,11 +798,27 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
public String getMovementType() public String getMovementType()
{ {
if (getCostCollectorType()==MPPCostCollector.COSTCOLLECTORTYPE_MaterialReceipt) if (isCostCollectorType(COSTCOLLECTORTYPE_MaterialReceipt))
return MTransaction.MOVEMENTTYPE_WorkOrderPlus; return MTransaction.MOVEMENTTYPE_WorkOrderPlus;
else if(getCostCollectorType()==MPPCostCollector.COSTCOLLECTORTYPE_ComponentIssue) else if(isCostCollectorType(COSTCOLLECTORTYPE_ComponentIssue))
return MTransaction.MOVEMENTTYPE_WorkOrder_; return MTransaction.MOVEMENTTYPE_WorkOrder_;
return null; return null;
} }
/**
* Check if CostCollectorType is equal with any of provided types
* @param types
* @return
*/
public boolean isCostCollectorType(String ... types)
{
String type = getCostCollectorType();
for (String t : types)
{
if (type.equals(t))
return true;
}
return false;
}
} // MPPCostCollector } // MPPCostCollector