Refactoring

- organize imports
- delete large commented code
- improve indentation
This commit is contained in:
Carlos Ruiz 2008-10-09 23:01:24 +00:00
parent 577394612f
commit e3f0d270bb
8 changed files with 223 additions and 431 deletions

View File

@ -29,7 +29,6 @@ import java.util.logging.Level;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.report.MReportTree;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,13 +16,21 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.io.*; import java.io.File;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.sql.Timestamp;
import org.compiere.process.*; import java.util.ArrayList;
import org.compiere.util.*; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.util.CCache;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/** /**
* Physical Inventory Model * Physical Inventory Model
@ -388,205 +396,6 @@ public class MInventory extends X_M_Inventory implements DocAction
approveIt(); approveIt();
log.info(toString()); log.info(toString());
//vpj-cd begin e-evolution recalculate the attribute instances and qty.
/*MInventoryLine[] linesup = getLines(false);
for (int i = 0; i < linesup.length; i++)
{
MInventoryLine line = linesup[i];
String sql1 = "Delete From M_InventoryLineMA "
+ " WHERE M_InventoryLine_ID=" +line.getM_InventoryLine_ID();
int no = DB.executeUpdate(sql1, get_TrxName());
log.info("MA deleted " + no);
StringBuffer sql = new StringBuffer(
"SELECT s.M_Product_ID, s.M_Locator_ID, s.M_AttributeSetInstance_ID,"
+ " s.QtyOnHand, p.M_AttributeSet_ID "
+ "FROM M_Product p"
+ " INNER JOIN M_Storage s ON (s.M_Product_ID=p.M_Product_ID)"
+ " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) "
+ "WHERE l.M_Warehouse_ID=?"
+ " AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'"
+ " AND s.M_Locator_ID=" +line.getM_Locator_ID()
+ " AND s.M_Product_ID=" +line.getM_Product_ID()
+ " AND s.QtyOnHand <> 0 "
);
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
int index = 1;
pstmt.setInt (index++, getM_Warehouse_ID());
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
{
MInventoryLineMA maup = new MInventoryLineMA (line,
rs.getInt(3), rs.getBigDecimal(4));
if (!maup.save())
;
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
}*/
//vpj-cd e-evolution recalculate the attribute instances and qty END.
/*
//
MInventoryLine[] lines = getLines(false);
for (int i = 0; i < lines.length; i++)
{
MInventoryLine line = lines[i];
if (!line.isActive())
continue;
MTransaction trx = null;
if (line.getM_AttributeSetInstance_ID() == 0)
{
BigDecimal qtyDiff = line.getQtyInternalUse().negate();
if (qtyDiff.signum() == 0)
qtyDiff = line.getQtyCount().subtract(line.getQtyBook());
//
if (qtyDiff.signum() > 0)
{
// Storage
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), 0, get_TrxName());
if (storage == null)
storage = MStorage.getCreate(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), 0, get_TrxName());
BigDecimal qtyNew = storage.getQtyOnHand().add(qtyDiff);
log.fine("Diff=" + qtyDiff
+ " - OnHand=" + storage.getQtyOnHand() + "->" + qtyNew);
storage.setQtyOnHand(qtyNew);
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = "Storage not updated(1)";
return DocAction.STATUS_Invalid;
}
log.fine(storage.toString());
// Transaction
trx = new MTransaction (getCtx(), line.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_InventoryIn,
line.getM_Locator_ID(), line.getM_Product_ID(), 0,
qtyDiff, getMovementDate(), get_TrxName());
trx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!trx.save())
{
m_processMsg = "Transaction not inserted(1)";
return DocAction.STATUS_Invalid;
}
}
else // negative qty
{
MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(),
line.getM_InventoryLine_ID(), get_TrxName());
for (int j = 0; j < mas.length; j++)
{
MInventoryLineMA ma = mas[j];
// Storage
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
if (storage == null)
storage = MStorage.getCreate(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
//
BigDecimal maxDiff = qtyDiff;
if (maxDiff.signum() < 0
&& ma.getMovementQty().compareTo(maxDiff.negate()) < 0)
maxDiff = ma.getMovementQty().negate();
BigDecimal qtyNew = ma.getMovementQty().add(maxDiff); // Storage+Diff
log.fine("MA Qty=" + ma.getMovementQty()
+ ",Diff=" + qtyDiff + "|" + maxDiff
+ " - OnHand=" + storage.getQtyOnHand() + "->" + qtyNew
+ " {" + ma.getM_AttributeSetInstance_ID() + "}");
//
storage.setQtyOnHand(qtyNew);
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = "Storage not updated (MA)";
return DocAction.STATUS_Invalid;
}
log.fine(storage.toString());
// Transaction
trx = new MTransaction (getCtx(), line.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_InventoryIn,
line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
maxDiff, getMovementDate(), get_TrxName());
trx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!trx.save())
{
m_processMsg = "Transaction not inserted (MA)";
return DocAction.STATUS_Invalid;
}
//
qtyDiff = qtyDiff.subtract(maxDiff);
if (qtyDiff.signum() == 0)
break;
}
} // negative qty
}
// Fallback
if (trx == null)
{
// Storage
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), get_TrxName());
if (storage == null)
storage = MStorage.getCreate(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), get_TrxName());
//
BigDecimal qtyDiff = line.getQtyInternalUse().negate();
if (Env.ZERO.compareTo(qtyDiff) == 0)
qtyDiff = line.getQtyCount().subtract(line.getQtyBook());
BigDecimal qtyNew = storage.getQtyOnHand().add(qtyDiff);
log.fine("Count=" + line.getQtyCount()
+ ",Book=" + line.getQtyBook() + ", Difference=" + qtyDiff
+ " - OnHand=" + storage.getQtyOnHand() + "->" + qtyNew);
//
storage.setQtyOnHand(qtyNew);
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = "Storage not updated(2)";
return DocAction.STATUS_Invalid;
}
log.fine(storage.toString());
// Transaction
trx = new MTransaction (getCtx(), line.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_InventoryIn,
line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
qtyDiff, getMovementDate(), get_TrxName());
trx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!trx.save())
{
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
} // Fallback
*/
MInventoryLine[] lines = getLines(false); MInventoryLine[] lines = getLines(false);
for (MInventoryLine line : lines) for (MInventoryLine line : lines)
{ {
@ -603,11 +412,11 @@ public class MInventory extends X_M_Inventory implements DocAction
//Ignore the Material Policy when is Reverse Correction //Ignore the Material Policy when is Reverse Correction
if(!isReversal()) if(!isReversal())
checkMaterialPolicy(line, qtyDiff); checkMaterialPolicy(line, qtyDiff);
// Stock Movement - Counterpart MOrder.reserveStock // Stock Movement - Counterpart MOrder.reserveStock
if (product != null if (product != null
&& product.isStocked() ) && product.isStocked() )
{ {
log.fine("Material Transaction"); log.fine("Material Transaction");
MTransaction mtrx = null; MTransaction mtrx = null;
@ -616,7 +425,7 @@ public class MInventory extends X_M_Inventory implements DocAction
if (line.getM_AttributeSetInstance_ID() == 0 || qtyDiff.compareTo(Env.ZERO) == 0) if (line.getM_AttributeSetInstance_ID() == 0 || qtyDiff.compareTo(Env.ZERO) == 0)
{ {
MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(),
line.getM_InventoryLine_ID(), get_TrxName()); line.getM_InventoryLine_ID(), get_TrxName());
for (int j = 0; j < mas.length; j++) for (int j = 0; j < mas.length; j++)
{ {
@ -626,45 +435,45 @@ public class MInventory extends X_M_Inventory implements DocAction
log.fine("Diff=" + qtyDiff log.fine("Diff=" + qtyDiff
+ " - Instance OnHand=" + QtyMA + "->" + QtyNew); + " - Instance OnHand=" + QtyMA + "->" + QtyNew);
if (!MStorage.add(getCtx(), getM_Warehouse_ID(), if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
line.getM_Locator_ID(), line.getM_Locator_ID(),
line.getM_Product_ID(), line.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), 0, ma.getM_AttributeSetInstance_ID(), 0,
QtyMA.negate(), Env.ZERO, Env.ZERO, get_TrxName())) QtyMA.negate(), Env.ZERO, Env.ZERO, get_TrxName()))
{ {
m_processMsg = "Cannot correct Inventory (MA)"; m_processMsg = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Only Update Date Last Inventory if is a Physical Inventory // Only Update Date Last Inventory if is a Physical Inventory
if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0) if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0)
{
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{ {
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(), m_processMsg = "Storage not updated(2)";
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = "Storage not updated(2)";
return DocAction.STATUS_Invalid;
}
}
String m_MovementType =null;
if(QtyMA.negate().compareTo(Env.ZERO) > 0 )
m_MovementType = MTransaction.MOVEMENTTYPE_InventoryIn;
else
m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut;
// Transaction
mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType,
line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
QtyMA.negate(), getMovementDate(), get_TrxName());
mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!mtrx.save())
{
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
qtyDiff = QtyNew; }
String m_MovementType =null;
if(QtyMA.negate().compareTo(Env.ZERO) > 0 )
m_MovementType = MTransaction.MOVEMENTTYPE_InventoryIn;
else
m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut;
// Transaction
mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType,
line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
QtyMA.negate(), getMovementDate(), get_TrxName());
mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!mtrx.save())
{
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
qtyDiff = QtyNew;
} }
} }
@ -679,8 +488,8 @@ public class MInventory extends X_M_Inventory implements DocAction
line.getM_AttributeSetInstance_ID(), 0, line.getM_AttributeSetInstance_ID(), 0,
qtyDiff, Env.ZERO, Env.ZERO, get_TrxName())) qtyDiff, Env.ZERO, Env.ZERO, get_TrxName()))
{ {
m_processMsg = "Cannot correct Inventory (MA)"; m_processMsg = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Only Update Date Last Inventory if is a Physical Inventory // Only Update Date Last Inventory if is a Physical Inventory
@ -704,8 +513,8 @@ public class MInventory extends X_M_Inventory implements DocAction
m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut; m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut;
// Transaction // Transaction
mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType, mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType,
line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
qtyDiff, getMovementDate(), get_TrxName()); qtyDiff, getMovementDate(), get_TrxName());
mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!mtrx.save()) if (!mtrx.save())
{ {
@ -713,7 +522,7 @@ public class MInventory extends X_M_Inventory implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} // Fallback } // Fallback
} // stock movement } // stock movement
} // for all lines } // for all lines
@ -762,128 +571,83 @@ public class MInventory extends X_M_Inventory implements DocAction
log.config("Delete old #" + no); log.config("Delete old #" + no);
// Check Line // Check Line
boolean needSave = false; boolean needSave = false;
BigDecimal qtyASI = Env.ZERO ; BigDecimal qtyASI = Env.ZERO ;
// Attribute Set Instance // Attribute Set Instance
if (line.getM_AttributeSetInstance_ID() == 0) if (line.getM_AttributeSetInstance_ID() == 0)
{
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
if (qtyDiff.signum() > 0) // Incoming Trx
{ {
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID()); MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), 0, get_TrxName());
if (qtyDiff.signum() > 0) // Incoming Trx asi.setClientOrg(getAD_Client_ID(), 0);
asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID());
if (!asi.save())
{ {
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), 0, get_TrxName()); throw new IllegalStateException("Error try create ASI Reservation");
asi.setClientOrg(getAD_Client_ID(), 0);
asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID());
if (!asi.save())
{
throw new IllegalStateException("Error try create ASI Reservation");
}
if (asi.save())
{
line.setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
needSave = true;
}
} }
else // Outgoing Trx if (asi.save())
{ {
String MMPolicy = product.getMMPolicy(); line.setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
MStorage[] storages = MStorage.getAllWithASI(getCtx(), needSave = true;
}
}
else // Outgoing Trx
{
String MMPolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
line.getM_Product_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_Locator_ID(),
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName()); MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
BigDecimal qtyToDeliver = qtyDiff.negate(); BigDecimal qtyToDeliver = qtyDiff.negate();
/*for (int ii = 0; ii < storages.length; ii++) for (MStorage storage: storages)
{
//cosume ASI Zero
if (storage.getM_AttributeSetInstance_ID() == 0)
{ {
MStorage storage = storages[ii]; qtyASI = qtyASI.add(storage.getQtyOnHand());
if (ii == 0) qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
{ continue;
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0) }
{
line.setM_AttributeSetInstance_ID(storage.getM_AttributeSetInstance_ID()); if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
needSave = true; {
log.config("Direct - " + line); MInventoryLineMA ma = new MInventoryLineMA (line,
qtyToDeliver = Env.ZERO;
}
else
{
log.config("Split - " + line);
MInventoryLineMA ma = new MInventoryLineMA (line,
storage.getM_AttributeSetInstance_ID(),
storage.getQtyOnHand().negate());
if (!ma.save())
;
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
log.fine("#" + ii + ": " + ma + ", QtyToDeliver=" + qtyToDeliver);
}
}
else // create addl material allocation
{
MInventoryLineMA ma = new MInventoryLineMA (line,
storage.getM_AttributeSetInstance_ID(), storage.getM_AttributeSetInstance_ID(),
qtyToDeliver.negate()); qtyToDeliver);
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
qtyToDeliver = Env.ZERO;
else
{
ma.setMovementQty(storage.getQtyOnHand().negate());
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
}
if (!ma.save())
;
log.fine("#" + ii + ": " + ma + ", QtyToDeliver=" + qtyToDeliver);
}
if (qtyToDeliver.signum() == 0)
break;
} // for all storages
*/
for (MStorage storage: storages)
{
//cosume ASI Zero
if (storage.getM_AttributeSetInstance_ID() == 0)
{
qtyASI = qtyASI.add(storage.getQtyOnHand());
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
continue;
}
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
{
MInventoryLineMA ma = new MInventoryLineMA (line,
storage.getM_AttributeSetInstance_ID(),
qtyToDeliver);
if (!ma.save())
{
throw new IllegalStateException("Error try create ASI Reservation");
}
qtyToDeliver = Env.ZERO;
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
//return;
}
else
{
MInventoryLineMA ma = new MInventoryLineMA (line,
storage.getM_AttributeSetInstance_ID(),
storage.getQtyOnHand());
if (!ma.save())
{
throw new IllegalStateException("Error try create ASI Reservation");
}
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
}
}
// No AttributeSetInstance found for remainder
if (qtyToDeliver.signum() != 0 || qtyASI.signum() != 0)
{
MInventoryLineMA ma = new MInventoryLineMA (line, 0 , qtyToDeliver.add(qtyASI));
if (!ma.save()) if (!ma.save())
; {
log.fine("##: " + ma); throw new IllegalStateException("Error try create ASI Reservation");
}
qtyToDeliver = Env.ZERO;
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
//return;
} }
} // outgoing Trx else
{
MInventoryLineMA ma = new MInventoryLineMA (line,
storage.getM_AttributeSetInstance_ID(),
storage.getQtyOnHand());
if (!ma.save())
{
throw new IllegalStateException("Error try create ASI Reservation");
}
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
}
}
// No AttributeSetInstance found for remainder
if (qtyToDeliver.signum() != 0 || qtyASI.signum() != 0)
{
MInventoryLineMA ma = new MInventoryLineMA (line, 0 , qtyToDeliver.add(qtyASI));
if (!ma.save())
;
log.fine("##: " + ma);
}
} // outgoing Trx
if (needSave && !line.save()) if (needSave && !line.save())
log.severe("NOT saved " + line); log.severe("NOT saved " + line);
@ -1033,12 +797,12 @@ public class MInventory extends X_M_Inventory implements DocAction
if (rLine.getM_AttributeSetInstance_ID() == 0) if (rLine.getM_AttributeSetInstance_ID() == 0)
{ {
MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(),
oLines[i].getM_InventoryLine_ID(), get_TrxName()); oLines[i].getM_InventoryLine_ID(), get_TrxName());
for (int j = 0; j < mas.length; j++) for (int j = 0; j < mas.length; j++)
{ {
MInventoryLineMA ma = new MInventoryLineMA (rLine, MInventoryLineMA ma = new MInventoryLineMA (rLine,
mas[j].getM_AttributeSetInstance_ID(), mas[j].getM_AttributeSetInstance_ID(),
mas[j].getMovementQty().negate()); mas[j].getMovementQty().negate());
if (!ma.save()) if (!ma.save())
; ;
} }
@ -1069,7 +833,7 @@ public class MInventory extends X_M_Inventory implements DocAction
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return true; return true;
} // reverseCorrectionIt } // reverseCorrectIt
/** /**
* Reverse Accrual * Reverse Accrual

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,12 +16,16 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.*; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/** /**
* Physical Inventory Line Model * Physical Inventory Line Model

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,11 +16,15 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.util.ArrayList;
import org.compiere.util.*; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/** /**

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,10 +16,15 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.sql.SQLException;
import org.compiere.util.*; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/** /**
* Warehouse Locator Object * Warehouse Locator Object

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,15 +16,23 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.io.*; import java.io.File;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.sql.Timestamp;
import org.compiere.process.*; import java.util.ArrayList;
import org.compiere.util.*; import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.eevolution.model.*; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.eevolution.model.MDDOrder;
import org.eevolution.model.MDDOrderLine;
/** /**
* Inventory Movement Model * Inventory Movement Model
* *
@ -439,7 +447,7 @@ public class MMovement extends X_M_Movement implements DocAction
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName()); line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
//*/ //*/
MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); // MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName());
//Update Storage //Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(), if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_LocatorTo_ID(), line.getM_LocatorTo_ID(),
@ -530,7 +538,7 @@ public class MMovement extends X_M_Movement implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); // MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName());
//Update Storage //Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(), if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_LocatorTo_ID(), line.getM_LocatorTo_ID(),

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -16,11 +16,19 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.sql.SQLException;
import org.compiere.util.*; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/** /**
* Inventory Storage Model * Inventory Storage Model

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *