NET ERP System Architecture Design

Source: Internet
Author: User
Tags ftp file ftp file transfer

Analysis of large. NET ERP system Architecture Design framework+ Application design pattern

My understanding of large-scale systems, from the number above, the source code more than millions of lines above, the system has more than 300 functions, from the quality of the system should have good scalability and maintainability, the function of the system is closely related. Apart from the complexity of the business, how to design such a well-coordinated system, build a developer base platform, has been my research direction.

Soucecounter (version 3.3.91.79) statistics for the source code are as follows:

The following is a detailed analysis of the system's design architecture, pure. NET technology architecture, C/S WinForms system.

The system is divided into the framework and application two parts, the former is the Framework (framework), contains the core basic functions, such as public class library, license authorization, data dictionary, common control, public form, multi-threaded component, communication Foundation, session management and other basic parts, The latter is the application part, according to the different business logic, for the ERP system, can be divided into invoicing (distribution), engineering (Engineering), Production (Production), Production planning (Production Planning), Finance ( Account Receivable,account payable,general Ledger), Customer relationship (CRM) and other modules.

Framework development Frameworks 1. Common public Class Library
    • Defines the exception type for system exception handling: LicenseException licensing exception, field validation exception fieldvalidationexception, entity validation exception, application exception appexception, Crystal Report Exception crystalreportexception.
    • Define version information, set the value of the four-version field
"3";    "4";" 0 "; "0";  
    • Define licensing schemes, Systemlicense system license files, Haredwareinformation hardware information. Systemlicense contains a core method verify for verifying licensing, such as Expiration Time, version (Standard, enterprise), hardware information, parameter settings (maximum number of users, number of available modules, available databases).
Enum licensetype{       Internal, Standard       ,       Enterprise}
    • Optimize the. NET dataset transfer, primarily Adonethelper, which is from an article on CodeProject, titled Optimize. NET dataset, fully customizable dataset in. Net Remoting server and client transfer methods.
    • Define Help Class Library, DataSetHelper dataset operation, Crystalreporthelper Crystal Report Helper class, Wmihelper operating System WMI helper class, encryption and decryption helper class Rsacryptionhelper, Safeinvokehelper is used for COM operations help classes, database operations Help classes Sqlhelper,statisticshelper Data Statistics helper classes, Strongnamesignaturehelper strong named Validation helper classes.
    • FTP File Transfer System.Net.FtpClient, this reference to NETFTP, there are many examples of code to get started quickly.
    • Type Converter, which is often encountered when designing an ASP. NET control, is used to convert the text definition in ASPX to a type of. Nets, compare commonly used such as bool value conversion, 0 conversion to false,1 or other value conversion to true, The character y converts true, and the character N translates to many typeconverter examples in false,msdn.
    • Excel import class, for the Excel import class, the only requirement for functionality is that Microsoft Excel cannot be required, and the client's server can have very few software installed, so it totally negated Microsoft's own office Interop.
    • Defines the resource files that are commonly used by the system, built into the assembly with embedded resources.

