Method and device for generating EDI message
By mapping EDI document fields to the underlying database fields, defining common and personalized processing methods, and combining them into templates, the problems of complex and difficult maintenance of EDI packet generation code in the prior art are solved, and simple and efficient EDI packet generation and maintenance are achieved.
Patent Information
- Application Number
- CN202510177558.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-23
AI Technical Summary
In the prior art, the code for generating EDI messages is complex and has high coupling properties, which leads to high development costs, high maintenance difficulties, and is difficult to easily generate EDI messages that are easy to maintain.
By mapping each field of the EDI document to the underlying field of the database, the database field is generated; then common fields are processed in general, common and personalized processing methods are defined, common and personalized processing methods are combined into templates, and EDI messages are generated in response to business-level instructions.
It realizes simple generation of EDI packets, reduces the complexity and coupling of code, improves the development speed and maintenance of EDI templates, and simplifies the message change process.
Smart Images

Figure CN120031000A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field, and in particular to a method and device for generating an EDI message. Background Art
[0002] Electronic data interchange (EDI) is a technology that transmits standard economic information between trading partners' computer systems through communication networks in accordance with internationally recognized standard formats to achieve data exchange and automatic processing. It is widely used in various trade scenarios to improve the efficiency and accuracy of data transmission.
[0003] In the prior art, it is usually necessary to extract the corresponding data by writing code and generate EDI messages according to specific rules. Due to the large amount of data, different extraction requirements, and many factors involved in the rules, the written code is often very complex and highly coupled with the data. The writing process is time-consuming and labor-intensive, and the development cost is high. In addition, it is difficult to maintain the code under different rules and when the rules change. Therefore, how to easily generate EDI messages that are easy to maintain has become a problem that needs to be solved urgently. Summary of the invention
[0004] Based on the above problems, the present application provides a method and device for generating EDI messages, so as to simply generate EDI messages that are easy to maintain.
[0005] The present application discloses a method for generating an EDI message, the method comprising:
[0006] Map each field of the EDI document to the underlying field of the database to obtain the database field;
[0007] Performing common processing on the common fields in the database fields to generate a back-end common method for the data source;
[0008] According to the template rules and the non-common fields in the database fields, define a common processing method and a personalized processing method for the template;
[0009] The template is obtained by combining the common processing method, the individual processing method and the back-end general method;
[0010] In response to the EDI message generation instruction from the business layer, the EDI message is generated according to the template.
[0011] Optionally, mapping each field of the EDI document to an underlying field of a database to obtain a database field includes:
[0012] According to EDI business requirements, each field of the EDI document is disassembled and analyzed, and mapped to the underlying fields of the database;
[0013] The mapped underlying fields are encapsulated and named according to the business content to obtain the database fields.
[0014] Optionally, the common fields in the database fields are processed in a universal manner to generate a backend universal method for the data source, including:
[0015] Arrange common field processing methods according to EDI business requirements;
[0016] According to the common field processing method, the common fields are generally processed and encapsulated to generate the backend general method.
[0017] Optionally, defining a common processing method and a personalized processing method for the template according to the template rule and the non-common fields in the database fields includes:
[0018] According to the template rules, the common processing method is defined using a Velocity macro script;
[0019] The Velocity macro script is used to define the personalized processing method according to the different values of the non-common fields.
[0020] Optionally, the step of combining the common processing method, the personalized processing method and the backend general method to obtain the template includes:
[0021] Create a new Velocity template, and configure the template fields corresponding to each line of EDI message fields in the Velocity template;
[0022] Processing each of the template fields according to different processing rules of the EDI message fields;
[0023] The Velocity template is stored as the template.
[0024] Optionally, after the template is obtained by combining the common processing method, the individual processing method and the backend general method, the method further includes:
[0025] The template is adjusted following the modification of the processing rules.
[0026] Optionally, after the template is obtained by combining the common processing method, the individual processing method and the backend general method, the method further includes:
[0027] Debugging the template and outputting the error information that occurs; the error information includes the location where the error occurs;
[0028] The meaning of the data source represented by each row of fields in the template used to generate the EDI message is displayed.
[0029] Optionally, after generating the EDI message, the method further includes:
[0030] The EDI message and the data related to the EDI message are processed into a log and retained.
[0031] Optionally, after generating the EDI message, the method further includes:
[0032] After the EDI message is iteratively updated, an update log corresponding to the updated EDI message is obtained;
[0033] The update log is compared with the log corresponding to the EDI message generated by the same business.
[0034] Based on the above method for generating an EDI message, the present application also discloses a device for generating an EDI message, including: a mapping unit, a general unit, a definition unit, a combination unit and a generation unit;
[0035] The mapping unit is used to map each field of the EDI document to the underlying field of the database to obtain the database field;
[0036] The general unit is used to perform general processing on the common fields in the database fields to generate a back-end general method for the data source;
[0037] The definition unit is used to define a common processing method and a personalized processing method for the template according to the template rule and the non-common fields in the database fields;
[0038] The combining unit is used to combine the common processing method, the individual processing method and the back-end general method to obtain the template;
[0039] The generating unit is used to respond to the EDI message generating instruction from the business layer and generate the EDI message according to the template.
[0040] Optionally, the mapping unit includes:
[0041] The analysis subunit is used to analyze and disassemble the fields of the EDI document according to the EDI business requirements and map them to the underlying fields of the database;
[0042] The encapsulation subunit is used to encapsulate the mapped bottom-level fields and name them according to the business content to obtain the database fields.
[0043] Optionally, the general unit includes:
[0044] Arrangement subunit, used to arrange common field processing methods according to EDI business requirements;
[0045] The processing subunit is used to perform common processing and encapsulation on the common fields according to the common field processing method to generate the backend common method.
[0046] Optionally, the definition unit includes:
[0047] A common definition subunit, used to define the common processing method using a Velocity macro script according to the template rule;
[0048] The personality definition subunit is used to define the personality processing method according to the different values of the non-common fields by using the Velocity macro script.
[0049] Optionally, the combination unit includes:
[0050] A new subunit is used to create a new Velocity template and configure the template field corresponding to each line of EDI message field in the Velocity template;
[0051] A rule processing subunit, used for processing each of the template fields according to different processing rules of the EDI message fields;
[0052] The storage subunit is used to store the Velocity template as the template.
[0053] Optionally, the device further comprises:
[0054] An adjusting unit is used to adjust the template following the modification of the processing rule.
[0055] Optionally, the device further comprises:
[0056] A debugging unit, used to debug the template and output error information that occurs; the error information includes the location where the error occurs;
[0057] The display unit is used to display the meaning of the data source represented by each line of fields in the template used to generate the EDI message.
[0058] Optionally, the device further comprises:
[0059] The retaining unit is used to process the EDI message and the related data of the EDI message into a log and retain it.
[0060] Optionally, the device further comprises:
[0061] An updating unit, configured to obtain an update log corresponding to the updated EDI message after the EDI message is iteratively updated;
[0062] The comparison unit is used to compare the update log with the log corresponding to the EDI message generated by the same business.
[0063] The present application discloses a method and device for generating EDI messages. By mapping each field of the EDI document to the underlying field of the database, the code and the data are decoupled to obtain the database field. The source of field attributes is provided for the template, which enhances the flexibility and maintainability of the subsequently generated EDI message. The common fields in the database fields are processed universally to generate a back-end universal method for the data source. According to the template rules and the non-common fields in the database fields, reusable public processing methods and personalized processing methods for the template are defined to reduce duplication of work. The public processing method, the personalized processing method and the back-end universal method are combined to obtain a template. The development speed of the EDI template is improved, and the EDI message generation instruction from the business layer is responded to and generated according to the template, so that the EDI message is easily generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0065] Figure 1 A flowchart of a method for generating an EDI message disclosed in an embodiment of the present application;
[0066] Figure 2a A flowchart of another method for generating an EDI message disclosed in an embodiment of the present application;
[0067] Figure 2b A schematic diagram of the process of generating an EDI message for a user disclosed in an embodiment of the present application;
[0068] Figure 3 A schematic diagram of the structure of a device for generating EDI messages disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0070] Embodiment 1: This application discloses a method for generating an EDI message.
[0071] For details, please refer to Figure 1 A method for generating an EDI message disclosed in this embodiment includes the following steps:
[0072] Step 101: Map each field of the EDI document to the underlying field of the database to obtain the database field.
[0073] The method described in this embodiment can be implemented by mainstream programming languages, such as Java, etc. The type of programming language used by the method described in this embodiment is not specifically limited here, and it is sufficient to be able to implement the steps described in this embodiment. As an optional method, it can be implemented by combining Java with the Velocity template engine. Among them, Velocity is a Java-based template engine that provides a template language that references objects defined by Java code, which can ensure the isolation of the application between the presentation layer and the business logic layer.
[0074] In the method described in this embodiment, each field of the EDI document can be deeply analyzed according to the EDI business requirements to obtain its meaning and role in the business process. Then, according to the EDI business requirements, these fields can be disassembled and mapped to the underlying database fields in the system to ensure the accuracy and consistency of the data and lay the foundation for subsequent data processing. After completing the field mapping, the mapped database fields can be read to encapsulate the data source.
[0075] As an optional method, you can name the attributes of the encapsulated database fields according to the actual meaning of the business fields, ensuring that the names are concise and clear, and accurately reflect the business meaning they represent. This facilitates efficient and intuitive calling of subsequent Velocity templates, improves readability and friendliness for template users, and lowers the threshold for learning and use. For example, the content of a business field is a certain year and month, and its actual meaning is used to indicate the project start time. Then the name of the database field encapsulated by the business field can be the project start time.
[0076] Step 102: Perform common processing on the common fields in the database fields to generate a back-end common method for the data source.
[0077] In the method described in this embodiment, a series of processing rules for common fields can be identified and sorted out according to EDI business requirements, so that these rules can be referred to when processing data from different data sources. Since the generation of EDI messages is a relatively repetitive task, these rules are encapsulated into back-end general methods written in the back-end code. When encountering a situation where common fields need to be processed, it is only necessary to call the corresponding general method without repeatedly writing the same processing code. This improves the reusability and maintainability of the code, handles this highly repetitive task efficiently and easily, and reduces the risk of errors.
[0078] Specifically, we can deeply analyze EDI business requirements and identify common fields that often appear in the processing process, such as date format conversion, string truncation, special character processing, etc. For these common fields, set unified processing logic to form rules. Ensure that when processing data from different data sources, a consistent method can be used for common fields to avoid code redundancy and improve processing efficiency. Encapsulate these rules into a back-end general method, which is used for general processing of common fields, can receive different types of input data, and process them according to the rules. For example, for the step of converting date strings of different formats to a standard date format, a date format conversion method can be organized, and date strings of multiple different formats can be converted to a standard date format in multiple scenarios. Or for the step of truncating strings that exceed the specified length, a string truncation method can be organized, etc.
[0079] In the method described in this embodiment, as an optional method, the backend general method can also be combined with Velocity, and these backend general methods can be directly called in the template to realize dynamic processing and display of data, thereby improving the flexibility and scalability of the backend general method.
[0080] Step 103: Define a common processing method and a personalized processing method for the template according to the template rules and the non-common fields in the database fields.
[0081] In the method described in this embodiment, Velocity macro script is a template engine technology that supports the definition of different processing methods to meet the needs of different business scenarios. Among them, the fields of EDI messages are complex and diverse. Velocity macro scripts can define common processing methods according to template rules (EDI field rules) to implement general and reusable processing logic. The processing efficiency of the template is improved, and the readability and maintainability of the code are enhanced.
[0082] For example, when recursively processing multiple box tickets and automatically outputting information in a loop, a dedicated public processing method can be defined. This public processing method can accept the number of lines to be recursively cut and the number of words to be output in a single line, and control the output format and layout through two parameters to meet the needs of the business scenario. In addition, this public processing method supports reuse. Once defined, it can be applied to any EDI document with the same business scenario without having to repeatedly write the same processing code.
[0083] In the method described in this embodiment, in the actual working scenario, there will be many differences specific to factors such as ship operators, channels, ports, etc., and different ship operators, channels and ports may have their own unique message formats and processing requirements. In view of these differences, the Velocity macro script can be used to define personalized processing methods. Among them, the personalized processing method is to define different processing methods according to the different values of the key element fields (i.e., non-common fields). Non-common fields include but are not limited to ship operator codes, channel types, port names, etc.
[0084] In the method described in this embodiment, the personalized processing method focuses on the processing logic in a specific business scenario. It is usually used in combination with the back-end general method to implement a complete processing flow from data source to template output. For example, when processing an EDI document of a specific shipping company, a personalized processing method can be defined and called. The method will execute different processing logics according to the different shipping company codes, and specifically, it can be a processing logic for the execution characteristics of the specific shipping company.
[0085] By combining public processing methods with personalized processing methods, various complex EDI documents can be processed more efficiently.
[0086] Step 104: Combine the public processing method, the personalized processing method and the backend general method to obtain the template.
[0087] In the method described in this embodiment, the composition of the template mainly includes a common processing method, a personalized processing method and a back-end general method. Among them, the data source that has processed the database field is used to provide the data input required by the template, and the common processing method, the personalized processing method and the back-end general method can be controlled by configuration parameters.
[0088] As an optional method, you can first create a new Velocity template and configure the template fields corresponding to the EDI message fields you want to generate in each row of the Velocity template. Ultimately, it can support users to reference data in Java objects through a simple template language and generate message output. Among them, when configuring the template field, you can obtain the processing rules for each EDI message field and process each template field. These processing rules include but are not limited to length restrictions, field format verification, and cutting loop output of the sender and receiver. For example, the length restriction can ensure that the field value does not exceed the predetermined number of characters. The field format verification can verify whether the field value meets specific format requirements, such as date format, number format, etc. The cutting loop output of the sender and receiver is for those fields that need to be output repeatedly, and the corresponding message content is generated cyclically through specific tags or delimiters.
[0089] In the method described in this embodiment, after completing the configuration of the template fields, the Velocity template is stored in the database as a template, so as to facilitate the management and maintenance of a large number of template files, and also facilitate quick retrieval and use when needed.
[0090] In the method described in this embodiment, the template is debugged, and debugging is a key step in ensuring the correctness of the template. During the debugging process, the system simulates a request to generate an EDI message and outputs the generated EDI message. If there is an error in the template, the system directly outputs the corresponding line number and specific error information. This improves the efficiency of error location and repair, and the problem can be quickly located and corrected.
[0091] In the method described in this embodiment, a preview template is also supported. The preview function displays the meaning of the data source represented by each line of fields in the template used to generate the EDI message, so that the user can intuitively see the meaning of the data source represented by each line of fields in the message, thereby improving the readability of the template and facilitating understanding of the correspondence between the message structure and the data source.
[0092] Step 105: Responding to the EDI message generation instruction from the business layer, generating an EDI message according to the template.
[0093] In the method described in this embodiment, at the business level, when the EDI message generation method is called, the system will accurately generate message elements line by line according to the preset EDI template configuration until a complete message is constructed. At the same time, the system will retain relevant data such as the detailed process and result records of the EDI message generation in the database in real time to form a log trace. Among them, the log can reflect every step of the message generation in detail, providing a reliable basis for subsequent analysis and inspection. As an optional method, a special log management page can also be configured to support users to view and manage all relevant log records.
[0094] In the method described in this embodiment, a comprehensive regression test is performed each time an EDI message is iteratively updated or its content is modified. The update log corresponding to the updated EDI message is obtained, and the update log is compared and analyzed with the log corresponding to the EDI message previously generated by the same business. In this way, the difference points before and after the modification can be quickly and accurately identified to ensure the correctness and consistency of the message update.
[0095] In the method described in this embodiment, the template is adjusted as the processing rules are modified. When the message format or content rules need to be modified, the user only needs to adjust the corresponding template directly without the need for code-level modification and testing. After the adjustment is completed, the template is saved and the template information in the database is updated through SQL statements to achieve rapid changes and online release of the message. This simplifies the message change process and shortens the time cycle for demand response and online release. For example, when the output length limit of the remark field needs to be adjusted, the user can directly modify the length rule of the remark data source row in the Velocity template, then save the template and update the database to quickly implement the change in demand. This change method that does not require code to be online not only improves the efficiency of development and testing, but also reduces operational risks and the possibility of human errors, providing strong technical support for the rapid response and flexible adjustment of EDI messages.
[0096] The method described in this embodiment achieves variable separation by decoupling code from data. The encapsulation of the underlying data source accurately reflects the business meaning it represents, and provides a source of field attributes for the visualization template. It facilitates the efficient and intuitive calling of subsequent Velocity templates, improves the readability and friendliness of the template, and lowers the threshold for learning and use. The public processing methods and personalized processing methods are highly reusable and maintainable, avoiding the situation where each field needs to be redeveloped and designed, reducing the risk of errors. Velocity scripts are easy to debug, and there is no need to write code to modify template-compatible rules, which simplifies the process of message changes and improves the efficiency of development and testing. Exception error reporting supports precise output location, improving the efficiency of error location and repair.
[0097] Embodiment 2: This application discloses another method for generating EDI messages, please refer to Figure 2a The method described in this embodiment introduces the whole process of obtaining the EDI message template.
[0098] Step 201: According to EDI business requirements, each field of the EDI document is disassembled and analyzed, and mapped to the underlying fields of the database.
[0099] Step 202: Encapsulate the mapped fields and name them to obtain database fields that can be called by the template.
[0100] Step 203: Process the common fields according to EDI business requirements and encapsulate to obtain the back-end general method for the data source.
[0101] Step 204: Define the common processing method using the Velocity macro script according to the template rules.
[0102] Step 205: Use Velocity macro script to define a personalized processing method for non-common fields.
[0103] Step 206: Combine the common processing method, the personalized processing method and the backend general method to obtain a template.
[0104] Based on the first and second embodiments, the present application discloses a method for generating an EDI message. When used by a user, Figure 2b As shown in the figure, the user interface UI (User Interface Layer) layer is used to interact with users and supports receiving users' EDI template rendering and display requests and outputting message POST and GET requests (i.e., POST and GET requests in the http protocol). After receiving the user's request, the business layer starts working through a variety of built-in business functions. These include EDI templates, EDI settings, EDI code conversion, batch / single messages, booking orders SO (shipping order), supplementary information SI (Supplemental Information), manifests (such as detailed information on a certain voyage, carriers, modes of transportation, etc.). Then, deep-level functions are selected in the data layer, including stored procedures, data caches, custom functions, transactions, reading and writing databases, etc. In this process, EDI will generate and send log records to the database. According to the above deep-level functions, the database begins to interact and process EDI templates and business data through databases such as MySQL or Oracle, and finally outputs the generated EDI messages in the output layer.
[0105] EDI template, based on the method for generating EDI message disclosed in the above embodiment, this embodiment correspondingly discloses a device for generating EDI message. Figure 3 , the device for generating an EDI message includes: a mapping unit 301, a general unit 302, a definition unit 303, a combination unit 304 and a generation unit 305;
[0106] The mapping unit 301 is used to map each field of the EDI document to the underlying field of the database to obtain the database field;
[0107] The general unit 302 is used to perform general processing on the common fields in the database fields to generate a backend general method for the data source;
[0108] The definition unit 303 is used to define a common processing method and a personalized processing method for the template according to the template rule and the non-common fields in the database fields;
[0109] The combining unit 304 is used to combine the common processing method, the individual processing method and the backend general method to obtain the template;
[0110] The generating unit 305 is used to respond to the EDI message generating instruction from the business layer and generate the EDI message according to the template.
[0111] Optionally, the mapping unit 301 includes:
[0112] The analysis subunit is used to analyze and disassemble the fields of the EDI document according to the EDI business requirements and map them to the underlying fields of the database;
[0113] The encapsulation subunit is used to encapsulate the mapped underlying fields and name them according to the business content to obtain the database fields.
[0114] Optionally, the general unit 302 includes:
[0115] Arrangement subunit, used to arrange common field processing methods according to EDI business requirements;
[0116] The processing subunit is used to perform common processing and encapsulation on the common fields according to the common field processing method to generate the backend common method.
[0117] Optionally, the definition unit 303 includes:
[0118] A common definition subunit, used to define the common processing method using a Velocity macro script according to the template rule;
[0119] The personality definition subunit is used to define the personality processing method according to the different values of the non-common fields by using the Velocity macro script.
[0120] Optionally, the combining unit 304 includes:
[0121] A new subunit is used to create a new Velocity template and configure the template field corresponding to each line of EDI message field in the Velocity template;
[0122] A rule processing subunit, used for processing each of the template fields according to different processing rules of the EDI message fields;
[0123] The storage subunit is used to store the Velocity template as the template.
[0124] Optionally, the device further comprises:
[0125] An adjusting unit is used to adjust the template following the modification of the processing rule.
[0126] Optionally, the device further comprises:
[0127] A debugging unit, used to debug the template and output error information that occurs; the error information includes the location where the error occurs;
[0128] The display unit is used to display the meaning of the data source represented by each line of fields in the template used to generate the EDI message.
[0129] Optionally, the device further comprises:
[0130] The retaining unit is used to process the EDI message and the related data of the EDI message into a log and retain it.
[0131] Optionally, the device further comprises:
[0132] An updating unit, configured to obtain an update log corresponding to the updated EDI message after the EDI message is iteratively updated;
[0133] The comparison unit is used to compare the update log with the log corresponding to the EDI message generated by the same business.
[0134] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0135] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0136] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0137] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.
[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating an EDI message, characterized in that: include: Map each field of the EDI document to the underlying field of the database to obtain the database field; Performing common processing on the common fields in the database fields to generate a back-end common method for the data source; According to the template rules and the non-common fields in the database fields, define a common processing method and a personalized processing method for the template; The template is obtained by combining the common processing method, the individual processing method and the back-end general method; In response to the EDI message generation instruction from the business layer, the EDI message is generated according to the template.
2. The method according to claim 1, characterized in that: The mapping of each field of the EDI document to the underlying field of the database to obtain the database field includes: According to EDI business requirements, each field of the EDI document is disassembled and analyzed, and mapped to the underlying fields of the database; The mapped underlying fields are encapsulated and named according to the business content to obtain the database fields.
3. The method according to claim 1, characterized in that The common fields in the database fields are processed in a universal manner to generate a back-end universal method for the data source, including: Arrange common field processing methods according to EDI business requirements; According to the common field processing method, the common fields are generally processed and encapsulated to generate the backend general method.
4. The method according to claim 1, characterized in that Defining a common processing method and a personalized processing method for the template according to the template rule and the non-common fields in the database fields includes: According to the template rules, the common processing method is defined using a Velocity macro script; The Velocity macro script is used to define the personalized processing method according to the different values of the non-common fields.
5. The method according to claim 1, characterized in that The step of combining the common processing method, the individual processing method and the backend general method to obtain the template includes: Create a new Velocity template, and configure the template fields corresponding to each line of EDI message fields in the Velocity template; Processing each of the template fields according to different processing rules of the EDI message fields; The Velocity template is stored as the template.
6. The method according to claim 5, characterized in that After the template is obtained by combining the common processing method, the individual processing method and the backend general method, the method further includes: The template is adjusted following the modification of the processing rules.
7. The method according to claim 1, characterized in that After the template is obtained by combining the common processing method, the individual processing method and the backend general method, the method further includes: Debugging the template and outputting the error information that occurs; the error information includes the location where the error occurs; The meaning of the data source represented by each row of fields in the template used to generate the EDI message is displayed.
8. The method according to claim 1, characterized in that After generating the EDI message, the method further comprises: The EDI message and the data related to the EDI message are processed into a log and retained.
9. The method according to claim 8, characterized in that After generating the EDI message, the method further comprises: After the EDI message is iteratively updated, an update log corresponding to the updated EDI message is obtained; The update log is compared with the log corresponding to the EDI message generated by the same business.
10. A device for generating an EDI message, characterized in that: include: mapping units, generic units, definition units, combination units, and generation units; The mapping unit is used to map each field of the EDI document to the underlying field of the database to obtain the database field; The general unit is used to perform general processing on the common fields in the database fields to generate a back-end general method for the data source; The definition unit is used to define a common processing method and a personalized processing method for the template according to the template rule and the non-common fields in the database fields; The combining unit is used to combine the common processing method, the individual processing method and the back-end general method to obtain the template; The generating unit is used to respond to the EDI message generating instruction from the business layer and generate the EDI message according to the template.