您的当前位置:首页正文

企业进销存管理系统数据库课程设计本科论文

2022-11-18 来源:榕意旅游网


数据库与信息管理技术

设计报告

设计名称: 企业进销存管理系统

专 业: xxxxxxxxx 班 级:xxxxxxxxxx 学 号: xxxxxxxx 姓 名: xx 指导教师: xx

2015 年 xx 月 xx 日

目录

一 绪论.......................................................................................................................... 3

1.1 需求分析 ...................................................................................................... 3 1.2 项目开发的目标............................................................................................. 3 1.3.1 操作系统及其数据库................................................................................. 4 1.3.2 编辑语言..................................................................................................... 4 二 系统分析与设计...................................................................................................... 4

2.1 系统功能结构................................................................................................. 4 2.2 系统总体流程图............................................................................................. 5 2.3 系统所采用的架构:..................................................................................... 6 三 数据库设计.............................................................................................................. 6

3.1创建数据库....................................................................................................... 6 3.2创建数据表....................................................................................................... 7 3.3 数据库关系图................................................................................................ 12 3.4 数据库使用到的视图.................................................................................... 13 四 主程序设计............................................................................................................ 14

4.1 登录界面........................................................................................................ 14 4.2 主窗体效果.................................................................................................... 14 4.3 各模块功能效果............................................................................................ 14 五、测试运行.............................................................................................................. 19 六、心得体会.............................................................................................................. 23 七、参考文献.............................................................................................................. 23 附录1:部分java核心代码 ......................................................................................... 24 附录2:数据库设计相关代码 ..................................................................................... 44

一 绪论

随着国内经济的高速发展,中小型的商品流通企业越来越多,其所经营商品种类繁多,难以管理,而进销存管理系统逐渐成为企业经营和管理中的核心环节,也是企业取得收益的关键。为了完善管理制度,增强企业的竞争力,因此必须开发出进销存管理系统,从而实现对商品管理的信息化。

1.1 需求分析

企业进销存管理系统的主要工作,是对企业的采购、进货、销售和库存以信息化的方式进行管理,最大限度地减少各个环节中可能出现的错误,有效减少盲目采购、降低采购成本、合理控制库存、减少资金占用并提高市场灵敏度,使企业能够合理安排进销存的每个关键步骤,提升企业市场竞争力。针对这些问题,经销商对产品的进销存合理化提出了更高的要求。

通过上网查阅资料以及研究分析可知,企业进销存管理系统应具有以下功能:

(1) 界面美观大方、方便、快捷、操作灵活。 (2) 通过主界面的按钮快速实现人机交互。

(3) 实现强大的进销存管理,包括基本信息、采购、进货销售和库存管理。 (4) 能够在不同的操作系统下运行,不局限于特定的平台。 (5) 提供库存盘点功能。

(6) 提供多条件查询和模糊查询功能。 (7) 能够提供方便快捷的服务。

1.2 项目开发的目标

实现企业信息化管理是现代社会中小企业稳步发展的必要条件,它可以

提高企业的管理水平和工作效率,最大限度地减少手工操作带来的失误。进销存管理的主要功能是实现企业进销存的信息化管理,主要功能包括商品的采购、销

售和库存,另外还需要提供统计查询的功能,其中包括商品查询、供应商查询、客户查询等。并且还应达到以下的这些目标:

(1) 灵活的人机交互界面,操作简单方便,界面简洁美观。 (2) 可以通过菜单、工具栏灵活操作。 (3) 对进货和销售提供相应的退货管理功能。 (4) 实现各种查询,如单一条件查询或多条件查询等。 (5) 可以随时修改系统口令。 (6) 可以设置用户的使用权限。

(7) 系统最大限度地实现易安装性、易维护性和已操作性。 (8) 系统运行稳定、安全可靠。

1.3.1 操作系统及其数据库

操作系统:Windows8.1,数据库管理软件:Microsoft SQL SERVER2012 编程软件:Eclipse

1.3.2 编辑语言

前台客户端的开发使用的是java语言,里面嵌入了SQL SERVER数据库操作的SQL语句。

二 系统分析与设计

2.1 系统功能结构

企业进销存管理系统必须提供商品信息、供应商信息和客户信息的基础信

息,并提供强大的多条件搜索功能和商品的进货、销售和库存管理功能。此外,每个用户都有属于自己的权限,不同的用户对系统的操作不同。该系统还必须保证数据的安全性、完整性和准确性。

本系统包括基础信息、进货管理、销售管理、库存管理、查询统计、系统管理六大部分。系统机构如下图1所示:

企业进销存管理系统 进货管理 进 货单 进货退货 客户信息管理 基础信息管理 销售管理 库存管理 查询统计 系统管理 客户信息添加 商品信息管理 供应商信息管理 销售单 销售退货 库存盘点 库存价格调整 客户查询 商品查询 供应商查询 操作员管理 更改密码 权限管理 客户修改与删除 商品信息添加 商品修改与删除 供应商信息添加 供应商修改与删除 图1 企业进销存管理系统功能结构

2.2 系统总体流程图

用 户 登录 是 否 是否成功 系统管理 管理员 操作员 基础信息管理 进货管理 销售管理 库存管理 查询统计 图2 进销存系统流程图

2.3 系统所采用的架构:

本系统所采用的结构是B/S架构,前台是以客户端的形式呈现,后台是以

DBMS软件作为服务器来处理客户端发来的请求并进行处理。前台客户端登录后按照界面提示完成相应的操作,后台的DBMS应用则会按照前台客户端执行的操作请求来执行相应的操作,从而达到对数据进行正确有效的管理。

三 数据库设计 3.1创建数据库

数据库使企业进销存管理系统的数据集合,是系统开发的首要环节。数

据库结构设计的好坏直接影响着系统的效率和性能。为了方便数据库的创建,本系统使用Microsoft SQL SERVER2012来创建数据库,数据库名称为db_jxcmanager,创建完成后的效果如图三。

3 SQL SERVER2012窗口

3.2创建数据表

在已经创建好的数据库jxc_manager中创建了13个数据表,其具体内容

如下所示:(包含在sqlserver中所建表的截图)

(1) 客户信息表(tb_khinfo)

企业进销存管理系统将记录所有的客户信息,在销售、退货等操作时,将 直接引用该客户的实体属性。客户信息包括客户编号、客户名称、简称、地址、电话、邮政编码、联系人、联系人电话、传真、开户行和账号,表结构如表4-1所示。

表4-1 tb_khinfo表结构

字段名称 id khname jian address bianma tel fax 类型 varchar(50) varchar(50) varchar(50) varchar(100) varchar(50) varchar(50) varchar(50) 说明 客户编号,主键 客户姓名 简称 地址 邮政编码 电话 传真 lian ltel yinhang zhanghao varchar(50) varchar(50) varchar(60) varchar(60) 联系人 联系人电话 开户银行 账号 数据库中所建的表:客户信息表(tb_khinfo)

(2) 供应商信息表(tb_gysinfo)

不同的供应商可以为企业提供不同的商品,在商品信息中将引用商品供商的实体属性。供应商信息包括编号、名称、简称、地址、电话、邮政编码、传真、联系人、联系电话、开户银行和E-mail地址,表结构如表4-2所示。

表4-2 tb_gysinfo表结构

字段名 id name jc address bianma tel fax lian ltel yh mail 类型 varchar(20) varchar(60) varchar(50) varchar(100) varchar(50) varchar(50) varchar(50) varchar(50) varchar(50) varchar(50) varchar(50) 说明 供应商编号,主键 供应商名称 简称 地址 邮政编码 联系电话 传真 联系人 联系人电话 开户银行 E-mail地址 数据库中所建的表:供应商信息表(tb_gysinfo)

(3) 商品信息表(tb_spinfo)

商品信息是进销存管理系统中的核心信息,系统将维护商品的进货、退货、销售、库存等操作。商品信息包括商品编号、名称、产地、单位、规格、包装、批号、批准文号、简称和供应商,表结构如表4-3所示。 表4-3 tb_spinfo表结构

字段名 id spname 类型 varchar(50) varchar(50) 说明 商品编号,主键 商品名称 简称 产地 单位 规格 包装 批号 批准文号 简称 供应商 jc varchar(50) cd dw gg bz ph pzwh memo gysname varchar(60) varchar(50) varchar(50) varchar(50) varchar(50) varchar(50) varchar(90) varchar(100) 数据库中所建的表:商品信息表(tb_spinfo)

(4) 库存信息表(tb_kucun)

库存商品信息包括商品编号、名称、商品简称、产地、规格、包装、单位、单价和库存数量,表结构如表4-4所示

表4-4 db_kucun表结构

字段名 id spname jc 类型 varchar(30) varchar(50) varchar(50) 说明 商品编号,主键 商品名称 简称 cd dw gg bz dj kcsl varchar(60) varchar(50) varchar(50) varchar(50) money int 产地 单位 规格 包装 单价 库存数量 数据库中所建的表:库存信息表(tb_kucun)

(5) 进货详细表(tb_ruku_detail)

进货详细表包括编号、进货票号、商品编号、单价、进货数量,表结构如表4-5所示

表4-5 tb_ruku_detail表结构

字段名 id kcID spid 类型 int varchar(30) varchar(50) 说明 编号,主键,自增 进货票号,外键 商品编号,外键,参考tb_spinfo中的id dj sl money int 单价 进货数量 数据库中所建的表:进货详细表(tb_ruku_detail)

(6) 进货主表(tb_ruku_main)

进货主要信息包括进货票号、进货总金额、验收结论、供应商名称、进货时间、经手人、操作员、结算方式,表结构如表4-6所示。 表4-6 tb_ruku_main表结构

字段名 rkID je ysjl gysname rkdate czy jsr jsfs 类型 varchar(30) money varchar(50) varchar(100) varchar(50) varchar(30) varchar(30) varchar(10) 说明 进货票号,主键 进货总价 验收结论 供应商名称 进货时间 操作员 经手人 结算方式 数据库中所建的表:库存信息表(tb_ruku_main)