2. Component Common Controls and components
  • Editor edit control, text Edit Control texteditor, date Edit Control datetimeeditor, drop-down selection control Comboeditor, multiline detail Edit control grid, radio control Checkboxeditor, Picture edit control PictureBox, Rich Text edit Control Richtextboxeditor, digital Edit Control Numericeditor, Time Edit Control timeeditor, Gantt Chart edit Control Ganttaeditor.
  • The Calendar date control date control is used to display tasks in the current time range (work order, production plan, delivery schedule), reference the date control in Outlook, and the code from the article in CodeProject.
  • Form base class, which is a very central part, the subclass of the form of code can be concise and efficient, all lies in this place. Defines the formbase type, which contains the basic functionality: multiple languages (all controls on the readable interface are reset by the Text property), and the layout is persisted (layouts persistence), used to save user-modified interface offsets, often in grid column order modification, Splittcontainer up and down panel position sizing, custom layout for the form designer to modify the interface layout, form shortcut key definition, such as the ENTER key to rewrite tab key to facilitate jump.
  • Query Form/enquiry form base class, used to define a common query interface, the user will be a SQL statement, or stored procedures, or through the query generation tool to generate a query, through the interface base class to parse the production interface and production data.
  • Crystal Report Form the base class, the user designed the report, placed in the configuration of the directory, you can view the Crystal Report, easy to print settings, report multi-language, report parameter delivery, report export to Excel or PDF, report generation sent to the user message in the specified format.
  • Error Dialog Exception dialog box, CodeProject an article on how to get the information of the. NET stack, when the system business throws an exception, you need to encapsulate this exception information, such as getting the current version of the program, build time and other packages passed to the Exception dialog box, in the Exception dialog box a simple copy to the Clipboard button to collect the error information, so that The programmer will diagnose the problem.
  • The Form Designer Forms Designer, used to customize layout layouts, save the layout as an XML file after modification, formbase the layout definition for this feature in the Custom layout table (Formlayout) beforehand, and if found to be loaded. NET CLR Form Host an article describes how to generate XML file definition content, a simple understanding of Visual Studio can be defined as a code generation tool, drag and drop controls into the form will generate different source code, c#,vb.net, and Xml,visual Studio does not support generating XML format interface configurations, but CLR form host can do this.
  • The graph graph base class is used to render data graphically, column/pie/point/Graph/Candlestick chart, open Excel charting to see various types of charts, Visual Studio 2009 has built-in rich chart controls for simple encapsulation.
  • Field Range Control query component involves ORM query, only need to fill the control to the entity name and attribute name, it can generate query criteria for me, so at design time is convenient to design the query conditions, saving a lot of stitching conditions of the code.
  • Condition Editor conditional edit control, which is used primarily for conditional editing of if-else activities in a workflow.
  • BackgroundWorker multithreaded components for multithreaded processing. NET system already contains the very practical background line program control BackgroundWorker, avoids the main interface to die, also realizes the multithreading processing, but this control needs to rely on in the form form, needs to add a workerthreadbase, the reference code The article in Project.
  • Misc Miscellaneous SQL Editor controls, such as generating query statements, workflow condition settings, Alert alert query statements and other places will involve the SQL display or writing, there is a syntax highlighting the editing control will add a lot of color to the system, Code project has a large number of SQL Hightlight editor controls are available, Auto CAD drawings display controls, BOM for engineering modules may increase sheet attachments, drawings in DWG format need to be viewed online, Desktop Alert controls the reference example of this is MSN message alert, When Outlook alerts you to new messages, refer to code project for a number of similar controls. tab MDI Layout Control (Dockmanager), this component is also very important, because there is a build in Infragistics, out of the box, you can change the traditional MDI layout to the tab MDI, no need to modify the code. The chart control is used to set the zoom mode for the picture, the camera control, the employee master file in the personnel system to take photos to the employee, the browser Control Web browser is used to display the Web page, overrides. NET system, modify several properties, and turn off the error script prompt.

3. Pre-defined basic functionality administration UI

Well-designed systems should be pre-defined a series of basic interfaces to manage the metadata in the framework function, which is explained in two parts, one is what the framework defines, and the second is how to implement these functions. Let's take a look at the underlying metadata table definitions of the framework database framework:

Write a basic query statement that queries all tables in the framework system database.

By name
Data Sheet Defined
Attachment Accessories for all functions in the system, which can store files directly or store an FTP file path

Branch/branchdetail

Implement multi-Inventory organization
Company Implement multi-company book sets
Configuration System parameter Configuration

Contextfunction Contextfunctiondetail

System context menu item definition

Dictionary
Dictionarydetail

Variable data dictionary definitions for modifiable data dictionaries

Formlayout
Formlayoutdetail

Self-windowing interface (XML file saved after Form designer design)
Formprofile User bias (grid sort, control position or size drag)
Languagetranslation Multi-lingual Translation
Component Assemblies read at system startup
Lookup Find Data dialog box
Message
Messagedetail
message box
Report Report parameter definition
Scheduledtask Scheduled Tasks for System presets
Systemmodule
Systemfunction
Modules and functions included in the system
User System users
Userdefinedquery Pre-defined queries
UserGroup User Group
Usergroupauthorization User Group Authorization
Usergroupmenu User Group Menu
Usergroupmenubitmap User group Navigation Map
Userlog User log
Workflow Workflow definition

    • Modifiable data dictionaries, such as employee work levels, from T1 to T4, to m1,t for Technican technician, M for Manaer manager, which can be added or decreased according to the implementation. Non-modifiable data dictionary such as gender, only male or female two options, can not be modified, this immutable data dictionary directly in the code to write dead.
    • A system-preset scheduled task that is often used for message reminders or report generation requirements in a workflow. The former such as when the inventory is not enough to send a message to remind the Purchaser, the latter for the weekly regular generation boss report sent to the boss mailbox.
    • The workflow definition saves the xoml file generated by the Workflow designer. Visual Studio does not support generating workflow definitions for the XOML format, but. NET Workflow host can get workflow definition files generated by the Workflow Designer by modifying the output.
    • Document Code/document serial number some customers prefer to put in the business database, which is not mentioned in the table above.

