简体   繁体   中英

Looking for best structure for this inventory system

So my issue for the past week has been how to structure my inventory system. I am trying to write a database to track every small detail about a variety of different IT related items including but not limited to..... Windows based laptops from every manufacturer, apple laptops, windows based desktops, apple desktops, Iphones, android phones, blackberry phones, printer equipment, server equipment, so on and so forth. I will also be adding car, motorcycles, and many other random items, I have a business where i buy and sell just about anything i can make money on. I need the database for inventory/asset management , sales tracking, and customer/business relations. I pull inventory in from many different sources for varying prices. What i am trying to do is bring a lot in, assigne it a lot number, test and inventory each item tracking LotNumber, Tester.

Table Invester // I sometimes have lots that other businesses have a stake in

  • InvesterID
  • BusinessName

Table Supplier // I will add in other things like phone number, address, and other stuff latter.

  • SupplierID
  • SupplierName

Table PurchaseLot

  • LotID
  • Date
  • Cost
  • Invester_InvesterID
  • Supplier_SupplierID

Table Tester

  • TesterID
  • Name // Later once i create a logon it will be employeeID

Table Monitor

  • MonitorID
  • Size
  • Grade
  • Model
  • Manufacturer
  • Tester_TesterID
  • PurchaseLot_PurchaseLotID
  • ETC //Trigger on insert add MonitorID to Inventory to create a uniform inventory numbering system.

Table Laptop

  • LaptopID
  • Manufacturer
  • Model
  • Serial
  • Tester_TesterID
  • PurchaseLot_PurchaseLotID //Trigger on insert add LaptopID to Inventory to create a uniform inventory numbering system.

Table Inventory

  • InventoryID
  • Monitor_MonitorID
  • Laptop_LaptopID

That is my basic table structure. The real question is is this the best way to do this or will this create a bigger headache? what i plan on doing i creating a table for different kinds of items, tablets, phones, laptops, desktops, etc. later on i may have to break different items into parts for resale because not all items will be fixable, thus having to create a parts Table. i will also track where in the warehouse an item is by assigning it a shelf number, latter this will have to expand to track multiple warehouses, owner, business (within a year) If there is an easier way please let me know. I want to make this as simple and straight forward as possible so it will be easy to write multiple php scripts to handle different tasks including putting up on a website for sale. also I am not sure how to handle multiple of the same item especially since multiple of the same laptop can be broken down into 10+ different parts that will need to be tracked. any advice and or incite would be great. Just to outline my experience in this is I am basically the copy and paste king. I have created a few databases with their php counterparts to handle customer relations. But this is the largest and most ambitious project as of yet and really only out of necessity for the proper sustainable growth of my business.

As @Jim Garrison implied, you are asking a very broad question here, so I cannot provide an answer, only some pointers to consider. The approach in using one table for each type of product, and then a table to bring all your types of product together is inherently fragile, and is unlikely to scale. Reasons for this include:

  1. Does every item of inventory have a monitor and a keyboard?
  2. What do you expect to do when you add a tablet to your inventory?
  3. Do you expect the inventory table to expand over time, and to include many nulls as it does expand?

I would suggest that there need to be at least the following three tables included in your application

  1. Item - containing information that is common to ALL items - and may well include investor and supplier IDs.
  2. Item type - containing information that this item is (eg) a tablet; and specific information about tablets in general.
  3. Component - Top level item plus identification of (eg) the OTG cable that came with the tablet. This table would need to represent a hierarchy of variable and unknown depth.

It is possible that in addition to the component table you need a similar hierarchy "associated_with".

This leads to a more complicated approach than you propose, but I do not believe you can provide the capabilities you require AND keep it simple.

HTH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM