문제

I have been developing an Inventory system (PHP Codeigniter & MySQL), I have setup almost everything except one feature which one of my clients wants to implement to the system - A multi - unit support feature for the system.

Currently my system only supports single unit per item per transaction:

item_desc: Item1
default_unit: pc
reorder: 1
in_stock: 25
remain: 25

In multi - unit feature, this would become:

item_desc: Item1
default_unit: pc
big_unit: pack
pack_size: 50
reorder: 1
in_stock: 25 pack
remain: 24 pack 5 pc

Can someone give me hint on probably the easy way to implement this? I just want to know where to start on this thing. I would appreciate much if someone could share an idea regarding on this one :)

도움이 되었습니까?

해결책

We just launched v2 of our website and I've gone through 8 months of all kinds of questions like this myself. The best way to do it is to separate your tables into products, inventory and listings.

Products holds product specific information only, things that will never change. Inventory holds information about current inventory only, ie quantity on hand, backorder, location in warehouse etc. Listings are how you handle the multi item support. This table would hold listing information and draw from the other two tables for the product and quantity data. So you'd have a basic table structure something like this

Products

  • productId
  • productName
  • productModel
  • productDescription

Inventory

  • inventoryId
  • productId
  • quantityOnHand
  • location

Listings

  • listingId
  • inventoryId
  • quantityInListing
  • numberOfListings
  • price

Our company sells a lot of preowned things so the listings change regularly, but you could always set the listings up to auto-populate based on inventory if you're selling new things that you just restock. Doing it this way means you don't end up with a ton of data duplication as you would if you just created products for the multiples. It also allows you to sell any item in any quantity and set prices for those quantities manually.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top