remove X, I and M storage classes
This commit is contained in:
parent
31ee8bc837
commit
ed5084972e
|
@ -1,215 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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_Storage
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a
|
||||
*/
|
||||
public interface I_M_Storage
|
||||
{
|
||||
|
||||
/** TableName=M_Storage */
|
||||
public static final String Table_Name = "M_Storage";
|
||||
|
||||
/** AD_Table_ID=250 */
|
||||
public static final int Table_ID = 250;
|
||||
|
||||
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 org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
|
||||
|
||||
/** Column name M_Storage_UU */
|
||||
public static final String COLUMNNAME_M_Storage_UU = "M_Storage_UU";
|
||||
|
||||
/** Set M_Storage_UU */
|
||||
public void setM_Storage_UU (String M_Storage_UU);
|
||||
|
||||
/** Get M_Storage_UU */
|
||||
public String getM_Storage_UU();
|
||||
|
||||
/** 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 QtyOrdered */
|
||||
public static final String COLUMNNAME_QtyOrdered = "QtyOrdered";
|
||||
|
||||
/** Set Ordered Quantity.
|
||||
* Ordered Quantity
|
||||
*/
|
||||
public void setQtyOrdered (BigDecimal QtyOrdered);
|
||||
|
||||
/** Get Ordered Quantity.
|
||||
* Ordered Quantity
|
||||
*/
|
||||
public BigDecimal getQtyOrdered();
|
||||
|
||||
/** Column name QtyReserved */
|
||||
public static final String COLUMNNAME_QtyReserved = "QtyReserved";
|
||||
|
||||
/** Set Reserved Quantity.
|
||||
* Reserved Quantity
|
||||
*/
|
||||
public void setQtyReserved (BigDecimal QtyReserved);
|
||||
|
||||
/** Get Reserved Quantity.
|
||||
* Reserved Quantity
|
||||
*/
|
||||
public BigDecimal getQtyReserved();
|
||||
|
||||
/** 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();
|
||||
}
|
|
@ -1,750 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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 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 MStorage extends X_M_Storage
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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 MStorage get (Properties ctx, int M_Locator_ID,
|
||||
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
|
||||
{
|
||||
MStorage retValue = null;
|
||||
String sql = "SELECT * FROM M_Storage "
|
||||
+ "WHERE M_Locator_ID=? AND M_Product_ID=? AND ";
|
||||
if (M_AttributeSetInstance_ID == 0)
|
||||
sql += "(M_AttributeSetInstance_ID=? OR M_AttributeSetInstance_ID IS NULL)";
|
||||
else
|
||||
sql += "M_AttributeSetInstance_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, M_Locator_ID);
|
||||
pstmt.setInt (2, M_Product_ID);
|
||||
pstmt.setInt (3, M_AttributeSetInstance_ID);
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MStorage (ctx, rs, trxName);
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
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 MStorage[] getAllWithASI (Properties ctx, int M_Product_ID, int M_Locator_ID,
|
||||
boolean FiFo, String trxName)
|
||||
{
|
||||
ArrayList<MStorage> list = new ArrayList<MStorage>();
|
||||
String sql = "SELECT * FROM M_Storage "
|
||||
+ "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 MStorage (ctx, rs, trxName));
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorage[] retValue = new MStorage[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 MStorage[] getAll (Properties ctx,
|
||||
int M_Product_ID, int M_Locator_ID, String trxName)
|
||||
{
|
||||
ArrayList<MStorage> list = new ArrayList<MStorage>();
|
||||
String sql = "SELECT * FROM M_Storage "
|
||||
+ "WHERE M_Product_ID=? AND M_Locator_ID=?"
|
||||
+ " AND QtyOnHand <> 0 "
|
||||
+ "ORDER BY M_AttributeSetInstance_ID";
|
||||
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 MStorage (ctx, rs, trxName));
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorage[] retValue = new MStorage[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 MStorage[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
||||
{
|
||||
ArrayList<MStorage> list = new ArrayList<MStorage>();
|
||||
String sql = "SELECT * FROM M_Storage "
|
||||
+ "WHERE M_Product_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, M_Product_ID);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add(new MStorage (ctx, rs, trxName));
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorage[] retValue = new MStorage[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 MStorage[] 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 MStorage[] 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 MStorage[0];
|
||||
|
||||
boolean allAttributeInstances = false;
|
||||
if (M_AttributeSetInstance_ID == 0)
|
||||
allAttributeInstances = true;
|
||||
|
||||
ArrayList<MStorage> list = new ArrayList<MStorage>();
|
||||
// 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,"
|
||||
+ "s.QtyOnHand,s.QtyReserved,s.QtyOrdered,s.DateLastInventory "
|
||||
+ "FROM M_Storage 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,"
|
||||
+ "s.QtyOnHand,s.QtyReserved,s.QtyOrdered,s.DateLastInventory,s.M_Storage_UU "
|
||||
+ "FROM M_Storage 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 MStorage (ctx, rs, trxName));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
MStorage[] retValue = new MStorage[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 MStorage 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");
|
||||
MStorage 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 MStorage (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 diffQtyReserved add reserved
|
||||
* @param diffQtyOrdered add order
|
||||
* @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,
|
||||
BigDecimal diffQtyReserved, BigDecimal diffQtyOrdered, String trxName)
|
||||
{
|
||||
MStorage 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;
|
||||
}
|
||||
//
|
||||
|
||||
MStorage 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;
|
||||
}
|
||||
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_Storage 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_Storage 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 MStorage (Properties ctx, int ignored, String trxName)
|
||||
{
|
||||
super(ctx, 0, trxName);
|
||||
if (ignored != 0)
|
||||
throw new IllegalArgumentException("Multi-Key");
|
||||
//
|
||||
setQtyOnHand (Env.ZERO);
|
||||
setQtyOrdered (Env.ZERO);
|
||||
setQtyReserved (Env.ZERO);
|
||||
} // MStorage
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MStorage (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 MStorage (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 (MStorage.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_Storage 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())
|
||||
.append(",Reserved=").append(getQtyReserved())
|
||||
.append(",Ordered=").append(getQtyOrdered())
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
} // toString
|
||||
|
||||
} // MStorage
|
|
@ -1,254 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 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_Storage
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a - $Id$ */
|
||||
public class X_M_Storage extends PO implements I_M_Storage, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121031L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_Storage (Properties ctx, int M_Storage_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_Storage_ID, trxName);
|
||||
/** if (M_Storage_ID == 0)
|
||||
{
|
||||
setM_AttributeSetInstance_ID (0);
|
||||
setM_Locator_ID (0);
|
||||
setM_Product_ID (0);
|
||||
setQtyOnHand (Env.ZERO);
|
||||
setQtyOrdered (Env.ZERO);
|
||||
setQtyReserved (Env.ZERO);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_M_Storage (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_Storage[")
|
||||
.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 org.compiere.model.I_M_Product getM_Product() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.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 M_Storage_UU.
|
||||
@param M_Storage_UU M_Storage_UU */
|
||||
public void setM_Storage_UU (String M_Storage_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_M_Storage_UU, M_Storage_UU);
|
||||
}
|
||||
|
||||
/** Get M_Storage_UU.
|
||||
@return M_Storage_UU */
|
||||
public String getM_Storage_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_M_Storage_UU);
|
||||
}
|
||||
|
||||
/** 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;
|
||||
}
|
||||
|
||||
/** Set Ordered Quantity.
|
||||
@param QtyOrdered
|
||||
Ordered Quantity
|
||||
*/
|
||||
public void setQtyOrdered (BigDecimal QtyOrdered)
|
||||
{
|
||||
set_ValueNoCheck (COLUMNNAME_QtyOrdered, QtyOrdered);
|
||||
}
|
||||
|
||||
/** Get Ordered Quantity.
|
||||
@return Ordered Quantity
|
||||
*/
|
||||
public BigDecimal getQtyOrdered ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
|
||||
/** Set Reserved Quantity.
|
||||
@param QtyReserved
|
||||
Reserved Quantity
|
||||
*/
|
||||
public void setQtyReserved (BigDecimal QtyReserved)
|
||||
{
|
||||
set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved);
|
||||
}
|
||||
|
||||
/** Get Reserved Quantity.
|
||||
@return Reserved Quantity
|
||||
*/
|
||||
public BigDecimal getQtyReserved ()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReserved);
|
||||
if (bd == null)
|
||||
return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue