First, project introduction
This project is a submodule of an ERP system in a mining industry, achieving management of its production scheduling.
Second, the overall demand of the production data analysis system
1. The user is divided into three levels (according to its organization structure) group company, the headquarters, factory mine.
Data of all levels of user analysis, factory mines, headquarters, and group companies are summarized.
2. Category of production data analysis: The total output of each level user, the total production of subcategory production.
3, the valve value of production data: year, month, day
4. The chart and analysis form that requires the generated: the output chart of each threshold, the histogram
5. Requirements according to the date of real-time mobile dynamics of the mouse, plan yield, actual production, and ultrarrend [department determined]
Third, resources and environmental conditions
Database server IBMP670, application server SUME650, application server Tomcat5 (debugging), WebSphere, Oracle9i
The data required by the analysis system has been generated by other systems.
Fourth, the operating mode of the production data analysis system
Java desktop program, JWS deployment, connect the database to the original database connection pool connection database
V. Imaginary
Note: In order to make full use of the original resources, the operation of the database is not performed separately, but use the Java client program to communicate with a servlet, and this servlet can take advantage of the original development of the database library.
6. Realization of JavaClient
System interface basic class
Import javax.swing. *; import java.awt. *; import java.awt.event. *;
public class BaseWindow extends JFrame implements MouseMotionListener {BaseWindow () {/ ** * increases mouse motion listener * / addMouseMotionListener (this); / ** * the form of a display screen member WINDOW mode * / String UIlaf = UIManager.getSystemLookAndFeelClassName () Try {UIManager.SetLookandFeel (UILAF);} catch (exception e) {system.out.println ("You cannot change the component display mode. Error:" E.getMessage ());} / ** * Settings If the user is forcing exit the system, operation of the system * / this.setDefaultCloseOperation (EXIT_ON_CLOSE); / ** * display mode setting for the system 16 or the like 800 * 600 * / GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment (); GraphicsDevice device = environment.getDefaultScreenDevice () ; DisplayMode displayMode = new DisplayMode (1024,768,32,75); / ** * set the system to full-screen mode * / this.setUndecorated (true); device.setFullScreenWindow (this); device.setDisplayMode (displayMode);} Public void mousedragged (mouseevent e) {mousemoved (e);} public void mousemoved (mouseevent e) { }} System main interface class
Import java.awt. *;
Import java.awt.event. *;
Import javax.swing. *;
Import java.util. *;
Import java.util.calendar;
Public class analyysismainwindow extends basewindow {
Public static void main (String [] args) {
AnalysisMainWindow AMW = new analysis;
AMW.RUN ();
}
/ ************************************************** ********************************************************
* The variables defined below are mainly to depict the system main interface.
*
*********************************************************** ***************************************************************** /
INT heighty;
Int widthx;
INT heighty1;
INT heighty2;
INT heighty3;
INT heighty4;
INT heighty5;
/ ************************************************** *************************************************system Recommended components
*********************************************************** ***************************************************************** /
Choice departments;
Choice fxlbgj;
Choice fxfzgj;
Textfield fxyeargj;
Label MousePositionX;
Label mousepositiony;
Label nowDate; // Display system now date
Label NOWTIME; / / Display System Time
Label username; // Show users name
Button EXITSYS; // Exit System
/ ************************************************** *********************************************************
* Event completion flag
*********************************************************** ***************************************************************** /
Boolean prepareParameterfinished = false;
Boolean DrawsysmaInframefinished = false;
Boolean getDatafinished = false;
String waitingflag = "is ready to extract data ...";
String waitingflagtemp = "is ready to extract data ...";
/ **
* Take production data and store him
* /
Scqueringity scdata = new scquantity ();
SAVESCQUANTINTITY SAVESCDATA = New SAVESCQUANTINTITY ();
/ **
* Main method of system operation
* /
Public void run () {
// Call the initialization variable method
// Prepare screen system parameters
WaitingFlag = "Preparing the screen parameters, please wait ...";
Repaint ();
Prepareframeter ();
// Get production data
WaitingFlag = "Get database data, please wait ...";
Repaint ();
SCDATA.GETSCDATA ();
GetDatafinished = true;
// Data processing is completed
Waitingflag = ""
Repaint ();
// Registering components
Processevent ();
/ **
* Show dialog box to log in
* /
// login ();
/ **
* Data from the production
* /
}
Public void prepareframeter () {
/ / Pay the variable
SetBackground ;; Color.Black;
Widthx = getWidth () - 10;
Heighty = GetHeight () - 10;
Heighty1 = Math.Round (Heighty / 10);
Heighty2 = Math.Round (Heighty * 3/10);
Heighty3 = math.round (heighty-heighty * 3/10-heighty * 2/20-hothty / 10);
Heighty4 = Math.Round (Heighty / 20); Heighty5 = Math.Round (Heighty / 20);
Try {
Thread.sleep (1500);
} catch (exception e) {
}
PrepareParameterFinished = true;
}
/ / Painting the main framework
Public void DrawsysmaInframe (graphics g) {
g.setColor (Color.Red);
// Draw a total rectangle
g.drawline (5, 5, Widthx 5, 5);
g.drawline (5, 5, 5, heighty 5);
G. Drawline (5, Heighty 5, Widthx 5, Heighty 5);
g.drawline (widthx 5, 5, Widthx 5, Heighty 5);
/ / Painting the first partitionline and system icon
g.drawline (5, 5 heighty1, widthx 5, 5 heighty1);
g.setcolor (color.white);
G.SetFont (New Font ("Song", Font.Plain, 28);
g.drawstring ("Ningxia Coal Group Corporation Production Data Analysis System", 305, 50);
// Painting the second division line
g.setColor (Color.Red);
g.drawline (5,5 heighty1 heighty2, math.Round ((5 widthx) * 9/10), 5 heighty1 heighty2);
/ / Painting Article 3 Segmentation Line
G.SetFont (New Font ("Song Body", Font.Plain, 18);
G. Drawline (5, 5 Heighty1 Heighty2 Heighty3, 5 Widthx, 5 Heighty1 Heighty2 Heighty3);
G. Drawstring ("Department:", 8, 5 Heighty1 Heighty2 Heighty3 23);
g.drawstring ("Analysis Category:", 150, 5 Heighty1 Heighty2 HeighTy3 23);
g.drawstring ("Analysis Value:", 330, 5 Heighty1 Heighty2 Heighty3 23);
g.drawstring ("Analysis Year:", 470, 5 Heighty1 Heighty2 Heighty3 23);
g.drawline (639, 5 heighty1 heighty2 heighty3, 639, 5 heighty1 heighty2 heighty3 heighty4);
g.drawstring ("Date:", 642, 5 Heighty1 Heighty2 Heighty3 23);
g.drawstring ("User:", 790, 5 Heighty1 Heighty2 Heighty3 23);
g.drawline (Math.Round ((5 widthx) * 9/10), 5 Heighty1 Heighty2 Heighty3, Math.Round ((5 Widthx) * 9/10), 5 Heighty1 Heighty2 Heighty3 HEIGHTY4);
// Draw a fourth division line
G. Drawline (5,5 heighty1 heighty2 heighty3 heighty4, 5 widthx, 5 heighty1 heighty2 heighty3 heighty4);
// Display supplier name and copyright information
g.setcolor (color.white);
G.SetFont (New Font ", Font.Plain, 15);
G. DrawString ("Software Developer: Imposion Software Co., Ltd. Copyright Allright Server 2004 Copyright", 8, 5 Heighty1 Heighty2 Heighty3 Heighty4 23);
// Draw the side of the right side
g.setColor (Color.Red);
g.drawline (Math.Round ((5 Widthx) * 9/10), 5 Heighty1, Math.Round ((5 Widthx) * 9/10), 5 Heighty1 Heighty2 Heighty3);
// Data
g.setcolor (color.green);
g.drawstring ("Analysis Category", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 30);
g.drawstring ("Analysis Department", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 95);
g.drawstring ("Analysis Date", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 160);
g.drawstring ("Plan Yield", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 235);
g.drawstring ("Actual Yield", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 300);
g.drawstring ("Super Yield", Math.Round ((5 Widthx) * 9/10) 14, 5 Heighty1 365);
g.drawstring ("Same period yield", Math.Round ((5 widthx) * 9/10) 14, 5 heighty1 430);
g.drawstring ("same period ratio", Math.Round ((5 widthx) * 9/10) 14, 5 heighty1 500);
g.setColor (Color.Red);
g.drawline ((Math.Round ((5 widthx) * 9/10)), 5 heighty1 555, 5 widthx, 5 heighty1 555);
}
// Message Processing Function
Public void processevent () {
/ **
* Analysis department
* /
Departmentgj = new choice ();
Departmentgj.Additem ("Group Corporation");
Departmentgj.Additem ("Command");
//DepartmentGj.seteditable (FALSE);
Departmentgj.reshape (53, 5 Heighty1 Heighty2 Heighty3 8, 80, 20);
THIS.GETCONTENTPANE (). add (divaTmentgj); / **
* Analysis category
* /
Fxlbgj = new choice ();
FXLBGJ.ADDITEM ("raw coal production");
FXLBGJ.ADDITEM ("Removal Yield");
FXLBGJ.ADDITEM ("Digging");
FXLBGJ.ADDITEM ("Pioneering Fund");
FXLBGJ.RESHAPE (230, 5 Heighty1 Heighty2 Heighty3 8, 80, 20);
THIS.GETCONTENTPANE (). Add (fxlbgj);
/ **
* Analyze threshold
* /
Fxfzgj = new choice ();
FXFZGJ.Add ("year");
FXFZGJ.ADD ("Month");
FXFZGJ.ADD ("Japan");
FXFZGJ.RESHAPE (410, 5 Heighty1 Heighty2 Heighty3 8, 40, 20);
THIS.GETCONTENTPANE (). Add (fxfzgj);
/ **
* Analysis Year
* /
FXYEARGJ = New TextField ();
Fxyeargj.reshape (550, 5 Heighty1 Heighty2 Heighty3 8, 80, 20);
THIS.GETCONTENTPANE (). Add (fxyeargj);
/ **
* Make the content pane transparent
* /
IF (getContentPane () instanceof jcomponent) {
((JComponent) getContentPane ()). Setopaque (true);
}
/ **
* Display the current date and time
* /
NowDate = new label ();
THIS.GETCONTENTPANE (). add (nowdate);
NowDate.setBackground; GetBackground ());
Nowdate.setForeground; Color.Yellow);
Nowdate.reshape (690, 5 Heighty1 Heighty2 Heighty3 8, 95, 20);
NowDate.Settext (Nowdate (). Tostring (). Substring (0, 4) "Year" nowdate (). TOSTRING (). Substring (5,7) "Month" nowDate (). Tostring (). Substring (8, 10) "Day");
/ **
* Display the user's name
* /
Username = new label ();
Username.reshape (840, 5 heighty1 heighty2 heighty3 8, 75, 20);
UserName.SetForeground; Color.Yellow);
Username.setBackground; Color.Black
THIS.GETCONTENTPANE (). Add (username);
UserName.Settext ("Test User");
/ **
*Exit system
* /
EXITSYS = New Button ("Exit System");
EXITSYS.RESHAPE (Math.Round ((5 widthx) * 9/10) 3, 5 Heighty1 Heighty2 Heighty3 4, 96, 32);
THIS.GETCONTENTPANE (). Add (exits);
EXITSYS.ADDACTIONLISTENER (NEW ActionListener () {
Public Void ActionPerformed (ActionEvent E) {
IF ((E.GetActionCommand ()). Equals ("Exit System")) {
System.exit (0);
}
}
});
/ **
* Initializing the mouse and yield tag
* /
MousePositionX = new label ();
MousePositionY = New label ();
MousePositionX.SetBackground (GetBackground ());
MousePositiony.SetBackground (GetBackground ());
MousePositionX.SetForeground (Color.White);
MousePositiony.SetForeground (color.white);
MousePositionX.reshape ((Math.Round ((5 widthx) * 9/10)) 10, 5 heighty1 555 5, 80, 20);
MousePositiony.reshape ((Math.Round ((5 widthx) * 9/10)) 10, 5 Heighty1 555 25, 80, 20);
THIS.GETCONTENTPANE (). add (mousepositionX);
THIS.GETCONTENTPANE (). Add (mousepositiony);
MousePositionx.Settext ("x:");
MousePositiony.Settext ("Y:");
}
Public void paint (graphics g) {
// Waiting for information display
G.SetFont (New Font ("Song Body", Font.Plain, 18);
G.SetColor (GetBackground ());
g.drawstring (WaitingFlagTemp, 200, 50);
g.setcolor (color.white);
g.drawstring (WaitingFlag, 200, 50);
WaitingFlagTemp = WaitingFlag;
// Display system main framework
PREPAREPARAMETAFINISHED && getDatafinished) {
DrawsysmaInframe (g);
}
}
/ / =========================================================================================================================================================================================== === item function ============================================== ==========
/ **
Get the date of the day (this machine)
* / public java.sql.date nowdate () {
Calendar Cal = Calendar.getInstance ();
Java.util.date utildate = CAL.GETTIME ();
Long NowTime = utildate.gettime ();
Java.sql.date nowdate = new java.sql.date (nowTime);
Return NowDate;
}
/ / =========================================================================================================================================================================================== === Mouse movement event ============================================ ======
Public void mousemoved (mouseevent e) {
MousePositionX.Settext ("x:" E.GETX ());
MousePositiony.Settext ("Y:" E.GETY ());
}
}
/ / Connect the class of servlet, here we don't do any public class scquantity {public void getscdata () {Try {thread.sleep (1000);} catch (exception e) {}}} // Store buffer data Class, don't do anything here
Public Class Savescquantity {}
Other class library finishing. . .