Class InventoryItem
- All Implemented Interfaces:
Displayable,StringFiller,HasId,HasInventoryItem,HasInventoryItemType
- Direct Known Subclasses:
ServiceItem,SubscriptionItem
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattachPO(Transaction transaction, InventoryPO po) Attach the PO for this item.voidattachRO(Transaction transaction, InventoryRO ro) Attach the RO to this item.static String[]booleanCheck if this item came as a part of a bigger assembly when it was purchased.final booleancanBin(InventoryLocation location) Can this item be stored at the given location?protected booleancanStore(InventoryLocation location) Can this item be stored at the given location?voidchangePartNumber(Transaction transaction, InventoryItemType newPartNumber) voidCheck whether the measurement unit of the given quantity compatible for this item or not.voidCheck whether the measurement unit of the given quantity compatible for this item or not.static voidcreateGRN(Transaction transaction, InventoryStore store, Date grnDate, int grnNumber, Date invoiceDate, String invoiceReference, Entity supplier) Create the GRN for this item.createGRN(Transaction transaction, InventoryStore store, Date grnDate, int grnNumber, Date invoiceDate, String invoiceReference, Entity supplier, int grnType) Create the GRN for this item.static <T extends InventoryItem>
Tget(Class<T> itemClass, String serialNumber, InventoryItemType partNumber) static <T extends InventoryItem>
Tget(Class<T> itemClass, String serialNumber, InventoryItemType partNumber, boolean any) static <T extends InventoryItem>
InventoryItemget(String serialNumber, InventoryItemType partNumber) static InventoryItemfinal intGet the assembly level of this item.static <T extends InventoryItem>
TgetByPartNumber(Class<T> itemClass, String serialNumber, String partNumber) static <T extends InventoryItem>
TgetByPartNumber(Class<T> itemClass, String serialNumber, String partNumber, boolean any) static <T extends InventoryItem>
TgetByPartNumberId(Class<T> itemClass, String serialNumber, Id partNumber) static InventoryItemgetByPartNumberId(String serialNumber, Id partNumber) getCost()Get the grandparent item on which this item is fitted on.final InventoryGRNgetGRN()final IdgetGRNId()booleangetItem()Retrieves the inventory item associated with this entity.final Class<? extends InventoryItemType> Get the name of the current location for display purposes.getOwner()Get the parent item on which this item is fitted on.<I extends InventoryItem>
IgetParentItem(Class<I> itemClass) Get the parent/grandparents item on which this item is fitted on.final Stringfinal Stringfinal Class<? extends InventoryItemType> final InventoryPOgetPO()Get the PO through which this item was procured.final InventoryLocationfinal InventoryLocationgetPreviousLocation(int stepsBackward) Retrieves the quantity of the inventory item associated with this entity.Get the real location of this item.final InventoryROgetRO()Get the RO through which this item was repaired.Get the serial number for display purposes.getSerialNumberDisplay(boolean includePN) Get the serial number for display purposes.final Stringfinal StringGet the shelf-life of this item.Get that description of the status of this item (serviceability, storage condition, etc.)getStore()getUnitCost(boolean guessIfZero) getUnitCost(MeasurementUnit unit) static voidbooleanCheck for vacant fitment positions under this item.booleanisAvailableAt(InventoryLocation location) Is this item available at the given location?booleanIs this a "blocked" serial?final booleanIs this a consumable item?final booleanIs this an expendable item?booleanIs this an obsolete part number?booleanIs this a repairable item?final booleanIs this a repairable item?final booleanIs this a serialized item?booleanWhether this item is serviceable or not.final booleanIs shelf-life applicable?final booleanisTool()Is this item a tool?static <T extends InventoryItem>
ObjectIterator<T> list(Class<T> itemClass, String serialNumber, InventoryItemType partNumber) static <T extends InventoryItem>
ObjectIterator<T> list(Class<T> itemClass, String serialNumber, InventoryItemType partNumber, boolean any) final ObjectIterator<InventoryItem> List of assembly items under this item.final <O extends InventoryItem>
ObjectIterator<O> listAssemblies(Class<O> itemClass) List of assembly items under this item.final <O extends InventoryItem>
ObjectIterator<O> listAssemblies(Class<O> itemClass, Predicate<O> filter) List of assembly items under this item.final ObjectIterator<InventoryItem> listAssemblies(Predicate<InventoryItem> filter) List of assembly items under this item.List of all fitment positions (includes the full tree) under this item.List the fitment positions under this item.static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber) List all the items for the given part number.static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, boolean includeZeros) List all the items for the given part number.static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, String condition) List all the items for the given part number.static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, String condition, boolean includeZeros) List all the items for the given part number.List the assembly positions where items are missing.static ObjectIterator<InventoryItem> listStock(InventoryItemType partNumber, String serialNumber) List stock for a given part number.static ObjectIterator<InventoryItem> listStock(String partNumber, InventoryLocation location) List stock for a given part number and location.static ObjectIterator<InventoryItem> listStock(String partNumber, InventoryStore store) List stock for a given part number and store.static ObjectIterator<InventoryItem> List stock for a given part number.static ObjectIterator<InventoryItem> listStock(String partNumber, String serialNumber, InventoryLocation location) List stock for a given part number and location.static ObjectIterator<InventoryItem> listStock(String partNumber, String serialNumber, InventoryStore store) List stock for a given part number and store.static <T extends InventoryItemType>
ObjectIterator<InventoryItem> listStock(T partNumber) List stock for a given part number and store.static <T extends InventoryItemType>
ObjectIterator<InventoryItem> listStock(T partNumber, InventoryLocation location) List stock for a given part number and location.static <T extends InventoryItemType>
ObjectIterator<InventoryItem> listStock(T partNumber, InventoryStore store) List stock for a given part number and store.static <T extends InventoryItemType>
ObjectIterator<InventoryItem> listStock(T partNumber, String serialNumber, InventoryLocation location) List stock for a given part number and location.static <T extends InventoryItemType>
ObjectIterator<InventoryItem> listStock(T partNumber, String serialNumber, InventoryStore store) List stock for a given part number and store.voidmigrate(TransactionManager tm, InventoryItemType migratedType, Function<InventoryItem, InventoryItem> itemConvertor) Migrate this item to another type.voidmigrate(TransactionManager tm, StoredObject migratedInstance) Migrate this instance to another class instance.voidmoved(InventoryLocation from, InventoryLocation to) This will be invoked whenever this item is moved from one location to another.static String[]voidreloaded()This method is invoked whenever this instance is reloaded from the database.voidresurrect(Money cost, InventoryLocation location) Resurrect an item so that the same P/N and S/N can be used again.static String[]voidsetBatchTag(String batchTag) voidvoidvoidvoidsetGRN(InventoryGRN grn) voidsetGRN(BigDecimal idValue) voidsetInTransit(boolean inTransit) voidsetLocation(Id locationId) voidsetLocation(InventoryLocation location) voidsetLocation(BigDecimal idValue) voidvoidvoidsetOwner(BigDecimal idValue) voidsetPartNumber(Id partNumberId) voidsetPartNumber(InventoryItemType partNumber) voidsetPartNumber(BigDecimal idValue) voidsetPurchaseDate(Date purchaseDate) voidsetQuantity(Quantity quantity) voidsetQuantity(Object value) voidsetSerialNumber(String serialNumber) voidvoidsetStore(InventoryStore store) voidsetStore(BigDecimal idValue) Display representation of the instance used for human-friendly display.toString()String representation of the instance.booleanupdateCost(TransactionManager tm, Money newCost, boolean updateAll) Update the cost of this item.voidvalidate()The system invokes this method internally whenever the object gets saved to the DB (that means, while doing transactions).voidThe system will invoke this whenever the object is saved to the DB.voidThis method will be invoked whenever an existing instance is deleted from the database.voidThis method will be invoked whenever an existing instance is updated in the database.booleanWhether this item was data-picked or not.booleanwasDataPicked(int stepsBackward) Whether this item was data-picked or not.Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, getContemporaryOf, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listDeletedIds, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loadAttributesFrom, loaded, loading, makeNew, makeVirtual, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, transacting, undelete, undelete, undeleted, updated, user, userId, validateChildAttach, validateChildDetach, validateChildUpdate, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, valueEqualsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.storedobject.core.HasInventoryItem
getInventoryItem, getInventoryItemType, getItemFromHistory
-
Constructor Details
-
InventoryItem
public InventoryItem()
-
-
Method Details
-
columns
-
indices
-
protectedColumns
-
searchColumns
-
browseColumns
-
setPartNumber
-
setPartNumber
-
setPartNumber
-
getPartNumberId
-
getPartNumber
-
setSerialNumber
-
getSerialNumber
-
getSerialNumberDisplay
Get the serial number for display purposes.- Returns:
- By default, the
serialNumbervalue is returned with the appropriate name prefix. But it can be overridden to display other details.
-
getSerialNumberDisplay
Get the serial number for display purposes.- Parameters:
includePN- Include the part number in the display string.- Returns:
- By default, the
serialNumbervalue is returned with the appropriate name prefix. But it can be overridden to display other details.
-
setBatchTag
-
getBatchTag
-
setStore
-
setStore
-
setStore
-
getStoreId
-
getStore
-
setLocation
-
setLocation
-
setLocation
-
getLocationId
-
getLocation
-
getLocationDisplay
Get the name of the current location for display purposes.- Returns:
- By default, this method returns the
toDisplay()string of the location returned by thegetLocation()method. But this could be overridden to provide other information.
-
getRealLocation
Get the real location of this item. (If the item is on an assembly, then, its grandparent's location is returned).- Returns:
- Real location of this item.
-
isAvailableAt
Is this item available at the given location?- Parameters:
location- Location to check.- Returns:
- True if the item is currently available at the same location or in the same store.
-
setQuantity
-
setQuantity
-
getItem
Description copied from interface:HasInventoryItemRetrieves the inventory item associated with this entity.- Specified by:
getItemin interfaceHasInventoryItem- Returns:
- the associated InventoryItem instance
-
getQuantity
Description copied from interface:HasInventoryItemRetrieves the quantity of the inventory item associated with this entity.- Specified by:
getQuantityin interfaceHasInventoryItem- Returns:
- the quantity of the associated inventory item
-
setCost
-
setCost
-
getCost
-
getUnitCost
-
getUnitCost
-
getUnitCost
-
getCost
-
updateCost
Update the cost of this item.- Parameters:
tm- Transaction manager.newCost- New cost.updateAll- Update all items or not (applicable for serialized items only).- Throws:
Exception- if an error occurs while updating.
-
setInTransit
public void setInTransit(boolean inTransit) -
getInTransit
public boolean getInTransit() -
setOwner
-
setOwner
-
setOwner
-
getOwnerId
-
getOwner
-
setPurchaseDate
-
getPurchaseDate
-
setGRN
-
setGRN
-
setGRN
-
getGRNId
-
getGRN
-
reloaded
public void reloaded()Description copied from class:StoredObjectThis method is invoked whenever this instance is reloaded from the database.- Overrides:
reloadedin classStoredObject
-
moved
This will be invoked whenever this item is moved from one location to another. This is called from within the transaction. So,StoredObject.getTransaction()can be used tp get the current transaction.- Parameters:
from- Location from.to- Location to.- Throws:
Exception- An exception may be raised if the move is not legal.
-
validateData
Description copied from class:StoredObjectThe system will invoke this whenever the object is saved to the DB. It will be invoked in all cases while creating new objects and updating/deleting/undeleting existing objects. If any exception is raised by this method, the process of saving to the DB will be abandoned.
Note: This method is mainly used to validate the data of all attributes of the object, and it may be used by others for validating the object. For example, front-end data-entry systems can use this method for validating the object.
- Overrides:
validateDatain classStoredObject- Parameters:
tm- Current transaction manager.- Throws:
Exception- If data is invalid.
-
validate
Description copied from class:StoredObjectThe system invokes this method internally whenever the object gets saved to the DB (that means, while doing transactions). It will be invoked in all cases (while creating new objects and updating/deleting/undeleting existing objects). If this method raises any exceptions, the process of saving to the DB will be abandoned.
This method is not usually used for validating data (For that purpose,
StoredObject.validateData(TransactionManager)is recommended). It is mainly used for validating the state of the object. Methods such asStoredObject.created(),StoredObject.updated(),StoredObject.deleted(),StoredObject.undeleted()etc. are used to check the specific states, but overridden methods may check for other "application-specific"/"business-specific" states.This method is invoked only after one of the other operation-specific validate-methods is invoked depending on the save operation -
StoredObject.validateInsert(),StoredObject.validateUpdate(),StoredObject.validateDelete(),StoredObject.validateUndelete().Note: When overridden "super" should be called, otherwise, a "design error" will occur.
- Overrides:
validatein classStoredObject- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
validateUpdate
Description copied from class:StoredObjectThis method will be invoked whenever an existing instance is updated in the database. So, it will be called within an active transaction. Child classes can override this method to do validation when an existing instance is updated in the database.Note: When overridden "super" should be called, otherwise, a "design error" will occur.
Also, see
StoredObject.validate().- Overrides:
validateUpdatein classStoredObject- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
validateDelete
Description copied from class:StoredObjectThis method will be invoked whenever an existing instance is deleted from the database. So, it will be called within an active transaction. Child classes can override this method to do validation when an existing instance is deleted from the database.Note: When overridden "super" should be called, otherwise, a "design error" will occur.
Also, see
StoredObject.validate().- Overrides:
validateDeletein classStoredObject- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
get
-
get
public static <T extends InventoryItem> InventoryItem get(String serialNumber, InventoryItemType partNumber) -
getByPartNumberId
-
getByPartNumber
public static <T extends InventoryItem> T getByPartNumber(Class<T> itemClass, String serialNumber, String partNumber) -
get
public static <T extends InventoryItem> T get(Class<T> itemClass, String serialNumber, InventoryItemType partNumber) -
getByPartNumber
public static <T extends InventoryItem> T getByPartNumber(Class<T> itemClass, String serialNumber, String partNumber, boolean any) -
get
public static <T extends InventoryItem> T get(Class<T> itemClass, String serialNumber, InventoryItemType partNumber, boolean any) -
getByPartNumberId
public static <T extends InventoryItem> T getByPartNumberId(Class<T> itemClass, String serialNumber, Id partNumber) -
list
public static <T extends InventoryItem> ObjectIterator<T> list(Class<T> itemClass, String serialNumber, InventoryItemType partNumber) -
list
public static <T extends InventoryItem> ObjectIterator<T> list(Class<T> itemClass, String serialNumber, InventoryItemType partNumber, boolean any) -
canBin
Can this item be stored at the given location?Note: This is the method to be used to check if the item can be binned at a specific location or not. The other method
canStore(InventoryLocation)may be overridden by inherited classes and may skip fundamental checks.- Parameters:
location- Location.- Returns:
- True or false.
-
canStore
Can this item be stored at the given location?- Parameters:
location- Location.- Returns:
- True or false.
-
isServiceable
public boolean isServiceable()Whether this item is serviceable or not. If the item is not serviceable, it will not be selected for issuing against any requests. It can still be transferred to other locations.- Returns:
- Default is true. However, a subclass may return false depending on other attribute values.
-
isBlocked
public boolean isBlocked()Is this a "blocked" serial? One or more serial numbers (or a sequence of serial numbers) may be blocked and should not be used any more due to safety reasons. The default implementation of this method checks whether the P/N is blocked or not. If this method is overridden, it must call the super so that the default implementation is still applied.- Returns:
- True or false.
-
isObsolete
public boolean isObsolete()Is this an obsolete part number? If marked as obsolete, it will not be ordered again via purchase orders. The default implementation of this method checks whether the P/N is obsolete or not. If this method is overridden, it must call the super so that the default implementation is still applied.- Returns:
- True or false.
-
isSerialized
public final boolean isSerialized()Is this a serialized item?
A serialized item has a unique serial number (mostly assigned by the manufacturer itself). The item is always tracked by the serial number in the system.
- Returns:
- True or false.
-
isExpendable
public final boolean isExpendable()Is this an expendable item?
Items (such as nut, bolt, rivet, etc.) for which (1) no authorized repair procedure exists, and/or (2) the cost of repair would exceed the cost of its replacement. Expendable items are usually considered to be consumed when issued and are not recorded as returnable inventory.
- Returns:
- True or false.
-
isConsumable
public final boolean isConsumable()Is this a consumable item?
A consumable item (or a consumable) is an item that is once used, cannot be recovered. Once issued from stores, consumables get incorporated into other items and lose their identity. An example of a consumable is paint.
- Returns:
- True or false.
-
isTool
public final boolean isTool()Is this item a tool?
A tool is always tracked when issued to a location other than another store.
- Returns:
- True or false.
-
isRepairable
public boolean isRepairable()Is this a repairable item?
Generally, serialized items are repairable but this method can return
falseif a serialized item is not repairable. If this method returnstruefor non-serialized items, it will be ignored by theisRepairAllowed()method.- Returns:
- True or false.
-
isRepairAllowed
public final boolean isRepairAllowed()Is this a repairable item?
This method is used to check whether an item is repairable or not. It makes sure that the item is a serialized item and its
isRepairable()returnstrue.- Returns:
- True or false.
-
getPartNumberType
-
getItemType
-
isShelfLifeApplicable
public final boolean isShelfLifeApplicable()Is shelf-life applicable?- Returns:
- True or false.
-
getShelfLife
Get the shelf-life of this item.- Returns:
- Date of expiry if shelf-life is applicable, otherwise
null.
-
checkUnit
Check whether the measurement unit of the given quantity compatible for this item or not.- Parameters:
quantity- Quantity to check.name- Name of the quantity (used to generate a message of the exception).- Throws:
Invalid_State- Throws if the measurement unit is not compatible.
-
checkUnit
Check whether the measurement unit of the given quantity compatible for this item or not.- Parameters:
quantity- Quantity to check.- Throws:
Invalid_State- Throws if the measurement unit is not compatible.
-
toString
Description copied from class:StoredObjectString representation of the instance. Mostly used for logging purposes.- Overrides:
toStringin classStoredObject- Returns:
- String representation of the instance.
-
toDisplay
Description copied from class:StoredObjectDisplay representation of the instance used for human-friendly display.- Specified by:
toDisplayin interfaceDisplayable- Overrides:
toDisplayin classStoredObject- Returns:
- Display representation of the instance.
-
listStock
List stock for a given part number and store.- Parameters:
partNumber- Part number.- Returns:
- List of items that are in the stock.
-
listStock
List stock for a given part number and store.- Parameters:
partNumber- Part number.store- Store.- Returns:
- List of items that are in the stock.
-
listStock
public static ObjectIterator<InventoryItem> listStock(String partNumber, String serialNumber, InventoryStore store) List stock for a given part number and store.- Parameters:
partNumber- Part number.serialNumber- Serial number.store- Store.- Returns:
- List of items that are in the stock.
-
listStock
public static <T extends InventoryItemType> ObjectIterator<InventoryItem> listStock(T partNumber, InventoryStore store) List stock for a given part number and store.- Parameters:
partNumber- Part number.store- Store.- Returns:
- List of items that are in the stock.
-
listStock
public static <T extends InventoryItemType> ObjectIterator<InventoryItem> listStock(T partNumber, String serialNumber, InventoryStore store) List stock for a given part number and store.- Parameters:
partNumber- Part number.serialNumber- Serial number.store- Store.- Returns:
- List of items that are in the stock.
-
listStock
public static ObjectIterator<InventoryItem> listStock(String partNumber, InventoryLocation location) List stock for a given part number and location.- Parameters:
partNumber- Part number.location- Location.- Returns:
- List of items that are in the stock.
-
listStock
public static ObjectIterator<InventoryItem> listStock(String partNumber, String serialNumber, InventoryLocation location) List stock for a given part number and location.- Parameters:
partNumber- Part number.serialNumber- Serial number.location- Location.- Returns:
- List of items that are in the stock.
-
listStock
public static <T extends InventoryItemType> ObjectIterator<InventoryItem> listStock(T partNumber, InventoryLocation location) List stock for a given part number and location.- Parameters:
partNumber- Part number.location- Location.- Returns:
- List of items that are in the stock.
-
listStock
public static <T extends InventoryItemType> ObjectIterator<InventoryItem> listStock(T partNumber, String serialNumber, InventoryLocation location) List stock for a given part number and location.- Parameters:
partNumber- Part number.serialNumber- Serial number.location- Location.- Returns:
- List of items that are in the stock.
-
listStock
List stock for a given part number.- Parameters:
partNumber- Part number.serialNumber- Serial number.- Returns:
- List of items that are in the stock.
-
listStock
public static ObjectIterator<InventoryItem> listStock(InventoryItemType partNumber, String serialNumber) List stock for a given part number.- Parameters:
partNumber- Part number.serialNumber- Serial number.- Returns:
- List of items that are in the stock.
-
listItems
List all the items for the given part number. It will return even the items fitted on assemblies, items sent for repair, etc. However, items that are already scrapped/consumed will not be included.- Parameters:
partNumber- Part number for which the list needs to be obtained.- Returns:
- List of items.
-
listItems
public static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, String condition) List all the items for the given part number. It will return even the items fitted on assemblies, items sent for repair, etc. However, items that are already scrapped/consumed will not be included.- Parameters:
partNumber- Part number for which the list needs to be obtained.condition- Additional condition if any. Could be null.- Returns:
- List of items.
-
listItems
public static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, boolean includeZeros) List all the items for the given part number. It will return even the items fitted on assemblies, items sent for repair, etc. However, items that are already scrapped/consumed will not be included.- Parameters:
partNumber- Part number for which the list needs to be obtained.includeZeros- Whether to include zero quantity items (in the case of non-serialized items) or not.- Returns:
- List of items.
-
listItems
public static ObjectIterator<InventoryItem> listItems(InventoryItemType partNumber, String condition, boolean includeZeros) List all the items for the given part number. It will return even the items fitted on assemblies, items sent for repair, etc. However, items that are already scrapped/consumed will not be included.- Parameters:
partNumber- Part number for which the list needs to be obtained.condition- Additional condition if any. Could be null.includeZeros- Whether to include zero quantity items (in the case of non-serialized items) or not.- Returns:
- List of items.
-
getGrandParentItem
Get the grandparent item on which this item is fitted on.- Returns:
- Grandparent item if exists.
-
getParentItem
Get the parent item on which this item is fitted on.- Returns:
- Parent item if exists.
-
getParentItem
Get the parent/grandparents item on which this item is fitted on.- Type Parameters:
I- Type of parent class.- Parameters:
itemClass- Type of parent/grandparent to look for.- Returns:
- Parent item if exists.
-
getPreviousLocation
-
getPreviousLocation
-
getPartNumberName
-
getPartNumberShortName
-
getSerialNumberName
-
getSerialNumberShortName
-
listFitmentPositions
List of all fitment positions (includes the full tree) under this item.- Returns:
- Iterator containing all fitment positions.
-
listImmediateFitmentPositions
List the fitment positions under this item.- Returns:
- Iterator containing all fitment positions (not the children).
-
listAssemblies
List of assembly items under this item.- Type Parameters:
O- Type of the item class.- Parameters:
itemClass- Type of assemblies to be retrieved.- Returns:
- Iterator containing assembly items under this item.
-
listAssemblies
public final <O extends InventoryItem> ObjectIterator<O> listAssemblies(Class<O> itemClass, Predicate<O> filter) List of assembly items under this item.- Type Parameters:
O- Type of the item class.- Parameters:
itemClass- Type of assemblies to be retrieved.filter- Filter to be applied.- Returns:
- Iterator containing assembly items under this item.
-
listAssemblies
List of assembly items under this item.- Returns:
- Iterator containing assembly items under this item.
-
listAssemblies
List of assembly items under this item.- Parameters:
filter- Filter to be applied.- Returns:
- Iterator containing assembly items under this item.
-
isAssemblyIncomplete
public boolean isAssemblyIncomplete()Check for vacant fitment positions under this item. (Only mandatory assemblies are counted and accessories are not considered).- Returns:
- True/false.
-
listMissingAssemblies
List the assembly positions where items are missing.- Returns:
- Assembly positions where items are missing.
-
wasDataPicked
public boolean wasDataPicked()Whether this item was data-picked or not.- Returns:
- True/false.
-
wasDataPicked
public boolean wasDataPicked(int stepsBackward) Whether this item was data-picked or not.- Parameters:
stepsBackward- Number of steps backward to go for checking.- Returns:
- True/false.
-
cameAsAssemblyPart
public boolean cameAsAssemblyPart()Check if this item came as a part of a bigger assembly when it was purchased. This will return true only if the item is still part of the assembly and not moved to anywhere else, including other fitment locations.- Returns:
- True/false.
-
getAssemblyLevel
public final int getAssemblyLevel()Get the assembly level of this item. If this item is fitted as part of an assembly, this method returns the level at which that exists from the top level assembly. If it is not fitted on any assembly, this method returns 0.- Returns:
- Assembly level.
-
getStatusDescription
Get that description of the status of this item (serviceability, storage condition, etc.)- Returns:
- Status description.
-
getPO
Get the PO through which this item was procured. If this item was repaired by a repair organization later, this information will not be available anymore, and you should seegetRO().- Returns:
- PO if available.
-
getRO
Get the RO through which this item was repaired. If this item was repaired more than once, the latest RO is returned.- Returns:
- RO if available.
-
createGRN
public InventoryGRN createGRN(Transaction transaction, InventoryStore store, Date grnDate, int grnNumber, Date invoiceDate, String invoiceReference, Entity supplier, int grnType) throws Exception Create the GRN for this item. This method is used only for creating GRNs for the items that are data-picked.- Parameters:
transaction- Transaction.store- Store.grnDate- GRN date (Receipt date)grnNumber- GRN number (if zero is passed, a new number is generated).invoiceDate- Invoice date.invoiceReference- Invoice reference (supplier's invoice number).supplier- Supplier.grnType- GRN Type - 0:Purchase, 1: External Owner, 2: Loaned from, 3: Items Repaired by, 4: Sales Return- Returns:
- GRN
- Throws:
Exception- if transaction errors occur.
-
createGRN
public InventoryGRN createGRN(Transaction transaction, InventoryStore store, Date grnDate, int grnNumber, Date invoiceDate, String invoiceReference, Entity supplier) throws Exception Create the GRN for this item. This method is used only for creating GRNs for the items that are data-picked.- Parameters:
transaction- Transaction.store- Store.grnDate- GRN date (Receipt date)grnNumber- GRN number (if zero is passed, a new number is generated).invoiceDate- Invoice date.invoiceReference- Invoice reference (supplier's invoice number).supplier- Supplier.- Returns:
- GRN
- Throws:
Exception- if transaction errors occur.
-
attachPO
Attach the PO for this item. This method is used only for creating POs for the items that are data-picked.- Parameters:
transaction- Transaction.po- PO to attach.- Throws:
Exception- if transaction errors occur.
-
attachRO
Attach the RO to this item. This method is used only for creating ROs for the items that are data-picked.- Parameters:
transaction- Transaction.ro- RO to attach.- Throws:
Exception- if transaction errors occur.
-
changePartNumber
public void changePartNumber(Transaction transaction, InventoryItemType newPartNumber) throws Exception - Throws:
Exception
-
migrate
Description copied from class:StoredObjectMigrate this instance to another class instance. Please note that there is no error checking or validations when this is invoked. This is used very rarely, and it may be useful for building low-level utilities.- Overrides:
migratein classStoredObject- Parameters:
tm- Transaction Manager.migratedInstance- Migrated instance. Make sure that all the attribute values are properly set.- Throws:
Exception- thrown for errors.
-
migrate
public void migrate(TransactionManager tm, InventoryItemType migratedType, Function<InventoryItem, InventoryItem> itemConvertor) throws ExceptionMigrate this item to another type.- Parameters:
tm- Transaction Manager.migratedType- Migrated item type.itemConvertor- Item convertor.- Throws:
Exception- thrown for errors.
-
resurrect
Resurrect an item so that the same P/N and S/N can be used again.- Parameters:
cost- Cost.location- New location.
-