The underlying functionality of the framework can be seen through the definition of the above Framework database table, which is to read and write the above data. I follow the form's categories for a brief introduction.

    1. Login Exit class function: Logindialog user Login, Login success can display splash screen, then enter the main interface main form, when the user exits, but also to detect whether there is currently a form of data is not saved (dirty) By reminding the user to save the data or discard the changes, the user may modify the login password, and the user may do some customization of the menu or function.
    2. Design class Features: Query Designer designs queries to save query text to the datasheet userdefinedquery. Report Dialog Designer is used to maintain the reporting parameters, the design of the report is finished by the Crystal Report, there is no energy to maintain a report designer, so directly with the powerful Crystal Reports, in the Report dialog box only need to maintain the parameters of the report, This allows you to pass the parameter values to the report without writing the code. Workflow Designer is used to design workflows, saving results xoml to Workflow tables. The Form Designer is used to modify the custom layout, hide or resize the control's location, or modify the query criteria. The lookup designer is used to design a lookup form, and the intuitive explanation is that when the cursor is placed in the customer number control, the control displays a small button, and the Click button pops up the Customer Number selection dialog box, where the design lookup form, which is the design of the Customer Number selection dialog box.
    3. Application class Features: Control application startup, shutdown, control communication layer, implement application recovery mode, this feature can get source code reference from Windows 7 code package. When the application crashes, you can prompt for a restart before recovering the data before the crash.
    4. Auto-update class feature: Supports downloading the latest version of the file update system from Ftp,http,xcopy and other means. There is no implementation of calling Microsoft's background Intelligent Transfer Service, nor does it implement the ability to invoke third-party download APIs, and does not support the continuation of breakpoints or fast large file downloads. Call Thunderbolt API speed is probably the reason for the request server has backup files, which is not feasible for enterprise applications, and third-party download API will encounter speed limit and other problems, or honestly realize the fast and stable local area network update.
    5. Generic Attachment class functionality: Implements a common attachment management module, and other functions require only one supportattachment=true attribute to have attachment management capabilities. Attachments can be saved in a database or FTP file server.

4 Workflow Basics Workflow Essential

Four basic functions of workflow implementation: Notification reminders, approving, scheduling tasks, calling custom code.

Notification Reminder: ERP system contains a large number of reminders, each add a business function to write a reminder of the function of code calls appear to be a bit cumbersome, in this only to make a setting to implement notification settings, including the person to notify, the content of the notification.

Approval: The framework should abstract all the document's approval requirements, establish a separate batch system, any function only need to simply set up to invoke the workflow code, to achieve the approval process.

Scheduled tasks: There are some regular tasks in the system, such as employee birthday reminder, inventory balance alarm, pending receipt record reminder, boss report scheduled to send.

Call custom code: If the functionality in the system is defective defect, the software company is reluctant to modify the case, you can consider adding a custom. NET code to solve the problem. Just insert the appropriate code at a reasonable event point to complete the repetitive data repair work.

Based on the Microsoft Workflow solution, take a look at the underlying components that are included:

Activities Activity Library, an activity is a basic code execution unit in a workflow definition, and the code that can be cured executes can be encapsulated into an activity. Contains the document batch activity, send report activity, query activity, call. NET code activities, and so on. Call. NET code activity is set up in the following reference:

Assembly=microsoft.applications.myreportdll; class=microsoft.applications.myreportdll.employeelistingdal;method=getemployeelisting ();

Familiar with. NET Framework to reflect the calling method of a friend at a glance understand the meaning of the definition above, the source code of this activity can be simplified as follows:

Override Activityexecutionstatus Execute (ActivityExecutionContext executioncontext) {      assembly = assembly.load ( Segments[0]);     Type = assembly. GetType (Segments[1]);     method = Segments[2];      Type. GetMethod (method, BindingFlags.Public | bindingflags.static). Invoke (null);}

Contracts interface and implementation in the first-step activity definition, a large number of calls are made to the Callexternalmethod activity in WF, which is used to invoke an external custom method to decouple the interface from the implementation. When designing an activity, you only need to specify the interfaces and methods to invoke, and the implementation can vary as needed.

. NET WF requires that you register the services you want to perform when you start the WF runtime, with the following code reference:

SqlWorkflowPersistenceService  persistenceservice=new SqlWorkflowPersistenceService  ( ConnectionString); runtime. AddService (persistenceservice);

In the active code, the registered service can be referenced in the following ways:

SqlWorkflowPersistenceService  Persistenceservice=context. Getservice<sqlworkflowpersistenceservice> ();//method of invoking the Persistenceservice service

In this way, the interface of the service can invoke ERP code, which realizes the integration of ERP logic and. NET WF Workflow.

Workflows defines a workflow type for each common process, making it easy to do persistence and validation work.

Workflow Designer Control re-host The workflow definition component, directly referencing the example borrowed from MSDN.

Monitor workflow monitoring to see the execution of the process, the current execution node, and the execution path.