(7) 用户表(tb_userlist)

用户可以分为两种权限,即操作员和管理员权限。用户信息包括用户姓名、用户名、密码和权限,表结构如表4-7所示。 表4-7 tb_userlist表结构

字段名 name username pass quan 类型 varchar(50) varchar(50) varchar(50) varchar(2) 说明 用户姓名 用户名,主键 密码 权限,c表示操作员,a表示管理员

数据库中所建的表:库存信息表(tb_userlist)

进货退货详细表(tb_rkth_detail)、销售详细表(tb_sell_detail)、销售退货详细表(tb_xsth_detail)与 进货详细表(tb_ruku_detail)字段相似,进货退货主表(tb_rkth_main)、销售主表(tb_sell_main)、销售退货主表(tb_xsth_main)与进货主表(tb_ruku_main)字段相似,不一一详细列出具体看生成的sql语句查看

3.3 数据库关系图

说明:tb_rkth_detail,tb_sell_detail,tb_xsth_detail,tb_ruku_detail四张表的spid都是参考tb_spinfo里的主键id来进行外键约束的,来保证商品信息表里的商品在销售入库中均能出现。tb_rkth_detail,tb_sell_detail等的详细表里票号rkthID,sellID等是参考tb_rkth_main,tb_sell_main里的主键rkthID,sellID来进行外间约束的。

3.4 数据库使用到的视图

在数据库设计过程中,考虑到后面的查询需要进行关联几张表。因此建立了几个视图选择相关联的三张表将其进行内连接并选出需要输出的信息,这样在后面进行前台查询时使得检索速度提升也可较为方便地显示出所需要的信息。

四 主程序设计 4.1 登录界面

图4-1 登录界面

登录默认用户名为admin,密码为admin。

4.2 主窗体效果

图4-2 主窗体效果图

主窗体界面是系统的欢迎界面,该窗体采用导航面板综合了系统菜单和工具栏的优点,使得界面更加美观,操作也更加地便捷。清晰地呈现了进销存系统所有的功能便于用户的使用。效果如图4-2所示。

4.3 各模块功能效果

基础信息管理

图4-3 基础信息管理

选取基础信息管理里的商品信息管理为例来进行说明,通过较为方便的文本编辑框来实现。用户将信息在编辑框内修改完成后直接点击按钮便实现相应的功能,操作方便快捷。客户信息管理和供应商管理的界面与此例似。

进货管理

进货管理主要包括进货单和进货退货两个部分。现以进货退货功能为例。

进货退货功能主要负责记录进货管理中的退货信息,界面效果如上图所示。在选择了退货的商品之后,单击【退货】按钮,将在表格中的商品退货信息更新到数

据库中,从而使库存的商品数量减少。入库退货程序界面如图4-4所示

销售管理

图4-5 销售单界面

销售管理主要包括销售单和销售退货两个部分。现以销售单功能为例。销售单功能主要负责记录企业的商品销售信息,可以单击【添加】按钮,在商品表中添加销售的商品信息。在供应商下拉列表框中选择对应的客户,将会改变商品表中的商品记录。销售单程序界面如图4-5所示。

查询统计

图4-6 模糊查询

图 4-7 显示全部数据

企业进销存管理系统中的查询统计模块包括客户查询、商品查询、供应商查询销售查询、销售退货查询、入库查询、入库退货查询功能。 客户查询功能主要用于查询系统中的客户信息,其查询方式可以分为客户全程匹配查询和模糊查询。程序界面如图4-6和图4-7所示。其中销售查询因为用到多表查询因此将多表进行内连接建立视图视图如数据库设计中的视图所示。

库存管理

图4-8 价格调整界面

企业进销存管理系统中的库存管理模块包括库存盘点和价格调整两个

功能,由于库存盘点是将查询库存中的所有数据并显示在商品表格中,主要以价格调整进行说明。

价格调整的主要用于调整库存中的单价,当用户选择了指定的商品,价格调整功能的界面将会显示该商品在库存中的单价、库存数量、库存金额、单位、产地等信息。程序界面如图4-8所示。用户可以修改商品单价并单击【确定】按钮,调整该商品的单价信息。

系统管理

图4-9 更新密码界面

用户以管理员身份登录时,才可以对系统管理模块进行操作。企业进

销存管理系统中的系统管理模块包括操作员管理、更新密码和权限管理3个部分,其中操作员管理包括添加操作员和删除操作员,由于这两种操作实现较为简单,重点说明更改密码和权限管理。

在进销存管理系统中,管理员可以修改自己的密码,但不可以修改操作员的密码。程序界面如图4-9所示。

图4-10 权限管理界面

企业进销存管理系统中的用户分为两种权限:操作员和管理员,其中,

管理员身份的用户在用户表中的权限标识为a,操作员身份的用户在用户表中权限标识为c。在权限管理界面中,当用户选择下拉列表框中的用户时,该用户的详细信息将会填充界面中对应的文本框。用户可以选择该用户的权限,从而修改该用户权限。程序及界面如图4-10所示。

五、测试运行

(1)登录程序界面如下图5-1所示,程序默认用户名和密码分别为admin和admin。点击登录后程序连接入后台数据库进行用户名和密码校验成功后进入主界面。

图5-1 登录界面

(2)调试运行发现客户新成功添加入数据库。调试结果如上图5-2所示。供应商和商品信息管理与客户操作调试结果类似就不一一展示。

图5-2 用户添加界面

(3)调试运行发现正确将商品的入库信息添加入数据库。调试结果如

图5-3所示。

图5-3 商品入库管理(进货单信息)

(4)调试运行发现正确将商品的入库商品的退货信息正确添加入数据库。调试结果如图5-4所示。销售管理调试与进货管理调试结果类似。

图5-4 商品入库退货管理

(5)模糊查询调试结果如下图5-5所示,与数据库索保存的信息一致。

图5-5 供应商信息模糊查询

(6)调试发现商品的价格正确进行了调整(从1000调至1050)并正确更新

到了数据库。调试结果如图5-6所示。

图5-6 商品价格调整

(7)调试发现系统管理中的更改密码正确实现,并更新至数据库中。调试结果图5-7所示。

图5-7 系统管理之密码更改

六、心得体会

经过课堂上的学习,掌握不少关于数据库方面的知识,但是理论理解好了

并不能说明自己已经掌握好了这门学科,还需要进行实践练习才能真正掌握。虽然先前进行过一些实验,但只是熟悉了DBMS软件的简单使用还不是很熟练地理解一些方法和概念。

而课程设计正好给我提供一个难能可贵机会去巩固课堂知识并去结合入实践去进行练习。经过这次课设是自己对课堂上一些不是很理解的概念逐渐明白并掌握,这次课设自己使用的前台开发语言是java Swing和jdbc。通过课设使自己掌握掌握了一些原来Java课堂上没有学到的方法并加以灵活应用。最重要的一点是:通过课设是自己逐步建立其解决问题的基本步骤和解决方案这对以后的工作学习都有很大的帮助。完成一个较为完善的工程需要自己一步一个脚印去逐步完成不可能一蹴而就,而且语言这个东西得勤加练习才能熟练。

七、参考文献

1.《数据库系统概念》(机械工业出版社第六版)。 2.《 Java核心技术I》(机械工业出版社第九版). 3.《java编程从基础到应用》(清华大学出版社) 4. 《java变相对象程序设计》(清华大学出版社第二版) 5.《java编程思想》(机械工业出版社第四版)

附录1:部分java核心代码

1、登录界面java核心代码

package com.lzw.login;

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent;

import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.WindowConstants;

import com.lzw.JXCFrame; import com.lzw.dao.Dao; import com.lzw.model.TbUserlist;

