智能仓库软件系统设计
运行环境及技术选型
运行环境:
| 运行环境 | 版本 |
|---|---|
| 操作系统 | centos5.6 |
| JDK | JDK11 |
| 数据库 | mysql5.7 |
| 服务器 | tomcat9.0.33 |
技术选型:
- 后端采用Spring + Mybatis + SpringMVC, 用Maven管理项目依赖。
- 前端采用React + redux ,用npm管理项目依赖。
软件架构
本项目采用前后点分离的开发方式,大致流程如下:
- 首先前后端开发人员一起确定接口api。
- 前后端开发人员根据接口api各自按照api进行同步开发。
- 双方协助调试和修正接口出现的故障。
后端采用MVC分层结构,前端采用MVVM结构。
MVC

- 模型:用来封装核心数据和功能。它独立于特定的输出表示和输入行为,是执行某些任务的代码,至于这些任务以什么形式显示给用户。并不是模型所关注的问题。
- 视图:用来向用户显示信息,它获取来自模型的数据,决定模型以什么样的方式展示给用户。由于采用前后端分离,视图采用 RESTFUL 架构的JSON类型。
- 控制器:通过控制器来操纵模型,从而向模型传递数据,改变模型的状态,并最后导致视图的更新
MVVM

在前端页面上,把Model 用纯JavaScript对象表示,View 负责显示,用ViewModel把View和Model关联起来。ViewModel负责把Model的数据同步到View显示出来,还负责把View的修改同步到Model.
流程图和时序图
在上次的作业中,我们通过需求分析做出了流程图和时序图:


api
/user/login
request:
String username,
String password
response:
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"role": 0,
}
}
fail:
{
"status": 1,
"msg": "密码错误"
}
/user/edit
request:
String username,
String password,
int role,
response:
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"role": 0,
}
}
fail:
{
"status": 1,
"msg": ""
}
/user/list
显示所有用户
response:
success:
{
"status": 0,
"data": [{
"id": 12,
"username": "aaa",
"role": 0,
},]
}
fail:
{
"status": 1,
"msg": ""
}
/user/chmod
改变用户权限
response:
success
{
"status": 0,
"data": [{
"id": 12,
"username": "aaa",
"role": 0,
},]
}
fail:
{
"status": 1,
"msg": ""
}
/department/edit
request:
int id
response:
success
{
"status": 0,
"data": {
"id": 12,
"name": "业务部",
"desc": "",
}
}
fail:
{
"status": 1,
"msg": ""
}
/department/list
显示所有部门
response:
success:
{
"status": 0,
"data": [{
"id": 12,
"name": "业务部",
"desc": "",
},]
}
fail:
{
"status": 1,
"msg": ""
}
/good/addGood
添加产品信息
request:
String name
int quantity
String detail,
response:
success:
{
"status": 0,
"data": {
"id": 12,
"name": "",
"quantity": 20,
"detail":""
status:"未发货"
}
}
fail:
{
"status": 1,
"msg": ""
}
/good/changeStatus
改变产品状态(未发货、发货中、已收货等)
request:
int id,
int status
response:
success:
{
"status": 0,
"data": {
"id": 12,
"name": "",
"quantity": 20,
"detail":""
status:"未发货"
}
}
fail:
{
"status": 1,
"msg": ""
}
/good/editGood
添加产品信息
request:
int id
String name
int quantity
String detail
response:
success:
{
"status": 0,
"data": {
"id": 12,
"name": "",
"quantity": 20,
"detail":""
status:"未发货"
}
}
fail:
{
"status": 1,
"msg": ""
}
/good/list
显示订单可选的所有产品
response:
success:
{
"status": 0,
"data": [{
"id": 12,
"name": "",
"quantity": 20,
"detail":""
status:"未发货"
},]
}
fail:
{
"status": 1,
"msg": ""
}
/cart/addGood
将产品放到货架上.
request
int cartId
int row
int col
int productId
response
success:
{
"status": 0,
msg: "添加成功"
}
fail:
{
"status": 1,
"msg": "已被放置"
}
/cart/removeGood
将产品从货架拿走.
request
int cartId
int row
int col
int productId
response
success:
{
"status": 0,
msg: "移除成功"
}
fail:
{
"status": 1,
"msg": "失败"
}
/cart/list
显示货架上各个位置的产品
response
success:
{
"status": 0,
msg:[
{
"id": 2,
products:[[200, 100, -1], [20, 18, 7]] //-1表示无产品
}
]
}
fail:
{
"status": 1,
"msg": "失败"
}
/log/add
添加错误日志
request
int type
string message
int handlerId
response
success:
{
"status": 0,
msg:
{
"id": 2,
type:2,
string:"损坏",
handlerId: 2
}
]
}
fail:
{
"status": 1,
"msg": "失败"
}
/log/get
获取错误日志
request
int id
response
success:
{
"status": 0,
msg:
{
"id": 2,
type:2,
string:"损坏",
handlerId: 2
}
]
}
fail:
{
"status": 1,
"msg": "失败"
}
/log/add
获取所有错误日志
response
success:
{
"status": 0,
msg:
[{
"id": 2,
type:2,
string:"损坏",
handlerId: 2
}]
]
}
fail:
{
"status": 1,
"msg": "失败"
}
数据库
user
| id | username | password | role |
|---|---|---|---|
department
| id | name | desc |
|---|---|---|
user_department
| id | departmentId | userId |
|---|---|---|
product
| id | name | quantity | detail | status | position |
|---|---|---|---|---|---|
shipping订单
| id | userId | productId | status | handler |
|---|---|---|---|---|
cart货架
| id | row | col |
|---|---|---|
error_info
| id | type | message | handler |
|---|---|---|---|
项目目录
后端
entity里面是实体类,dao层负责数据库交互,service层负责具体的功能逻辑,controller层负责与用户进行交互。

前端
page中存放的是各个页面, component存放公共组件,store、reducer和action目录负责redux的功能来管理数据。


浙公网安备 33010602011771号