Application of FoxPro in information management of the Three Gorges Project
Source: Chinese thesis download center [07-07-20 17:08:00] Author: Li fangqing EDIT: studa20
Abstract: The Three Gorges Project is a world-class giant project with many professional categories, complicated technologies, and huge information management workload, the MIS system must be used to collect, sort, store, collect, analyze, and tabulation information. Over the past few years, we have used FOXBASE and FoxPro to compile the Wage Management System, earthwork engineering quantity calculation program, Engineering Payment Management System, document management system, and concrete strength statistical analysis program. and other small desktop systems. In the programming process, it has gone through the conversion from the low-level platform (DBASE) to the high-level platform (FOXPRO), from the character interface (DOS) to the graphic user interface (Windows, some Application Experience is summarized.
Key words: Three Gorges Project FOXPRO application experience
The Three Gorges Project is a world-class giant project with many professional categories, complicated technologies, and huge information management workload. It is necessary to use the MIS system to collect, sort, store, collect, analyze, and tabulation information. At present, the MIS systems of various participating units are successively put into operation, such as the tgpmis System of the Three Gorges Engineering Development Company of the Yangtze River, and the "construction file management system" of the Three Gorges Construction Contracting Company of Gezhouba Co., Ltd. These systems have strong functions and wide scope, but they cannot cover information management aspects. They need to be supplemented by the desktop database system. Because desktop databases are easy to learn, they have a large user base. Using a desktop database to develop a powerful system also has many success stories, such as 1995 ~ In 1997, the Three Gorges Construction Site used the "Statistical System" and the budget summary software developed by the State Power Company.
In terms of desktop databases, over the past few years, we have used FOXBASE and FoxPro to compile the Wage Management System, earthwork engineering quantity calculation program, Engineering Payment Management System, document management system, and concrete strength statistical analysis program. and other small desktop systems. In the programming process, it has gone through the conversion from the low-level platform (DBASE) to the high-level platform (FOXPRO), from the character interface (DOS) to the graphic user interface (Windows, some Application Experience is summarized. For example, in Windows, you can continue to use the "Regular Report", make full use of browse to quickly create an input interface, use the "expression generator" to create a query, and use foxgraph to create an intuitive bar chart and pie chart.
1. Project Manager
After introducing the concept of a project, the project manager frees developers from the tedious management of various files in the application system, so that they can spend more time on module development: the project manager has the following advantages: (1) You only need to put the main control module (usually the menu) of the application system into the project manager. when a project is generated, it can include almost all files in the application system to facilitate modification and debugging of program modules. (2) it allows you to easily create executable files, it also has the function of automatically updating the versions of each component in the project during compilation.
Note the following when using the Project Manager: (1) use the original file (mnx, SCX, etc.) as much as possible, instead of the program file (such as flrs and SPRs) converted from the generator ), after menus and screens are updated, the "build" button in the project manager can be automatically converted. When the menu or screen is called in a program, call a file with the extension MPX or SPX, instead of a file with the extension of MPX or SPX. (2) if most of the modules in an application have been finalized, but some modules are changing in use. For example, the statistical module in the "Wage Management System" compiled by us, the modification (Secondary Development) of this module is relatively simple, and the users of the system can also be competent. This requires that this module is not included in the compiled executable file. The implementation method is to mark the module in the Project Manager using the "exclude" menu bar in the Foxpro "project" menu, then, execute the "pack" function in the "project" menu and re-compile the project. An external module is a fxp file. During installation, place the external module file in the directory where the application system EXE file is located.
2. menu of the Foxpro Program
A program is usually composed of multiple functional modules, which can be called by a series of buttons and other objects arranged on the screen. However, menus are usually used to combine functional modules to form a whole. Therefore, we use Delphi to compile an automatic menu generator.
FoxPro provides bar menus and pop-up menus consistent with Windows Graphical User interfaces, and provides corresponding automatic generation tools (genmenu. fxp ). This menu feature: menus can be classified into multiple levels; menus can be dynamically changed during running; functional modules can be directly included in the menu, making it possible to form an application system by a menu program; you can directly use some common functions, such as file creation, copying, and pasting. In this form of menu, when used for the first time, it is often generated to exit the menu only once, you can use the following solution:
(1) Add the following cycle start statement to the end of the setup code:
Do while. T.
(2) The cleanup code of the menu is as follows:
Read valid. f.
Enddo
(3) The code for exiting the menu program is as follows:
Close Database
Clear all
Set sysmenu to default
Cancel
In the application system, the application name is often used to replace the title "Microsoft foxprow" in the foxprow main window. The implementation method is to add code similar to the following before the setup code:
Modify window screen at 36,147 size;
Title "material and material management procedures"
Font "MS sans serif", 8 float close minimize
Move window screen center
Zoom window screen Max
FOXBASE drop-down menu (meun bar ....... Read menu to) is a single task. When a specific module is executed, the menu is hidden, and the control is in the executed module. While FoxPro bar menus have the nature of multi-task, the same module can be executed repeatedly and sometimes need to use this function, but in most cases it is not required, this is because the same module or multiple modules active at the same time often process the same type of database or table, which may cause errors due to conflicts. Therefore, when executing a module, other modules with the same database file cannot be executed. This can be done by introducing several logical memory variables in the setup code and using the Skip attribute in the menu bar. In this way, modules can be associated.
3. Application Information Input
(1) screen Generator
Similar to menus, the screen has two code segments: setup and cleanup. You can set the corresponding environment or restore the environment when the screen (or menu) exits. Although the save feature in the ENVIRON-MEXT button in the Screen Builder can be used to save the development environment, this feature is limited and is not easy to make complex settings, the stored development environment may be different from the runtime environment, resulting in an error during the program running. Therefore, it is recommended that programmers use this function instead of the former.
There are two layers for writing code on the screen: The Screen Layer and the object Layer on the screen. Common processing can be done at the object level. At the screen level, only the setup and cleanup code segments are used. Other code segments are usually used in multiple forms and screens. In the object hierarchy, you usually only need to write the "valid" code.
(2) Powerful browse
Anyone who has used Excel is used to operate the vertical and horizontal tables, which is intuitive and natural. In foxprow, similar functions can be implemented using browse. If you want to use browse to perform any operation on the table, use the following simple command:
Use
Browse title
In this case, the data in the table is insecure and it is necessary to restrict the browsing operations on the table. If node-Lete, noappend, and nomodify are selectively added to the Browse command, you can restrict "add Delete flag", "APPEND record", or "Modify record.
Borwse titile nodelete noappend nomodity
(Note: This command can only display the table content and cannot be modified)
Sometimes, when the field name of a table is a western field name or a Chinese field but the meaning is not easy to understand, you need to provide a header that is easy to recognize during browsing, then you need to use ": the field name modification of H = "is as follows:
Browse field name: H = "name"
(Note: here the name is the name of the west field, and it should be replaced by "name" when displayed)
Adding nomodify to the Browse command will lock all fields and cannot be modified. Generally, however, you only need to lock the key fields and associated fields. In this case, you cannot use nomodify, but use the field name modification function ": W =. F. As follows:
Browse field name: H = "name": W =. F .,
Basic: H = "basic score"
(Note: The Name field cannot be modified.
The browse function is very powerful. Readers can refer to the help tips of browse. The Browse clause and some modification functions can be flexibly applied to implement extremely powerful database input, editing, and modification functions.
4. Application retrieval implementation
(1) instance-based link query
In the development environment or command environment, using a powerful rqbe for queries is the best choice. It is easy to use it to create a single table or multi-Table query, there are a lot of materials to introduce in this area. Here, we will not repeat them here. Because the rqbe feature is not integrated in the Runtime Library, do not include this feature during application development. However, SQL statements generated using the rqbe function can be used in the application system to reduce the time used to compile the query module. Set the content of statements in SQL statements to variables, and use the macro replacement function to form a general query module to some extent.
(2) expression Generator
When running, you can use the expression generator (getexpr to call) to generate filter conditions, filter query records, and display the output in the browser window or report.
(3) custom query Screen
For example-based relational queries and expression generators, you must have a certain foundation for Using FoxPro. For common users, You need to construct a query screen like a fool. You can find the corresponding records by filling in a few strings or numbers.
5. application result output
(1) browse
Browse is powerful, that is, it can be used for information input and as a carrier of information output.
(2) Reports
Compared with reports in FOXBASE, FOXPRO adds the table line function, which is more suitable for Chinese reports and easier to create reports. However, it is a little difficult to locate the objects in the report. It takes a lot of time to prepare a report. In addition, the customized report is of a certain size, after the paper size changes, it cannot be adaptive.
In FOXBASE and FoxPro under DOS, to print a report, you usually use "@... Say ......." Statement programming implementation. The generated report is a text report. Such reports can be directly sent to the printer for output, stored in a text file, and output after being processed by other word processing programs. In the early days, it was very troublesome to compile a program to generate a report. During system development, a large amount of time was spent preparing a report program. In order to speed up the preparation of the Report Program, we used Delphi in practice to compile a tool for Automatic Generation of Character Report programs. Among these tools, there are both quick interfaces for generating simple reports and tools for generating complex vertical and horizontal table Report programs.
The cced2000 makes it very convenient to output a simplified report on the Windows graphic user interface, in addition, using our own tools to generate text tab-type reports is much faster than the graph reports generated by FoxPro, so even now, A large number of reports are still structured. If the text report has been saved to the file autoprn. PRN, use cced2000 to open the text report as follows:
Filename = sys (5) + sys (2003) + "/autoprn. PRN"
Run C:/cced2000/cced2000 & filename
(3) Charts
In foxprow, data can be directly extracted from the database to generate charts such as bar charts and pie charts. You can use the copy command to copy the fields used in the chart to a temporary database, and then call the foxgraph wizard. For example, the database ABC. DBF contains 10 fields, such as "month" and "output value". A column chart is generated using the values of the "month" and "output value" fields. The Code required to complete the requirements is as follows:
Use ABC
Copy to temp. DBF field month, output value
Use temp
Do (-foxgraph)
(4) Generate Reports in Excel
Excel can directly open the foxprow2.5b database for post-processing. To be able to call excel in FoxPro, an Excel search path must be included in the DOS path. For example, you can use Excel to open the ABC. dbf database (In Foxpro, close the database first) using the following code:
Filename = sys (5) + sys (2003) + "/ABC. DBF"
Run Excel & filename
6 conclusion
To speed up application system development, we developed several automatic generation tools to shorten the time for developing an application by half a month ~ In one month, the development efficiency has doubled. Desktop databases still have a wide market, and FOXPRO's application systems have broad development prospects.