public class Login extends JFrame{

private JLabel userLabel; private JLabel passLabel; private JButton exit; private JButton login; private static TbUserlist user; public Login(){

setTitle(\"登录企业进销存管理系统!\"); final JPanel panel=new LoginPanel(); panel.setLayout(null); getContentPane().add(panel);

setBounds(300,200,panel.getWidth(),panel.getHeight()); userLabel = new JLabel(); userLabel.setText(\"用户名:\"); userLabel.setBounds(100, 135, 200, 18); panel.add(userLabel);

final JTextField userName=new JTextField(); userName.setText(\"admin\"); //默认用户名 userName.setBounds(150, 135, 200, 18); panel.add(userName);

passLabel=new JLabel(); passLabel.setText(\"密码:\");

passLabel.setBounds(100, 165, 200, 18); panel.add(passLabel);

final JPasswordField userPassword=new JPasswordField(); userPassword.addKeyListener(new KeyAdapter(){ });

userPassword.setBounds(150, 165, 200, 18); panel.add(userPassword);

userPassword.setText(\"admin\"); //默认的密码 login=new JButton();

login.addActionListener(new ActionListener(){ });

login.setText(\"登录\");

login.setBounds(180, 195, 60, 18); panel.add(login); exit=new JButton();

exit.addActionListener(new ActionListener(){ });

exit.setText(\"退出\");

exit.setBounds(260,195,60,18); panel.add(exit); setVisible(true);

setResizable(false); //设置窗体不可以自由改变大小

setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); //setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

public void actionPerformed(final ActionEvent e){ }

System.exit(0);

public void actionPerformed(final ActionEvent e){ }

user=Dao.getUser(userName.getText(),userPassword.getText()); if(user.getUsername()==null || user.getName()==null){ }

setVisible(false); new JXCFrame();

userName.setText(null); userPassword.setText(null); return;

public void KeyPressed(final KeyEvent e){ }

if(e.getKeyCode() == 10)

login.doClick();

}

}

public static TbUserlist getUser(){ }

public static void setUser(TbUserlist user){ }

Login.user=user; return user;

2、主界面java核心代码

public class JXCFrame {

private JPanel sysManagePanel; private JDesktopPane desktopPane; private JFrame frame; private JLabel backLabel; // 创建窗体的Map类型集合对象

private Map ifs = new HashMap(); public JXCFrame() { }

public static void main(String[] args) { }

private JTabbedPane createNavigationPanel() { // 创建导航标签面板的方法

SwingUtilities.invokeLater(new Runnable() { });

public void run() { }

new Login();

frame = new JFrame(\"企业进销存管理系统\");

frame.getContentPane().setBackground(new Color(170, 188, 120)); frame.addComponentListener(new FrameListener()); frame.getContentPane().setLayout(new BorderLayout()); frame.setBounds(100, 100, 800, 600);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); backLabel = new JLabel();// 背景标签

backLabel.setVerticalAlignment(SwingConstants.TOP); backLabel.setHorizontalAlignment(SwingConstants.CENTER); updateBackImage(); // 更新或初始化背景图片 desktopPane = new JDesktopPane();

desktopPane.add(backLabel, new Integer(Integer.MIN_VALUE)); frame.getContentPane().add(desktopPane);

JTabbedPane navigationPanel = createNavigationPanel(); // 创建导航标签面板 frame.getContentPane().add(navigationPanel, BorderLayout.NORTH); frame.setVisible(true);

JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setFocusable(false);

tabbedPane.setBackground(new Color(211, 230, 192));

tabbedPane.setBorder(new BevelBorder(BevelBorder.RAISED)); JPanel baseManagePanel = new JPanel(); // 基础信息管理面板 baseManagePanel.setBackground(new Color(215, 223, 194)); baseManagePanel.setLayout(new BoxLayout(baseManagePanel,

BoxLayout.X_AXIS));

baseManagePanel.add(createFrameButton(\"客户信息管理\baseManagePanel.add(createFrameButton(\"商品信息管理\baseManagePanel.add(createFrameButton(\"供应商信息管理\JPanel depotManagePanel = new JPanel(); // 库存管理面板 depotManagePanel.setBackground(new Color(215, 223, 194)); depotManagePanel.setLayout(new BoxLayout(depotManagePanel,

BoxLayout.X_AXIS));

depotManagePanel.add(createFrameButton(\"库存盘点\depotManagePanel.add(createFrameButton(\"价格调整\JPanel sellManagePanel = new JPanel();// 销售管理面板 sellManagePanel.setBackground(new Color(215, 223, 194)); sellManagePanel.setLayout(new BoxLayout(sellManagePanel,

BoxLayout.X_AXIS));

sellManagePanel.add(createFrameButton(\"销售单\sellManagePanel.add(createFrameButton(\"销售退货\JPanel searchStatisticPanel = new JPanel();// 查询统计面板 searchStatisticPanel.setBounds(0, 0, 600, 41); searchStatisticPanel.setName(\"searchStatisticPanel\");

searchStatisticPanel.setBackground(new Color(215, 223, 194)); searchStatisticPanel.setLayout(new BoxLayout(searchStatisticPanel,

BoxLayout.X_AXIS));

searchStatisticPanel.add(createFrameButton(\"客户信息查询\searchStatisticPanel.add(createFrameButton(\"商品信息查询\searchStatisticPanel.add(createFrameButton(\"供应商信息查询\

\"GongYingShangChaXun\"));

searchStatisticPanel.add(createFrameButton(\"销售信息查询\searchStatisticPanel.add(createFrameButton(\"销售退货查询\

\"XiaoShouTuiHuoChaXun\"));

searchStatisticPanel.add(createFrameButton(\"入库查询\searchStatisticPanel

.add(createFrameButton(\"入库退货查询\

//searchStatisticPanel.add(createFrameButton(\"销售排行\

}

/** *********************辅助方法************************* */ // 为内部窗体添加Action的方法

private JButton createFrameButton(String fName, String cname) {

String imgUrl = \"res/ActionIcon/\" + fName + \".png\"; String imgUrl_roll = \"res/ActionIcon/\" + fName Icon icon = new ImageIcon(imgUrl); Icon icon_roll = null; if (imgUrl_roll != null)

icon_roll = new ImageIcon(imgUrl_roll); Icon icon_down = null; if (imgUrl_down != null)

icon_down = new ImageIcon(imgUrl_down);

Action action = new openFrameAction(fName, cname, icon); JButton button = new JButton(action); button.setMargin(new Insets(0, 0, 0, 0)); button.setHideActionText(true); button.setFocusPainted(false); button.setBorderPainted(false);

+ \"_roll.png\";

String imgUrl_down = \"res/ActionIcon/\" + fName + \"_down.png\"; return tabbedPane;

tabbedPane.addTab(\" 基础信息管理 \基础信息管理\"); tabbedPane.addTab(\" 进货管理 \进货管理\"); tabbedPane.addTab(\" 销售管理 \销售管理\"); tabbedPane.addTab(\" 查询统计 \查询统计\"); tabbedPane.addTab(\" 库存管理 \库存管理\"); tabbedPane.addTab(\" 系统管理 \系统管理\");

sysManagePanel = new JPanel();// 系统管理面板 sysManagePanel.setBackground(new Color(215, 223, 194)); sysManagePanel

.setLayout(new BoxLayout(sysManagePanel, BoxLayout.X_AXIS));

sysManagePanel.add(createFrameButton(\"用户管理\sysManagePanel.add(createFrameButton(\"更改密码\sysManagePanel.add(createFrameButton(\"权限管理\

JPanel stockManagePanel = new JPanel();// 进货管理面板 stockManagePanel.setBackground(new Color(215, 223, 194)); stockManagePanel.setLayout(new BoxLayout(stockManagePanel,

BoxLayout.X_AXIS));

stockManagePanel.add(createFrameButton(\"进货单\stockManagePanel.add(createFrameButton(\"进货退货\

}

button.setContentAreaFilled(false); if (icon_roll != null)

button.setRolloverIcon(icon_roll); button.setPressedIcon(icon_down); if (icon_down != null) return button;

// 获取内部窗体的唯一实例对象

private JInternalFrame getIFrame(String frameName) { }

// 更新背景图片的方法 private void updateBackImage() { }

// 窗体监听器

private final class FrameListener extends ComponentAdapter { }

// 主窗体菜单项的单击事件监听器

public void componentResized(final ComponentEvent e) { }

updateBackImage(); if (backLabel != null) { }

int backw = JXCFrame.this.frame.getWidth(); int backh = frame.getHeight(); backLabel.setSize(backw, backh);

backLabel.setText(\"+ JXCFrame.this.getClass().getResource(\"welcome.jpg\") + \"'>\");

JInternalFrame jf = null;

if (!ifs.containsKey(frameName)) {

try { }

jf = ifs.get(frameName);

Class fClass = Class.forName(\"com.lzw.internalFrame.\" + frameName); Constructor constructor = fClass.getConstructor(null); jf = (JInternalFrame) constructor.newInstance(null); ifs.put(frameName, jf); e.printStackTrace();

} catch (Exception e) {

} else return jf;

}

protected final class openFrameAction extends AbstractAction { } static { }

try { }

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); e.printStackTrace(); } catch (Exception e) {

private String frameName = null; private openFrameAction() { }

public openFrameAction(String cname, String frameName, Icon icon) { }

public void actionPerformed(final ActionEvent e) { }

JInternalFrame jf = getIFrame(frameName);

// 在内部窗体闭关时,从内部窗体容器ifs对象中清除该窗体。 jf.addInternalFrameListener(new InternalFrameAdapter() { });

if (jf.getDesktopPane() == null) { } try { }

jf.setSelected(true); e1.printStackTrace();

} catch (PropertyVetoException e1) {

desktopPane.add(jf); jf.setVisible(true);

public void internalFrameClosed(InternalFrameEvent e) { }

ifs.remove(frameName);

this.frameName = frameName; putValue(Action.NAME, cname);

putValue(Action.SHORT_DESCRIPTION, cname); putValue(Action.SMALL_ICON, icon);

3、数据库连接部分java核心代码

package com.lzw.dao;

import java.sql.Connection; import java.sql.Date;

import java.sql.DriverManager;

import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set;

import com.lzw.internalFrame.guanli.Item; import com.lzw.model.TbGysinfo; import com.lzw.model.TbKhinfo; import com.lzw.model.TbKucun; import com.lzw.model.TbRkthDetail; import com.lzw.model.TbRkthMain; import com.lzw.model.TbRukuDetail; import com.lzw.model.TbRukuMain; import com.lzw.model.TbSellDetail; import com.lzw.model.TbSellMain; import com.lzw.model.TbSpinfo; import com.lzw.model.TbUserlist; import com.lzw.model.TbXsthDetail; import com.lzw.model.TbXsthMain;

public class Dao {

protected static String dbClassName = \"com.microsoft.sqlserver.jdbc.SQLServerDriver\"; protected

static

String

dbUrl

\"jdbc:sqlserver://localhost:1433;DatabaseName=db_jxcmanager;SelectMethod=Cursor\"; protected static String dbUser = \"sa\";

protected static String dbPwd = \"sk18829042034\"; protected static String second = null; public static Connection conn = null; static { try { if (conn == null) { Class.forName(dbClassName).newInstance();

conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);

}

} catch (Exception ee) {

ee.printStackTrace();

}

} private Dao() {

} =

// 读取所有客户信息 public static List getKhInfos() { }

// 读取所有供应商信息 public static List getGysInfos() { }

// 读取客户信息

public static TbKhinfo getKhInfo(Item item) { }

// 读取指定供应商信息

public static TbGysinfo getGysInfo(Item item) {

String where = \"name='\" + item.getName() + \"'\"; if (item.getId() != null)

where = \"id='\" + item.getId() + \"'\"; TbGysinfo info = new TbGysinfo();

ResultSet set = findForResultSet(\"select * from tb_gysinfo where \" String where = \"khname='\" + item.getName() + \"'\"; if (item.getId() != null)

where = \"id='\" + item.getId() + \"'\"; TbKhinfo info = new TbKhinfo();

ResultSet set = findForResultSet(\"select * from tb_khinfo where \" try { }

return info;

if (set.next()) { }

e.printStackTrace();

info.setId(set.getString(\"id\").trim());

info.setKhname(set.getString(\"khname\").trim()); info.setJian(set.getString(\"jian\").trim()); info.setAddress(set.getString(\"address\").trim()); info.setBianma(set.getString(\"bianma\").trim()); info.setFax(set.getString(\"fax\").trim()); info.setHao(set.getString(\"zhanghao\").trim()); info.setLian(set.getString(\"lianxiren\").trim()); info.setLtel(set.getString(\"ltel\").trim()); info.setTel(set.getString(\"tel\").trim());

info.setYinhang(set.getString(\"yinhang\").trim());

+ where);

List list = findForList(\"select id,name from tb_gysinfo order by name asc\"); return list;

List list = findForList(\"select id,khname from tb_khinfo\"); return list;

} catch (SQLException e) {

}

try { }

+ where);

if (set.next()) { }

e.printStackTrace();

info.setId(set.getString(\"id\").trim());

info.setAddress(set.getString(\"address\").trim()); info.setBianma(set.getString(\"bianma\").trim()); info.setFax(set.getString(\"fax\").trim()); info.setJc(set.getString(\"jc\").trim()); info.setLian(set.getString(\"lianxiren\").trim()); info.setLtel(set.getString(\"ltel\").trim()); info.setName(set.getString(\"name\").trim()); info.setTel(set.getString(\"tel\").trim()); info.setMail(set.getString(\"mail\").trim()); info.setYh(set.getString(\"yh\").trim());

} catch (SQLException e) {

return info;

// 读取用户

public static TbUserlist getUser(String name, String password) { }

// 执行指定查询

public static ResultSet query(String QueryStr) { }

ResultSet set = findForResultSet(QueryStr); return set;

TbUserlist user = new TbUserlist();

ResultSet rs = findForResultSet(\"select * from tb_userlist where username='\" try { }

return user;

if (rs.next()) { }

e.printStackTrace();

user.setUsername(name); user.setPass(rs.getString(\"pass\")); if (user.getPass().equals(password)) { }

user.setName(rs.getString(\"name\")); user.setQuan(rs.getString(\"quan\"));

+ name + \"'\");

} catch (SQLException e) {

// 执行删除

public static int delete(String sql) { }

// 添加客户信息的方法

public static boolean addKeHu(TbKhinfo khinfo) { }

// 修改客户信息的方法

public static int updateKeHu(TbKhinfo khinfo) { }

// 修改库存的方法

public static int updateKucunDj(TbKucun kcInfo) { }

// 修改供应商信息的方法

public static int updateGys(TbGysinfo gysInfo) { }

// 添加供应商信息的方法

public static boolean addGys(TbGysinfo gysInfo) {

if (gysInfo == null)

return false;

return insert(\"insert tb_gysinfo values('\" + gysInfo.getId() + \"','\" return update(\"update tb_gysinfo set jc='\" + gysInfo.getJc()

+ \"',address='\" + gysInfo.getAddress() + \"',bianma='\" + gysInfo.getBianma() + \"',tel='\" + gysInfo.getTel() + \"',fax='\" + gysInfo.getFax() + \"',lian='\" + gysInfo.getLian() + \"',ltel='\" + gysInfo.getLtel() + \"',mail='\" + gysInfo.getMail() + \"',yh='\" + gysInfo.getYh() + \"' where id='\" + gysInfo.getId() + \"'\");

return update(\"update tb_kucun set dj=\" + kcInfo.getDj()

+ \" where id='\" + kcInfo.getId() + \"'\");

return update(\"update tb_khinfo set jian='\" + khinfo.getJian()

+ \"',address='\" + khinfo.getAddress() + \"',bianma='\" + khinfo.getBianma() + \"',tel='\" + khinfo.getTel() + \"',fax='\" + khinfo.getFax() + \"',lian='\" + khinfo.getLian() + \"',ltel='\"

+ khinfo.getLtel() + \"',mail='\"+ \"',yinhang='\" + khinfo.getYinhang() + \"',hao='\" + khinfo.getHao() + \"' where id='\" + khinfo.getId() + \"')\");

if (khinfo == null)

return false;

+ khinfo.getKhname() + \"','\" + khinfo.getJian() + \"','\" + khinfo.getAddress() + \"','\" + khinfo.getBianma() + \"','\" + khinfo.getTel() + \"','\" + khinfo.getFax() + \"','\" + khinfo.getLian() + \"','\" + khinfo.getLtel() + \"','\" + khinfo.getYinhang() + \"','\"+ khinfo.getHao() + \"')\");

return insert(\"insert tb_khinfo values('\" + khinfo.getId() + \"','\" return update(sql);

}

+ gysInfo.getName() + \"','\" + gysInfo.getJc() + \"','\" + gysInfo.getAddress() + \"','\" + gysInfo.getBianma() + \"','\" + gysInfo.getTel() + \"','\" + gysInfo.getFax() + \"','\" + gysInfo.getLian() + \"','\" + gysInfo.getLtel() + \"','\" + gysInfo.getYh() + \"','\" + gysInfo.getMail() + \"')\");

// 添加商品

public static boolean addSp(TbSpinfo spInfo) { }

// 更新商品

public static int updateSp(TbSpinfo spInfo) { }

// 读取商品信息

public static TbSpinfo getSpInfo(Item item) {

String where = \"spname='\" + item.getName() + \"'\"; if (item.getId() != null) try {

if (rs.next()) {

spInfo.setId(rs.getString(\"id\").trim()); spInfo.setBz(rs.getString(\"bz\").trim()); spInfo.setCd(rs.getString(\"cd\").trim()); spInfo.setDw(rs.getString(\"dw\").trim()); spInfo.setGg(rs.getString(\"gg\").trim());

spInfo.setGysname(rs.getString(\"gysname\").trim()); spInfo.setJc(rs.getString(\"jc\").trim());

//spInfo.setMemo(rs.getString(\"memo\").trim()); where = \"id='\" + item.getId() + \"'\";

+ where);

ResultSet rs = findForResultSet(\"select * from tb_spinfo where \" TbSpinfo spInfo = new TbSpinfo();

return update(\"update tb_spinfo set jc='\" + spInfo.getJc() + \"',cd='\"

+ spInfo.getCd() + \"',dw='\" + spInfo.getDw() + \"',gg='\" + spInfo.getGg() + \"',bz='\" + spInfo.getBz() + \"',ph='\" + spInfo.getPh() + \"',pzwh='\" + spInfo.getPzwh() + \"',memo='\" + spInfo.getMemo() + \"',gysname='\" + spInfo.getGysname() + \"' where id='\" + spInfo.getId() + \"'\");

if (spInfo == null)

return false;

+ spInfo.getSpname() + \"','\" + spInfo.getJc() + \"','\" + spInfo.getCd() + \"','\" + spInfo.getDw() + \"','\" + spInfo.getGg() + \"','\" + spInfo.getBz() + \"','\" + spInfo.getPh() + \"','\" + spInfo.getPzwh() + \"','\" + spInfo.getMemo() + \"','\" + spInfo.getGysname() + \"')\");

return insert(\"insert tb_spinfo values('\" + spInfo.getId() + \"','\"

}

}

}

spInfo.setPh(rs.getString(\"ph\").trim()); spInfo.setPzwh(rs.getString(\"pzwh\").trim()); spInfo.setSpname(rs.getString(\"spname\").trim());

} catch (SQLException e) {

e.printStackTrace();

return spInfo;

// 获取所有商品信息 public static List getSpInfos() { }

// 获取库存商品信息

public static TbKucun getKucun(Item item) { }

// 获取入库单的最大ID,即最大入库票号 public static String getRuKuMainMaxId(Date date) { }

// 在事务中添加入库信息

public static boolean insertRukuInfo(TbRukuMain ruMain) {

return getMainTypeTableMaxId(date, \"tb_ruku_main\String where = \"spname='\" + item.getName() + \"'\"; if (item.getId() != null)

where = \"id='\" + item.getId() + \"'\";

ResultSet rs = findForResultSet(\"select * from tb_kucun where \" + where); TbKucun kucun = new TbKucun(); try { }

return kucun;

if (rs.next()) { }

e.printStackTrace();

kucun.setId(rs.getString(\"id\"));

kucun.setSpname(rs.getString(\"spname\")); kucun.setJc(rs.getString(\"jc\")); kucun.setBz(rs.getString(\"bz\")); kucun.setCd(rs.getString(\"cd\")); kucun.setDj(rs.getFloat(\"dj\")); kucun.setDw(rs.getString(\"dw\")); kucun.setGg(rs.getString(\"gg\")); kucun.setKcsl(rs.getInt(\"kcsl\"));

List list = findForList(\"select * from tb_spinfo\"); return list;

} catch (SQLException e) {

boolean flag=false; try {

boolean autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); // 添加入库主表记录

insert(\"insert into tb_ruku_main values('\" + ruMain.getRkId()

+ \"','\" + ruMain.getPzs() + \"',\" + ruMain.getJe() + \+ ruMain.getYsjl() + \"','\" + ruMain.getGysname() + \"','\" + ruMain.getRkdate() + \"','\" + ruMain.getCzy() + \"','\" + ruMain.getJsr() + \"','\" + ruMain.getJsfs() + \"')\");

Set rkDetails = ruMain.getTabRukuDetails(); for (Iterator iter = rkDetails.iterator(); iter }

conn.commit();

conn.setAutoCommit(autoCommit); flag=true;

.hasNext();) {

TbRukuDetail details = iter.next(); // 添加入库详细表记录

insert(\"insert into tb_ruku_detail values('\" + ruMain.getRkId()

+ \"','\" + details.getTabSpinfo() + \"',\" + details.getDj() + \

// 添加或修改库存表记录 Item item = new Item();

item.setId(details.getTabSpinfo()); TbSpinfo spInfo = getSpInfo(item);

if (spInfo.getId() != null && !spInfo.getId().isEmpty()) { }

TbKucun kucun = getKucun(item);

if (kucun.getId() == null || kucun.getId().isEmpty()) { }

insert(\"insert into tb_kucun values('\" + spInfo.getId()

+ \"','\" + spInfo.getSpname() + \"','\" + spInfo.getJc() + \"','\" + spInfo.getCd() + \"','\" + spInfo.getGg() + \"','\"

+ spInfo.getBz() + \"','\" + spInfo.getDw() + \"',\" + details.getDj() + \+ details.getSl() + \")\");

} else {

int sl = kucun.getKcsl() + details.getSl(); update(\"update tb_kucun set kcsl=\" + sl + \

+ details.getDj() + \" where id='\" + kucun.getId() + \"'\");

} catch (SQLException e) {

}

}

try { }

e.printStackTrace();

conn.rollback(); e1.printStackTrace(); } catch (SQLException e1) {

return flag;

public static ResultSet findForResultSet(String sql) { }

public static boolean insert(String sql) { }

public static int update(String sql) {

int result = 0; try { }

Statement stmt = conn.createStatement(); result = stmt.executeUpdate(sql); e.printStackTrace(); boolean result = false; try { }

return result;

Statement stmt = conn.createStatement(); result = stmt.execute(sql); e.printStackTrace(); if (conn == null)

return null;

long time = System.currentTimeMillis(); ResultSet rs = null; try { } return rs;

Statement stmt = null;

stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,

ResultSet.CONCUR_READ_ONLY);

rs = stmt.executeQuery(sql);

second = ((System.currentTimeMillis() - time) / 1000d) + \"\"; e.printStackTrace();

} catch (Exception e) {

} catch (SQLException e) {

} catch (SQLException e) {

}

return result;

public static List findForList(String sql) { }

// 获取退货最大ID

public static String getRkthMainMaxId(Date date) { }

// 在事务中添加入库退货信息

public static boolean insertRkthInfo(TbRkthMain rkthMain) {

boolean flag=false; try {

boolean autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); // 添加入库退货主表记录

insert(\"insert into tb_rkth_main values('\" + rkthMain.getRkthId()

+ \"','\" + rkthMain.getPzs() + \"',\" + rkthMain.getJe() + \+ \"','\" + rkthMain.getRtdate() + \"','\" + rkthMain.getCzy() + \"','\" + rkthMain.getJsr() + \"','\" + rkthMain.getJsfs() + \"')\");

return getMainTypeTableMaxId(date, \"tb_rkth_main\List list = new ArrayList(); ResultSet rs = findForResultSet(sql); try { } return list;

ResultSetMetaData metaData = rs.getMetaData(); int colCount = metaData.getColumnCount(); while (rs.next()) { }

e.printStackTrace();

List row = new ArrayList(); for (int i = 1; i <= colCount; i++) { }

list.add(row);

String str = rs.getString(i); if (str != null && !str.isEmpty())

str = str.trim(); row.add(str);

} catch (Exception e) {

Set rkDetails = rkthMain.getTbRkthDetails(); for (Iterator iter = rkDetails.iterator(); iter

.hasNext();) {

TbRkthDetail details = iter.next();

}

}

}

// 添加入库详细表记录

insert(\"insert into tb_rkth_detail values('\"

+ rkthMain.getRkthId() + \"','\" + details.getSpid() + \"',\" + details.getDj() + \

// 添加或修改库存表记录 Item item = new Item(); item.setId(details.getSpid()); TbSpinfo spInfo = getSpInfo(item);

if (spInfo.getId() != null && !spInfo.getId().isEmpty()) { }

TbKucun kucun = getKucun(item);

if (kucun.getId() != null && !kucun.getId().isEmpty()) { }

int sl = kucun.getKcsl() - details.getSl();

update(\"update tb_kucun set kcsl=\" + sl + \" where id='\"

+ kucun.getId() + \"'\");

conn.commit();

conn.setAutoCommit(autoCommit); flag=true;

e.printStackTrace(); flag=false;

} catch (SQLException e) {

return flag;

// 获取销售主表最大ID

public static String getSellMainMaxId(Date date) { }

// 在事务中添加销售信息

public static boolean insertSellInfo(TbSellMain sellMain) {

boolean flag=false; try {

boolean autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); // 添加销售主表记录

insert(\"insert into tb_sell_main values('\" + sellMain.getSellId()

+ \"','\" + sellMain.getPzs() + \"',\" + sellMain.getJe() + \+ \"','\" + sellMain.getXsdate() + \"','\" + sellMain.getCzy() + \"','\" + sellMain.getJsr() + \"','\" + sellMain.getJsfs() + \"')\");

return getMainTypeTableMaxId(date, \"tb_sell_main\

Set rkDetails = sellMain.getTbSellDetails();

}

}

for (Iterator iter = rkDetails.iterator(); iter }

conn.commit();

conn.setAutoCommit(autoCommit); flag=true;

e.printStackTrace(); flag=false;

.hasNext();) {

TbSellDetail details = iter.next(); // 添加销售详细表记录

insert(\"insert into tb_sell_detail values('\"

+ sellMain.getSellId() + \"','\" + details.getSpid() + \"',\" + details.getDj() + \

// 修改库存表记录 Item item = new Item(); item.setId(details.getSpid()); TbSpinfo spInfo = getSpInfo(item);

if (spInfo.getId() != null && !spInfo.getId().isEmpty()) { }

TbKucun kucun = getKucun(item);

if (kucun.getId() != null && !kucun.getId().isEmpty()) { }

int sl = kucun.getKcsl() - details.getSl();

update(\"update tb_kucun set kcsl=\" + sl + \" where id='\"

+ kucun.getId() + \"'\");

} catch (SQLException e) {

return flag;

// 获取更类主表最大ID

private static String getMainTypeTableMaxId(Date date, String table,

String idChar, String idName) { String dateStr = date.toString().replace(\"-\String id = idChar + dateStr;

String sql = \"select max(\" + idName + \") from \" + table + \" where \"

+ idName + \" like '\" + id + \"%'\";

ResultSet set = query(sql); String baseId = null; try { }

if (set.next())

baseId = set.getString(1);

} catch (SQLException e) {

e.printStackTrace();

}

baseId = baseId == null ? \"000\" : baseId.substring(baseId.length() - 3); int idNum = Integer.parseInt(baseId) + 1; id += String.format(\"%03d\return id;

public static String getXsthMainMaxId(Date date) { }

public static List getKucunInfos() { }

// 在事务中添加销售退货信息

public static boolean insertXsthInfo(TbXsthMain xsthMain) {

boolean flag=false; try {

boolean autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); // 添加销售退货主表记录

insert(\"insert into tb_xsth_main values('\" + xsthMain.getXsthId()

+ \"','\" + xsthMain.getPzs() + \"',\" + xsthMain.getJe() + \+ \"','\" + xsthMain.getThdate() + \"','\" + xsthMain.getCzy() + \"','\" + xsthMain.getJsr() + \"','\" + xsthMain.getJsfs() + \"')\");

List list = findForList(\"select id,spname,dj,kcsl from tb_kucun\"); return list;

return getMainTypeTableMaxId(date, \"tb_xsth_main\

Set xsthDetails = xsthMain.getTbXsthDetails(); for (Iterator iter = xsthDetails.iterator(); iter

.hasNext();) {

TbXsthDetail details = iter.next(); // 添加销售退货详细表记录

insert(\"insert into tb_xsth_detail values('\"

+ xsthMain.getXsthId() + \"','\" + details.getSpid() + \"',\" + details.getDj() + \

// 修改库存表记录 Item item = new Item(); item.setId(details.getSpid()); TbSpinfo spInfo = getSpInfo(item);

if (spInfo.getId() != null && !spInfo.getId().isEmpty()) {

TbKucun kucun = getKucun(item);

if (kucun.getId() != null && !kucun.getId().isEmpty()) { }

int sl = kucun.getKcsl() + details.getSl();

update(\"update tb_kucun set kcsl=\" + sl + \" where id='\"

+ kucun.getId() + \"'\");

}

}

}

}

flag=true; conn.commit();

conn.setAutoCommit(autoCommit); flag=false; e.printStackTrace();

} catch (SQLException e) {

return flag;

// 添加用户

public static int addUser(TbUserlist ul) { }

public static List getUsers() { }

// 修改用户方法

public static int updateUser(TbUserlist user) { }

// 获取用户对象的方法

public static TbUserlist getUser(Item item) {

String where = \"username='\" + item.getName() + \"'\"; if (item.getId() != null) try {

if (rs.next()) { }

user.setName(rs.getString(\"name\").trim()); user.setUsername(rs.getString(\"username\").trim()); user.setPass(rs.getString(\"pass\").trim()); user.setQuan(rs.getString(\"quan\").trim()); where = \"name='\" + item.getId() + \"'\";

+ where);

ResultSet rs = findForResultSet(\"select * from tb_userlist where \" TbUserlist user = new TbUserlist();

return update(\"update tb_userlist set username='\" + user.getUsername()

+ \"',name='\" + user.getName() + \"',pass='\" + user.getPass() + \"',quan='\" + user.getQuan() + \"' where name='\" + user.getName() + \"'\");

List list = findForList(\"select * from tb_userlist\"); return list;

return update(\"insert tb_userlist values('\" + ul.getUsername() + \"','\"

+ ul.getName() + \"','\" + ul.getPass() + \"','\" + ul.getQuan() + \"')\");

} catch (SQLException e) {

}

}

}

e.printStackTrace();

return user;

附录2:数据库设计相关代码

数据库文件 数据库名称:db_jxcmanager

USE [master] GO

/****** Object: Database [db_jxcmanager] Script Date: 2016-01-04 0:28:19 ******/ CREATE DATABASE [db_jxcmanager] CONTAINMENT = NONE ON PRIMARY (

NAME

=

N'db_jxcmanager',

FILENAME

=

N'C:\\Program

Files\\Microsoft

SQL

Server\\MSSQL11.MSSQLSERVER\\MSSQL\\DATA\\db_jxcmanager.mdf' , SIZE = 10240KB , MAXSIZE = UNLIMITED, FILEGROWTH = 2048KB ) LOG ON (

NAME

=

N'db_jxcmanager_log',

FILENAME

=

N'C:\\Program

Files\\Microsoft

SQL

Server\\MSSQL11.MSSQLSERVER\\MSSQL\\DATA\\db_jxcmanager_log.ldf' , SIZE = 5120KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO

ALTER DATABASE [db_jxcmanager] SET COMPATIBILITY_LEVEL = 110 GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin

EXEC [db_jxcmanager].[dbo].[sp_fulltext_database] @action = 'enable' end GO

ALTER DATABASE [db_jxcmanager] SET ANSI_NULL_DEFAULT OFF GO

ALTER DATABASE [db_jxcmanager] SET ANSI_NULLS OFF GO

ALTER DATABASE [db_jxcmanager] SET ANSI_PADDING OFF GO

ALTER DATABASE [db_jxcmanager] SET ANSI_WARNINGS OFF GO

ALTER DATABASE [db_jxcmanager] SET ARITHABORT OFF GO

ALTER DATABASE [db_jxcmanager] SET AUTO_CLOSE OFF GO

ALTER DATABASE [db_jxcmanager] SET AUTO_CREATE_STATISTICS ON

GO

ALTER DATABASE [db_jxcmanager] SET AUTO_SHRINK OFF GO

ALTER DATABASE [db_jxcmanager] SET AUTO_UPDATE_STATISTICS ON GO

ALTER DATABASE [db_jxcmanager] SET CURSOR_CLOSE_ON_COMMIT OFF GO

ALTER DATABASE [db_jxcmanager] SET CURSOR_DEFAULT GLOBAL GO

ALTER DATABASE [db_jxcmanager] SET CONCAT_NULL_YIELDS_NULL OFF GO

ALTER DATABASE [db_jxcmanager] SET NUMERIC_ROUNDABORT OFF GO

ALTER DATABASE [db_jxcmanager] SET QUOTED_IDENTIFIER OFF GO

ALTER DATABASE [db_jxcmanager] SET RECURSIVE_TRIGGERS OFF GO

ALTER DATABASE [db_jxcmanager] SET DISABLE_BROKER GO

ALTER DATABASE [db_jxcmanager] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO

ALTER DATABASE [db_jxcmanager] SET DATE_CORRELATION_OPTIMIZATION OFF GO

ALTER DATABASE [db_jxcmanager] SET TRUSTWORTHY OFF GO

ALTER DATABASE [db_jxcmanager] SET ALLOW_SNAPSHOT_ISOLATION OFF GO

ALTER DATABASE [db_jxcmanager] SET PARAMETERIZATION SIMPLE GO

ALTER DATABASE [db_jxcmanager] SET READ_COMMITTED_SNAPSHOT OFF GO

ALTER DATABASE [db_jxcmanager] SET HONOR_BROKER_PRIORITY OFF GO

ALTER DATABASE [db_jxcmanager] SET RECOVERY FULL GO

ALTER DATABASE [db_jxcmanager] SET MULTI_USER GO

ALTER DATABASE [db_jxcmanager] SET PAGE_VERIFY CHECKSUM GO

ALTER DATABASE [db_jxcmanager] SET DB_CHAINING OFF GO

ALTER DATABASE [db_jxcmanager] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) GO

ALTER DATABASE [db_jxcmanager] SET TARGET_RECOVERY_TIME = 0 SECONDS

GO

USE [db_jxcmanager] GO

/****** Object: User [sunkang] Script Date: 2016-01-04 0:28:20 ******/ CREATE USER [sunkang] FOR LOGIN [sunkang] WITH DEFAULT_SCHEMA=[dbo] GO

/****** Object: Table [dbo].[tb_gysinfo] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_gysinfo]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_khinfo] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_khinfo](

[id] [varchar](50) NOT NULL, [id] [varchar](20) NOT NULL, [name] [varchar](60) NULL, [jc] [varchar](50) NULL, [address] [varchar](100) NULL, [bianma] [varchar](50) NULL, [tel] [varchar](50) NULL, [fax] [varchar](50) NULL, [lianxiren] [varchar](50) NULL, [ltel] [varchar](50) NULL, [yh] [varchar](50) NULL, [mail] [varchar](50) NULL,

CONSTRAINT [PK_tb_gysinfo] PRIMARY KEY CLUSTERED

(

[khname] [varchar](50) NULL, [jian] [varchar](50) NULL, [address] [varchar](100) NULL, [bianma] [varchar](50) NULL, [tel] [varchar](50) NULL, [fax] [varchar](50) NULL, [lianxiren] [varchar](50) NULL, [ltel] [varchar](50) NULL, [yinhang] [varchar](60) NULL, [zhanghao] [varchar](60) NULL,

CONSTRAINT [PK_tb_khinfo] PRIMARY KEY CLUSTERED

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_kucun] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_kucun]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]

[id] [varchar](50) NOT NULL, [spname] [varchar](50) NOT NULL, [jc] [varchar](50) NULL, [cd] [varchar](60) NULL, [dw] [varchar](50) NULL, [gg] [varchar](50) NULL, [bz] [varchar](50) NULL, [dj] [float] NULL, [kcsl] [int] NULL,

CONSTRAINT [PK_tb_kucun] PRIMARY KEY CLUSTERED

GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_rkth_detail] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_rkth_detail]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_rkth_main] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_rkth_main](

[rkthID] [varchar](30) NOT NULL, [pzs] [int] NOT NULL, [je] [money] NOT NULL, [ysjl] [varchar](50) NULL,

[gysname] [varchar](50) NOT NULL, [rtdate] [datetime] NOT NULL, [czy] [varchar](30) NOT NULL, [jsr] [varchar](30) NOT NULL, [jsfs] [varchar](10) NOT NULL, [id] [int] IDENTITY(1,1) NOT NULL, [rkthID] [varchar](30) NOT NULL, [spid] [varchar](50) NOT NULL, [dj] [float] NOT NULL, [sl] [int] NOT NULL,

CONSTRAINT [PK_tb_rkth_detail] PRIMARY KEY CLUSTERED

CONSTRAINT [PK_tb_rkth_main] PRIMARY KEY CLUSTERED

(

[rkthID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_ruku_detail] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_ruku_detail]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_ruku_main] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_ruku_main](

[rkID] [varchar](30) NOT NULL, [pzs] [int] NOT NULL, [je] [money] NOT NULL, [ysjl] [varchar](50) NOT NULL, [id] [int] IDENTITY(1,1) NOT NULL, [rkID] [varchar](30) NOT NULL, [spid] [varchar](50) NOT NULL, [dj] [float] NOT NULL, [sl] [int] NOT NULL,

CONSTRAINT [PK_tb_ruku_detail] PRIMARY KEY CLUSTERED

(

[gysname] [varchar](100) NOT NULL, [rkdate] [datetime] NOT NULL, [czy] [varchar](30) NOT NULL, [jsr] [varchar](30) NOT NULL, [jsfs] [varchar](10) NOT NULL,

CONSTRAINT [PK_tb_ruku_main] PRIMARY KEY CLUSTERED

[rkID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_sell_detail] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_sell_detail]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_sell_main] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON

[id] [int] IDENTITY(1,1) NOT NULL, [sellID] [varchar](30) NOT NULL, [spid] [varchar](50) NOT NULL, [dj] [float] NOT NULL, [sl] [int] NOT NULL,

CONSTRAINT [PK_tb_sell_detail] PRIMARY KEY CLUSTERED

GO

CREATE TABLE [dbo].[tb_sell_main]( (

[sellID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_spinfo] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_spinfo]( (

[id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,

[id] [varchar](50) NOT NULL, [spname] [varchar](50) NOT NULL, [jc] [varchar](50) NULL, [cd] [varchar](60) NULL, [dw] [varchar](50) NOT NULL, [gg] [varchar](50) NOT NULL, [bz] [varchar](50) NULL, [ph] [varchar](50) NULL, [pzwh] [varchar](50) NULL, [memo] [varchar](90) NULL, [gysname] [varchar](100) NULL, [sellID] [varchar](30) NOT NULL, [pzs] [int] NOT NULL, [je] [money] NOT NULL, [ysjl] [varchar](50) NOT NULL, [khname] [varchar](100) NOT NULL, [xsdate] [datetime] NOT NULL, [czy] [varchar](30) NOT NULL, [jsr] [varchar](30) NOT NULL, [jsfs] [varchar](30) NOT NULL,

CONSTRAINT [PK_tb_sell_main] PRIMARY KEY CLUSTERED

CONSTRAINT [PK_tb_spinfo] PRIMARY KEY CLUSTERED

ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_userlist] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_userlist]( (

[username] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_xsth_detail] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_xsth_detail]( (

[id] ASC

[id] [int] IDENTITY(1,1) NOT NULL, [xsthID] [varchar](30) NOT NULL, [spid] [varchar](50) NOT NULL, [dj] [float] NOT NULL, [sl] [int] NOT NULL,

[name] [varchar](50) NOT NULL, [username] [varchar](50) NOT NULL, [pass] [varchar](50) NOT NULL, [quan] [varchar](2) NOT NULL,

CONSTRAINT [PK_tb_userlist] PRIMARY KEY CLUSTERED

CONSTRAINT [PK_tb_xsth_detail] PRIMARY KEY CLUSTERED

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: Table [dbo].[tb_xsth_main] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

SET ANSI_PADDING ON GO

CREATE TABLE [dbo].[tb_xsth_main]( (

[xsthID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO

SET ANSI_PADDING OFF GO

/****** Object: View [dbo].[v_rkthView] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

CREATE VIEW [dbo].[v_rkthView] AS

SELECT dbo.tb_rkth_main.rkthID AS Expr1, dbo.tb_rkth_detail.spid, dbo.tb_spinfo.spname, dbo.tb_spinfo.gg,

dbo.tb_rkth_detail.dj,

dbo.tb_rkth_detail.sl,

dbo.tb_rkth_main.je,

[xsthID] [varchar](30) NOT NULL, [pzs] [int] NOT NULL, [je] [money] NOT NULL, [ysjl] [varchar](50) NULL,

[khname] [varchar](100) NOT NULL, [thdate] [datetime] NOT NULL, [czy] [varchar](30) NOT NULL, [jsr] [varchar](30) NOT NULL, [jsfs] [varchar](10) NOT NULL,

CONSTRAINT [PK_tb_xsth_main] PRIMARY KEY CLUSTERED

dbo.tb_rkth_main.gysname, dbo.tb_rkth_main.rtdate,

dbo.tb_rkth_main.czy, dbo.tb_rkth_main.jsr, dbo.tb_rkth_main.jsfs FROM dbo.tb_rkth_main INNER JOIN

dbo.tb_rkth_detail ON dbo.tb_rkth_main.rkthID = dbo.tb_rkth_detail.rkthID INNER JOIN

dbo.tb_spinfo ON dbo.tb_rkth_detail.spid = dbo.tb_spinfo.id GO

/****** Object: View [dbo].[v_rukuView] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

CREATE VIEW [dbo].[v_rukuView] AS

SELECT dbo.tb_ruku_main.rkID, dbo.tb_ruku_detail.spid, dbo.tb_spinfo.spname, dbo.tb_spinfo.gg, dbo.tb_ruku_detail.dj,

dbo.tb_ruku_detail.sl, dbo.tb_ruku_main.rkdate,

dbo.tb_ruku_main.czy, dbo.tb_ruku_main.jsr, dbo.tb_ruku_main.jsfs FROM dbo.tb_ruku_main INNER JOIN

dbo.tb_ruku_detail ON dbo.tb_ruku_main.rkID = dbo.tb_ruku_detail.rkID INNER JOIN dbo.tb_spinfo ON dbo.tb_ruku_detail.spid = dbo.tb_spinfo.id GO

/****** Object: View [dbo].[v_sellView] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO

CREATE VIEW [dbo].[v_sellView] AS

SELECT dbo.tb_sell_main.sellID, dbo.tb_sell_detail.spid, dbo.tb_spinfo.spname, dbo.tb_spinfo.gg, dbo.tb_sell_detail.dj,

dbo.tb_sell_detail.sl, dbo.tb_sell_main.xsdate, dbo.tb_sell_main.czy,

dbo.tb_sell_main.jsr, dbo.tb_sell_main.jsfs FROM dbo.tb_sell_detail INNER JOIN

dbo.tb_sell_main ON dbo.tb_sell_detail.sellID = dbo.tb_sell_main.sellID INNER JOIN dbo.tb_spinfo ON dbo.tb_sell_detail.spid = dbo.tb_spinfo.id GO

/****** Object: View [dbo].[v_xsthView] Script Date: 2016-01-04 0:28:21 ******/ SET ANSI_NULLS ON

dbo.tb_sell_main.je,

dbo.tb_sell_main.khname,

dbo.tb_ruku_main.je,

dbo.tb_ruku_main.gysname,

GO

SET QUOTED_IDENTIFIER ON GO

CREATE VIEW [dbo].[v_xsthView] AS

SELECT dbo.tb_xsth_main.xsthID, dbo.tb_xsth_detail.spid, dbo.tb_spinfo.spname, dbo.tb_spinfo.gg, dbo.tb_xsth_detail.dj,

dbo.tb_xsth_detail.sl, dbo.tb_xsth_main.thdate, dbo.tb_xsth_main.czy,

dbo.tb_xsth_main.jsr, dbo.tb_xsth_main.jsfs FROM dbo.tb_xsth_main INNER JOIN

dbo.tb_xsth_detail ON dbo.tb_xsth_main.xsthID = dbo.tb_xsth_detail.xsthID INNER JOIN

dbo.tb_spinfo ON dbo.tb_xsth_detail.spid = dbo.tb_spinfo.id GO

ALTER TABLE [dbo].[tb_kucun] WITH CHECK ADD CONSTRAINT [FK_tb_kucun_tb_spinfo] FOREIGN KEY([id])

REFERENCES [dbo].[tb_spinfo] ([id]) GO

ALTER TABLE [dbo].[tb_kucun] CHECK CONSTRAINT [FK_tb_kucun_tb_spinfo] GO ALTER

TABLE

[dbo].[tb_rkth_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_rkth_detail_tb_rkth_detail] FOREIGN KEY([rkthID]) REFERENCES [dbo].[tb_rkth_main] ([rkthID]) GO

ALTER TABLE [dbo].[tb_rkth_detail] CHECK CONSTRAINT [FK_tb_rkth_detail_tb_rkth_detail] GO ALTER

TABLE

[dbo].[tb_rkth_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_rkth_detail_tb_spinfo] FOREIGN KEY([spid]) REFERENCES [dbo].[tb_spinfo] ([id]) GO

ALTER TABLE [dbo].[tb_rkth_detail] CHECK CONSTRAINT [FK_tb_rkth_detail_tb_spinfo] GO ALTER

TABLE

[dbo].[tb_ruku_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_ruku_detail_tb_ruku_main1] FOREIGN KEY([rkID]) REFERENCES [dbo].[tb_ruku_main] ([rkID]) GO

ALTER TABLE [dbo].[tb_ruku_detail] CHECK CONSTRAINT [FK_tb_ruku_detail_tb_ruku_main1] GO ALTER

TABLE

[dbo].[tb_ruku_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_ruku_detail_tb_spinfo] FOREIGN KEY([spid]) REFERENCES [dbo].[tb_spinfo] ([id]) ON UPDATE CASCADE

dbo.tb_xsth_main.je,

dbo.tb_xsth_main.khname,

ON DELETE CASCADE GO

ALTER TABLE [dbo].[tb_ruku_detail] CHECK CONSTRAINT [FK_tb_ruku_detail_tb_spinfo] GO ALTER

TABLE

[dbo].[tb_sell_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_sell_detail_tb_sell_main] FOREIGN KEY([sellID]) REFERENCES [dbo].[tb_sell_main] ([sellID]) ON UPDATE CASCADE ON DELETE CASCADE GO

ALTER TABLE [dbo].[tb_sell_detail] CHECK CONSTRAINT [FK_tb_sell_detail_tb_sell_main] GO ALTER

TABLE

[dbo].[tb_sell_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_sell_detail_tb_spinfo] FOREIGN KEY([spid]) REFERENCES [dbo].[tb_spinfo] ([id]) GO

ALTER TABLE [dbo].[tb_sell_detail] CHECK CONSTRAINT [FK_tb_sell_detail_tb_spinfo] GO ALTER

TABLE

[dbo].[tb_xsth_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_xsth_detail_tb_spinfo] FOREIGN KEY([spid]) REFERENCES [dbo].[tb_spinfo] ([id]) GO

ALTER TABLE [dbo].[tb_xsth_detail] CHECK CONSTRAINT [FK_tb_xsth_detail_tb_spinfo] GO ALTER

TABLE

[dbo].[tb_xsth_detail]

WITH

CHECK

ADD

CONSTRAINT

[FK_tb_xsth_detail_tb_xsth_main] FOREIGN KEY([xsthID]) REFERENCES [dbo].[tb_xsth_main] ([xsthID]) ON UPDATE CASCADE ON DELETE CASCADE GO

ALTER TABLE [dbo].[tb_xsth_detail] CHECK CONSTRAINT [FK_tb_xsth_detail_tb_xsth_main] GO EXEC

Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4

Configuration = \"(H (1[41] 4[30] 2[11] 3) )\" End

Begin PaneConfiguration = 1 NumPanes = 3

Configuration = \"(H (1 [50] 4 [25] 3))\" End

sys.sp_addextendedproperty

@name=N'MS_DiagramPane1',

@value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]

Begin PaneConfiguration = 2 NumPanes = 3

Configuration = \"(H (1 [50] 2 [25] 3))\" End

Begin PaneConfiguration = 3 NumPanes = 3

Configuration = \"(H (4 [30] 2 [40] 3))\" End

Begin PaneConfiguration = 4 NumPanes = 2

Configuration = \"(H (1 [56] 3))\" End

Begin PaneConfiguration = 5 NumPanes = 2

Configuration = \"(H (2 [66] 3))\" End

Begin PaneConfiguration = 6 NumPanes = 2

Configuration = \"(H (4 [50] 3))\" End

Begin PaneConfiguration = 7 NumPanes = 1

Configuration = \"(V (3))\" End

Begin PaneConfiguration = 8 NumPanes = 3

Configuration = \"(H (1[56] 4[18] 2) )\" End

Begin PaneConfiguration = 9 NumPanes = 2

Configuration = \"(H (1 [75] 4))\" End

Begin PaneConfiguration = 10 NumPanes = 2

Configuration = \"(H (1[66] 2) )\" End

Begin PaneConfiguration = 11 NumPanes = 2

Configuration = \"(H (4 [60] 2))\" End

Begin PaneConfiguration = 12 NumPanes = 1

Configuration = \"(H (1) )\" End

Begin PaneConfiguration = 13 NumPanes = 1

Configuration = \"(V (4))\" End

Begin PaneConfiguration = 14 NumPanes = 1

Configuration = \"(V (2))\" End

ActivePaneConfig = 0 End

Begin DiagramPane = Begin Origin = Top = -192 Left = 0 End

Begin Tables =

Begin Table = \"tb_rkth_main\" Begin Extent = Top = 23 Left = 549 Bottom = 163 Right = 691 End

DisplayFlags = 280 TopColumn = 0 End

Begin Table = \"tb_rkth_detail\" Begin Extent = Top = 12 Left = 304 Bottom = 152 Right = 446 End

DisplayFlags = 280 TopColumn = 0 End

Begin Table = \"tb_spinfo\" Begin Extent = Top = 6 Left = 38 Bottom = 146 Right = 180 End

DisplayFlags = 280

TopColumn = 0 End End End

Begin SQLPane = End

Begin DataPane =

Begin ParameterDefaults = \"\" End End

Begin CriteriaPane = Begin ColumnWidths = 11 Column = 1440 Alias = 900 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410 GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End

' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_rkthView' GO EXEC GO EXEC

Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4

Configuration = \"(H (1[41] 4[34] 2[7] 3) )\" End

Begin PaneConfiguration = 1 NumPanes = 3

Configuration = \"(H (1 [50] 4 [25] 3))\"

sys.sp_addextendedproperty

@name=N'MS_DiagramPane1',

@value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]

sys.sp_addextendedproperty

@name=N'MS_DiagramPaneCount',

@value=1

,

@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_rkthView'

End

Begin PaneConfiguration = 2 NumPanes = 3

Configuration = \"(H (1 [50] 2 [25] 3))\" End

Begin PaneConfiguration = 3 NumPanes = 3

Configuration = \"(H (4 [30] 2 [40] 3))\" End

Begin PaneConfiguration = 4 NumPanes = 2

Configuration = \"(H (1 [56] 3))\" End

Begin PaneConfiguration = 5 NumPanes = 2

Configuration = \"(H (2 [66] 3))\" End

Begin PaneConfiguration = 6 NumPanes = 2

Configuration = \"(H (4 [50] 3))\" End

Begin PaneConfiguration = 7 NumPanes = 1

Configuration = \"(V (3))\" End

Begin PaneConfiguration = 8 NumPanes = 3

Configuration = \"(H (1[56] 4[18] 2) )\" End

Begin PaneConfiguration = 9 NumPanes = 2

Configuration = \"(H (1 [75] 4))\" End

Begin PaneConfiguration = 10 NumPanes = 2

Configuration = \"(H (1[66] 2) )\" End

Begin PaneConfiguration = 11 NumPanes = 2

Configuration = \"(H (4 [60] 2))\" End

Begin PaneConfiguration = 12 NumPanes = 1

Configuration = \"(H (1) )\"

End

Begin PaneConfiguration = 13 NumPanes = 1

Configuration = \"(V (4))\" End

Begin PaneConfiguration = 14 NumPanes = 1

Configuration = \"(V (2))\" End

ActivePaneConfig = 0 End

Begin DiagramPane = Begin Origin = Top = 0 Left = 0 End

Begin Tables =

Begin Table = \"tb_ruku_main\" Begin Extent = Top = 2 Left = 0 Bottom = 142 Right = 142 End

DisplayFlags = 280 TopColumn = 0 End

Begin Table = \"tb_ruku_detail\" Begin Extent = Top = 14 Left = 276 Bottom = 154 Right = 418 End

DisplayFlags = 280 TopColumn = 1 End

Begin Table = \"tb_spinfo\" Begin Extent = Top = 49 Left = 511 Bottom = 189 Right = 653 End

DisplayFlags = 280 TopColumn = 0 End End End

Begin SQLPane = End

Begin DataPane =

Begin ParameterDefaults = \"\" End

Begin ColumnWidths = 9 Width = 284 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 End End

Begin CriteriaPane = Begin ColumnWidths = 11 Column = 1440 Alias = 900 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410 GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End

' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_rukuView' GO EXEC

sys.sp_addextendedproperty

@name=N'MS_DiagramPaneCount',

@value=1

,

@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_rukuView'

GO EXEC

Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4

Configuration = \"(H (1[41] 4[36] 2[5] 3) )\" End

Begin PaneConfiguration = 1 NumPanes = 3

Configuration = \"(H (1 [50] 4 [25] 3))\" End

Begin PaneConfiguration = 2 NumPanes = 3

Configuration = \"(H (1 [50] 2 [25] 3))\" End

Begin PaneConfiguration = 3 NumPanes = 3

Configuration = \"(H (4 [30] 2 [40] 3))\" End

Begin PaneConfiguration = 4 NumPanes = 2

Configuration = \"(H (1 [56] 3))\" End

Begin PaneConfiguration = 5 NumPanes = 2

Configuration = \"(H (2 [66] 3))\" End

Begin PaneConfiguration = 6 NumPanes = 2

Configuration = \"(H (4 [50] 3))\" End

Begin PaneConfiguration = 7 NumPanes = 1

Configuration = \"(V (3))\" End

Begin PaneConfiguration = 8 NumPanes = 3

Configuration = \"(H (1[56] 4[18] 2) )\" End

Begin PaneConfiguration = 9 NumPanes = 2

Configuration = \"(H (1 [75] 4))\"

sys.sp_addextendedproperty

@name=N'MS_DiagramPane1',

@value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]

End

Begin PaneConfiguration = 10 NumPanes = 2

Configuration = \"(H (1[66] 2) )\" End

Begin PaneConfiguration = 11 NumPanes = 2

Configuration = \"(H (4 [60] 2))\" End

Begin PaneConfiguration = 12 NumPanes = 1

Configuration = \"(H (1) )\" End

Begin PaneConfiguration = 13 NumPanes = 1

Configuration = \"(V (4))\" End

Begin PaneConfiguration = 14 NumPanes = 1

Configuration = \"(V (2))\" End

ActivePaneConfig = 0 End

Begin DiagramPane = Begin Origin = Top = 0 Left = 0 End

Begin Tables =

Begin Table = \"tb_sell_detail\" Begin Extent = Top = 13 Left = 306 Bottom = 153 Right = 448 End

DisplayFlags = 280 TopColumn = 1 End

Begin Table = \"tb_sell_main\" Begin Extent = Top = 23 Left = 567 Bottom = 163

Right = 709 End

DisplayFlags = 280 TopColumn = 5 End

Begin Table = \"tb_spinfo\" Begin Extent = Top = 26 Left = 73 Bottom = 166 Right = 215 End

DisplayFlags = 280 TopColumn = 0 End End End

Begin SQLPane = End

Begin DataPane =

Begin ParameterDefaults = \"\" End

Begin ColumnWidths = 9 Width = 284 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 End End

Begin CriteriaPane = Begin ColumnWidths = 11 Column = 1440 Alias = 900 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410

GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End

' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_sellView' GO EXEC GO EXEC

Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4

Configuration = \"(H (1[41] 4[32] 2[9] 3) )\" End

Begin PaneConfiguration = 1 NumPanes = 3

Configuration = \"(H (1 [50] 4 [25] 3))\" End

Begin PaneConfiguration = 2 NumPanes = 3

Configuration = \"(H (1 [50] 2 [25] 3))\" End

Begin PaneConfiguration = 3 NumPanes = 3

Configuration = \"(H (4 [30] 2 [40] 3))\" End

Begin PaneConfiguration = 4 NumPanes = 2

Configuration = \"(H (1 [56] 3))\" End

Begin PaneConfiguration = 5 NumPanes = 2

Configuration = \"(H (2 [66] 3))\" End

Begin PaneConfiguration = 6 NumPanes = 2

Configuration = \"(H (4 [50] 3))\"

sys.sp_addextendedproperty

@name=N'MS_DiagramPane1',

@value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]

sys.sp_addextendedproperty

@name=N'MS_DiagramPaneCount',

@value=1

,

@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_sellView'

End

Begin PaneConfiguration = 7 NumPanes = 1

Configuration = \"(V (3))\" End

Begin PaneConfiguration = 8 NumPanes = 3

Configuration = \"(H (1[56] 4[18] 2) )\" End

Begin PaneConfiguration = 9 NumPanes = 2

Configuration = \"(H (1 [75] 4))\" End

Begin PaneConfiguration = 10 NumPanes = 2

Configuration = \"(H (1[66] 2) )\" End

Begin PaneConfiguration = 11 NumPanes = 2

Configuration = \"(H (4 [60] 2))\" End

Begin PaneConfiguration = 12 NumPanes = 1

Configuration = \"(H (1) )\" End

Begin PaneConfiguration = 13 NumPanes = 1

Configuration = \"(V (4))\" End

Begin PaneConfiguration = 14 NumPanes = 1

Configuration = \"(V (2))\" End

ActivePaneConfig = 0 End

Begin DiagramPane = Begin Origin = Top = 0 Left = 0 End

Begin Tables =

Begin Table = \"tb_xsth_main\" Begin Extent = Top = 6

Left = 38 Bottom = 146 Right = 180 End

DisplayFlags = 280 TopColumn = 0 End

Begin Table = \"tb_xsth_detail\" Begin Extent = Top = 10 Left = 256 Bottom = 150 Right = 398 End

DisplayFlags = 280 TopColumn = 1 End

Begin Table = \"tb_spinfo\" Begin Extent = Top = 14 Left = 488 Bottom = 154 Right = 630 End

DisplayFlags = 280 TopColumn = 0 End End End

Begin SQLPane = End

Begin DataPane =

Begin ParameterDefaults = \"\" End

Begin ColumnWidths = 9 Width = 284 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500

End End

Begin CriteriaPane = Begin ColumnWidths = 11 Column = 1440 Alias = 900 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410 GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End

' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_xsthView' GO EXEC GO

USE [master] GO

ALTER DATABASE [db_jxcmanager] SET READ_WRITE GO

sys.sp_addextendedproperty

@name=N'MS_DiagramPaneCount',

@value=1

,

@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_xsthView'

因篇幅问题不能全部显示,请点此查看更多更全内容