wrong The reserved and order qty
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2927996
This commit is contained in:
parent
af81a9f30e
commit
141aa2e00d
|
@ -450,8 +450,10 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
*/
|
*/
|
||||||
public MDDOrderLine[] getLines (boolean requery, String orderBy)
|
public MDDOrderLine[] getLines (boolean requery, String orderBy)
|
||||||
{
|
{
|
||||||
if (m_lines != null && !requery)
|
if (m_lines != null && !requery) {
|
||||||
|
set_TrxName(m_lines, get_TrxName());
|
||||||
return m_lines;
|
return m_lines;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
String orderClause = "";
|
String orderClause = "";
|
||||||
if (orderBy != null && orderBy.length() > 0)
|
if (orderBy != null && orderBy.length() > 0)
|
||||||
|
@ -842,15 +844,14 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
* @param lines distribution order lines (ordered by M_Product_ID for deadlock prevention)
|
* @param lines distribution order lines (ordered by M_Product_ID for deadlock prevention)
|
||||||
* @return true if (un) reserved
|
* @return true if (un) reserved
|
||||||
*/
|
*/
|
||||||
private void reserveStock (MDDOrderLine[] lines)
|
public void reserveStock (MDDOrderLine[] lines)
|
||||||
{
|
{
|
||||||
BigDecimal Volume = Env.ZERO;
|
BigDecimal Volume = Env.ZERO;
|
||||||
BigDecimal Weight = Env.ZERO;
|
BigDecimal Weight = Env.ZERO;
|
||||||
|
|
||||||
// Always check and (un) Reserve Inventory
|
// Always check and (un) Reserve Inventory
|
||||||
for (int i = 0; i < lines.length; i++)
|
for (MDDOrderLine line : lines)
|
||||||
{
|
{
|
||||||
MDDOrderLine line = lines[i];
|
|
||||||
MLocator locator_from = MLocator.get(getCtx(),line.getM_Locator_ID());
|
MLocator locator_from = MLocator.get(getCtx(),line.getM_Locator_ID());
|
||||||
MLocator locator_to = MLocator.get(getCtx(),line.getM_LocatorTo_ID());
|
MLocator locator_to = MLocator.get(getCtx(),line.getM_LocatorTo_ID());
|
||||||
BigDecimal reserved_ordered = line.getQtyOrdered()
|
BigDecimal reserved_ordered = line.getQtyOrdered()
|
||||||
|
@ -878,7 +879,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
if (product.isStocked())
|
if (product.isStocked())
|
||||||
{
|
{
|
||||||
// Update Storage
|
// Update Storage
|
||||||
if (!MStorage.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
|
if (!MStorage.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
|
||||||
line.getM_Product_ID(),
|
line.getM_Product_ID(),
|
||||||
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
|
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
|
||||||
Env.ZERO, reserved_ordered , Env.ZERO , get_TrxName()))
|
Env.ZERO, reserved_ordered , Env.ZERO , get_TrxName()))
|
||||||
|
@ -886,7 +887,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
throw new AdempiereException();
|
throw new AdempiereException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MStorage.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
|
if (!MStorage.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
|
||||||
line.getM_Product_ID(),
|
line.getM_Product_ID(),
|
||||||
line.getM_AttributeSetInstanceTo_ID(), line.getM_AttributeSetInstance_ID(),
|
line.getM_AttributeSetInstanceTo_ID(), line.getM_AttributeSetInstance_ID(),
|
||||||
Env.ZERO, Env.ZERO , reserved_ordered, get_TrxName()))
|
Env.ZERO, Env.ZERO , reserved_ordered, get_TrxName()))
|
||||||
|
@ -897,7 +898,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
||||||
} // stockec
|
} // stockec
|
||||||
// update line
|
// update line
|
||||||
line.setQtyReserved(line.getQtyReserved().add(reserved_ordered));
|
line.setQtyReserved(line.getQtyReserved().add(reserved_ordered));
|
||||||
line.saveEx(get_TrxName());
|
line.saveEx();
|
||||||
//
|
//
|
||||||
Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered()));
|
Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered()));
|
||||||
Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered()));
|
Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered()));
|
||||||
|
|
Loading…
Reference in New Issue