仓库管理系统的数据库设计及表的关系
时间: 2023-11-16 15:05:15 浏览: 69
仓库管理系统的数据库设计应该包括以下几个方面:
1. 仓库信息管理:包括仓库编号、仓库名称、仓库地址、联系人等信息。
2. 物料信息管理:包括物料编号、物料名称、规格型号、单位、单价、库存数量等信息。
3. 入库管理:包括入库单编号、入库日期、仓库编号、供应商编号、经办人等信息。
4. 出库管理:包括出库单编号、出库日期、仓库编号、客户编号、经办人等信息。
5. 库存管理:包括物料编号、库存数量、可用数量、冻结数量等信息。
基于以上基本信息,可以设计出以下表结构及其关系:
1. 仓库信息表
字段名 | 类型 | 说明
---|---|---
warehouse_id | int | 仓库编号,主键
warehouse_name | varchar | 仓库名称
warehouse_address | varchar | 仓库地址
contact_person | varchar | 联系人
2. 物料信息表
字段名 | 类型 | 说明
---|---|---
material_id | int | 物料编号,主键
material_name | varchar | 物料名称
material_spec | varchar | 规格型号
unit | varchar | 单位
unit_price | decimal | 单价
quantity | int | 库存数量
3. 入库单表
字段名 | 类型 | 说明
---|---|---
inbound_id | int | 入库单编号,主键
warehouse_id | int | 仓库编号,外键
supplier_id | int | 供应商编号,外键
operator | varchar | 经办人
create_time | datetime | 入库日期
4. 入库明细表
字段名 | 类型 | 说明
---|---|---
inbound_detail_id | int | 入库明细编号,主键
inbound_id | int | 入库单编号,外键
material_id | int | 物料编号,外键
unit_price | decimal | 单价
quantity | int | 数量
subtotal | decimal | 小计金额
5. 出库单表
字段名 | 类型 | 说明
---|---|---
outbound_id | int | 出库单编号,主键
warehouse_id | int | 仓库编号,外键
customer_id | int | 客户编号,外键
operator | varchar | 经办人
create_time | datetime | 出库日期
6. 出库明细表
字段名 | 类型 | 说明
---|---|---
outbound_detail_id | int | 出库明细编号,主键
outbound_id | int | 出库单编号,外键
material_id | int | 物料编号,外键
unit_price | decimal | 单价
quantity | int | 数量
subtotal | decimal | 小计金额
7. 库存表
字段名 | 类型 | 说明
---|---|---
inventory_id | int | 库存编号,主键
material_id | int | 物料编号,外键
warehouse_id | int | 仓库编号,外键
total_quantity | int | 总数量
available_quantity | int | 可用数量
frozen_quantity | int | 冻结数量
以上表之间的关系如下:
- 仓库信息表与入库单表、出库单表、库存表存在一对多关系;
- 物料信息表与入库明细表、出库明细表、库存表存在一对多关系;
- 入库单表与入库明细表存在一对多关系;
- 出库单表与出库明细表存在一对多关系;
- 库存表与物料信息表、仓库信息表存在多对多关系。
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)