进销存管理系统
WANG Anbao1*, XUJie2
School of Computer and Information, Shanghai Second Polytechnic University, Shanghai 201209, China
1wabhappy@163.com; 2xujiesspu@sina.com
Abstract: With the rapid development of network technology, the Web applications are used more widely,
and the higher requirements on the Web system has been pursued by many people. The web applications
should become more simple and convenient; also it requires some new internal adjustments in the Enterprise.
The techniques of struts2, spring and the Hibernate are used in this paper, and these three kinds of lightweight
frames are very popular at present, also the Ajax technology is introduced in our work to implement the de-
velopment. According to the practical demands of the Back-state management of the B2C Shopping Mall and
Inventory management system, this two systems are integrated, and these three framework technologies and
Ajax technique are integrated which can in accordance with J2EE three-tier structure as well, finally the
framework for Ajax+SSH (Struts+Spring+Hibernate) is realized.
Keywords: Struts2; Spring; Hibernate; Ajax; Back-state management; Inventory management system
1 Introduction
With the impulse of advancement for network tech-
nique and the rapid development of electronic commerce,
online shopping has become the latest consumptive mode
for consumers, particular for our younger generations
who are more accept new concept and tend to pay more
attention to it.
In consequence, more and more businessmen establish
online malls and make this novel shopping concept ac-
cepted by consumers.
However, as for these online malls evolved from tradi-
tional malls, there are some redundant, even conflict is-
sues existed in online and offline data management and its
process. Especially, it is quite important for the adjust-
ments between the former purchase-sell-stock manage-
ment system and the latter Back-state management of the
online shops, which has higher requirements for the out-
put of the enterprise workload, the integrity and timeli-
ness of the data.
In the past, the client/server architectures are adopted
by the purchase-sell-stock management information sys-
tem, which divides application into two parts. One is the
server which is responsible for data management, and the
other one is the Client which engages in the interaction
with manager. A1s we known, the client/server architec-
ture is has reflected the superiority, the Inventory man-
agement system's upgrade also has been put on the agenda.
The improved model and the Back-state management of
1 * corresponding author
online mall are very similar, and this will give us oppor-
tunities on the integration or mutual expansion between
them. The purpose of this paper is to design an online
store Back-state management system with the Inventory
management system in order to reduce unnecessary data's
duplication for input and output and ensure time-
consistency between the two systems described above.
2 Related techniques
The purpose of this paper is to construct online mall in-
ventory management integrated system using the concept
of purchase-sell-stock management system.
The current three open-source frameworks and Ajax
technique are used in our research. Struts serves as a
MVC pattern of framework, which separates business
logic and data performance effectively, optimizes the sys-
tem structure, and improves the system extensibility as
well. Spring is a lightweight J2EE application framework,
and it reduces coupling degree between systems effective-
ly through the reverse control characteristic. Hibernate is
an open-source persistence layer framework, and it reduc-
es the complexity of database development and improve
the portability of the system with the use of JDBC pack-
age. Finally, Ajax combines several technologies, it pro-
motes the user experience through asynchronous refresh
and optimizes data transfer between the browser and the
web server, more importantly, and it also efficiently re-
duces the unnecessary data round trip and bandwidth con-
sumption.
These three frameworks and Ajax technology are inte-
grated in accordance with J2EE three-tier structure, it
forms the framework of Ajax + SSH (Struts + Spring +
Hibernate) and the framework is used in the development
of online mall back-stage management system. Spring is
responsible for the work of business logic layer, which
implements the application system with the business logic
for the transaction and other functions. The presentation
layer can be implemented in the technique of Struts, such
as page displaying, responding to users’ requests etc. The
mainly task of Hibernate is in the data persistence layer,
such as completes the interactive function with database.
In addition, we will use technology of Ajax to optimize
the JSP page in the framework, and with the helping of
the local refresh technology to manage the objects in one
page, so as to avoid the frequent jump between more pag-
es and make the system run more smoothly.
3 The Integration between Struts and Spring
Techniques
There are various methods to integrate Struts and
Spring, three of them are very popular, which are Spring’s
ActionSupport, Spring's DelegatingRequestProcessor and
Action's full authority Agency used in Struts. The last one
is considered the best of the three.
The Struts’ Action can be entrusted to the Spring
framework so as to decouple the code, therefore the
struts’ application can take advantage of the features used
in Spring. Moreover, once Spring controls the Struts Ac-
tion, it can be used to add more vitality to the Struts Ac-
tion. The control of the procedure is as follows: Firstly,
registered plug-in of the Spring in the struts-config.xml
file. Then, set
the action as
org.springframework.web.struts.DelegatingActionProxy,
the action is delegated to the Spring. Finally, a path
attribute of the action tag corresponding to a bean are
configured in configuration file applicationContext.xml of
Spring.
type attributes of
4 The Integration between Spring and Hi-
bernate
The file hibernate.cfg.xml is the most important confi-
guration file of Hibernate. The classes which need persis-
tency and some related global properties are defined in
this file, Spring does some encapsulation and interface
conversion to Hibernate through the class of LocalSes-
sionFactoryBean, in this way, and then we can use unified
method to deal with Spring and Hibernate. At the same
time, it also provides a global SessionFactory. In this pa-
per, we will adopt the methods of putting SessionFactory
into HibernateTemplate to make the integration between
Spring and Hibernate.
The key is that the basic resources which Hibernate
needs are provided and injected by Spring. Hibernate
creates the DataSource required by SessionFactory, the
Session which is necessary for executive persistence and
the affairs control which is essential for accessing to the
persistence layer access are also created by the Hibernate.
These logics which are controlled by the code originally
had to be controlled by Spring as a Spring bean container
now. Spring manages SessionFactory by applicationCon-
text.xml, and does configuration management of the con-
nection between the SessionFactory and the database by
using applicationContext.xml .
According to the description above, the structure of
Struts, Hibernate and Spring is displayed in Fig 1. The
frames are divided into three layers which are the Presen-
tation Layer (web layer), Business Layer and Persistence
Layer. Each frame is responsible for the realization of one
layer: The Presentation Layer uses Struts, Spring is used
in the Business Layer, and Hibernate is used in the Persis-
tence Layer. Each layer in the application has a clear re-
sponsibility, each application layer is independent, but it
keeps consistency with each other. These frame levels in a
loose coupling effect of each other and do not take the
low-level technical details into consideration.
Fig 1. The framework of Struts,Hibernate and Spring
The application of the technologies in Ajax
Due to the fact is subjected to HTML, the B/S applica-
tion cannot use abundant effects to display the data just
like the C/S application, any interaction operation with
the server are all required to refresh the page, this means
that it needs 2 to 5 seconds delay, which leads to poor
users' experience, however, introducing AJAX technique
in the web applications based on J2EE can well solve
these problems. In this mode, the data which was sent
directly to the user performance layer was change to re-
turn the available data to Ajax Engine. These data in-
cludes plaintext, xml and other formats, the only require-
ment is that Ajax engine can understand and parse the
data, the details is displayed in Fig 2.
Fig 2. The application model of the Ajax web
5 Analyses and Design
After researching the current disconnection between
the existing website backstage and purchase-sale-exist
management system, the following defects are discovered
as follows, Inefficiency, low speed of processing, data
transmit not in time, inaccurate, duplication of labor and
causing data inconsistencies and so on. The defects have
constrained the managers' creativity, and it is difficulty to
keep up with the changes of modernization market. How-
ever, through the integration of the applications between
the techniques of Ajax and SSH framework, we can com-
bine the characteristics of B2C online mall, make some
improvement in system design. The conception is de-
scribed as follows.
First, because the web mall's foreground and back-
ground has a very close relationship, there are some im-
portant modules in the mall’s foreground, which are web
news bulletin, the part of merchandise display, website
shopping module, web users’ module and website com-
modity comments module etc. The detailed modules are
described in Fig 3.
Fig 3. The detailed modules
As shown in Fig 3, these five parts are closely related
with the background, and will be reflected in the back-
ground one by one, they are news bulletin management,
merchandise management, sales management, member-
ship management and commodity comments management.
Among them, the shopping module and commodity dis-
play module are the most crucial parts of the purchase-
sell-stock management system, and also the relation is the
closest of all. It is difficult to integrate back-state man-
agement and purchase-sell-stock management system.
The following will focus on this part and introduce in
detail.
The relationship between back-state management and
purchase-sell-stock management system includes six parts.
Firstly, when the registered members complete the shop-
ping process, the data will enter into the sales manage-
ment module and order management module, and the best
sellers list is worked out. Secondly, after registered mem-
ber confirms the receiving information, then the data will
enter into the order management module and inventory
management module. Thirdly, after registered member
collect merchandise, then the data will enter into the sales
management module, and generate preference list. Then,
after registered member comments merchandise, then the
data will enter into the sales management module, the
management module analyses information and improves
commodity procurement and sales plan. Again, when
procurement department have new commodity, sales
management will put commodities on the shelf, and gen-
erate latest products. Finally, if some goods is in a large
inventory, after approval by related department, the sale
department generate Special sale list.
There are four parts in business models, which are pur-
chasing management, sales management, inventory man-
agement and financial management. The analyses of their
relationships are as follows.
There are three relationships between inventory man-
agement and sales management. Firstly, sales manage-
ment apply to put the goods on the shelves, compare sell-
ing quantity and inventory quantity, then according to the
difference value and the stock warning level to determine
further action. When the difference value is higher than
the stock warning level, execute sales outbound operation,
at the same time reduce warehouse inventory, at last sa-
lesmen put the commodities on the shelves; when the
difference value is lower than the stock warning level, by
implementing the above strategy and the purchasing in-
formation was sent to the purchasing department, and the
information content is drew up by the sales department
and inventory management departments together. Second-
ly, the sales department put the goods off shelves, off-the-
shelf products will be returned to the inventory depart-
ment, and they will do in-stockroom operation according
to the commodity attribute (such as period, product cate-
gory). Thirdly, the inventory department put forward out-
bound sales application to the sales department under a
certain conditions (such as near the validity or other out-
bound cordon).
There are three relationships between inventory man-
agement and purchasing management. Firstly, the inven-
tory department put forward purchasing application, the
purchasing department and the financial department ex-
ecutes procurement operation according to the order in-
formation. Secondly, the purchasing department issues
the purchase notice, and the inventory department ex-
ecutes commodity input operation. Thirdly, the inventory
department issues a return outbound notice and executes
goods delivery operation, and then purchasing department
will negotiate with suppliers.
There are two relationships between order management
and inventory management. Firstly, after the customer
complete the payment process, order department take
orders operation according to order information and the
follow-up logistics is carry on also, and then inventory
departments carry out goods delivery processing. Second-
ly, after the customer receives the goods, if problem ap-
pears and the sales department agrees to return, and then
the inventory management executes the handling of return
goods.
After the above analysis, simple purchase-sell-stock
management system was joined into online background
management system as an expansion, and a new website
backstage management system is created. The summary
of each module is displayed in Fig 4.
The following portions are the briefly extension to the
above, basic information module is mainly responsible for
data backup, recovery and browse the system log. The
main functions of the financial management are statistical
sales revenue, expenditure, the budget, profit distribution
and funds occupy, the treatment of providers paid, ac-
counts payable and the capital turnover control are also
done in this module. In addition, the financial statistics
about online sales, sales calculation within day, month
and season are also completed in this module. Sales man-
agement is an indispensable part of the daily operation,
which fully embodies the advantages of automation,
compatible with all the features of commodity manage-
ment.
There are also some module functions which are de-
scribed as follows, inquiries about the mall sales situation;
the statistical analysis about sales and gross profit, in-
quires the commodity quotes, and other special treatment
and discount, controlling on the sale of goods and printing
the form, the inquiry about the details of the sales, new
products on selves and old products off selves, and the
management of commodity price and other functions.
Inventory management is mainly responsible for in-
coming goods, inventories revision and query, carrying
out the inventory reports and so on. The functions of this
module are as follows, providing timely inventory goods
type, stock, quality, price, storage location and other in-
formation. According to the inventory loss, overflow and
inventory management, effectively reduce the inventory
loss, enhance the effective inventory, support receptionist
sales, and obtains reasonable merchandise ordering cycle
and quantity. Purchasing management can input, modify,
query and analyze in real time, and print a variety of doc-
uments according to purchase orders, indent and returned
purchase invoice. According to replenishment orders and
sales situation to draw up purchasing plan and cooperate
with order management department to finish distribution
management and return money management.
6 Conclusions
J2EE three-tier structure and the current popular web
application development framework are analyzed and
studied, Ajax + SSH (Struts + Spring + Hibernate)
framework is formed based on the techniques described
above, in this paper this Ajax + SSH (Struts + Spring +
Hibernate) framework is applied to B2C website back-
ground management, it has effectively changed the condi-
tion that client code is redundant, reduced the burden and
later maintenance on the client, and the difficulty about
expansion issues is resolved as well. In addition, it also
greatly enhances the efficiency of the staff and avoids the
cumbersome, messy and long cycle of In-out warehouse,
and it makes that the system can quickly respond to mar-
ket changes.
[1]
(America) Marty Hall, Larry Brown. Core Servlet and JavaServer
Pages: Volume 1: Core Technologies 2nd Edition
[M].
PEARSON Prentice Hall, 2004.
[2] LI Gang. the actual practice of Lightweight Java EE enterprise
application--Integration and development using Struts 2, Spring
and Hibernate [M]. BeiJing: Electronic industry press, 2007.
frame
[3] YANG Shaobo. J2EE Project
training-- Hibernate
technology [M]. BeiJing: Tsinghua university press, 2008.
[4] YUAN Shuai. The introduce of the business module in purchase-
sell-stock management system based on Java (in Chinese) [J].
China science and technology exhibition, 2008.8 .
[5] ZHAO Xiaoxia. Invoicing Management System Design and
Implementation (in Chinese) [J]. Coal Technology, 129(101), Jan,
2010.
[6] LIU Bin. Proficient in Java Web integration and development:
industry press,
JSP+AJAX+Strust+Hibernate[M]. Electronic
2007.11.
[7] SHA Shixuan, WANG Shan. An introduction to database system
(3rd Edition) [M]. Higher education press, 2000.
[8] KE Baicong. Ajax Development—conception, Case and the
framework [M]. Electronic industry press, 2006.5.
[9] LI Xiaojun. The design and implementation in Electronic
commerce system. BeiJing: Mechanical industry press, 2007.8.
[10] YANG Shulin, HU Jieping. The latest Java language practical
case tutorial. BeiJing: Tsinghua university press, 2006.
[11] Rob Harrop, Jon Machacek. Professional development
guidelines for Spring (Redsaga translation team translation).
BeiJing: Mechanical industry press, 2006.8.
[12] William Crawford, Jonathan Kaplan. J2EE Design Patterns[M].
[13] Bruce Eckel. Thinking in Java. 3rd Edition[M]. Prentice Hall,
o’Reilly. 2003.9 .
Inc, 2003.