commit initial work on IDEMPIERE-385
This commit is contained in:
parent
5e23f70cf0
commit
2a4b62f683
|
@ -121,7 +121,7 @@ public class CalloutMovement extends CalloutEngine
|
|||
if (M_Locator_ID <= 0)
|
||||
return;
|
||||
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
|
||||
BigDecimal available = MStorage.getQtyAvailable(0, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
|
||||
BigDecimal available = MStorageOnHand.getQtyAvailable(0, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
|
||||
if (available == null)
|
||||
available = Env.ZERO;
|
||||
if (available.signum() == 0)
|
||||
|
|
|
@ -821,7 +821,7 @@ public class CalloutOrder extends CalloutEngine
|
|||
BigDecimal QtyOrdered = (BigDecimal)mTab.getValue("QtyOrdered");
|
||||
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
|
||||
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
|
||||
BigDecimal available = MStorage.getQtyAvailable
|
||||
BigDecimal available = MStorageOnHand.getQtyAvailable
|
||||
(M_Warehouse_ID, 0, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null);
|
||||
if (available == null)
|
||||
available = Env.ZERO;
|
||||
|
@ -1296,7 +1296,7 @@ public class CalloutOrder extends CalloutEngine
|
|||
{
|
||||
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
|
||||
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
|
||||
BigDecimal available = MStorage.getQtyAvailable
|
||||
BigDecimal available = MStorageOnHand.getQtyAvailable
|
||||
(M_Warehouse_ID, 0, M_Product_ID, M_AttributeSetInstance_ID, null);
|
||||
if (available == null)
|
||||
available = Env.ZERO;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.compiere.model.MInOutLine;
|
|||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.util.AdempiereUserError;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -78,11 +78,11 @@ public class InOutGenerate extends SvrProcess
|
|||
|
||||
|
||||
/** Storages temp space */
|
||||
private HashMap<SParameter,MStorage[]> m_map = new HashMap<SParameter,MStorage[]>();
|
||||
private HashMap<SParameter,MStorageOnHand[]> m_map = new HashMap<SParameter,MStorageOnHand[]>();
|
||||
/** Last Parameter */
|
||||
private SParameter m_lastPP = null;
|
||||
/** Last Storage */
|
||||
private MStorage[] m_lastStorages = null;
|
||||
private MStorageOnHand[] m_lastStorages = null;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -299,13 +299,13 @@ public class InOutGenerate extends SvrProcess
|
|||
// Stored Product
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
|
||||
MStorage[] storages = getStorages(line.getM_Warehouse_ID(),
|
||||
MStorageOnHand[] storages = getStorages(line.getM_Warehouse_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy));
|
||||
|
||||
for (int j = 0; j < storages.length; j++)
|
||||
{
|
||||
MStorage storage = storages[j];
|
||||
MStorageOnHand storage = storages[j];
|
||||
onHand = onHand.add(storage.getQtyOnHand());
|
||||
}
|
||||
boolean fullLine = onHand.compareTo(toDeliver) >= 0
|
||||
|
@ -377,7 +377,7 @@ public class InOutGenerate extends SvrProcess
|
|||
MProduct product = line.getProduct();
|
||||
BigDecimal toDeliver = line.getQtyOrdered().subtract(line.getQtyDelivered());
|
||||
//
|
||||
MStorage[] storages = null;
|
||||
MStorageOnHand[] storages = null;
|
||||
if (product != null && product.isStocked())
|
||||
{
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
|
@ -425,7 +425,7 @@ public class InOutGenerate extends SvrProcess
|
|||
* @param force force delivery
|
||||
*/
|
||||
private void createLine (MOrder order, MOrderLine orderLine, BigDecimal qty,
|
||||
MStorage[] storages, boolean force)
|
||||
MStorageOnHand[] storages, boolean force)
|
||||
{
|
||||
// Complete last Shipment - can have multiple shipments
|
||||
if (m_lastC_BPartner_Location_ID != orderLine.getC_BPartner_Location_ID() )
|
||||
|
@ -466,7 +466,7 @@ public class InOutGenerate extends SvrProcess
|
|||
BigDecimal toDeliver = qty;
|
||||
for (int i = 0; i < storages.length; i++)
|
||||
{
|
||||
MStorage storage = storages[i];
|
||||
MStorageOnHand storage = storages[i];
|
||||
BigDecimal deliver = toDeliver;
|
||||
//skip negative storage record
|
||||
if (storage.getQtyOnHand().signum() < 0)
|
||||
|
@ -550,7 +550,7 @@ public class InOutGenerate extends SvrProcess
|
|||
* @param FiFo
|
||||
* @return storages
|
||||
*/
|
||||
private MStorage[] getStorages(int M_Warehouse_ID,
|
||||
private MStorageOnHand[] getStorages(int M_Warehouse_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID,
|
||||
Timestamp minGuaranteeDate, boolean FiFo)
|
||||
{
|
||||
|
@ -562,7 +562,7 @@ public class InOutGenerate extends SvrProcess
|
|||
|
||||
if (m_lastStorages == null)
|
||||
{
|
||||
m_lastStorages = MStorage.getWarehouse(getCtx(),
|
||||
m_lastStorages = MStorageOnHand.getWarehouse(getCtx(),
|
||||
M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID,
|
||||
minGuaranteeDate, FiFo,false, 0, get_TrxName());
|
||||
m_map.put(m_lastPP, m_lastStorages);
|
||||
|
@ -590,7 +590,7 @@ public class InOutGenerate extends SvrProcess
|
|||
m_created++;
|
||||
|
||||
//reset storage cache as MInOut.completeIt will update m_storage
|
||||
m_map = new HashMap<SParameter,MStorage[]>();
|
||||
m_map = new HashMap<SParameter,MStorageOnHand[]>();
|
||||
m_lastPP = null;
|
||||
m_lastStorages = null;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Level;
|
|||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInventoryLine;
|
||||
import org.compiere.model.MInventoryLineMA;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -145,11 +145,11 @@ public class InventoryCountUpdate extends SvrProcess
|
|||
{
|
||||
MInventoryLine il = new MInventoryLine (getCtx(), rs, get_TrxName());
|
||||
BigDecimal onHand = Env.ZERO;
|
||||
MStorage[] storages = MStorage.getAll(getCtx(), il.getM_Product_ID(), il.getM_Locator_ID(), get_TrxName());
|
||||
MStorageOnHand[] storages = MStorageOnHand.getAll(getCtx(), il.getM_Product_ID(), il.getM_Locator_ID(), get_TrxName());
|
||||
MInventoryLineMA ma = null;
|
||||
for (int i = 0; i < storages.length; i++)
|
||||
{
|
||||
MStorage storage = storages[i];
|
||||
MStorageOnHand storage = storages[i];
|
||||
if (storage.getQtyOnHand().signum() == 0)
|
||||
continue;
|
||||
onHand = onHand.add(storage.getQtyOnHand());
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.logging.Level;
|
|||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MTransaction;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_M_Production;
|
||||
|
@ -140,7 +140,7 @@ public class M_Production_Run extends SvrProcess {
|
|||
continue ;
|
||||
else if(MovementQty.signum() < 0)
|
||||
{
|
||||
BigDecimal QtyAvailable = MStorage.getQtyAvailable(
|
||||
BigDecimal QtyAvailable = MStorageOnHand.getQtyAvailable(
|
||||
locator.getM_Warehouse_ID(),
|
||||
locator.getM_Locator_ID(),
|
||||
pline.getM_Product_ID(),
|
||||
|
@ -155,7 +155,7 @@ public class M_Production_Run extends SvrProcess {
|
|||
MovementType = MTransaction.MOVEMENTTYPE_Production_;
|
||||
}
|
||||
|
||||
if (!MStorage.add(getCtx(), locator.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), locator.getM_Warehouse_ID(),
|
||||
locator.getM_Locator_ID(),
|
||||
pline.getM_Product_ID(),
|
||||
pline.getM_AttributeSetInstance_ID(), 0 ,
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.compiere.model.MInOutLine;
|
|||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MProjectIssue;
|
||||
import org.compiere.model.MProjectLine;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MTimeExpense;
|
||||
import org.compiere.model.MTimeExpenseLine;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -234,7 +234,7 @@ public class ProjectIssue extends SvrProcess
|
|||
int M_Locator_ID = 0;
|
||||
// MProduct product = new MProduct (getCtx(), expenseLines[i].getM_Product_ID());
|
||||
// if (product.isStocked())
|
||||
M_Locator_ID = MStorage.getM_Locator_ID(expense.getM_Warehouse_ID(),
|
||||
M_Locator_ID = MStorageOnHand.getM_Locator_ID(expense.getM_Warehouse_ID(),
|
||||
expenseLines[i].getM_Product_ID(), 0, // no ASI
|
||||
expenseLines[i].getQty(), null);
|
||||
if (M_Locator_ID == 0) // Service/Expense - get default (and fallback)
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.compiere.model.MOrg;
|
|||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MRequisition;
|
||||
import org.compiere.model.MRequisitionLine;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MWarehouse;
|
||||
import org.compiere.model.X_T_Replenish;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
|
@ -534,7 +534,7 @@ public class ReplenishReport extends SvrProcess
|
|||
// From: Look-up Storage
|
||||
MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID());
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
|
||||
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0,
|
||||
true, null,
|
||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||
|
@ -542,7 +542,7 @@ public class ReplenishReport extends SvrProcess
|
|||
BigDecimal target = replenish.getQtyToOrder();
|
||||
for (int j = 0; j < storages.length; j++)
|
||||
{
|
||||
MStorage storage = storages[j];
|
||||
MStorageOnHand storage = storages[j];
|
||||
if (storage.getQtyOnHand().signum() <= 0)
|
||||
continue;
|
||||
BigDecimal moveQty = target;
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.compiere.model.MProduction;
|
|||
import org.compiere.model.MReplenish;
|
||||
import org.compiere.model.MRequisition;
|
||||
import org.compiere.model.MRequisitionLine;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MWarehouse;
|
||||
import org.compiere.model.X_T_Replenish;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
|
@ -570,7 +570,7 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
// From: Look-up Storage
|
||||
MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID());
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
|
||||
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0,
|
||||
true, null,
|
||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||
|
@ -578,7 +578,7 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
BigDecimal target = replenish.getQtyToOrder();
|
||||
for (int j = 0; j < storages.length; j++)
|
||||
{
|
||||
MStorage storage = storages[j];
|
||||
MStorageOnHand storage = storages[j];
|
||||
if (storage.getQtyOnHand().signum() <= 0)
|
||||
continue;
|
||||
BigDecimal moveQty = target;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.compiere.model.MLocator;
|
|||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MMovementLine;
|
||||
import org.compiere.model.MRefList;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class StorageCleanup extends SvrProcess
|
|||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
lines += move (new MStorage(getCtx(), rs, get_TrxName()));
|
||||
lines += move (new MStorageOnHand(getCtx(), rs, get_TrxName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -126,7 +126,7 @@ public class StorageCleanup extends SvrProcess
|
|||
* @param target target storage
|
||||
* @return no of movements
|
||||
*/
|
||||
private int move (MStorage target)
|
||||
private int move (MStorageOnHand target)
|
||||
{
|
||||
log.info(target.toString());
|
||||
BigDecimal qty = target.getQtyOnHand().negate();
|
||||
|
@ -140,10 +140,10 @@ public class StorageCleanup extends SvrProcess
|
|||
return 0;
|
||||
|
||||
int lines = 0;
|
||||
MStorage[] sources = getSources(target.getM_Product_ID(), target.getM_Locator_ID());
|
||||
MStorageOnHand[] sources = getSources(target.getM_Product_ID(), target.getM_Locator_ID());
|
||||
for (int i = 0; i < sources.length; i++)
|
||||
{
|
||||
MStorage source = sources[i];
|
||||
MStorageOnHand source = sources[i];
|
||||
|
||||
// Movement Line
|
||||
MMovementLine ml = new MMovementLine(mh);
|
||||
|
@ -189,13 +189,13 @@ public class StorageCleanup extends SvrProcess
|
|||
* Eliminate Reserved/Ordered
|
||||
* @param target target Storage
|
||||
*/
|
||||
private void eliminateReservation(MStorage target)
|
||||
private void eliminateReservation(MStorageOnHand target)
|
||||
{
|
||||
// Negative Ordered / Reserved Qty
|
||||
if (target.getQtyReserved().signum() != 0 || target.getQtyOrdered().signum() != 0)
|
||||
{
|
||||
int M_Locator_ID = target.getM_Locator_ID();
|
||||
MStorage storage0 = MStorage.get(getCtx(), M_Locator_ID,
|
||||
MStorageOnHand storage0 = MStorageOnHand.get(getCtx(), M_Locator_ID,
|
||||
target.getM_Product_ID(), 0, get_TrxName());
|
||||
if (storage0 == null)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ public class StorageCleanup extends SvrProcess
|
|||
if (M_Locator_ID != defaultLoc.getM_Locator_ID())
|
||||
{
|
||||
M_Locator_ID = defaultLoc.getM_Locator_ID();
|
||||
storage0 = MStorage.get(getCtx(), M_Locator_ID,
|
||||
storage0 = MStorageOnHand.get(getCtx(), M_Locator_ID,
|
||||
target.getM_Product_ID(), 0, get_TrxName());
|
||||
}
|
||||
}
|
||||
|
@ -218,12 +218,12 @@ public class StorageCleanup extends SvrProcess
|
|||
// Eliminate Reservation
|
||||
if (reserved.signum() != 0 || ordered.signum() != 0)
|
||||
{
|
||||
if (MStorage.add(getCtx(), target.getM_Warehouse_ID(), target.getM_Locator_ID(),
|
||||
if (MStorageOnHand.add(getCtx(), target.getM_Warehouse_ID(), target.getM_Locator_ID(),
|
||||
target.getM_Product_ID(),
|
||||
target.getM_AttributeSetInstance_ID(), target.getM_AttributeSetInstance_ID(),
|
||||
Env.ZERO, reserved.negate(), ordered.negate(), get_TrxName()))
|
||||
{
|
||||
if (MStorage.add(getCtx(), storage0.getM_Warehouse_ID(), storage0.getM_Locator_ID(),
|
||||
if (MStorageOnHand.add(getCtx(), storage0.getM_Warehouse_ID(), storage0.getM_Locator_ID(),
|
||||
storage0.getM_Product_ID(),
|
||||
storage0.getM_AttributeSetInstance_ID(), storage0.getM_AttributeSetInstance_ID(),
|
||||
Env.ZERO, reserved, ordered, get_TrxName()))
|
||||
|
@ -244,9 +244,9 @@ public class StorageCleanup extends SvrProcess
|
|||
* @param M_Locator_ID locator
|
||||
* @return sources
|
||||
*/
|
||||
private MStorage[] getSources (int M_Product_ID, int M_Locator_ID)
|
||||
private MStorageOnHand[] getSources (int M_Product_ID, int M_Locator_ID)
|
||||
{
|
||||
ArrayList<MStorage> list = new ArrayList<MStorage>();
|
||||
ArrayList<MStorageOnHand> list = new ArrayList<MStorageOnHand>();
|
||||
String sql = "SELECT * "
|
||||
+ "FROM M_Storage s "
|
||||
+ "WHERE QtyOnHand > 0"
|
||||
|
@ -272,7 +272,7 @@ public class StorageCleanup extends SvrProcess
|
|||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
list.add (new MStorage (getCtx(), rs, get_TrxName()));
|
||||
list.add (new MStorageOnHand (getCtx(), rs, get_TrxName()));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -284,7 +284,7 @@ public class StorageCleanup extends SvrProcess
|
|||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorage[] retValue = new MStorage[list.size()];
|
||||
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
} // getSources
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* 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 *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for M_StorageOnHand
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015
|
||||
*/
|
||||
public interface I_M_StorageOnHand
|
||||
{
|
||||
|
||||
/** TableName=M_StorageOnHand */
|
||||
public static final String Table_Name = "M_StorageOnHand";
|
||||
|
||||
/** AD_Table_ID=200026 */
|
||||
public static final int Table_ID = MTable.getTable_ID(Table_Name);
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - Client - Org
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(3);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name DateLastInventory */
|
||||
public static final String COLUMNNAME_DateLastInventory = "DateLastInventory";
|
||||
|
||||
/** Set Date last inventory count.
|
||||
* Date of Last Inventory Count
|
||||
*/
|
||||
public void setDateLastInventory (Timestamp DateLastInventory);
|
||||
|
||||
/** Get Date last inventory count.
|
||||
* Date of Last Inventory Count
|
||||
*/
|
||||
public Timestamp getDateLastInventory();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name M_AttributeSetInstance_ID */
|
||||
public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID";
|
||||
|
||||
/** Set Attribute Set Instance.
|
||||
* Product Attribute Set Instance
|
||||
*/
|
||||
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID);
|
||||
|
||||
/** Get Attribute Set Instance.
|
||||
* Product Attribute Set Instance
|
||||
*/
|
||||
public int getM_AttributeSetInstance_ID();
|
||||
|
||||
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException;
|
||||
|
||||
/** Column name M_Locator_ID */
|
||||
public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID";
|
||||
|
||||
/** Set Locator.
|
||||
* Warehouse Locator
|
||||
*/
|
||||
public void setM_Locator_ID (int M_Locator_ID);
|
||||
|
||||
/** Get Locator.
|
||||
* Warehouse Locator
|
||||
*/
|
||||
public int getM_Locator_ID();
|
||||
|
||||
public I_M_Locator getM_Locator() throws RuntimeException;
|
||||
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
|
||||
/** Set Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID);
|
||||
|
||||
/** Get Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID();
|
||||
|
||||
public I_M_Product getM_Product() throws RuntimeException;
|
||||
|
||||
/** Column name QtyOnHand */
|
||||
public static final String COLUMNNAME_QtyOnHand = "QtyOnHand";
|
||||
|
||||
/** Set On Hand Quantity.
|
||||
* On Hand Quantity
|
||||
*/
|
||||
public void setQtyOnHand (BigDecimal QtyOnHand);
|
||||
|
||||
/** Get On Hand Quantity.
|
||||
* On Hand Quantity
|
||||
*/
|
||||
public BigDecimal getQtyOnHand();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* 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 *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for M_StorageReservation
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015
|
||||
*/
|
||||
public interface I_M_StorageReservation
|
||||
{
|
||||
|
||||
/** TableName=M_StorageReservation */
|
||||
public static final String Table_Name = "M_StorageReservation";
|
||||
|
||||
/** AD_Table_ID=200027 */
|
||||
public static final int Table_ID = MTable.getTable_ID(Table_Name);
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 3 - Client - Org
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(3);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name DateLastInventory */
|
||||
public static final String COLUMNNAME_DateLastInventory = "DateLastInventory";
|
||||
|
||||
/** Set Date last inventory count.
|
||||
* Date of Last Inventory Count
|
||||
*/
|
||||
public void setDateLastInventory (Timestamp DateLastInventory);
|
||||
|
||||
/** Get Date last inventory count.
|
||||
* Date of Last Inventory Count
|
||||
*/
|
||||
public Timestamp getDateLastInventory();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsSOTrx */
|
||||
public static final String COLUMNNAME_IsSOTrx = "IsSOTrx";
|
||||
|
||||
/** Set Sales Transaction.
|
||||
* This is a Sales Transaction
|
||||
*/
|
||||
public void setIsSOTrx (boolean IsSOTrx);
|
||||
|
||||
/** Get Sales Transaction.
|
||||
* This is a Sales Transaction
|
||||
*/
|
||||
public boolean isSOTrx();
|
||||
|
||||
/** Column name M_AttributeSetInstance_ID */
|
||||
public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID";
|
||||
|
||||
/** Set Attribute Set Instance.
|
||||
* Product Attribute Set Instance
|
||||
*/
|
||||
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID);
|
||||
|
||||
/** Get Attribute Set Instance.
|
||||
* Product Attribute Set Instance
|
||||
*/
|
||||
public int getM_AttributeSetInstance_ID();
|
||||
|
||||
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException;
|
||||
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
|
||||
/** Set Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID);
|
||||
|
||||
/** Get Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID();
|
||||
|
||||
public I_M_Product getM_Product() throws RuntimeException;
|
||||
|
||||
/** Column name M_Warehouse_ID */
|
||||
public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID";
|
||||
|
||||
/** Set Warehouse.
|
||||
* Storage Warehouse and Service Point
|
||||
*/
|
||||
public void setM_Warehouse_ID (int M_Warehouse_ID);
|
||||
|
||||
/** Get Warehouse.
|
||||
* Storage Warehouse and Service Point
|
||||
*/
|
||||
public int getM_Warehouse_ID();
|
||||
|
||||
public I_M_Warehouse getM_Warehouse() throws RuntimeException;
|
||||
|
||||
/** Column name Qty */
|
||||
public static final String COLUMNNAME_Qty = "Qty";
|
||||
|
||||
/** Set Quantity.
|
||||
* Quantity
|
||||
*/
|
||||
public void setQty (BigDecimal Qty);
|
||||
|
||||
/** Get Quantity.
|
||||
* Quantity
|
||||
*/
|
||||
public BigDecimal getQty();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
}
|
|
@ -101,12 +101,12 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
if (qty.signum() == 0)
|
||||
continue;
|
||||
// Stock Info
|
||||
MStorage[] storages = null;
|
||||
MStorageOnHand[] storages = null;
|
||||
MProduct product = oLines[i].getProduct();
|
||||
if (product != null && product.get_ID() != 0 && product.isStocked())
|
||||
{
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
storages = MStorage.getWarehouse (order.getCtx(), order.getM_Warehouse_ID(),
|
||||
storages = MStorageOnHand.getWarehouse (order.getCtx(), order.getM_Warehouse_ID(),
|
||||
oLines[i].getM_Product_ID(), oLines[i].getM_AttributeSetInstance_ID(),
|
||||
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, 0, trxName);
|
||||
} else {
|
||||
|
@ -1353,7 +1353,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
|
||||
|
||||
// Update Storage - see also VMatch.createMatchRecord
|
||||
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
|
||||
sLine.getM_Locator_ID(),
|
||||
sLine.getM_Product_ID(),
|
||||
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
|
||||
|
@ -1369,7 +1369,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
if (!sameWarehouse) {
|
||||
//correct qtyOrdered in warehouse of order
|
||||
MWarehouse wh = MWarehouse.get(getCtx(), oLine.getM_Warehouse_ID());
|
||||
if (!MStorage.add(getCtx(), oLine.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), oLine.getM_Warehouse_ID(),
|
||||
wh.getDefaultLocator().getM_Locator_ID(),
|
||||
sLine.getM_Product_ID(),
|
||||
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
|
||||
|
@ -1399,7 +1399,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
BigDecimal orderedDiff = sameWarehouse ? QtyPO.negate(): Env.ZERO;
|
||||
|
||||
// Fallback: Update Storage - see also VMatch.createMatchRecord
|
||||
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
|
||||
sLine.getM_Locator_ID(),
|
||||
sLine.getM_Product_ID(),
|
||||
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
|
||||
|
@ -1411,7 +1411,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
if (!sameWarehouse) {
|
||||
//correct qtyOrdered in warehouse of order
|
||||
MWarehouse wh = MWarehouse.get(getCtx(), oLine.getM_Warehouse_ID());
|
||||
if (!MStorage.add(getCtx(), oLine.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), oLine.getM_Warehouse_ID(),
|
||||
wh.getDefaultLocator().getM_Locator_ID(),
|
||||
sLine.getM_Product_ID(),
|
||||
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
|
||||
|
@ -1775,9 +1775,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
{
|
||||
MAttributeSetInstance asi = null;
|
||||
//auto balance negative on hand
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, line.getM_Locator_ID(), get_TrxName());
|
||||
for (MStorage storage : storages)
|
||||
for (MStorageOnHand storage : storages)
|
||||
{
|
||||
if (storage.getQtyOnHand().signum() < 0)
|
||||
{
|
||||
|
@ -1799,10 +1799,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
{
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
Timestamp minGuaranteeDate = getMovementDate();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
|
||||
BigDecimal qtyToDeliver = line.getMovementQty();
|
||||
for (MStorage storage: storages)
|
||||
for (MStorageOnHand storage: storages)
|
||||
{
|
||||
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
|
||||
{
|
||||
|
|
|
@ -304,7 +304,7 @@ public class MInOutLine extends X_M_InOutLine
|
|||
}
|
||||
|
||||
// Get existing Location
|
||||
int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(),
|
||||
int M_Locator_ID = MStorageOnHand.getM_Locator_ID (getM_Warehouse_ID(),
|
||||
getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
||||
Qty, get_TrxName());
|
||||
// Get default Location
|
||||
|
|
|
@ -437,7 +437,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
log.fine("Diff=" + qtyDiff
|
||||
+ " - Instance OnHand=" + QtyMA + "->" + QtyNew);
|
||||
|
||||
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
|
||||
line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
ma.getM_AttributeSetInstance_ID(), 0,
|
||||
|
@ -451,7 +451,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
// Only Update Date Last Inventory if is a Physical Inventory
|
||||
if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0)
|
||||
{
|
||||
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
|
||||
MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
storage.setDateLastInventory(getMovementDate());
|
||||
if (!storage.save(get_TrxName()))
|
||||
|
@ -488,7 +488,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
if (mtrx == null)
|
||||
{
|
||||
//Fallback: Update Storage - see also VMatch.createMatchRecord
|
||||
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
|
||||
line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), 0,
|
||||
|
@ -501,7 +501,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
// Only Update Date Last Inventory if is a Physical Inventory
|
||||
if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0)
|
||||
{
|
||||
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
|
||||
MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
|
||||
storage.setDateLastInventory(getMovementDate());
|
||||
|
@ -583,9 +583,9 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
{
|
||||
MAttributeSetInstance asi = null;
|
||||
//auto balance negative on hand
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, line.getM_Locator_ID(), get_TrxName());
|
||||
for (MStorage storage : storages)
|
||||
for (MStorageOnHand storage : storages)
|
||||
{
|
||||
if (storage.getQtyOnHand().signum() < 0)
|
||||
{
|
||||
|
@ -603,12 +603,12 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
else // Outgoing Trx
|
||||
{
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
|
||||
|
||||
BigDecimal qtyToDeliver = qtyDiff.negate();
|
||||
|
||||
for (MStorage storage: storages)
|
||||
for (MStorageOnHand storage: storages)
|
||||
{
|
||||
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
|
||||
{
|
||||
|
|
|
@ -350,7 +350,7 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
*/
|
||||
private void createMA()
|
||||
{
|
||||
MStorage[] storages = MStorage.getAll(getCtx(), getM_Product_ID(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getAll(getCtx(), getM_Product_ID(),
|
||||
getM_Locator_ID(), get_TrxName());
|
||||
boolean allZeroASI = true;
|
||||
for (int i = 0; i < storages.length; i++)
|
||||
|
@ -368,7 +368,7 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
BigDecimal sum = Env.ZERO;
|
||||
for (int i = 0; i < storages.length; i++)
|
||||
{
|
||||
MStorage storage = storages[i];
|
||||
MStorageOnHand storage = storages[i];
|
||||
if (storage.getQtyOnHand().signum() == 0)
|
||||
continue;
|
||||
if (ma != null
|
||||
|
|
|
@ -399,7 +399,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
//
|
||||
MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName());
|
||||
//Update Storage
|
||||
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
ma.getM_AttributeSetInstance_ID(), 0,
|
||||
|
@ -416,7 +416,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID();
|
||||
}
|
||||
//Update Storage
|
||||
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
line.getM_LocatorTo_ID(),
|
||||
line.getM_Product_ID(),
|
||||
M_AttributeSetInstanceTo_ID, 0,
|
||||
|
@ -455,7 +455,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
{
|
||||
MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName());
|
||||
//Update Storage
|
||||
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
line.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), 0,
|
||||
|
@ -466,7 +466,7 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
}
|
||||
|
||||
//Update Storage
|
||||
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
|
||||
line.getM_LocatorTo_ID(),
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstanceTo_ID(), 0,
|
||||
|
@ -550,12 +550,12 @@ public class MMovement extends X_M_Movement implements DocAction
|
|||
{
|
||||
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
|
||||
String MMPolicy = product.getMMPolicy();
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(), 0, line.getM_Product_ID(), 0,
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0, line.getM_Product_ID(), 0,
|
||||
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
|
||||
|
||||
BigDecimal qtyToDeliver = line.getMovementQty();
|
||||
|
||||
for (MStorage storage: storages)
|
||||
for (MStorageOnHand storage: storages)
|
||||
{
|
||||
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
|
||||
{
|
||||
|
|
|
@ -137,9 +137,9 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
if (to.copyLinesFrom(from, counter, copyASI) == 0)
|
||||
throw new IllegalStateException("Could not create Order Lines");
|
||||
|
||||
// don't copy linked PO/SO
|
||||
to.setLink_Order_ID(0);
|
||||
|
||||
// don't copy linked PO/SO
|
||||
to.setLink_Order_ID(0);
|
||||
|
||||
return to;
|
||||
} // copyFrom
|
||||
|
||||
|
@ -543,8 +543,8 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
else
|
||||
line.setRef_OrderLine_ID(0);
|
||||
|
||||
// don't copy linked lines
|
||||
line.setLink_OrderLine_ID(0);
|
||||
// don't copy linked lines
|
||||
line.setLink_OrderLine_ID(0);
|
||||
// Tax
|
||||
if (getC_BPartner_ID() != otherOrder.getC_BPartner_ID())
|
||||
line.setTax(); // recalculate
|
||||
|
@ -1514,7 +1514,7 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
// Closing Binding Quotation
|
||||
|| (MDocType.DOCSUBTYPESO_Quotation.equals(dt.getDocSubTypeSO())
|
||||
&& DOCACTION_Close.equals(getDocAction()))
|
||||
) // || isDropShip() )
|
||||
) // || isDropShip() )
|
||||
binding = false;
|
||||
boolean isSOTrx = isSOTrx();
|
||||
log.fine("Binding=" + binding + " - IsSOTrx=" + isSOTrx);
|
||||
|
@ -1571,7 +1571,7 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
int M_Locator_ID = 0;
|
||||
// Get Locator to reserve
|
||||
if (line.getM_AttributeSetInstance_ID() != 0) // Get existing Location
|
||||
M_Locator_ID = MStorage.getM_Locator_ID (line.getM_Warehouse_ID(),
|
||||
M_Locator_ID = MStorageOnHand.getM_Locator_ID (line.getM_Warehouse_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
ordered, get_TrxName());
|
||||
// Get default Location
|
||||
|
@ -1592,7 +1592,7 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
}
|
||||
}
|
||||
// Update Storage
|
||||
if (!MStorage.add(getCtx(), line.getM_Warehouse_ID(), M_Locator_ID,
|
||||
if (!MStorageOnHand.add(getCtx(), line.getM_Warehouse_ID(), M_Locator_ID,
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
Env.ZERO, reserved, ordered, get_TrxName()))
|
||||
|
@ -2036,7 +2036,7 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
// Qty = Ordered - Delivered
|
||||
BigDecimal MovementQty = oLine.getQtyOrdered().subtract(oLine.getQtyDelivered());
|
||||
// Location
|
||||
int M_Locator_ID = MStorage.getM_Locator_ID (oLine.getM_Warehouse_ID(),
|
||||
int M_Locator_ID = MStorageOnHand.getM_Locator_ID (oLine.getM_Warehouse_ID(),
|
||||
oLine.getM_Product_ID(), oLine.getM_AttributeSetInstance_ID(),
|
||||
MovementQty, get_TrxName());
|
||||
if (M_Locator_ID == 0) // Get default Location
|
||||
|
|
|
@ -200,9 +200,9 @@ public class MOrderLine extends X_C_OrderLine
|
|||
private boolean m_IsSOTrx = true;
|
||||
// Product Pricing
|
||||
private MProductPricing m_productPrice = null;
|
||||
|
||||
/** Tax */
|
||||
private MTax m_tax = null;
|
||||
|
||||
/** Tax */
|
||||
private MTax m_tax = null;
|
||||
|
||||
/** Cached Currency Precision */
|
||||
private Integer m_precision = null;
|
||||
|
@ -418,17 +418,17 @@ public class MOrderLine extends X_C_OrderLine
|
|||
if (m_charge == null && getC_Charge_ID() != 0)
|
||||
m_charge = MCharge.get (getCtx(), getC_Charge_ID());
|
||||
return m_charge;
|
||||
}
|
||||
/**
|
||||
* Get Tax
|
||||
* @return tax
|
||||
*/
|
||||
protected MTax getTax()
|
||||
{
|
||||
if (m_tax == null)
|
||||
m_tax = MTax.get(getCtx(), getC_Tax_ID());
|
||||
return m_tax;
|
||||
} // getTax
|
||||
}
|
||||
/**
|
||||
* Get Tax
|
||||
* @return tax
|
||||
*/
|
||||
protected MTax getTax()
|
||||
{
|
||||
if (m_tax == null)
|
||||
m_tax = MTax.get(getCtx(), getC_Tax_ID());
|
||||
return m_tax;
|
||||
} // getTax
|
||||
|
||||
/**
|
||||
* Get Currency Precision from Currency
|
||||
|
@ -873,7 +873,7 @@ public class MOrderLine extends X_C_OrderLine
|
|||
// Max
|
||||
if (isInstance)
|
||||
{
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
|
||||
getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
||||
M_AttributeSet_ID, false, null, true, get_TrxName());
|
||||
BigDecimal qty = Env.ZERO;
|
||||
|
|
|
@ -571,7 +571,7 @@ public class MProduct extends X_M_Product
|
|||
|| (is_ValueChanged("ProductType") // from Item
|
||||
&& PRODUCTTYPE_Item.equals(get_ValueOld("ProductType")))))
|
||||
{
|
||||
MStorage[] storages = MStorage.getOfProduct(getCtx(), get_ID(), get_TrxName());
|
||||
MStorageOnHand[] storages = MStorageOnHand.getOfProduct(getCtx(), get_ID(), get_TrxName());
|
||||
BigDecimal OnHand = Env.ZERO;
|
||||
BigDecimal Ordered = Env.ZERO;
|
||||
BigDecimal Reserved = Env.ZERO;
|
||||
|
@ -710,7 +710,7 @@ public class MProduct extends X_M_Product
|
|||
// Check Storage
|
||||
if (isStocked() || PRODUCTTYPE_Item.equals(getProductType()))
|
||||
{
|
||||
MStorage[] storages = MStorage.getOfProduct(getCtx(), get_ID(), get_TrxName());
|
||||
MStorageOnHand[] storages = MStorageOnHand.getOfProduct(getCtx(), get_ID(), get_TrxName());
|
||||
BigDecimal OnHand = Env.ZERO;
|
||||
BigDecimal Ordered = Env.ZERO;
|
||||
BigDecimal Reserved = Env.ZERO;
|
||||
|
|
|
@ -186,7 +186,7 @@ public class MProduction extends X_M_Production {
|
|||
{
|
||||
|
||||
// BOM stock info
|
||||
MStorage[] storages = null;
|
||||
MStorageOnHand[] storages = null;
|
||||
MProduct usedProduct = MProduct.get(getCtx(), BOMProduct_ID);
|
||||
defaultLocator = usedProduct.getM_Locator_ID();
|
||||
if ( defaultLocator == 0 )
|
||||
|
@ -203,7 +203,7 @@ public class MProduction extends X_M_Production {
|
|||
MMPolicy = client.getMMPolicy();
|
||||
}
|
||||
|
||||
storages = MStorage.getWarehouse(getCtx(), M_Warehouse_ID, BOMProduct_ID, 0, null,
|
||||
storages = MStorageOnHand.getWarehouse(getCtx(), M_Warehouse_ID, BOMProduct_ID, 0, null,
|
||||
MProductCategory.MMPOLICY_FiFo.equals(MMPolicy), true, 0, get_TrxName());
|
||||
|
||||
MProductionLine BOMLine = null;
|
||||
|
|
|
@ -104,7 +104,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
log.log(Level.SEVERE, "Could not save transaction for " + toString());
|
||||
errorString.append("Could not save transaction for " + toString() + "\n");
|
||||
}
|
||||
MStorage storage = MStorage.getCreate(getCtx(), getM_Locator_ID(),
|
||||
MStorageOnHand storage = MStorageOnHand.getCreate(getCtx(), getM_Locator_ID(),
|
||||
getM_Product_ID(), asi.get_ID(), get_TrxName());
|
||||
storage.changeQtyOnHand(getMovementQty(), true);
|
||||
if ( !storage.save(get_TrxName()) ) {
|
||||
|
@ -117,7 +117,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
}
|
||||
|
||||
// create transactions and update stock used in production
|
||||
MStorage[] storages = MStorage.getAll( getCtx(), getM_Product_ID(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getAll( getCtx(), getM_Product_ID(),
|
||||
getM_Locator_ID(), get_TrxName());
|
||||
|
||||
MProductionLineMA lineMA = null;
|
||||
|
@ -192,10 +192,10 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
}
|
||||
else
|
||||
{
|
||||
MStorage storage = MStorage.get(Env.getCtx(), getM_Locator_ID(), getM_Product_ID(), 0, get_TrxName());
|
||||
MStorageOnHand storage = MStorageOnHand.get(Env.getCtx(), getM_Locator_ID(), getM_Product_ID(), 0, get_TrxName());
|
||||
if (storage == null)
|
||||
{
|
||||
storage = new MStorage(Env.getCtx(), 0, get_TrxName());
|
||||
storage = new MStorageOnHand(Env.getCtx(), 0, get_TrxName());
|
||||
storage.setM_Locator_ID(getM_Locator_ID());
|
||||
storage.setM_Product_ID(getM_Product_ID());
|
||||
storage.setM_AttributeSetInstance_ID(0);
|
||||
|
|
|
@ -163,7 +163,7 @@ public class MProjectIssue extends X_C_ProjectIssue
|
|||
mTrx.setC_ProjectIssue_ID(getC_ProjectIssue_ID());
|
||||
//
|
||||
MLocator loc = MLocator.get(getCtx(), getM_Locator_ID());
|
||||
if (MStorage.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(),
|
||||
if (MStorageOnHand.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(),
|
||||
getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_AttributeSetInstance_ID(),
|
||||
getMovementQty().negate(), null, null, get_TrxName()))
|
||||
{
|
||||
|
|
|
@ -0,0 +1,709 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* 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 *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.List;
|
||||
|
||||
import org.compiere.util.CLogMgt;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
* Inventory Storage Model
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MStorage.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
|
||||
*/
|
||||
public class MStorageOnHand extends X_M_StorageOnHand
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3911132565445025309L;
|
||||
|
||||
/**
|
||||
* Get Storage Info
|
||||
* @param ctx context
|
||||
* @param M_Locator_ID locator
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID instance
|
||||
* @param trxName transaction
|
||||
* @return existing or null
|
||||
*/
|
||||
public static MStorageOnHand get (Properties ctx, int M_Locator_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
|
||||
{
|
||||
String sqlWhere = "M_Locator_ID=? AND M_Product_ID=? AND ";
|
||||
if (M_AttributeSetInstance_ID == 0)
|
||||
sqlWhere += "(M_AttributeSetInstance_ID=? OR M_AttributeSetInstance_ID IS NULL)";
|
||||
else
|
||||
sqlWhere += "M_AttributeSetInstance_ID=?";
|
||||
|
||||
MStorageOnHand retValue = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName)
|
||||
.setParameters(M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID)
|
||||
.first();
|
||||
|
||||
if (retValue == null)
|
||||
s_log.fine("Not Found - M_Locator_ID=" + M_Locator_ID
|
||||
+ ", M_Product_ID=" + M_Product_ID + ", M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID);
|
||||
else
|
||||
s_log.fine("M_Locator_ID=" + M_Locator_ID
|
||||
+ ", M_Product_ID=" + M_Product_ID + ", M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID);
|
||||
return retValue;
|
||||
} // get
|
||||
|
||||
/**
|
||||
* Get all Storages for Product with ASI and QtyOnHand <> 0
|
||||
* @param ctx context
|
||||
* @param M_Product_ID product
|
||||
* @param M_Locator_ID locator
|
||||
* @param FiFo first in-first-out
|
||||
* @param trxName transaction
|
||||
* @return existing or null
|
||||
*/
|
||||
public static MStorageOnHand[] getAllWithASI (Properties ctx, int M_Product_ID, int M_Locator_ID,
|
||||
boolean FiFo, String trxName)
|
||||
{
|
||||
ArrayList<MStorageOnHand> list = new ArrayList<MStorageOnHand>();
|
||||
String sql = "SELECT * FROM M_StorageOnHand "
|
||||
+ "WHERE M_Product_ID=? AND M_Locator_ID=?"
|
||||
+ " AND M_AttributeSetInstance_ID > 0 "
|
||||
+ " AND QtyOnHand <> 0 "
|
||||
+ "ORDER BY M_AttributeSetInstance_ID";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, M_Product_ID);
|
||||
pstmt.setInt (2, M_Locator_ID);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add(new MStorageOnHand (ctx, rs, trxName));
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
} // getAllWithASI
|
||||
|
||||
/**
|
||||
* Get all Storages for Product where QtyOnHand <> 0
|
||||
* @param ctx context
|
||||
* @param M_Product_ID product
|
||||
* @param M_Locator_ID locator
|
||||
* @param trxName transaction
|
||||
* @return existing or null
|
||||
*/
|
||||
public static MStorageOnHand[] getAll (Properties ctx,
|
||||
int M_Product_ID, int M_Locator_ID, String trxName)
|
||||
{
|
||||
String sqlWhere = "M_Product_ID=? AND M_Locator_ID=?"
|
||||
+ " AND QtyOnHand <> 0 "
|
||||
+ "ORDER BY M_AttributeSetInstance_ID";
|
||||
|
||||
List<MStorageOnHand> list = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName)
|
||||
.setParameters(M_Product_ID, M_Locator_ID)
|
||||
.list();
|
||||
|
||||
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
} // getAll
|
||||
|
||||
|
||||
/**
|
||||
* Get Storage Info for Product across warehouses
|
||||
* @param ctx context
|
||||
* @param M_Product_ID product
|
||||
* @param trxName transaction
|
||||
* @return existing or null
|
||||
*/
|
||||
public static MStorageOnHand[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
||||
{
|
||||
String sqlWhere = "M_Product_ID=?";
|
||||
|
||||
List<MStorageOnHand> list = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName)
|
||||
.setParameters(M_Product_ID)
|
||||
.list();
|
||||
|
||||
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
|
||||
} // getOfProduct
|
||||
|
||||
/**
|
||||
* Get Storage Info for Warehouse
|
||||
* @param ctx context
|
||||
* @param M_Warehouse_ID
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID instance
|
||||
* @param M_AttributeSet_ID attribute set
|
||||
* @param allAttributeInstances if true, all attribute set instances
|
||||
* @param minGuaranteeDate optional minimum guarantee date if all attribute instances
|
||||
* @param FiFo first in-first-out
|
||||
* @param trxName transaction
|
||||
* @return existing - ordered by location priority (desc) and/or guarantee date
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public static MStorageOnHand[] getWarehouse (Properties ctx, int M_Warehouse_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, int M_AttributeSet_ID,
|
||||
boolean allAttributeInstances, Timestamp minGuaranteeDate,
|
||||
boolean FiFo, String trxName)
|
||||
{
|
||||
return getWarehouse(ctx, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID,
|
||||
minGuaranteeDate, FiFo, false, 0, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Storage Info for Warehouse or locator
|
||||
* @param ctx context
|
||||
* @param M_Warehouse_ID ignore if M_Locator_ID > 0
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID instance id, 0 to retrieve all instance
|
||||
* @param minGuaranteeDate optional minimum guarantee date if all attribute instances
|
||||
* @param FiFo first in-first-out
|
||||
* @param positiveOnly if true, only return storage records with qtyOnHand > 0
|
||||
* @param M_Locator_ID optional locator id
|
||||
* @param trxName transaction
|
||||
* @return existing - ordered by location priority (desc) and/or guarantee date
|
||||
*/
|
||||
public static MStorageOnHand[] getWarehouse (Properties ctx, int M_Warehouse_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, Timestamp minGuaranteeDate,
|
||||
boolean FiFo, boolean positiveOnly, int M_Locator_ID, String trxName)
|
||||
{
|
||||
if ((M_Warehouse_ID == 0 && M_Locator_ID == 0) || M_Product_ID == 0)
|
||||
return new MStorageOnHand[0];
|
||||
|
||||
boolean allAttributeInstances = false;
|
||||
if (M_AttributeSetInstance_ID == 0)
|
||||
allAttributeInstances = true;
|
||||
|
||||
ArrayList<MStorageOnHand> list = new ArrayList<MStorageOnHand>();
|
||||
// Specific Attribute Set Instance
|
||||
String sql = "SELECT s.M_Product_ID,s.M_Locator_ID,s.M_AttributeSetInstance_ID,"
|
||||
+ "s.AD_Client_ID,s.AD_Org_ID,s.IsActive,s.Created,s.CreatedBy,s.Updated,s.UpdatedBy,"
|
||||
//@win change
|
||||
//+ "s.QtyOnHand,s.QtyReserved,s.QtyOrdered,s.DateLastInventory "
|
||||
+ "s.QtyOnHand,s.DateLastInventory "
|
||||
//end @win change
|
||||
|
||||
+ "FROM M_StorageOnHand s"
|
||||
+ " INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) ";
|
||||
if (M_Locator_ID > 0)
|
||||
sql += "WHERE l.M_Locator_ID = ?";
|
||||
else
|
||||
sql += "WHERE l.M_Warehouse_ID=?";
|
||||
sql += " AND s.M_Product_ID=?"
|
||||
+ " AND COALESCE(s.M_AttributeSetInstance_ID,0)=? ";
|
||||
if (positiveOnly)
|
||||
{
|
||||
sql += " AND s.QtyOnHand > 0 ";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += " AND s.QtyOnHand <> 0 ";
|
||||
}
|
||||
sql += "ORDER BY l.PriorityNo DESC, M_AttributeSetInstance_ID";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
// All Attribute Set Instances
|
||||
if (allAttributeInstances)
|
||||
{
|
||||
sql = "SELECT s.M_Product_ID,s.M_Locator_ID,s.M_AttributeSetInstance_ID,"
|
||||
+ "s.AD_Client_ID,s.AD_Org_ID,s.IsActive,s.Created,s.CreatedBy,s.Updated,s.UpdatedBy,"
|
||||
//@win change
|
||||
//+ "s.QtyOnHand,s.QtyReserved,s.QtyOrdered,s.DateLastInventory "
|
||||
+ "s.QtyOnHand,s.DateLastInventory "
|
||||
//end @win change
|
||||
|
||||
+ "FROM M_StorageOnHand s"
|
||||
+ " INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID)"
|
||||
+ " LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) ";
|
||||
if (M_Locator_ID > 0)
|
||||
sql += "WHERE l.M_Locator_ID = ?";
|
||||
else
|
||||
sql += "WHERE l.M_Warehouse_ID=?";
|
||||
sql += " AND s.M_Product_ID=? ";
|
||||
if (positiveOnly)
|
||||
{
|
||||
sql += " AND s.QtyOnHand > 0 ";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += " AND s.QtyOnHand <> 0 ";
|
||||
}
|
||||
if (minGuaranteeDate != null)
|
||||
{
|
||||
sql += "AND (asi.GuaranteeDate IS NULL OR asi.GuaranteeDate>?) ";
|
||||
sql += "ORDER BY l.PriorityNo DESC, " +
|
||||
"asi.GuaranteeDate, M_AttributeSetInstance_ID";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += ", s.QtyOnHand DESC";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += "ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.M_AttributeSetInstance_ID";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += ", s.QtyOnHand DESC";
|
||||
}
|
||||
}
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, M_Locator_ID > 0 ? M_Locator_ID : M_Warehouse_ID);
|
||||
pstmt.setInt(2, M_Product_ID);
|
||||
if (!allAttributeInstances)
|
||||
{
|
||||
pstmt.setInt(3, M_AttributeSetInstance_ID);
|
||||
}
|
||||
else if (minGuaranteeDate != null)
|
||||
{
|
||||
pstmt.setTimestamp(3, minGuaranteeDate);
|
||||
}
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
if(rs.getBigDecimal(11).signum() != 0)
|
||||
list.add (new MStorageOnHand (ctx, rs, trxName));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
} // getWarehouse
|
||||
|
||||
|
||||
/**
|
||||
* Create or Get Storage Info
|
||||
* @param ctx context
|
||||
* @param M_Locator_ID locator
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID instance
|
||||
* @param trxName transaction
|
||||
* @return existing/new or null
|
||||
*/
|
||||
public static MStorageOnHand getCreate (Properties ctx, int M_Locator_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
|
||||
{
|
||||
if (M_Locator_ID == 0)
|
||||
throw new IllegalArgumentException("M_Locator_ID=0");
|
||||
if (M_Product_ID == 0)
|
||||
throw new IllegalArgumentException("M_Product_ID=0");
|
||||
MStorageOnHand retValue = get(ctx, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID, trxName);
|
||||
if (retValue != null)
|
||||
return retValue;
|
||||
|
||||
// Insert row based on locator
|
||||
MLocator locator = new MLocator (ctx, M_Locator_ID, trxName);
|
||||
if (locator.get_ID() != M_Locator_ID)
|
||||
throw new IllegalArgumentException("Not found M_Locator_ID=" + M_Locator_ID);
|
||||
//
|
||||
retValue = new MStorageOnHand (locator, M_Product_ID, M_AttributeSetInstance_ID);
|
||||
retValue.save(trxName);
|
||||
s_log.fine("New " + retValue);
|
||||
return retValue;
|
||||
} // getCreate
|
||||
|
||||
|
||||
/**
|
||||
* Update Storage Info add.
|
||||
* Called from MProjectIssue
|
||||
* @param ctx context
|
||||
* @param M_Warehouse_ID warehouse
|
||||
* @param M_Locator_ID locator
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID AS Instance
|
||||
* @param reservationAttributeSetInstance_ID reservation AS Instance
|
||||
* @param diffQtyOnHand add on hand
|
||||
* @param trxName transaction
|
||||
* @return true if updated
|
||||
*/
|
||||
public static boolean add (Properties ctx, int M_Warehouse_ID, int M_Locator_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, int reservationAttributeSetInstance_ID,
|
||||
BigDecimal diffQtyOnHand, String trxName)
|
||||
{
|
||||
MStorageOnHand storage = null;
|
||||
StringBuffer diffText = new StringBuffer("(");
|
||||
|
||||
// Get Storage
|
||||
if (storage == null)
|
||||
storage = getCreate (ctx, M_Locator_ID,
|
||||
M_Product_ID, M_AttributeSetInstance_ID, trxName);
|
||||
// Verify
|
||||
if (storage.getM_Locator_ID() != M_Locator_ID
|
||||
&& storage.getM_Product_ID() != M_Product_ID
|
||||
&& storage.getM_AttributeSetInstance_ID() != M_AttributeSetInstance_ID)
|
||||
{
|
||||
s_log.severe ("No Storage found - M_Locator_ID=" + M_Locator_ID
|
||||
+ ",M_Product_ID=" + M_Product_ID + ",ASI=" + M_AttributeSetInstance_ID);
|
||||
return false;
|
||||
}
|
||||
|
||||
// CarlosRuiz - globalqss - Fix [ 1725383 ] QtyOrdered wrongly updated
|
||||
MProduct prd = new MProduct(ctx, M_Product_ID, trxName);
|
||||
if (prd.getM_AttributeSet_ID() == 0) {
|
||||
// Product doesn't manage attribute set, always reserved with 0
|
||||
reservationAttributeSetInstance_ID = 0;
|
||||
}
|
||||
//
|
||||
|
||||
MStorageOnHand storage0 = null;
|
||||
if (M_AttributeSetInstance_ID != reservationAttributeSetInstance_ID)
|
||||
{
|
||||
storage0 = get(ctx, M_Locator_ID,
|
||||
M_Product_ID, reservationAttributeSetInstance_ID, trxName);
|
||||
if (storage0 == null) // create if not existing - should not happen
|
||||
{
|
||||
MWarehouse wh = MWarehouse.get(ctx, M_Warehouse_ID);
|
||||
int xM_Locator_ID = wh.getDefaultLocator().getM_Locator_ID();
|
||||
storage0 = getCreate (ctx, xM_Locator_ID,
|
||||
M_Product_ID, reservationAttributeSetInstance_ID, trxName);
|
||||
}
|
||||
}
|
||||
boolean changed = false;
|
||||
if (diffQtyOnHand != null && diffQtyOnHand.signum() != 0)
|
||||
{
|
||||
storage.setQtyOnHand (storage.getQtyOnHand().add (diffQtyOnHand));
|
||||
diffText.append("OnHand=").append(diffQtyOnHand);
|
||||
changed = true;
|
||||
}
|
||||
/*//@win commented out
|
||||
if (diffQtyReserved != null && diffQtyReserved.signum() != 0)
|
||||
{
|
||||
if (storage0 == null)
|
||||
storage.setQtyReserved (storage.getQtyReserved().add (diffQtyReserved));
|
||||
else
|
||||
storage0.setQtyReserved (storage0.getQtyReserved().add (diffQtyReserved));
|
||||
diffText.append(" Reserved=").append(diffQtyReserved);
|
||||
changed = true;
|
||||
}
|
||||
if (diffQtyOrdered != null && diffQtyOrdered.signum() != 0)
|
||||
{
|
||||
if (storage0 == null)
|
||||
storage.setQtyOrdered (storage.getQtyOrdered().add (diffQtyOrdered));
|
||||
else
|
||||
storage0.setQtyOrdered (storage0.getQtyOrdered().add (diffQtyOrdered));
|
||||
diffText.append(" Ordered=").append(diffQtyOrdered);
|
||||
changed = true;
|
||||
}
|
||||
*/
|
||||
if (changed)
|
||||
{
|
||||
diffText.append(") -> ").append(storage.toString());
|
||||
s_log.fine(diffText.toString());
|
||||
if (storage0 != null)
|
||||
storage0.save(trxName); // No AttributeSetInstance (reserved/ordered)
|
||||
return storage.save (trxName);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // add
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Location with highest Locator Priority and a sufficient OnHand Qty
|
||||
* @param M_Warehouse_ID warehouse
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID asi
|
||||
* @param Qty qty
|
||||
* @param trxName transaction
|
||||
* @return id
|
||||
*/
|
||||
public static int getM_Locator_ID (int M_Warehouse_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, BigDecimal Qty,
|
||||
String trxName)
|
||||
{
|
||||
int M_Locator_ID = 0;
|
||||
int firstM_Locator_ID = 0;
|
||||
String sql = "SELECT s.M_Locator_ID, s.QtyOnHand "
|
||||
+ "FROM M_StorageOnHand s"
|
||||
+ " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)"
|
||||
+ " INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID)"
|
||||
+ " LEFT OUTER JOIN M_AttributeSet mas ON (p.M_AttributeSet_ID=mas.M_AttributeSet_ID) "
|
||||
+ "WHERE l.M_Warehouse_ID=?"
|
||||
+ " AND s.M_Product_ID=?"
|
||||
+ " AND (mas.IsInstanceAttribute IS NULL OR mas.IsInstanceAttribute='N' OR s.M_AttributeSetInstance_ID=?)"
|
||||
+ " AND l.IsActive='Y' "
|
||||
+ "ORDER BY l.PriorityNo DESC, s.QtyOnHand DESC";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, M_Warehouse_ID);
|
||||
pstmt.setInt(2, M_Product_ID);
|
||||
pstmt.setInt(3, M_AttributeSetInstance_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
BigDecimal QtyOnHand = rs.getBigDecimal(2);
|
||||
if (QtyOnHand != null && Qty.compareTo(QtyOnHand) <= 0)
|
||||
{
|
||||
M_Locator_ID = rs.getInt(1);
|
||||
break;
|
||||
}
|
||||
if (firstM_Locator_ID == 0)
|
||||
firstM_Locator_ID = rs.getInt(1);
|
||||
}
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
if (M_Locator_ID != 0)
|
||||
return M_Locator_ID;
|
||||
return firstM_Locator_ID;
|
||||
} // getM_Locator_ID
|
||||
|
||||
/**
|
||||
* Get Available Qty.
|
||||
* The call is accurate only if there is a storage record
|
||||
* and assumes that the product is stocked
|
||||
* @param M_Warehouse_ID wh
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID masi
|
||||
* @param trxName transaction
|
||||
* @return qty available (QtyOnHand-QtyReserved) or null
|
||||
* @deprecated Since 331b. Please use {@link #getQtyAvailable(int, int, int, int, String)}.
|
||||
*/
|
||||
public static BigDecimal getQtyAvailable (int M_Warehouse_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
|
||||
{
|
||||
return getQtyAvailable(M_Warehouse_ID, 0, M_Product_ID, M_AttributeSetInstance_ID, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Warehouse/Locator Available Qty.
|
||||
* The call is accurate only if there is a storage record
|
||||
* and assumes that the product is stocked
|
||||
* @param M_Warehouse_ID wh (if the M_Locator_ID!=0 then M_Warehouse_ID is ignored)
|
||||
* @param M_Locator_ID locator (if 0, the whole warehouse will be evaluated)
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID masi
|
||||
* @param trxName transaction
|
||||
* @return qty available (QtyOnHand-QtyReserved) or null if error
|
||||
*/
|
||||
public static BigDecimal getQtyAvailable (int M_Warehouse_ID, int M_Locator_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
|
||||
{
|
||||
ArrayList<Object> params = new ArrayList<Object>();
|
||||
StringBuffer sql = new StringBuffer("SELECT COALESCE(SUM(s.QtyOnHand-s.QtyReserved),0)")
|
||||
.append(" FROM M_StorageOnHand s")
|
||||
.append(" WHERE s.M_Product_ID=?");
|
||||
params.add(M_Product_ID);
|
||||
// Warehouse level
|
||||
if (M_Locator_ID == 0) {
|
||||
sql.append(" AND EXISTS (SELECT 1 FROM M_Locator l WHERE s.M_Locator_ID=l.M_Locator_ID AND l.M_Warehouse_ID=?)");
|
||||
params.add(M_Warehouse_ID);
|
||||
}
|
||||
// Locator level
|
||||
else {
|
||||
sql.append(" AND s.M_Locator_ID=?");
|
||||
params.add(M_Locator_ID);
|
||||
}
|
||||
// With ASI
|
||||
if (M_AttributeSetInstance_ID != 0) {
|
||||
sql.append(" AND s.M_AttributeSetInstance_ID=?");
|
||||
params.add(M_AttributeSetInstance_ID);
|
||||
}
|
||||
//
|
||||
BigDecimal retValue = DB.getSQLValueBD(trxName, sql.toString(), params);
|
||||
if (CLogMgt.isLevelFine())
|
||||
s_log.fine("M_Warehouse_ID=" + M_Warehouse_ID + ", M_Locator_ID=" + M_Locator_ID
|
||||
+ ",M_Product_ID=" + M_Product_ID + " = " + retValue);
|
||||
return retValue;
|
||||
} // getQtyAvailable
|
||||
|
||||
/**************************************************************************
|
||||
* Persistency Constructor
|
||||
* @param ctx context
|
||||
* @param ignored ignored
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MStorageOnHand (Properties ctx, int ignored, String trxName)
|
||||
{
|
||||
super(ctx, 0, trxName);
|
||||
if (ignored != 0)
|
||||
throw new IllegalArgumentException("Multi-Key");
|
||||
//
|
||||
setQtyOnHand (Env.ZERO);
|
||||
|
||||
} // MStorage
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MStorageOnHand (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
} // MStorage
|
||||
|
||||
/**
|
||||
* Full NEW Constructor
|
||||
* @param locator (parent) locator
|
||||
* @param M_Product_ID product
|
||||
* @param M_AttributeSetInstance_ID attribute
|
||||
*/
|
||||
private MStorageOnHand (MLocator locator, int M_Product_ID, int M_AttributeSetInstance_ID)
|
||||
{
|
||||
this (locator.getCtx(), 0, locator.get_TrxName());
|
||||
setClientOrg(locator);
|
||||
setM_Locator_ID (locator.getM_Locator_ID());
|
||||
setM_Product_ID (M_Product_ID);
|
||||
setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
|
||||
} // MStorage
|
||||
|
||||
/** Log */
|
||||
private static CLogger s_log = CLogger.getCLogger (MStorageOnHand.class);
|
||||
/** Warehouse */
|
||||
private int m_M_Warehouse_ID = 0;
|
||||
|
||||
/**
|
||||
* Change Qty OnHand
|
||||
* @param qty quantity
|
||||
* @param add add if true
|
||||
*/
|
||||
public void changeQtyOnHand (BigDecimal qty, boolean add)
|
||||
{
|
||||
if (qty == null || qty.signum() == 0)
|
||||
return;
|
||||
if (add)
|
||||
setQtyOnHand(getQtyOnHand().add(qty));
|
||||
else
|
||||
setQtyOnHand(getQtyOnHand().subtract(qty));
|
||||
} // changeQtyOnHand
|
||||
|
||||
/**
|
||||
* Get M_Warehouse_ID of Locator
|
||||
* @return warehouse
|
||||
*/
|
||||
public int getM_Warehouse_ID()
|
||||
{
|
||||
if (m_M_Warehouse_ID == 0)
|
||||
{
|
||||
MLocator loc = MLocator.get(getCtx(), getM_Locator_ID());
|
||||
m_M_Warehouse_ID = loc.getM_Warehouse_ID();
|
||||
}
|
||||
return m_M_Warehouse_ID;
|
||||
} // getM_Warehouse_ID
|
||||
|
||||
/**
|
||||
* Before Save
|
||||
* @param newRecord new
|
||||
* @param success success
|
||||
* @return success
|
||||
*/
|
||||
@Override
|
||||
protected boolean beforeSave(boolean newRecord)
|
||||
{
|
||||
// Negative Inventory check
|
||||
if (newRecord || is_ValueChanged("QtyOnHand"))
|
||||
{
|
||||
MWarehouse wh = new MWarehouse(getCtx(), getM_Warehouse_ID(), get_TrxName());
|
||||
if (wh.isDisallowNegativeInv())
|
||||
{
|
||||
String sql = "SELECT SUM(QtyOnHand) "
|
||||
+ "FROM M_StorageOnHand s"
|
||||
+ " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) "
|
||||
+ "WHERE s.M_Product_ID=?" // #1
|
||||
+ " AND l.M_Warehouse_ID=?"
|
||||
+ " AND l.M_Locator_ID=?"
|
||||
+ " AND s.M_AttributeSetInstance_ID<>?";
|
||||
BigDecimal QtyOnHand = DB.getSQLValueBDEx(get_TrxName(), sql, new Object[] {getM_Product_ID(), getM_Warehouse_ID(), getM_Locator_ID(), getM_AttributeSetInstance_ID()});
|
||||
if (QtyOnHand == null)
|
||||
QtyOnHand = Env.ZERO;
|
||||
|
||||
// Add qty onhand for current record
|
||||
QtyOnHand = QtyOnHand.add(getQtyOnHand());
|
||||
|
||||
if (getQtyOnHand().compareTo(BigDecimal.ZERO) < 0 ||
|
||||
QtyOnHand.compareTo(Env.ZERO) < 0)
|
||||
{
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "NegativeInventoryDisallowed"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
* @return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer("MStorage[")
|
||||
.append("M_Locator_ID=").append(getM_Locator_ID())
|
||||
.append(",M_Product_ID=").append(getM_Product_ID())
|
||||
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
|
||||
.append(": OnHand=").append(getQtyOnHand())
|
||||
/* @win commented out
|
||||
.append(",Reserved=").append(getQtyReserved())
|
||||
.append(",Ordered=").append(getQtyOrdered())
|
||||
*/
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
} // MStorage
|
|
@ -0,0 +1,20 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MStorageReservation extends X_M_StorageReservation {
|
||||
|
||||
public MStorageReservation(Properties ctx, int M_StorageReservation_ID,
|
||||
String trxName) {
|
||||
super(ctx, M_StorageReservation_ID, trxName);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public MStorageReservation(Properties ctx, ResultSet rs,
|
||||
String trxName) {
|
||||
super(ctx, rs, trxName);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* 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 *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/** Generated Model for M_StorageOnHand
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015 - $Id$ */
|
||||
public class X_M_StorageOnHand extends PO implements I_M_StorageOnHand, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121016L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_StorageOnHand (Properties ctx, int M_StorageOnHand_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_StorageOnHand_ID, trxName);
|
||||
/** if (M_StorageOnHand_ID == 0)
|
||||
{
|
||||
setM_AttributeSetInstance_ID (0);
|
||||
setM_Locator_ID (0);
|
||||
setM_Product_ID (0);
|
||||
setQtyOnHand (Env.ZERO);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_M_StorageOnHand (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 3 - Client - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_M_StorageOnHand[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set Date last inventory count.
|
||||
@param DateLastInventory
|
||||
Date of Last Inventory Count
|
||||
*/
|
||||
public void setDateLastInventory (Timestamp DateLastInventory)
|
||||
{
|
||||
set_Value (COLUMNNAME_DateLastInventory, DateLastInventory);
|
||||
}
|
||||
|
||||
/** Get Date last inventory count.
|
||||
@return Date of Last Inventory Count
|
||||
*/
|
||||
public Timestamp getDateLastInventory ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_DateLastInventory);
|
||||
}
|
||||
|
||||
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
|
||||
{
|
||||
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
|
||||
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Attribute Set Instance.
|
||||
@param M_AttributeSetInstance_ID
|
||||
Product Attribute Set Instance
|
||||
*/
|
||||
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
|
||||
{
|
||||
if (M_AttributeSetInstance_ID < 0)
|
||||
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
|
||||
}
|
||||
|
||||
/** Get Attribute Set Instance.
|
||||
@return Product Attribute Set Instance
|
||||
*/
|
||||
public int getM_AttributeSetInstance_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_M_Locator getM_Locator() throws RuntimeException
|
||||
{
|
||||
return (I_M_Locator)MTable.get(getCtx(), I_M_Locator.Table_Name)
|
||||
.getPO(getM_Locator_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Locator.
|
||||
@param M_Locator_ID
|
||||
Warehouse Locator
|
||||
*/
|
||||
public void setM_Locator_ID (int M_Locator_ID)
|
||||
{
|
||||
if (M_Locator_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_M_Locator_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_Locator_ID, Integer.valueOf(M_Locator_ID));
|
||||
}
|
||||
|
||||
/** Get Locator.
|
||||
@return Warehouse Locator
|
||||
*/
|
||||
public int getM_Locator_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_Locator_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_M_Product getM_Product() throws RuntimeException
|
||||
{
|
||||
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
|
||||
.getPO(getM_Product_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Product.
|
||||
@param M_Product_ID
|
||||
Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID)
|
||||
{
|
||||
if (M_Product_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
|
||||
}
|
||||
|
||||
/** Get Product.
|
||||
@return Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set On Hand Quantity.
|
||||
@param QtyOnHand
|
||||
On Hand Quantity
|
||||
*/
|
||||
public void setQtyOnHand (BigDecimal QtyOnHand)
|
||||
{
|
||||
set_ValueNoCheck (COLUMNNAME_QtyOnHand, QtyOnHand);
|
||||
}
|
||||
|
||||
/** Get On Hand Quantity.
|
||||
@return On Hand Quantity
|
||||
*/
|
||||
public BigDecimal getQtyOnHand ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOnHand);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,222 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* 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 *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/** Generated Model for M_StorageReservation
|
||||
* @author Adempiere (generated)
|
||||
* @version 360LTS.015 - $Id$ */
|
||||
public class X_M_StorageReservation extends PO implements I_M_StorageReservation, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121016L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_StorageReservation (Properties ctx, int M_StorageReservation_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_StorageReservation_ID, trxName);
|
||||
/** if (M_StorageReservation_ID == 0)
|
||||
{
|
||||
setM_AttributeSetInstance_ID (0);
|
||||
setM_Product_ID (0);
|
||||
setM_Warehouse_ID (0);
|
||||
setQty (Env.ZERO);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_M_StorageReservation (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 3 - Client - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_M_StorageReservation[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set Date last inventory count.
|
||||
@param DateLastInventory
|
||||
Date of Last Inventory Count
|
||||
*/
|
||||
public void setDateLastInventory (Timestamp DateLastInventory)
|
||||
{
|
||||
set_Value (COLUMNNAME_DateLastInventory, DateLastInventory);
|
||||
}
|
||||
|
||||
/** Get Date last inventory count.
|
||||
@return Date of Last Inventory Count
|
||||
*/
|
||||
public Timestamp getDateLastInventory ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_DateLastInventory);
|
||||
}
|
||||
|
||||
/** Set Sales Transaction.
|
||||
@param IsSOTrx
|
||||
This is a Sales Transaction
|
||||
*/
|
||||
public void setIsSOTrx (boolean IsSOTrx)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx));
|
||||
}
|
||||
|
||||
/** Get Sales Transaction.
|
||||
@return This is a Sales Transaction
|
||||
*/
|
||||
public boolean isSOTrx ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsSOTrx);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
|
||||
{
|
||||
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
|
||||
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Attribute Set Instance.
|
||||
@param M_AttributeSetInstance_ID
|
||||
Product Attribute Set Instance
|
||||
*/
|
||||
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
|
||||
{
|
||||
if (M_AttributeSetInstance_ID < 0)
|
||||
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
|
||||
}
|
||||
|
||||
/** Get Attribute Set Instance.
|
||||
@return Product Attribute Set Instance
|
||||
*/
|
||||
public int getM_AttributeSetInstance_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_M_Product getM_Product() throws RuntimeException
|
||||
{
|
||||
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
|
||||
.getPO(getM_Product_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Product.
|
||||
@param M_Product_ID
|
||||
Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID)
|
||||
{
|
||||
if (M_Product_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
|
||||
}
|
||||
|
||||
/** Get Product.
|
||||
@return Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_M_Warehouse getM_Warehouse() throws RuntimeException
|
||||
{
|
||||
return (I_M_Warehouse)MTable.get(getCtx(), I_M_Warehouse.Table_Name)
|
||||
.getPO(getM_Warehouse_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Warehouse.
|
||||
@param M_Warehouse_ID
|
||||
Storage Warehouse and Service Point
|
||||
*/
|
||||
public void setM_Warehouse_ID (int M_Warehouse_ID)
|
||||
{
|
||||
if (M_Warehouse_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID));
|
||||
}
|
||||
|
||||
/** Get Warehouse.
|
||||
@return Storage Warehouse and Service Point
|
||||
*/
|
||||
public int getM_Warehouse_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Quantity.
|
||||
@param Qty
|
||||
Quantity
|
||||
*/
|
||||
public void setQty (BigDecimal Qty)
|
||||
{
|
||||
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
|
||||
}
|
||||
|
||||
/** Get Quantity.
|
||||
@return Quantity
|
||||
*/
|
||||
public BigDecimal getQty ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ import org.compiere.model.MPeriod;
|
|||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MRefList;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
import org.compiere.model.ModelValidator;
|
||||
|
@ -883,7 +883,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
if (product.isStocked())
|
||||
{
|
||||
// Update Storage
|
||||
if (!MStorage.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
Env.ZERO, Env.ZERO , reserved_ordered , get_TrxName()))
|
||||
|
@ -891,7 +891,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
throw new AdempiereException();
|
||||
}
|
||||
|
||||
if (!MStorage.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
|
||||
if (!MStorageOnHand.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
|
||||
line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstanceTo_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
Env.ZERO, reserved_ordered, Env.ZERO , get_TrxName()))
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.compiere.model.MAttributeSet;
|
|||
import org.compiere.model.MCharge;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MUOM;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -577,7 +577,7 @@ public class MDDOrderLine extends X_DD_OrderLine
|
|||
if (isInstance)
|
||||
{
|
||||
MLocator locator_from = MLocator.get(getCtx(), getM_Locator_ID());
|
||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
|
||||
locator_from.getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
||||
M_AttributeSet_ID, false, null, true, get_TrxName());
|
||||
BigDecimal qty = Env.ZERO;
|
||||
|
|
|
@ -16,7 +16,7 @@ package test.functional;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.model.MWarehouse;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -44,18 +44,18 @@ public class MStorageTest extends AdempiereTestCase
|
|||
loc.saveEx();
|
||||
//
|
||||
BigDecimal targetQty = BigDecimal.valueOf(qtyOnHand).setScale(12, BigDecimal.ROUND_HALF_UP);
|
||||
MStorage s1 = MStorage.getCreate(getCtx(), loc.get_ID(), product_id, 0, getTrxName());
|
||||
MStorageOnHand s1 = MStorageOnHand.getCreate(getCtx(), loc.get_ID(), product_id, 0, getTrxName());
|
||||
s1.setQtyOnHand(targetQty);
|
||||
s1.saveEx();
|
||||
//
|
||||
BigDecimal qty = MStorage.getQtyAvailable(wh.get_ID(), loc.get_ID(), product_id, 0, getTrxName()).setScale(12, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal qty = MStorageOnHand.getQtyAvailable(wh.get_ID(), loc.get_ID(), product_id, 0, getTrxName()).setScale(12, BigDecimal.ROUND_HALF_UP);
|
||||
assertEquals("Error on locator "+locatorValue, targetQty, qty);
|
||||
//
|
||||
return loc;
|
||||
}
|
||||
private void assertWarehouseQty(MWarehouse wh, BigDecimal targetQty)
|
||||
{
|
||||
BigDecimal qty = MStorage.getQtyAvailable(wh.get_ID(), 0, product_id, 0, getTrxName());
|
||||
BigDecimal qty = MStorageOnHand.getQtyAvailable(wh.get_ID(), 0, product_id, 0, getTrxName());
|
||||
qty = qty.setScale(12, BigDecimal.ROUND_HALF_UP);
|
||||
targetQty = targetQty.setScale(12, BigDecimal.ROUND_HALF_UP);
|
||||
assertEquals(targetQty, qty);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.adempiere.exceptions.DBException;
|
|||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -193,7 +193,7 @@ public class InventoryTest extends AdempiereTestCase
|
|||
params.add(product.get_ID());
|
||||
if (M_ASI_ID >= 0)
|
||||
{
|
||||
sql += " AND "+MStorage.COLUMNNAME_M_AttributeSetInstance_ID+"=?";
|
||||
sql += " AND "+MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID+"=?";
|
||||
params.add(M_ASI_ID);
|
||||
}
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -232,11 +232,11 @@ public class InventoryTest extends AdempiereTestCase
|
|||
private void dumpStatus(MMDocument doc, String trxName)
|
||||
{
|
||||
MProduct product = InventoryUtil.getCreateProduct(doc.ProductValue, null);
|
||||
MStorage[] storage = MStorage.getOfProduct(getCtx(), product.get_ID(), trxName);
|
||||
MStorageOnHand[] storage = MStorageOnHand.getOfProduct(getCtx(), product.get_ID(), trxName);
|
||||
|
||||
System.err.println("STORAGE____________________________________________________");
|
||||
System.err.println(" "+doc);
|
||||
for (MStorage s : storage)
|
||||
for (MStorageOnHand s : storage)
|
||||
{
|
||||
System.err.println(""+s);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.compiere.model.MAttributeValue;
|
|||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.swing.CComboBox;
|
||||
import org.compiere.swing.CLabel;
|
||||
import org.compiere.swing.CPanel;
|
||||
|
@ -518,7 +518,7 @@ public class VAttributeGrid extends CPanel
|
|||
formatted = "";
|
||||
if (m_M_Warehouse_ID != 0)
|
||||
{
|
||||
BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
|
||||
BigDecimal qty = MStorageOnHand.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
|
||||
if (qty == null)
|
||||
formatted = "-";
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.compiere.model.MAttributeValue;
|
|||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
|
@ -607,7 +607,7 @@ public class WAttributeGrid extends ADForm implements EventListener
|
|||
formatted = "";
|
||||
if (m_M_Warehouse_ID != 0)
|
||||
{
|
||||
BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
|
||||
BigDecimal qty = MStorageOnHand.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
|
||||
if (qty == null)
|
||||
formatted = "-";
|
||||
else
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.compiere.model.MMatchInv;
|
|||
import org.compiere.model.MMatchPO;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MStorageOnHand;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -491,7 +491,7 @@ public class Match
|
|||
success = true;
|
||||
// Correct Ordered Qty for Stocked Products (see MOrder.reserveStock / MInOut.processIt)
|
||||
if (sLine.getProduct() != null && sLine.getProduct().isStocked())
|
||||
success = MStorage.add (Env.getCtx(), sLine.getM_Warehouse_ID(),
|
||||
success = MStorageOnHand.add (Env.getCtx(), sLine.getM_Warehouse_ID(),
|
||||
sLine.getM_Locator_ID(),
|
||||
sLine.getM_Product_ID(),
|
||||
sLine.getM_AttributeSetInstance_ID(), oLine.getM_AttributeSetInstance_ID(),
|
||||
|
|
Loading…
Reference in New Issue