Configuration type attribute change adaptation method
By creating generic classes and integrating user and table data in the lithium battery baking control program, the problem of changing configuration properties requires modifying a large amount of code, and efficient adaptation of configuration properties is achieved.
Patent Information
- Application Number
- CN202510444869.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-18
AI Technical Summary
In the lithium battery baking control program, changes in configuration properties require modification of a large amount of underlying code and user interface, causing developers to spend a lot of time and effort.
By creating a generic class, it defines its implementation class inherits the change event class, and creates users, tables and databases within the generic class, integrates user internal attributes and table internal data, and binds the tables to the user interface to display changes in configuration attributes.
This reduces the time and effort of developers to modify the user interface and underlying code. Configuration property changes can be directly reflected in the user interface, improving the efficiency of configuration property changes.
Smart Images

Figure CN120336340A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the technical field of lithium battery baking. More specifically, the present invention relates to an adaptation method for configured attribute changes. Background Art
[0002] The lithium battery baking control program contains a large number of configured attributes, such as scheduling robot basic configurations (such as IP addresses, ports), assembly robots, barcode scanners, ovens, process parameters, etc. The number of these configured attributes ranges from hundreds or thousands to tens of thousands. When adding or deleting corresponding configured attributes, in addition to modifying the underlying code related to the configured attributes, it is also necessary to add or delete buttons on the user interface, and add or delete a large amount of underlying code related to the user interface, and click the button to write. These steps require a lot of time and effort from developers.
[0003] In view of this, there is an urgent need to provide an adaptation method for configured attribute changes to solve the above problems. Summary of the Invention
[0004] In order to solve at least one or more of the above technical problems in the background art, the present invention proposes an adaptation method for configured attribute changes. For this purpose, the present invention provides the following technical solutions.
[0005] In a first aspect, the present invention discloses an adaptation method for configured attribute changes, including: S1: Create a generic class, and constrain the implementation class of the generic class to inherit the change event class; S2: Create a user, a table, and a database inside the generic class; The user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; S3: Obtain all the attributes inside the user; S4: Read the local data into the table; S5: Integrate all the attributes inside the user and the attributes of the local data inside the table; S6: Bind the table to the user interface to display all the attributes of the user on the user interface.
[0006] Preferably, integrating all the attributes inside the user and the attributes of the local data inside the table includes: configuring the names of the local data attributes inside the table to be the same as the names of all the attributes inside the user.
[0007] Preferably, configuring the names of the local data attributes inside the table to be the same as the names of all the attributes inside the user includes: querying one by one whether the name of each attribute among all the attributes inside the user exists in the table to determine whether to update the names of the local data attributes in the table; If the number of names of the local data attributes in the table is less than the number of names of all the attributes inside the user, then add the configuration attributes corresponding to all the attributes inside the user to the table in an added manner; If the number of names of the local data attributes in the table is more than the number of names of all the attributes inside the user, then delete the names of the redundant attributes in the table; And write the names of the attributes that have changed in the table into the database; if the names of the attributes in the table have not changed, there is no need to write.
[0008] Preferably, integrating all the attributes inside the user with the attributes of the local data inside the table further includes: and assigning the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user.
[0009] Preferably, assigning the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user includes: if the names of the local data attributes in the table are the same as the names of all the attributes inside the user, then read the values of the local data attributes in the table and write them to the corresponding attribute names inside the user.
[0010] Preferably, add a response event in response to a change in the value of any attribute inside the user, so that when the value of an attribute on the user interface changes, save the changed value of the attribute to the database.
[0011] Preferably, step S3 obtains all the attributes inside the user by calling typeof(user).GetProperties().ToList().
[0012] Preferably, step S4 reads the local data into the table by using the database's GetTab(TabName,"*").
[0013] Preferably, writing the names of the attributes that have changed in the table into the database can write the names of the attributes that have changed in the table into the database through the DataTable.getChang() function.
[0014] Preferably, to save the values of the attributes that will change into the database, it can be achieved by calling user.DataSave() to save the values of the attributes that have changed in the table into the database.
[0015] In a second aspect, the present invention also discloses an adaptation device for configuration-based attribute changes, including: Module M1, which is used to create a generic class and constrain that the implementation class of the generic class must inherit the change event class; Module M2, which is used to create a user, a table, and a database inside the generic class; the user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; Module M3, which is used to obtain all the attributes inside the user; Module M4, which is used to read local data into the table; Module M5, which is used to integrate all the attributes inside the user and the attributes of the local data inside the table; Module M6, which is used to bind the table to the user interface to display all the attributes of the user on the user interface.
[0016] In a third aspect, the present invention also provides an electronic device, including: a processor and a memory, where the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the method described in one or more embodiments of the first aspect.
[0017] In a fourth aspect, the present invention also provides a computer-readable storage medium, including: storing a computer program, and when the computer program is executed by a processor, the processor is caused to execute the method described in one or more embodiments of the first aspect.
[0018] At least one of the above technical solutions adopted by this application can achieve the following beneficial effects: By using the device described in the above and multiple solutions of the present invention, that is, the present invention can create a generic class and limit its implementation class to inherit the change event class, and create a user, a table, and a database inside the generic class. By integrating all the attributes inside the user and the attributes of the local data inside the table, and binding the table to the user interface. Thus, when the configuration-based attributes change (for example, when a large number of configuration-based attributes need to be added or deleted), developers do not need to spend a lot of time and effort modifying the user interface and the underlying code related to the user interface. The change of the configuration-based attributes can be reflected through the user interface, that is, after the configuration-based attributes change, all the attributes of the changed user can be displayed on the user interface.
[0019] In some embodiments, the present invention can further assign the value corresponding to the name of the local data attribute inside the table to the corresponding attribute name inside the user, and add a response event that responds to the change of any attribute value inside the user. When the value of the attribute on the user interface changes, the changed value of the attribute is saved to the database. Thus, when the value of the attribute on the user interface is modified, there is no need to modify the code again to implement the saving of the value of the attribute. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] By referring to the following detailed description of the drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understandable. In the drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals indicate the same or corresponding parts, wherein: Figure 1 is a flowchart of the methods of steps S1 to S6 in an adaptation method for configuration-based attribute changes according to an embodiment of the present invention; Figure 2 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] Embodiments will now be described with reference to the drawings. It should be understood that, for simplicity and clarity of illustration, where considered appropriate, reference numerals may be repeated in the drawings to indicate corresponding or similar elements. Additionally, the present invention sets forth numerous specific details in order to provide a thorough understanding of the embodiments described herein. However, those of ordinary skill in the art will understand that the embodiments described herein may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the embodiments described herein. Moreover, this description should not be considered as limiting the scope of the embodiments described herein.
[0022] According to an embodiment of the present invention, an adaptation method for configuration-based attribute changes is provided, including: S1: Create a generic class, and constrain that the implementation class of the generic class must inherit from the change event class; S2: Create a user, a table, and a database inside the generic class; The user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; S3: Obtain all the attributes inside the user; S4: Read the local data into the table; S5: Integrate all the attributes inside the user with the attributes of the local data inside the table; S6: Bind the said table to the user interface to display all the attributes of the user on the user interface.
[0023] For step S3 mentioned above, all the attributes inside the user can be obtained by calling typeof(user).GetProperties().ToList().
[0024] For step S4 mentioned above, the local data can be read into the said table by using GetTab(TabName, "*") of the database.
[0025] Binding the said table to the user interface as mentioned above can be to directly bind the table to the DataSource property of the dataGridView1 control on the user interface, so as to realize the display of all the attributes inside the user. All the attributes here refer to the name and value. The name can be such as Name, LocalIP, RemotePort, PlcEnable, etc.; the value is the value of the data corresponding to the name, for example, the value of the data corresponding to Name is the Plc name, the value of the data corresponding to LocalIP is 192.168.250.10, the value of the data corresponding to RemotePort is 3000, and the value of the data corresponding to PlcEnable is 0 or 1.
[0026] Integrating all the attributes inside the user with the attributes of the local data inside the said table as mentioned above includes: configuring the names of the local data attributes inside the table to be the same as the names of all the attributes inside the user.
[0027] Specifically, it includes: querying one by one whether the name of each attribute among all the attributes inside the user exists in the table to determine whether to update the name of the local data attribute in the table; if the number of the names of the local data attributes in the table is less than the number of the names of all the attributes inside the user, adding the configuration attributes corresponding to all the attributes inside the user to the table in an added way; if the number of the names of the local data attributes in the table is more than the number of the names of all the attributes inside the user, deleting the names of the redundant attributes in the table; and writing the names of the attributes that have changed in the table into the database; if the names of the attributes in the table have not changed, there is no need to write.
[0028] Writing or saving the names of the attributes that have changed in the said table into the database as mentioned above can write the names of the attributes that have changed in the table into the database by using the DataTable.getChange() function.
[0029] It is easy to understand that the purpose of writing the names of the attributes that have changed in the table into the database is to update the table. Since the implementation class of the generic class is required to inherit the change event class, after binding the table to the user interface, all the attributes of the updated user can be displayed on the user interface.
[0030] By using the device described in the above and multiple solutions of the present invention, that is, the present invention can create a generic class and limit its implementation class to inherit the change event class, and create a user, a table, and a database inside the generic class. By integrating all the attributes inside the user with the attributes of the local data inside the table, and binding the table to the user interface. Thus, when the configuration attributes change (for example, when a large number of configuration attributes need to be added or deleted), developers do not need to spend a lot of time and effort modifying the user interface and the underlying code related to the user interface. The change of the configuration attributes can be reflected through the user interface, that is, all the attributes of the changed user can be displayed on the user interface after the configuration attributes change.
[0031] In some of the following embodiments of the present invention, the integration of all the attributes inside the user with the attributes of the local data inside the table further includes: and assigning the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user.
[0032] In the above embodiment, the assigning the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user includes: if the names of the local data attributes in the table are the same as the names of all the attributes inside the user, then reading the values of the local data attributes in the table and writing them into the corresponding attribute names inside the user.
[0033] Further, by adding a response event that responds to the change of any attribute value inside the user, so that when the value of the attribute on the user interface changes, the value of the changed attribute is saved into the database. Among them, saving the value of the changed attribute into the database can be achieved by calling user.DataSave(), and saving the value of the changed attribute in the table into the database.
[0034] In each of the above embodiments, the present invention can further assign the value corresponding to the name of the local data attribute inside the table to the corresponding attribute name inside the user, and add a response event for responding to the change of any attribute value inside the user. When the value of an attribute on the user interface changes, the changed value of the attribute is saved to the database. Thus, when the value of an attribute on the user interface is modified, there is no need to write another piece of code to save the value of the attribute. That is, the above embodiments can save the changed values of the data on the user interface. When the value of a configuration-type attribute is modified, in order to save the modified value, it is often necessary to modify the code to implement the saving of the modified value. By using the technical means of the above embodiments, there is no need to modify or write code again to implement the saving of the value.
[0035] In the following second aspect, an embodiment of the device of the present application can be used to execute an adaptation method for a change in a configuration-type attribute disclosed in the first aspect of the present invention. For details not disclosed in the embodiments of the device of the present application, please refer to the method embodiments of the present application. An adaptation device for a change in a configuration-type attribute disclosed by the present invention specifically includes: Module M1, configured to create a generic class, and constrain the implementation class of the generic class to inherit from the change event class; Module M2, configured to create a user, a table, and a database inside the generic class; the user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; Module M3, configured to obtain all attributes inside the user; Module M4, configured to read local data into the table; Module M5, configured to integrate all attributes inside the user and the attributes of the local data inside the table; Module M6, configured to bind the table to the user interface to display all attributes of the user on the user interface.
[0036] In the third aspect, the present invention further provides an electronic device, including: a processor and a memory, where the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method described in one or more of the embodiments in the first aspect. Wherein, computer instructions are stored in the memory, and when the computer instructions are executed by the processor, the device executes the methods provided in the various embodiments of the first aspect above.
[0037] In the fourth aspect, the present invention further provides a computer-readable storage medium, including: storing a computer program, and when the computer program is executed by a processor, the processor executes the method described in one or more of the embodiments in the first aspect.
[0038] In the present invention, the foregoing readable storage medium may be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, the computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as dynamic random access memory DRAM, hybrid memory cube HMC, etc., or any other medium that can be used to store the required information and can be accessed by an application, module, or both. Any such computer storage medium may be part of the device or accessible or connectable to the device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that can be stored or otherwise held by such a computer-readable medium.
[0039] Those skilled in the art should understand that the embodiments of the present invention may be provided as a device, system, or apparatus. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer device implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, other readable memories, etc.) that contain computer-usable program code.
[0040] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0041] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An adaptation method for configuration-based attribute changes, characterized in that Including: S1: Create a generic class, and constrain that the implementing class of the generic class must inherit the change event class; S2: Create a user, a table, and a database inside the generic class; The user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; S3: Obtain all the attributes inside the user; S4: Read local data into the table; S5: Integrate all the attributes inside the user with the attributes of the local data inside the table; S6: Bind the table to the user interface to display all the attributes of the user on the user interface.
2. The adaptation method for configuration-based attribute changes according to claim 1, wherein The integration of all the attributes inside the user with the attributes of the local data inside the table includes: configuring the names of the local data attributes inside the table to be the same as the names of all the attributes inside the user.
3. The adaptation method for configuration-based attribute change according to claim 2, characterized in that The configuring the names of the local data attributes inside the table to be the same as the names of all the attributes inside the user includes: querying one by one whether the name of each attribute among all the attributes inside the user exists in the table to determine whether to update the name of the local data attribute in the table; If the number of the names of the local data attributes in the table is less than the number of the names of all the attributes inside the user, add the configuration attributes corresponding to all the attributes inside the user to the table in an added way; If the number of the names of the local data attributes in the table is more than the number of the names of all the attributes inside the user, delete the names of the redundant attributes in the table; And write the names of the attributes that have changed in the table into the database; if the names of the attributes in the table have not changed, there is no need to write.
4. The adaptation method for configuration-based attribute change according to claim 3, characterized in that The integration of all the attributes inside the user with the attributes of the local data inside the table further includes: and assign the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user.
5. The adaptation method for configuration-based attribute change according to claim 4, characterized in that The assigning the values corresponding to the names of the local data attributes inside the table to the corresponding attribute names inside the user includes: if the names of the local data attributes in the table are the same as the names of all the attributes inside the user, read the values of the local data attributes in the table and write them into the corresponding attribute names inside the user.
6. The adaptation method for configuration-based attribute change according to claim 5, characterized in that Add a response event for any change in the value of an attribute inside the user, so that when the value of an attribute on the user interface changes, save the changed value of the attribute into the database.
7. An adaptation device for configuration-based attribute changes, characterized in that Including: Module M1, used to create a generic class, and constrain that the implementing class of the generic class must inherit the change event class; Module M2, used to create a user, a table, and a database inside the generic class; the user represents the user of the generic class, the table is used to store local data, and the database is used to save the data inside the user; Module M3, used to obtain all the attributes inside the user; Module M4, used to read local data into the table; Module M5, used to integrate all the attributes inside the user with the attributes of the local data inside the table; Module M6, for binding the said form to a user interface to display all attributes of the user on the user interface.
8. An electronic device, characterized in that, Comprising: Comprising a processor and a memory, the memory storing a computer program, which when executed by the processor causes the processor to execute the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, Comprising: Storing a computer program, which when executed by a processor causes the processor to execute the steps of the method according to any one of claims 1-6.