5 Server System Server Series

Functionally speaking, the system should have the following four basic servers, to achieve the separation of data read and write.

Application server business logical server,. NET remoting server side.

Report server for report rendering, reducing the pressure on application server.

Workflow Server Workflow Server executes the workflow.

Scheduling server schedules The task server to reduce the pressure on application server.

Each server is configured with console and service versions, the code is exactly the same, the console is rendered as a control console program, and the service is implemented as a Windows service application, which facilitates development and is used for deployment and practical use.

Application applications

According to the functional classification of ERP project, divided into invoicing (distribution), engineering (Engineering), Production (Production), Production planning (Production Planning), Finance (account receivable, Account payable,general Ledger), Customer relationship (CRM) and other modules. Each module is compiled into an assembly independently of one visual Studio Project. By using the plug-in structure, it is only necessary to insert a row of records in the Component table to enable the system to recognize this assembly and invoke the functions in the assembly using the reflection method.

1 Business entities and business logic

If you are developing systems with LLBL Gen Pro, the business entity tier has the following folder hierarchies.

Take the sales single header as an example, database table SalesOrder, generate entity for salesorderentity, design read-write interface file for Isalesordermanager, interface implementation class is Salesordermanager, with a simple diagram is shown as follows:

salesorder–> salesorderentity–> isalesordermanager–> Salesordermanager

The system enforces the above conventions and Designs code Smith template codes to reduce the likelihood of errors. Both provide mandatory constraints, but also provide tools to assist developers to comply with the Convention, System development efficiency doubled.

The business entity layer also implements the data audit (Audit) feature, which records the modified values for each record in the table. Just graduated from work, often confused audit and approval differences, and now some systems still exist with audit as the meaning of the approval.

2 Data dictionary Enum

Defining immutable data dictionaries in the system, although the way to write dead dictionaries in code is worth negotiating, the benefits are obvious.

Define a labor contract enumeration, a fixed term and a non-fixed term contract, refer to the code below.

Enum contracttype{        [StringValue ("F")]        [DisplayText ("Fixed Time")]        fixedtime,        [ StringValue ("U")]        [DisplayText ("Unlimited Time")] Unlimitedtime}   

Get its value in the following way, values are stored in the database or used by the program code:

Stringenum<contracttype>. GetStringValue (Contracttype.fixedtime)

Get a description of it in the following way, described for rendering in the interface:

Stringenum<contracttype>. Getdisplaytext (Contracttype.fixedtime)
3 Business Logic Implementation

Some logic is implemented in business logic, such as type initialization values, automatic values, value validation, and so on. Complex logic such as in and out of the warehouse, related to the related table will be more, you may want to deduct inventory, modify the inventory balance, batch number generation, generate the average unit price, etc., complex logic to separate in a project design source generation, so as to facilitate maintenance.

4 Report

From the formal points, divided into graphical reports and data reports. Graphical reports are completed with Microsoft. NET-brought graphics controls, and MSDN contains a number of examples of samples environments for Microsoft Chart controls. The data report is finished with Crystal Report, more than 600 crystal report files, including the document printing, list query printing, main file data printing and other categories. The rich Crystal Report function adds a lot to the system.

5 Systems Maintenance System Maintenance

Integrated with some common functions, do not need to enter the system to complete system maintenance. such as database upgrade, database backup, database restore, new account set creation, system parameter setting, database performance optimization (mainly index rebuilding), these utility programs alleviate the burden of system administrator.

6 function Module/interface Presentation

Distribution invoicing, including sales, procurement, warehouse module.

Module Function
Sales Sales contracts, sales orders, delivery, returns, sales packaging, sales invoices
Purchasing Procurement Purchase requisitions, purchase orders, purchase receipts, purchase returns, vendor invoices
Inventory Warehouse Incoming (Receipt), out of position (Issue), transfer (Transfer), Inventory (cycle-count)

Engineering Engineering Bill of Materials, standard cost setting.

Production production work list, work order material, pour and assemble, material return, disperse material.

Production Planning Production Planning Master Production Plan MPs, MRP, capacity demand plan CRP

Finance Financial Account receivable receivable, Accounts payable payable, General Ledger Gl.

CRM Customer relationship sales lead, sales daily, sales report, travel application and expense reimbursement.

In my experience, I think it is very useful to build a set of development framework for enterprise development. The amount of energy and time spent in the early stages will be fully rewarded. However, the time and effort required to build a framework is debatable. The company has always been responsible for shareholders, can use the least time to finish the project, the recovery of the contract can be, a lot of trouble to do the product base function, for small companies to survive is a problem, well-designed framework requires a lot of energy to maintain and improve, aside from the company factors, Learning a large system is also important for personal career development and growth.

NET ERP System Architecture Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.