Search code examples
mysqlvb.netinheritanceclass-design

Stock management system approach


I am currently working on a project relating to a medicine stock management system on vb.net. Basically I have 3 tables in a MySQL database that I will link to my program; orders, current stock, and medicine.

Each order has an autoincrementing order reference, delivery date, units ordered and the reference number of the medicine that has been ordered.

The stock table contains all the medicine names which are in stock, how many units are in stock, the cost price and the retail price.

Finally, each medicine has a reference, a name, and a supplier name.

The tasks I would like to perform throughout my program are: 1- Store and add medicines to the system 2- create, edit and view orders 3- view medicines in stock and the amount of units present 4- search for a specific field in each of these tables

I am quite new to object oriented programming and Vb.net so I would like to know what is the best approach to design this program?

1- Windows form based application with no inheritance seeing that I have only 1 type of product (separate classes for everything) 2- Windows form based but with inheritance and an interface 3- any other more efficient approach?

If I were to choose option 2 I would require just a few guidance tips on what my baseclass should probably be.

Thank you


Solution

  • Well, technically speaking, this is not a stock management system only, if you are including orders. Stock is only the part taking care about stocking items.

    What you look for, in a nutshell, is probably:

    • (Purchase)Orders: Handle their logic separately from stock logic. You will need Orders (List of orders) and OrdersLines tables. I'm just guessing, that you mean Purchase Orders.
    • (Customer)Orders - you will need similar for Customer Orders, if you don't sell the goods in shop, but to a partners per Invoices.
    • Item: Table Item - ut will hold details of each medicine - columns like, ItemNo, Name, Description, OrderCode, VendorReference, ReferencePicture, Price (if you have different prices for different quantities, you will need another separate table ItemPrices with ID linked to foreign key of Items), etc.
    • Stock: Tables StockCards (each linked to Item, it is to store data like minimum, maximum a and actual stock level, you might pre-define stock location), StockRecords (to record movements of goods in and out of stock), you can have also a separate StockLocations

    And as for interface, I reccomend to do a List and Detail VB.NET form for each table. List will contain list of items and filters to find what you want. The Detail page will allow to show all the deatails and edit them. You can then load the forms into i.e. TabControl in your main application. And combine them, i.e. put a List into left panel of SplitContainer and detail into right one, and use DataGridView's CellClick to load item into the Detail module.