1) Describe the problem
The supplier will supply its products to the supermarket. When products are imported to the
warehouse as product batches, each product batch will only include one product type, quantity,
expiration date and production date. The warehouse staff will then inventory the quantity of
imported goods to ensure that the quantity on the invoice matches the actual quantity.
When the product is entered into the warehouse through the inventory of the warehouse staff,
the product will be divided into product categories such as cosmetics, household appliances,
clothing, frozen goods, books... divided into areas. specifically in the warehouse to best preserve
product quality. Each product will have a specific area in the warehouse to help facilitate
transportation.
When there is a request from the shelf or for frozen products with a short shelf life, the
warehouse staff will package the product, then accurately inventory the quantity released and
then transfer the product to the third party. sell. In case a product is returned from the shelf due
to unsold consumption or the product is returned by the customer due to a defect, the
warehouse staff will inventory the quantity and record the return content.
For importing goods, exporting goods or returning goods, employees are required to make
invoices recording the specific time of importing goods along with the person responsible for
making the invoice.
Building software to support warehouse management that meets the following requirements:
Manage product supplier information.
Manage the quantity of warehoused goods to meet supermarket requirements.
Manage quantity of goods
Manage warehouse area.
Information is stored in a database, making retrieval, backup and recovery easy, synchronous,
fast and reliable.
Notify the quantity of goods below the prescribed level, or near the expiration date.
1. Employee management:
- The system helps manage information of each employee in the warehouse including: id,
employee name, phone number, ID card, date of birth, photo... Each employee will have a
unique employee code, an account only to log into the system
- The system allows warehouse owners to perform the following functions: update, look up and
cancel employee personal information.
2. Product management:
- Information management system of all items in stock. Each item will have its own unique
product code
- Each product code will include: product code, product name, unit of measure, image
- Users can add, edit, and delete products.
3. Warehouse management
- Manage system warehouse entries including: product code, product name, quantity, supplier,
import time, price, production date...
- Users have the right to create input forms.
4. Supplier management:
- Information management system of suppliers. Each supplier will have its own code.
- Each supplier code will include: id, supplier name, representative name, phone number,
address, email, image.
- Users can add, edit, and delete suppliers.
5. Check the quantity of goods in stock
- Manage quantity, import date, production date and expiration date of the product.
6. Management of warehouse areas and types:
- There are different warehouses in one or more areas, and those warehouses are divided into
two types: dry storage and cold storage.
- Includes zone id, zone name, location, warehouse type id, warehouse type name.
2) Entity-relationship-ER
Product_pham and Type_sp: Each product (san_pham) belongs to a product type (loai_sp).
Loai_sp and Khu_vuc: Each type of product (loai_sp) can be sold in a certain area (khu_vuc).
Khu_vuc and Loai_kho: Each area (Khu_vuc) has a specific type of warehouse (Loai_kho).
kho and Lo_san_pham: Each warehouse (Kho) contains one or more batches of products
(Lo_san_pham).
Chi_tiet_lo_sp and San_pham: Each product batch detail (Chi_tiet_lo_sp) is related to a specific
product (San_pham).
Lo_san_pham and Phieu_nhap: Each batch of products (Lo_san_pham) is entered through an
input ticket (Pheu_nhap).
Phieu_nhap and Nhan_vien: Each input ticket (Phieu_nhap) is created by an employee
(Nhan_vien).
Chi_tiet_phieu_nhap and nguon_cc: Each input ticket detail (cost_price) is related to a supply
source (source_cc). This is shown through the foreign key id_nguon_cc in the
Chi_tiet_phieu_nhap table.
Tai_khoan and Nhan_vien: Each account (Tai_khoan) is managed by an employee (Nhan_vien
With the above relationships, we can clearly see that the tables have achieved 3NF standard
form
3) Database model
Bold is the primary key, italic is the foreign key
San_pham(id_sp, ten_sp, hinh_anh, id_loai_sp)
Loai_sp(id_loai_sp, ten_loai_sp, dvt, id_khu_vuc)
Khu_vuc(id_khu_vuc, ten_khu_vuc, vi_tri, id_loai_kho)
Loai_kho(id_loai_kho, ten_loai_kho)
Kho(id_kho, sl_san_pham, id_lo_sp, id_khu_vuc)
Chi_tiet_lo_sp(id_chi_tiet_sp, so_luong_sp, so_tien_sp, id_lo_sp, id_sp)
Lo_san_pham(id_lo_sp, hsd, nsx, id_phieu_nhap)
Phieu_nhap(id_phieu_nhap, thoi_gian, ghi_chu, id_nv, id_lo_sp)
Chi_tiet_phieu_nhap(id_ctpn, so_tien_lo, so_luong_lo, id_nguon_cc, id_phieu_nhap)
Nguon_cc(id_nguon_cc, ten_nha_cc, ten_dai_dien, sdt, dia_chi, email, hinh_anh)
Nhan_vien(id_nv, ten_nv, sdt, cmnd, ngay_sinh, hinh_anh)
Tai_khoan(id_tk, ten_tai_khoan, mat_khau, id_nv, loai)
NOTE:
San_pham: This table represents products with attributes such as product id (id_sp),
product name (ten_sp), image (hinh_anh), and product type id (id_loai_sp).
Loai_sp: This table represents product types with attributes such as product type id
(id_loai_sp), product type name (ten_loai_sp), unit of measure (dvt), and area id (id_khu_vuc).
khu_vuc: This table represents zones with attributes such as zone id (id_khu_vuc), zone
name (ten_khu_vuc), location (vi_tri), and warehouse type id (warehouse id_loai_kho).
Loai_kho: This table represents warehouse types with attributes such as warehouse type
id (id_loai_kho) and warehouse type name (ten_loai_kho).
Kho: This table represents warehouses with attributes such as warehouse id (warehouse
id), product quantity (sl_san_pham), lot id (id_lo_sp), and region id (id_khu_vuc).
Chi_tiet_lo_sp: This table represents the details of product batches with attributes such
as detail id (id_chi_tiet_sp), product quantity (so_luong_sp), product price (so_tien_sp), batch id
(id_lo_sp), and batch id product (id_sp).
Lo_san_pham: This table represents product batches with attributes such as batch id
(id_lo_sp), expiry date (hsd), production date (nsx), and receipt id (id_phieu_nhap).
Phieu_nhap: This table represents input tickets with attributes such as input ticket id
(id_phieu_nhap), time (thoi_gian), note (ghi_chu), employee id (id_nv), and batch id (id_lo_sp).
Chi_tiet_phieu_nhap: This table represents the details of imported tickets with
attributes such as detail id (id_ctpn), lot price (so_tien_lo), lot quantity (so_luong_lo), supply id
(id_nguon_cc), and ticket id enter (id_phieu_nhap).
Nguon_cc: This table represents suppliers with attributes such as source id
(id_nguon_cc), supplier name (ten_nha_cc), representative name (ten_dai_dien), phone number
(sdt), address (dia_chi ), email (email), and image (hinh_anh).
Employees: This table represents employees with attributes such as employee id (id_nv),
employee name (ten_nv), phone number (sdt), ID card number (ID), date of birth (ngay_sinh),
and photo photo (hinh_anh).
Tai_khoan: This table represents accounts with attributes such as account id (id_tk),
account name (ten_tai_khoan), password (mat_khau), employee id (id_nv), and type (loai).
4) Data Standardlization ( 3NF ) :
1. Loai_sp(id_loai_sp, ten_loai_sp, dvt, id_khu_vuc): In this case, id_loai_sp is the primary key. Other
attributes (ten_loai_sp, dvt, id_khu_vuc) all depend entirely on id_loai_sp. Therefore, the Loai_sp table
reaches 3NF.
2. Khu_vuc(id_khu_vuc, ten_khu_vuc, vi_tri, id_loai_kho): Similarly, id_khu_vuc is the primary key and
other attributes completely depend on id_khu_vuc. Therefore, the Khu_vuc table reaches 3NF.
3. Loai_kho(id_loai_kho, ten_loai_kho): id_loai_kho is the primary key and ten_loai_kho depends
entirely on id_loai_kho. Therefore, the Loai_kho table reaches 3NF.
4. Warehouse(id_kho, sl_san_pham, id_lo_sp, id_khu_vuc): id_kho is the primary key and other
attributes are completely dependent on id_kho. Therefore, the Warehouse table reaches 3NF.
5. Chi_tiet_lo_sp(id_chi_tiet_sp, so_luong_sp, so_tien_sp, id_lo_sp, id_sp): id_chi_tiet_sp is the primary
key and other attributes are completely dependent on id_chi_tiet_sp. Therefore, the Chi_tiet_lo_sp
table reaches 3NF.
6. Lo_san_pham(id_lo_sp, hsd, nsx, id_phieu_nhap): id_lo_sp is the primary key and other attributes are
completely dependent on id_lo_sp. Therefore, the Lo_san_pham table reaches 3NF.
7. Request(id_phieu_nhap, thoi_gian, ghi_chu, id_nv, id_lo_sp): id_phieu_nhap is the primary key and
other attributes are completely dependent on id_phieu_nhap. Therefore, the Phieu_nhap table reaches
3NF.
8. Chi_tiet_phieu_nhap(id_ctpn, so_tien_lo, so_luong_lo, id_nguon_cc, id_phieu_nhap): id_ctpn is the
primary key and other attributes are completely dependent on id_ctpn. Therefore, the
Chi_tiet_phieu_nhap table reaches 3NF.
9. Person_cc(id_word_cc, name_name_cc, name_dai_name, phone number, phone number, email,
image_image): id_nguon_cc is the primary key and other attributes are completely dependent on
id_nguon_cc. Therefore, the Nguon_cc table reaches 3NF.
10. Nhan_vien(id_nv, ten_nv, sdt, cmnd, ngay_sinh, hinh_anh): id_nv is the primary key and other
attributes completely depend on id_nv. Therefore, the Nhan_vien table reaches 3NF.
11. Tai_khoan(id_tk, name_tai_khoan, mat_khau, id_nv, loai): id_tk is the primary key and other
attributes completely depend on id_tk. Therefore, the Tai_khoan table reaches 3NF.
The model meets 3NF standard form
5 ) CREATE TABLE :
-- Create Account table :
CREATE TABLE Tai_Khoan (
Id_tk INT NOT NULL AUTO_INCREMENT,
Ten_tai_khoan VARCHAR(30) NOT NULL,
Mat_khau VARCHAR(30) NOT NULL,
Id_nv INT NOT NULL,
Loai_tk INT NOT NULL,
PRIMARY KEY (Id_tk)
);
-- Create Employee table :
CREATE TABLE Nhan_vien (
Id_nv INT NOT NULL AUTO_INCREMENT,
Ten_nv VARCHAR(100) NOT NULL,
Sdt VARCHAR(100) NOT NULL,
Cmnd VARCHAR(100) NOT NULL,
Ngay_sinh DATE NOT NULL,
Hinh_anh LONGBLOB,
PRIMARY KEY (Id_nv)
);
-- Create Product table :
CREATE TABLE San_pham (
Id_sp INT NOT NULL AUTO_INCREMENT,
Ten_sp VARCHAR(100) NOT NULL,
Hinh_anh LONGBLOB,
Id_loai_sp INT NOT NULL,
PRIMARY KEY (Id_sp)
);
-- Create Product Type table :
CREATE TABLE Loai_sp (
Id_loai_sp INT NOT NULL AUTO_INCREMENT,
Ten_loai_sp VARCHAR(100) NOT NULL,
Dvt VARCHAR(100),
Id_khu_vuc INT NOT NULL,
PRIMARY KEY (Id_loai_sp)
);
-- Create Area table :
CREATE TABLE Khu_vuc (
Id_khu_vuc INT NOT NULL AUTO_INCREMENT,
Ten_khu_vuc VARCHAR(100),
Vi_tri VARCHAR(100),
Id_loai_kho INT NOT NULL,
PRIMARY KEY (Id_khu_vuc)
);
-- Create Warehouse table :
CREATE TABLE Kho (
Id_kho INT NOT NULL AUTO_INCREMENT,
Sl_san_pham INT,
Id_lo_sp INT,
Id_khu_vuc INT NOT NULL,
PRIMARY KEY (Id_kho)
);
-- Create the Warehouse Type table :
CREATE TABLE Loai_kho (
Id_loai_kho INT NOT NULL AUTO_INCREMENT,
Ten_loai_kho VARCHAR(100),
PRIMARY KEY (Id_loai_kho)
);
-- Create Product Batch Details table :
CREATE TABLE chi_tiet_lo_sp (
Id_chi_tiet_sp INT NOT NULL AUTO_INCREMENT,
So_luong_sp INT,
So_tien_sp INT,
Id_lo_sp INT,
Id_sp INT,
PRIMARY KEY (Id_chi_tiet_sp)
);
-- Create Product Batch table :
CREATE TABLE Lo_san_pham (
Id_lo_sp INT NOT NULL AUTO_INCREMENT,
Hsd DATE,
Nsx DATE,
Id_phieu_nhap INT,
PRIMARY KEY (Id_lo_sp)
);
-- Create the Input Voucher table :
CREATE TABLE Phieu_nhap (
Id_phieu_nhap INT NOT NULL AUTO_INCREMENT,
Thoi_gian DATETIME,
Ghi_chu VARCHAR(100),
Id_nv INT,
Id_lo_sp INT,
PRIMARY KEY (Id_phieu_nhap)
);
-- Create the Input Voucher Details table :
CREATE TABLE Chi_tiet_phieu_nhap (
Id_ctpn INT NOT NULL AUTO_INCREMENT,
So_tien_lo INT,
So_luong_lo INT,
Id_nguon_cc INT,
Id_phieu_nhap INT,
PRIMARY KEY (Id_ctpn)
);
6, Display :
1, Typical Form :
2,Search form :
3,Report :
4,Another function :