Package com.storedobject.core
Class InventoryTransaction
java.lang.Object
com.storedobject.core.InventoryTransaction
Utility class to create inventory transactions (movement of items from one location to another).
- Author:
- Syam
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.InventoryTransaction
(TransactionManager tm, String reference) Deprecated.InventoryTransaction
(TransactionManager tm, Date date) Constructor.InventoryTransaction
(TransactionManager tm, Date date, String reference) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abandon()
Abandon the current set of entries.void
bookShortage
(InventoryItem item, Quantity quantity, String reference) Book shortage.void
checkTransit
(boolean checkTransit) void
consume
(InventoryItem item, Quantity quantity, String reference) Consume an item.void
consume
(InventoryItem item, String reference) Consume an item.static InventoryLocation
createConsumerLocation
(TransactionManager tm, Entity consumer) Create a consumer location.static InventoryLocation
createExternalOwnerLocation
(TransactionManager tm, Entity externalEntity) Create an external owner location from where we can receive stocks.static InventoryLocation
createLoanFromLocation
(TransactionManager tm, Entity entity) Create an organization location where we can rent items from.static InventoryLocation
createLoanToLocation
(TransactionManager tm, Entity entity) Create an organization location where we can rent out items.static InventoryLocation
createRepairLocation
(TransactionManager tm, Entity repairEntity) Create a repair organization location.static InventoryLocation
createSupplierLocation
(TransactionManager tm, Entity supplier) Create a supplier location.void
dataPickup
(InventoryItem item, InventoryLocation to) Create a "data pick-up" entry.void
dataPickup
(InventoryItem item, InventoryLocation locationTo, InventoryFitmentPosition assemblyPosition) Create a "data pick-up" entry.void
dataPickup
(InventoryItem item, Quantity quantity, InventoryLocation to) Create a "data pick-up" entry.static InventoryTransaction
Deprecated.static InventoryTransaction
forDataPickup
(TransactionManager tm, String reference) Create "Inventory Transaction" for data pick-up.getDate()
Get the currently set date.void
loanFrom
(InventoryItem item, String reference, InventoryLocation to, Entity entity) Loan an item from another entity.void
loanReturn
(InventoryItem item, String reference) Return of a loaned item.void
loanTo
(InventoryItem item, String reference, Entity entity) Loan an item to another entity.void
moveTo
(InventoryItem item, Quantity quantity, String reference, InventoryLocation to) Move items to another location.void
moveTo
(InventoryItem item, String reference, InventoryLocation to) Move items to another location.void
purchase
(InventoryItem item, Quantity quantity, String reference, InventoryLocation to, Entity fromEntity) Purchase an item.void
purchase
(InventoryItem item, String reference, InventoryLocation to, Entity fromEntity) Purchase an item.void
receiveFromExternal
(InventoryItem item, String reference, InventoryLocation to, Entity entity) Receive an item from another entity.void
reverse
(InventoryItem item, String reference) Reverse a previous movement of an item.void
sale
(InventoryItem item, Quantity quantity, String reference, Entity toEntity) Sell items.void
save()
Save the current entries by creating necessary internal transaction.void
save
(Transaction transaction) Save the current entries using the transaction that is provided.void
scrap
(InventoryItem item, Quantity quantity, String reference) Scrap an item.void
scrap
(InventoryItem item, String reference) Scrap an item.void
sendForRepair
(InventoryItem item, Quantity quantity, String reference, Entity repairEntity) Sent an item for repair.void
sendForRepair
(InventoryItem item, String reference, Entity repairEntity) Sent an item for repair.void
Set the data pickup mode.void
setGRN
(InventoryGRN grn) Set the GRN for this transaction so that all items will be marked as received from this GRN.void
splitQuantity
(InventoryItem item, Quantity quantity, String reference) Split the quantity within the same location.void
thrash
(InventoryItem item, Quantity quantity, String reference) Move items to thrash.void
thrash
(InventoryItem item, String reference) Move an item to thrash.
-
Field Details
-
dataPickupDate
-
-
Constructor Details
-
InventoryTransaction
Deprecated.Constructor. (Date of the transaction will be current working date of the organization).- Parameters:
tm
- Transaction manager.
-
InventoryTransaction
Deprecated.Constructor. (Date of the transaction will be current working date of the organization).- Parameters:
tm
- Transaction manager.reference
- Reference for the entries. Each movement entry can have a reference and no such reference is passed, this will be used as the default.
-
InventoryTransaction
Constructor.- Parameters:
tm
- Transaction manager.date
- Date of the transaction.
-
InventoryTransaction
Constructor. (Date of the transaction will be current working date of the organization).- Parameters:
tm
- Transaction manager.date
- Date of the transaction.reference
- Reference for the entries. Each movement entry can have a reference and no such reference is passed, this will be used as the default.
-
-
Method Details
-
getDate
-
forDataPickup
Deprecated.Create "Inventory Transaction" for data pick-up. (When doing data pick-up, this instance should be used).- Parameters:
tm
- Transaction manager.- Returns:
- Instance of the "Inventory Transaction" suitable for data pick-up.
-
forDataPickup
Create "Inventory Transaction" for data pick-up. (When doing data pick-up, this instance should be used).- Parameters:
tm
- Transaction manager.reference
- Default transaction reference.- Returns:
- Instance of the "Inventory Transaction" suitable for data pick-up.
-
createSupplierLocation
Create a supplier location. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.supplier
- Entity.- Returns:
- The location.
-
createConsumerLocation
Create a consumer location. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.consumer
- Entity.- Returns:
- The location.
-
createExternalOwnerLocation
public static InventoryLocation createExternalOwnerLocation(TransactionManager tm, Entity externalEntity) Create an external owner location from where we can receive stocks. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.externalEntity
- Entity.- Returns:
- The location.
-
createRepairLocation
Create a repair organization location. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.repairEntity
- Entity.- Returns:
- The location.
-
createLoanToLocation
Create an organization location where we can rent out items. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.entity
- Entity from which items will be rented from.- Returns:
- The location.
-
createLoanFromLocation
Create an organization location where we can rent items from. It will be created if it doesn't exist. Otherwise, the existing entry is returned.- Parameters:
tm
- Transaction manager.entity
- Entity from which items will be rented from.- Returns:
- The location.
-
setDataPickupMode
public void setDataPickupMode()Set the data pickup mode. Items transacted will not be "in transit" stage. -
dataPickup
Create a "data pick-up" entry. (Item may be edited after making this call. However, quantity and location should not be set).- Parameters:
item
- Item being data-picked.to
- Location to which it should be stored.
-
dataPickup
Create a "data pick-up" entry. (Item may be edited after making this call. However, quantity and location should not be set).- Parameters:
item
- Item being data-picked.quantity
- Quantity. This is applicable only for non-serialized items. Otherwise, it will be ignored.to
- Location to which it should be stored.
-
dataPickup
public void dataPickup(InventoryItem item, InventoryLocation locationTo, InventoryFitmentPosition assemblyPosition) Create a "data pick-up" entry. (Item may be edited after making this call. However, quantity and location should not be set).- Parameters:
item
- Item being data-picked.locationTo
- Location to which it should be moved (where the assembly is located).assemblyPosition
- Assembly location.
-
scrap
Scrap an item. (Whatever be the current quantity, that will be scrapped).- Parameters:
item
- Item to be scrapped.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
scrap
Scrap an item.- Parameters:
item
- Item to be scrapped.quantity
- Quantity to tbe scrapped.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
consume
Consume an item. Whatever be the current quantity, that will be consumed. Only non-serialized items can be consumed if the item is not located at a "Production Unit" or "Service Unit".- Parameters:
item
- Item to be consumed.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
consume
Consume an item.- Parameters:
item
- Item to be consumed. Only non-serialized items can be consumed if the item is not located at a "Production Unit" or "Service Unit".quantity
- Quantity to tbe scrapped.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
bookShortage
Book shortage.- Parameters:
item
- Item to be booked.quantity
- Quantity that is short.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
purchase
Purchase an item. (This method is typically used during the data-pickup period only).- Parameters:
item
- Item to be purchased.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Storage location.fromEntity
- Supplier entity.
-
purchase
public void purchase(InventoryItem item, Quantity quantity, String reference, InventoryLocation to, Entity fromEntity) Purchase an item. (This method is typically used during the data-pickup period only).- Parameters:
item
- Item to be purchased.quantity
- Quantity to be purchased. This should be passed only for non-serialized items. Otherwise, it will be ignored.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Storage location.fromEntity
- Supplier entity.
-
sale
Sell items. (This method is typically used during the data-pickup period only).- Parameters:
item
- Item to be sold.quantity
- Quantity.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).toEntity
- Customer/consumer entity.
-
splitQuantity
Split the quantity within the same location.- Parameters:
item
- Item to be moved.quantity
- Quantity to split.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
moveTo
Move items to another location.- Parameters:
item
- Item to be moved.quantity
- Quantity.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Location to move to.
-
moveTo
Move items to another location. (Full quantity will be moved).- Parameters:
item
- Item to be moved.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Location to move to.
-
reverse
Reverse a previous movement of an item.- Parameters:
item
- Item to be reversed.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
sendForRepair
Sent an item for repair.- Parameters:
item
- Item.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).repairEntity
- Repair entity who undertakes the repair.
-
sendForRepair
public void sendForRepair(InventoryItem item, Quantity quantity, String reference, Entity repairEntity) Sent an item for repair. The item may be a consumable if that is required for repairing some items sent along with it.- Parameters:
item
- Item.quantity
- Quantity. (This is typically required when consumables are sent).reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).repairEntity
- Repair entity who undertakes the repair.
-
loanTo
Loan an item to another entity.- Parameters:
item
- Item.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).entity
- Loanee.
-
receiveFromExternal
public void receiveFromExternal(InventoryItem item, String reference, InventoryLocation to, Entity entity) Receive an item from another entity. The item is received through some means other than leasing or sales return. This can take care of situations like handling of items removed from equipment that are getting serviced in a "Service Unit" etc. Also, we could receive items from an external entity in our stores. The ownership of the item will remain with the external entity.- Parameters:
item
- Item.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Location where the item will be received.entity
- The external entity who owns the item.
-
loanFrom
Loan an item from another entity.- Parameters:
item
- Item.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).to
- Location where the item will be received.entity
- Loaner.
-
loanReturn
Return of a loaned item.- Parameters:
item
- Item.reference
- Reference for the entry. (If null or empty reference is passed, the reference mentioned in the constructor will be used).
-
thrash
Move an item to thrash. An item that was created by mistake may be thrashed. If the item is already involved in any inventory transaction, it can not be thrashed.- Parameters:
item
- Item.reference
- Reference.
-
thrash
Move items to thrash. Items that were created by mistake may be thrashed. If the item is already involved in any inventory transaction, it can not be thrashed.- Parameters:
item
- Item.quantity
- Quantity.reference
- Reference.
-
abandon
public void abandon()Abandon the current set of entries. -
save
-
save
Save the current entries using the transaction that is provided. Transaction will not be committed.- Parameters:
transaction
- Transaction.- Throws:
Exception
- If any error occurs.
-
getItemsChanged
-
checkTransit
public void checkTransit(boolean checkTransit) -
setGRN
Set the GRN for this transaction so that all items will be marked as received from this GRN.- Parameters:
grn
- GRN.
-