We’re working on a stock control system that fits our operational requirements. Our product consists of multiple components, known as component
, which can be individual items, sub-assemblies, or finished goods. The definitions for these are outlined in bill_of_materials
: that’s the structural aspect.
On the instance level, every part added or shipped from our facility is logged in inventory_transaction
. For instance, if we order ten screws from a supplier, we enter a transaction of ‘+10’ with the id for those screws. The finished product produced here gets recorded with a transaction of ‘+1’. If it gets dispatched to a customer, we mark it with a ‘-1’. Each finished item is tracked by a unique serial number.
Our challenge lies in maintaining a comprehensive record of each part’s lifecycle. Some components may experience faults, necessitating returns for repair, after which they might be resold to the same or new clients. We also wish to track the specific components replaced during servicing.
Currently, our provisional database structure is as follows:
I think we might be able to eliminate inventory_details
, while inventory_transaction_details
could log the parts that underwent modifications or repairs.
With a large inventory_transaction
table, will querying and inserting records remain efficient? I suspect this table will process a significant amount of data, and I currently have some indexes applied.
Another approach I’m considering is creating a separate component_instance
table and a transaction_history
that would link to entries in the instance table.
Is this approach valid? I’m uncertain about the best path forward, so any insights would be helpful.