资源描述
库存分销管理系统
——数据库设计、统计报表管理开发与实现、测试
摘 要:本文针对目前库存管理系统存在的有关权限授权和认证问题分析,采用面向对象的开发方法,分析设计了库存分销管理系统,采用Java语言实现了库存分销管理系统中的子功能──统计报表管理与用户登录。本文对系统的数据库设计进行说明,并对统的系统管理模块进行测试说明。
关键词:库存;报表;登录;测试
Abstract:This article according to the present stock management system existed the problem of the authorization and authentication problem, used the object-oriented development method, analysis and design of the distribution of inventory management system, and used Java language to realize the the distribution of inventory management systems --manage statistic forms and user login. This article briefly described the design of the system, and the system management module of the system test instructions.
Key words:Inventory; Report forms; Login; Test
1 引言
1.1 编写目的
库存分销管理系统是管理企业的分销网络的系统,目的是使企业具有对订单和供货具有快速反应和持续补充库存的能力。
通过互联网将供应商与经销商有机地联系在一起,为企业的业务经营及与贸易伙伴的合作提供了一种全新的模式。供应商和经销商之间可以实时地提交订单、查询产品供应和库存状况、并获得市场、销售信息及客户支持,实现了供应商与经销商之间端到端的供应链管理,有效地缩短了供销链。
新的模式借助互联网的延申性及便利性,使商务过程不再受时间、地点和人员的限制,企业的工作效率和业务范围都得到了有效提高。企业可以在兼容互联网时代现有业务模式和现有基础设施情况下,扩展现有的业务和销售能力,实现零风险库存,大大降低分销成本,提高周转效率,确保获得领先一步的竞争优势。
1.2 范围
库存分销管理系统是管理企业的分销网络的系统,目的是使企业具有对订单和供货具有快速的反应和持续的补充库存的能力而开发的系统。通过互联网将供应商与经销商有机地联系在一起,为企业的业务经营及与贸易伙伴的合作提供了一种全新的模式。适用于所有的管理企业,主要用于企业对订单和库存的掌握和管理。
1.3 定义
数据库开发软件:Navicat for Mysql
数据库管理系统:Mysql
运行环境:Windows XP/ Win 7
开发语言:Java
1.4 本文可行性分析
可行性研究阶段的主要任务是在系统初步调查的基础上,对新系统是否能够实现和值得实现等问题作出判断,避免在花费了大量人力和物力之后才发现系统不能实现或新系统投入使用后没有任何实际意义而引起的浪费,对新系统的可行性的分析,要求用最小的代价在尽量短的时间内确定系统是否可行。
为了保证系统开发成功,采取面向对象的分析方法,采用面向对象的开发方法,可以将现实世界的复杂问题简单化,从现实世界中抽取出实体对象,通过协作关系将实体对象关联起来,从而达到整个系统正常运行。采用面向对象的开发方法,可以将复杂的问题简单化,有利于编程。
2 项目概述
2.1 产品描述
在计算机网络,数据库和先进的开发平台上,利用现有的软件,配置一定的硬件,开发一个具有开放体系结构的、易扩充的、易维护的、具有良好人机交互界面的库存分销管理系统。主要有如下几个方面的目标:
⑴ 确保系统用户及其权限的维护和数据的安全
⑵ 实现分销商库存时的各种数据计算、显示和记录
⑶ 为供货厂商和客户建立档案
⑷ 能对库存的管理和商品资料维护
⑸ 自动记录订单和报表情况并分析当天数据得到用户需要盈亏报表结果等。
根据客户的要求,分析现有情况及问题,采用Browser/Server结构,将分销资源计划管理系统做成一个独立的网站。
2.2 产品功能
公司所有产品都是通过一级分销商出货,一级分销商的货品分四种方式出库,即调拨到二级分销商调拨到三级分销商、纯销售到批发、销售到其他经销点(如超市等),二级分销商的货品分三种方式出库,即调拨到三级分销商、纯销售到批发、销售到其他经销点(如超市等),三级分销商的货品分两种方式出库,即纯销售到批发、销售到其他经销点(如超市等),超市和其他经销点都作为终端客户。
程序功能:
进行用户身份验证,根据不同登入的用户权限采用不同权限策略。
分销商库存管理:
分销商库存数量初始化确认、流向单维护、流向单审核、流向单抽查、流向单复审、盘点结果维护、盘点结果审核。
统计报表管理:
分销商级别分布图、流向单录入审核报告、流向单抽查报告、分销商月度分销(调拨)明细表、分销商库存报表。
基础数据管理:
物料维护、分销商维护、终端客户维护
系统管理:
用户维护、修改密码
2.3 用户特点
知道本系统的密码用户就可在浏览器上打开以使用,不同用户所拥有的权限不同。
2.4 一般约束
系统的实现约束如下:
(a) 操作系统为Win2000以上
(b) 开发平台为:MyEclipse-SDK-3.1.2-win32
(c) 数据库为Mysql
2.5 假设和依据
a. 本系统需要运行计算机为一般的PC机,计算机上一般都安装了浏览器。
b. 本系统采用JSP+struts开发,JSP在现在的web开发中比较流行。
3 数据库设计
数据库设计与实现是系统开发中的一个重要环节,一个结构合理的数据库可以提高系统的整体的运行效率,同时可以缩短系统的开发时间。本系统主要采用MySql Server作为数据库。
3.1 数据库的设计原则
在数据库的设计中,本系统按照以下原则进行设计,以尽量满足系统的要求。
(1)数据库中数据的可操作性
数据库设计时注意保证在整个系统运行和业务操作过程中,数据库都能便于访问和查询,同时还需要考虑要尽量节省数据库操作时的相应时间,尽可能的提高数据库对程序和业务请求的响应速度。
(2)数据库设计的准确性和完整性
数据库中的数据设计要满足程序设计的要求,对于程序中使用的数据和存储的数据内容,都有严格的数据和准确的数据类型与之对应,同时在数据库设计时要对关键数据进行详细说明,以方便系统设计人员的开发工作。
(3)数据库冗余性
过多的冗余数据会大大增加数据库的工作量,降低数据库的响应时间和准确性。因此改善数据库性能的一个非常重要的方面就是减少或消除数据库中的冗余信息,要通过规范化处理使冗余数据减少。
3.2 数据库连接设计
为了方便连接数据库,本系统把数据库连接保存在DB.java中,采用TOMCAT服务器提供的数据库连接池。
private DB() {
try {
ctx = new InitialContext();
// 采用jndi查找连接池
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/drp");
} catch (NamingException namee) {
System.out.println("查询连接池失败!\n" + namee.getMessage());
} finally {
if (ctx != null) {
try {
ctx.close();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
String driver="com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/drp";
String username="root";
String pwd="123456";
3.3 标识符和状态
表3.1 系统表名用表
表名
名称或标识符
描述
状态(试验/测试使用)
t_user
用户信息表
使用
t_client
分销商信息表
使用
t_temi_client
终端信息表
未使用
t_items
物料信息表
使用
t_fiscal_year_period
会计核算期表
使用
t_flow_card_master
流向单信息
使用
t_flow_card_detail
流向单详细信息
使用
t_data_dict
数据字典
使用
3.4 数据库表格设计
3.4.1 数据字典
数据字典是系统中各类数据描述集合,其中规定了每个字段名称,数据类型,长度,主键等基本信息。有时为了方便使用,在设计数据库时会有意增加一些数据冗余,对于本系统中出现的数据,这次系统中我们用以下数据字典做详细描述如下表所示:
表3.2 t_user表
t_user
列名
中文名称
数据类型
长度
是否能为空
备注
user_id
用户ID
Varchar
10
not null
primary key
user_name
用户名
varchar
20
not null
password
密码
varchar
20
contact_tel
联系电话
varchar
30
email
邮箱
varchar
30
create_date
创建日期
datetime
表3.3 t_client表
t_client
列名
中文名称
数据类型
长度
是否能为空
备注
id
序列ID
int
not null
primary key
pid
上级分销商ID
int
not null
name
名称
varchar
40
not null
client_id
分销商代码
varchar
10
client_level
分销商等级
char
3
bank_acct_no
银行账号
varchar
30
contact_tel
联系电话
varchar
20
address
地址
varchar
50
zip_code
邮编
varchar
20
is_leaf
是否为叶子节点
char
default 'N'
is_client
是否为分销商
char
default 'N'
表3.4 t_temi_client表
t_temi_client
列名
中文名称
数据类型
长度
是否能为空
备注
id
序列ID
int
not null
primary key
pid
上级分销商ID
int
not null
name
名称
varchar
40
not null
temi_id
分销商ID
varchar
20
temi_level
分销商级别
char
3
contact_tel
联系电话
varchar
18
contactor
联系人
varchar
30
address
地址
varchar
50
zip_code
邮编
varchar
20
is_leaf
是否为叶子节点
char
1
default 'N'
is_temi_client
是否为分销商
char
1
default 'N'
表3.5 t_items表
t_items
列名
中文名称
数据类型
长度
是否能为空
备注
item_no
编号
varchar
10
not null
primary key
item_name
名称
varchar
30
not null
spec
物料规格
varchar
30
pattern
型号
varchar
30
category
种类
char
3
not null
unit
单位
char
3
not null
表3.6 t_fiscal_year_period表
t_fiscal_year_period
列名
中文名称
数据类型
长度
是否能为空
备注
id
主键
int
not null
primary key
fiscal_year
核算年
int
not null
fiscal_period
核算月
tinyint
not null
begin_date
起始时间
datetime
not null
end_date
截止时间
datetime
not null
period_sts
是否可用标识
char
1
default 'N'
表3.7 t_flow_card表
t_flow_card
列名
中文名称
数据类型
长度
是否能为空
备注
vou_no
流向单标识主键
varchar
16
not null
primary key
fiscal_year
核算年
int
not null
fiscal_period
核算月
tinyint
not null
client_id
客户ID
varchar
10
not null
opr_type
操作类型
char
1
not null
record_date
录入日期当前日期
datetime
not null
recorder_id
录入人ID
varchar
10
not null
vou_sts
录入N 送审S
char
1
default 'N'
confirmer_id
复审人ID
varchar
10
conf_date
复审日期
datetime
spotter_id
抽查人ID
varchar
10
spot_date
抽查日期
datetime
spot_remark
抽查结果描述
varchar
60
spot_flag
抽查标记Y/N
char
1
default 'N'
adjust_time
调整时间
datetime
adjuster_id
调整人ID
varchar
10
表3.8 t_flow_card_detail表
t_flow_card_detail
列名
中文名称
数据类型
长度
是否能为空
备注
id
主键
int
not null
primary key
vou_no
流向单标识
varchar
16
not null
aim_id
客户ID
varchar
10
not null
item_no
物料标识
varchar
10
not null
qty
数量
decimal
(10,2)
default 0
amt
金额
decimal
(10,2)
default 0
adjust_qty
调整数量
decimal
(10,2)
default 0
adjust_reason
调整原因
varchar
50
adjust_flag
调整标识
char
1
default 'N'
表3.9 t_data_dict表
t_data_dict
列名
中文名称
数据类型
长度
是否能为空
备注
id
主键
char
3
not null
primary key
name
名称
varchar
20
not null
category
种类
varchar
30
not null
3.4.2 安全保密设计
在我们的系统中,因为是面向公司的后台系统,所以只有管理员的权限,用户名和密码不对普通用户开放。用户名和密码保存在数据库中,每次登录需匹配数据库中保存的管理员的用户名和密码,还是随机验证码,只要用户名或密码不正确,都不能登录该系统,安全度极高。
3.5 结构设计
3.5.1 概念结构设计
图3-1 各表关系图
3.5.2 逻辑结构设计
/*========================================================*/
/* Database name: drp */
/* DBMS name: MySQL */
/* Created on: 2015-01-22 */
/*=======================================================*/
/*========================================================*/
/* Table: t_user */
/*========================================================*/
create table if not exists t_user
(
user_id varchar(10) primary key not null,
user_name varchar(20) not null,
password varchar(20),
contact_tel varchar(30),
email varchar(30),
create_date datetime
);
/*========================================================*/
/* Table: t_client */
/*========================================================*/
create table if not exists t_client
(
id int primary key auto_increment not null,
pid int not null,
name varchar(40) not null,
client_id varchar(10),
client_level char(3),
bank_acct_no varchar(30),
contact_tel varchar(20),
address varchar(50),
zip_code varchar(20),
is_leaf char(1) default 'N',
is_client char(1) default 'N'
);
/*========================================================*/
/* Table: t_temi_client */
/*========================================================*/
create table if not exists t_temi_client
(
id int primary key auto_increment not null,
pid int not null,
name varchar(40) not null,
temi_id varchar(20),
temi_lelve char(3),
contact_tel varchar(18),
contactor varchar(30),
address varchar(50),
zip_code varchar(20),
is_leaf char(1) default 'N',
is_temi_client char(1) default 'N'
);
/*========================================================*/
/* Table: t_items */
/*========================================================*/
create table if not exists t_items
(
item_no varchar(10) primary key not null,
item_name varchar(30) not null,
spec varchar(30),
pattern varchar(30),
category char(3) not null,
unit char(3) not null
);
/*========================================================*/
/* Table: t_fiscal_year_period */
/*========================================================*/
create table if not exists t_fiscal_year_period
(
id int primary key auto_increment not null,
fiscal_year int not null,
fiscal_period tinyint not null,
begin_date datetime not null,
end_date datetime not null,
period_sts char(1) default 'N'
);
/*========================================================*/
/* Table: t_flow_card_master */
/*========================================================*/
create table if not exists t_flow_card
(
vou_no varchar(16) primary key not null,
fiscal_year int not null,
fiscal_period tinyint not null,
client_id varchar(10) not null,
opr_type char(1) not null,
record_date datetime not null,
recorder_id varchar(10) not null,
vou_sts char(1) default 'N',
confirmer_id varchar(10),
conf_date datetime,
spotter_id varchar(10),
spot_date datetime,
spot_remark varchar(60),
spot_flag char(1) default 'N',
adjust_time datetime,
adjuster_id varchar(10)
);
/*========================================================*/
/* Table: t_flow_card_detail */
/*========================================================*/
create table if not exists t_flow_card_detail
(
id int primary key auto_increment not null,
vou_no varchar(16) not null,
aim_id varchar(10) not null,
item_no varchar(10) not null,
qty decimal(10,2) default 0,
amt decimal(10,2) default 0,
adjust_qty decimal(10,2) default 0,
adjust_reason varchar(50),
adjust_flag char(1) default 'N'
);
/*========================================================*/
/* Table: t_data_dict */
/*========================================================*/
create table if not exists t_data_dict
(
id char(3) primary key not null,
name varchar(20) not null,
category varchar(30) not null
);
/*========================================================*/
/* View: v_aim_client */
/*========================================================*/
create view v_aim_client(id, name, level_id, level_name) as
select a.client_id as id, a.name, a.client_level as type_id, b.name as type_name from t_client a, t_data_dict b where a.client_level=b.id
union
select a.temi_id as id, a.name, a.temi_lelve as type_id, b.name as type_name from t_temi_client a, t_data_dict b where a.temi_lelve=b.id
4 子功能模块的开发与实现
4.1 统计报表管理模块
统计报表管理是用报表统计对分销商级别的分布。选择分销商或者分销省,可以用饼图来统计出分销商级别分布图
4.1.1 功能
图4-1 统计报表管理功能图
4.1.2 输入项
选择下拉框
4.1.3 输出项
显示图表
4.1.4 算法
分销商级别分布图
<title>分销商级别分布图</title>
<link rel="stylesheet" href="../style/drp.css">
<script type="text/javascript">
function findClient(){
with(document.getElementById("clientLevelChartForm")){ action="client_level_chart.jsp?pid=<%=pid%>&command=command";
method
展开阅读全文