FR [ 1885153 ] Refactor: getMMPolicy code
This commit is contained in:
parent
5b32d5e6b2
commit
71b71e4618
|
@ -75,13 +75,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
MProduct product = oLines[i].getProduct();
|
||||
if (product != null && product.get_ID() != 0 && product.isStocked())
|
||||
{
|
||||
MProductCategory pc = MProductCategory.get(order.getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
{
|
||||
MClient client = MClient.get(order.getCtx());
|
||||
MMPolicy = client.getMMPolicy();
|
||||
}
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
storages = MStorage.getWarehouse (order.getCtx(), order.getM_Warehouse_ID(),
|
||||
oLines[i].getM_Product_ID(), oLines[i].getM_AttributeSetInstance_ID(),
|
||||
product.getM_AttributeSet_ID(),
|
||||
|
@ -1523,7 +1517,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
// Incoming Trx
|
||||
String MovementType = getMovementType();
|
||||
boolean inTrx = MovementType.charAt(1) == '+'; // V+ Vendor Receipt
|
||||
MClient client = MClient.get(getCtx());
|
||||
|
||||
// Check Lines
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
|
@ -1559,11 +1552,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
}
|
||||
else // Outgoing Trx
|
||||
{
|
||||
MProductCategory pc = MProductCategory.get(getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
|
||||
line.getM_Product_ID(), line.getM_Locator_ID(),
|
||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||
|
|
|
@ -630,9 +630,6 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
log.config("Delete old #" + no);
|
||||
MInventoryLine[] lines = getLines(false);
|
||||
|
||||
// Incoming Trx
|
||||
MClient client = MClient.get(getCtx());
|
||||
|
||||
// Check Lines
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
|
@ -648,7 +645,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
qtyDiff = line.getQtyCount().subtract(line.getQtyBook());
|
||||
log.fine("Count=" + line.getQtyCount()
|
||||
+ ",Book=" + line.getQtyBook() + ", Difference=" + qtyDiff);
|
||||
if (qtyDiff.signum() > 0) // In
|
||||
if (qtyDiff.signum() > 0) // Incoming Trx
|
||||
{
|
||||
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), 0, get_TrxName());
|
||||
asi.setClientOrg(getAD_Client_ID(), 0);
|
||||
|
@ -661,11 +658,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
}
|
||||
else // Outgoing Trx
|
||||
{
|
||||
MProductCategory pc = MProductCategory.get(getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
|
||||
line.getM_Product_ID(), line.getM_Locator_ID(),
|
||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||
|
|
|
@ -568,8 +568,6 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
log.config("Delete old #" + no);
|
||||
MMovementLine[] lines = getLines(false);
|
||||
|
||||
MClient client = MClient.get(getCtx());
|
||||
|
||||
// Check Lines
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
|
@ -580,11 +578,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
if (line.getM_AttributeSetInstance_ID() == 0)
|
||||
{
|
||||
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
|
||||
MProductCategory pc = MProductCategory.get(getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
|
||||
line.getM_Product_ID(), line.getM_Locator_ID(),
|
||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||
|
|
|
@ -27,6 +27,9 @@ import org.compiere.util.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MProduct.java,v 1.5 2006/07/30 00:51:05 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>FR [ 1885153 ] Refactor: getMMPolicy code
|
||||
*/
|
||||
public class MProduct extends X_M_Product
|
||||
{
|
||||
|
@ -732,4 +735,17 @@ public class MProduct extends X_M_Product
|
|||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Material Management Policy.
|
||||
* Tries: Product Category, Client (in this order)
|
||||
* @return Material Management Policy
|
||||
*/
|
||||
public String getMMPolicy() {
|
||||
MProductCategory pc = MProductCategory.get(getCtx(), getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = MClient.get(getCtx()).getMMPolicy();
|
||||
return MMPolicy;
|
||||
}
|
||||
|
||||
} // MProduct
|
||||
|
|
|
@ -283,11 +283,7 @@ public class InOutGenerate extends SvrProcess
|
|||
}
|
||||
|
||||
// Stored Product
|
||||
MProductCategory pc = MProductCategory.get(order.getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = getStorages(line.getM_Warehouse_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
product.getM_AttributeSet_ID(),
|
||||
|
@ -371,11 +367,7 @@ public class InOutGenerate extends SvrProcess
|
|||
MStorage[] storages = null;
|
||||
if (product != null && product.isStocked())
|
||||
{
|
||||
MProductCategory pc = MProductCategory.get(order.getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
storages = getStorages(line.getM_Warehouse_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
product.getM_AttributeSet_ID(),
|
||||
|
|
|
@ -322,7 +322,7 @@ public class ReplenishReport extends SvrProcess
|
|||
ReplenishInterface custom = null;
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName(className);
|
||||
Class<?> clazz = Class.forName(className);
|
||||
custom = (ReplenishInterface)clazz.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -502,11 +502,7 @@ public class ReplenishReport extends SvrProcess
|
|||
int M_LocatorTo_ID = wh.getDefaultLocator().getM_Locator_ID();
|
||||
// From: Look-up Storage
|
||||
MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID());
|
||||
MProductCategory pc = MProductCategory.get(getCtx(), product.getM_Product_Category_ID());
|
||||
String MMPolicy = pc.getMMPolicy();
|
||||
if (MMPolicy == null || MMPolicy.length() == 0)
|
||||
MMPolicy = client.getMMPolicy();
|
||||
//
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0,
|
||||
true, null,
|
||||
|
|
Loading…
Reference in New Issue