Disclosure of Invention
The embodiment of the application provides a method and a device for counting predicted available inventory based on metadata, which are used for solving the problems that currently, each counting program is independently developed, and the semantic representations of the same element are different and even contradictory, so that the counting accuracy of the predicted available inventory is influenced, the counting difficulty is increased, and the probability of counting errors is improved.
The embodiment of the application provides a predicted available inventory statistical method based on metadata, which comprises the following steps:
determining an expected available inventory statistics context; the statistical context comprises a material range and a statistical strategy identifier;
calling a corresponding statistical strategy according to the statistical strategy identification to obtain a plurality of source classes to be counted;
calling a calculation strategy interface to calculate the source classes to be counted;
and obtaining the statistical result of the predicted available inventory according to a predefined standard result interface and the calculation result.
In one example, a calculation policy interface is called to calculate the source classes to be counted, including: acquiring a matching rule in a statistical strategy; and correspondingly calculating each attribute of the source classes to be counted according to the matching rule.
In one example, invoking a compute policy interface includes: and acquiring configuration information according to the configuration of the calculation strategy interface, and loading a program to call the calculation strategy interface.
In one example, the statistical context includes a start date; obtaining a plurality of source classes to be counted, including: determining a time period to be counted corresponding to the starting date to the current time; and acquiring all source classes in the time period to be counted as the source classes to be counted.
In one example, the statistical context includes a period policy identification; calling a calculation strategy interface to calculate the source classes to be counted, wherein the calculation strategy interface comprises the following steps: calling a corresponding time interval strategy according to the time interval strategy identification; and calling a calculation strategy interface, and calculating a plurality of source classes to be counted in the time period to be counted by adopting the time period strategy.
In one example, calculating a number of source classes to be counted in the time period to be counted by using the time period policy includes: determining time period strategy details corresponding to the time period strategies; dividing the time period to be counted into a plurality of detailed time periods according to the time period strategy details; and respectively calculating the source classes to be counted in the plurality of detail time periods according to the corresponding time period strategy details.
In one example, after dividing the time period to be counted into a plurality of detail time periods according to the period policy details, the method further includes: and determining the starting date and the ending date of each detail time period according to the starting date.
In one example, the method further comprises: determining a number of period policies enabled in the system; determining a period policy for the statistical context to use from the enabled period policies.
In one example, obtaining statistics of projected available inventory based on predefined standard result interfaces and the calculation results includes: aiming at each source class to be counted, determining a mapping relation between each attribute of the source class and the attribute of a predefined standard result interface; and determining the value of each attribute in the statistical result of the expected available inventory according to the mapping relation and the calculation result.
The embodiment of the application provides a predicted available inventory statistics device based on metadata, which comprises:
a determination module that determines a projected available inventory statistics context; the statistical context comprises a material range and a statistical strategy identifier;
the acquisition module calls a corresponding statistical strategy according to the statistical strategy identifier to acquire a plurality of source classes to be counted;
the calling module is used for calling a calculation strategy interface and calculating the source classes to be counted;
and the result module is used for obtaining a statistical result of the predicted available inventory according to a predefined standard result interface and a calculation result.
The embodiment of the application provides a method and a device for counting estimated available inventory based on metadata, which at least have the following beneficial effects: the output standard of a standard result interface is established for predicting the available inventory, the consistent attribute of each source class is set, the mapping relation metadata of each source class and the standard output result is established, the data structure of the statistical result of the available inventory can be predicted uniformly, the source classes are ensured to adopt the same statistical and calculation method, the repeated construction of the statistical method is avoided, the situation that the same semantic generates divergence and even contradiction in the setting is avoided, the input and the output are unified and standardized, and the statistical efficiency is improved. And moreover, the matching rules among the attributes are determined, errors such as attribute mismatching and the like can be avoided in the calculation and statistics processes, and the accuracy of statistics is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only a few embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Fig. 1 is a flowchart of a method for statistics of forecasted available inventory based on metadata according to an embodiment of the present application, which includes the following steps:
s101: an estimated available inventory statistics context is determined.
In an embodiment of the present application, the server may determine an expected available inventory statistical context (hereinafter, referred to as statistical context) according to an operation of the user. The server may then count the projected available inventory for the corresponding material based on the relevant information in the statistical context. Where the statistical context is used to describe a statistical range in which inventory statistics are expected to be available.
The statistical context may include attributes such as material scope, organization scope, warehouse scope, start date, statistical strategy identification, period strategy identification, and the like. Wherein "material range" is used to represent materials involved in statistical calculations of projected available inventory; "organization scope" is used to refer to an organization involved in the statistical calculation of the projected available inventory; "warehouse scope" is used to denote a warehouse that participates in the statistical calculation of forecasted available inventory; "start date" is used to indicate the start date of the statistics, i.e., to define the time range of the statistics; the statistical strategy identifier is used for representing a unique identifier of a statistical strategy adopted for performing expected available inventory statistics, and the statistical strategy is a preset statistical rule and is specifically described in the following relevant description; the "period policy identifier" is used to indicate a unique identifier of a period policy used for performing the forecasted available inventory statistics, and the period policy is a time division rule for time-defining the statistical policy, and is described in detail below.
It should be noted that the materials, the organizations, the warehouses, and the like may be specifically set according to the content in the enterprise resource plan, which is not limited in this application.
S102: and calling a corresponding statistical strategy according to the statistical strategy identification to obtain a plurality of source classes to be counted.
In this embodiment of the present application, the server may determine a corresponding statistical policy according to the statistical policy identifier in the statistical context. And the server can load and acquire a plurality of source classes to be counted corresponding to the statistical strategy through calling the statistical strategy and through an acquisition source class method. The source class represents a business document participating in prediction of available inventory statistical calculation, and the change information of the inventory is recorded on the business document.
The statistical strategy is used for limiting source classes participating in the estimated available inventory statistics, and comprises a main entity of the statistical strategy and a sub-entity of the strategy source class.
The main entity of the statistical strategy comprises attributes such as identification, coding, name and description. Wherein, the 'identification' is used for representing a unique statistical strategy; "encoding" is used to denote the encoding of a statistical strategy; "name" is used to denote the name of the statistical strategy; "description" is used to indicate the use of statistical strategies and applicable scenarios.
The strategy source sub-entity comprises attributes such as identification, statistical strategy identification, source identification and the like. Wherein, the 'identification' is used for uniquely identifying the sub-entity policy source class; "statistical strategy identification" is used to indicate which statistical strategy the sub-entity strategy source belongs to; the "source class identification" is used to identify a source class that will participate in the projected available inventory calculation.
The source class includes attributes such as identification, source class encoding, source class name, expected available inventory item type, whether the system is pre-manufactured, etc. The 'identification' is used for uniquely identifying a source class, one source class represents a business document, and the business document can generate expected or predicted available inventory; the source type code is used for expressing the source type code, and usually adopts English abbreviation of business documents; "source class name" is used to denote the name of the source class, usually the name of a business document; "projected available inventory item type" is used to indicate the direction of exit or entry of projected available inventory, projected indicating a projected available inventory decrease, represented by a negative number, projected indicating a projected available inventory increase, represented by a positive number; whether the system is prefabricated or not is used for indicating whether the source class is prefabricated in the system or not, and the source class is added according to the requirement at the later stage.
In one embodiment, the server may determine the corresponding time period to be counted from the start date to the current time according to the start date in the statistical context. And then, the server can determine all the source classes belonging to the time period to be counted according to the document issuing time included in the attributes of all the source classes as the source classes to be counted.
In one embodiment, the statistical strategy further comprises a sub-entity, being a matching rule sub-entity. The matching rule is used for representing the supply and demand matching rule of each attribute in the bill corresponding to the source class and is also the supply and demand matching rule of each attribute in the predefined standard result interface. When statistical calculation is performed, each source class needs to be calculated according to the corresponding matching rule.
The matching rule sub-entity comprises an identifier, a statistical strategy identifier, an attribute, a matching rule and other attributes. The "identification" is used for uniquely identifying a matching rule, and the "statistical policy identification" is used for indicating which statistical policy the matching rule belongs to; "Attribute" is used to denote the attribute in the standard result interface defined by the matching rule; "matching rules" are used to indicate the specific content of the matching rules, i.e. how attributes are matched.
Specifically, most of the attributes in the standard result interface are enumerated types, and the matching rules determined according to the enumerated types mainly include three types: exact match, no match and no match. Wherein, "exact match" indicates that the attribute values being computed must be exactly equal, and "no match" indicates that the attribute values do not participate in the matching computation; "there is a match null" indicates that the attribute values being calculated may be different, that is, the attribute values in demand may match the calculation with the attribute values in supply without equality.
S103: and calling a calculation strategy interface to calculate a plurality of source classes to be counted.
In the embodiment of the present application, after obtaining a plurality of source classes to be counted, the server may invoke a calculation policy interface to perform calculations such as adding, subtracting, and assigning values on the source classes, so as to obtain the expected available inventory. Wherein the calculation policy interface is a predefined interface for making forecasted available inventory calculations.
In one embodiment, when performing statistical calculation on a plurality of source classes, the server may first determine a corresponding statistical policy according to the statistical policy identifier. The server can load the matching rules corresponding to the statistical strategy through the method of acquiring the matching rules in the statistical strategy, and match the attributes of different source classes. And then, the server can correspondingly calculate each attribute of the source class according to the matching rule.
In one embodiment, the server may obtain the relevant configuration information through the operation of "obtaining the computing policy" in the configuration according to the computing policy interface, and load an implementation class program for implementing the computing policy interface, so as to implement the call to the computing policy interface.
In one embodiment, the server may invoke the corresponding period policy based on the period policy identification in the statistical context. Then, the server can adopt the time interval strategy and call a calculation strategy interface to calculate a plurality of source classes to be counted in the time interval to be counted.
The period policy is used to time limit the statistical policy, for example, the time period to be counted is divided into weeks, and the statistics are performed once per week.
The time interval strategy main entity comprises attributes such as identification, time interval strategy coding, time interval strategy name, starting or not, system built-in or not, remarks and the like. Wherein, the 'identification' is used for uniquely identifying a period policy; "time period policy encoding" is used to denote encoding of a time period policy; "period policy name" is used to denote the name of the period policy; whether the time interval strategy is enabled or not is used for indicating whether the time interval strategy is in an enabled state in the system, if yes, the time interval strategy can be selected in the statistical process, and if not, the time interval strategy is not available; whether the system is built-in or not is used for indicating whether the time interval strategy is prefabricated or not, and the strategy is added according to the requirement at the later stage; "remarks" are used to describe the use of this time period policy.
In one embodiment, the server, after obtaining the period policy, may determine period policy particulars included in the period policy. The server can divide the time period to be counted into a plurality of detail time periods according to the time period strategy details. Then, the server can respectively calculate the source classes in the corresponding detail time periods according to the corresponding time period strategy details.
The time interval strategy detail sub-entity comprises attributes such as identification, time interval strategy identification, sequence number, time interval type, time interval number, days per time interval and the like. Wherein, the 'identification' is used for uniquely identifying the policy detail of one time period; "period policy identification" is used to indicate to which period policy the period policy details belong; the "sequence number" is used to indicate the sequence of the period policy details in the corresponding period policy, that is, the application sequence applied in the period to be counted; the "period type" is used to indicate a type corresponding to the period policy statement, and the attribute is an enumeration type, including three enumeration values of day, week and month, that is, a statistical time unit of the period policy statement; "days per period" is used to indicate the number of days for which the period policy statement corresponds to the respective period type, i.e., "day" corresponds to a value of 1, "week" corresponds to a value of 7, and "month" corresponds to a value of 30; the term "number of time periods" is used to indicate the number of time periods that the time period policy details need to be applied, and the greater the number of time periods, the longer the detailed time period corresponding to the time period policy details, for example, the time period type of the time period policy details is day, the number of time periods is 10, and it indicates that within 10 days, statistical calculation needs to be performed on a day-by-day basis.
For example, the time period to be counted includes 21 days, the time period policy includes 2 time period policy details, the 1 st time period policy detail is that the time period type is week, the time period number is 2, the 2 nd time period policy detail is that the time period type is day, and the time period number is 7. Therefore, the server may perform statistical calculation on the source class within 14 days before the time period to be counted every week according to the 1 st period policy specification, and perform statistical calculation on the source class within 7 days after the time period to be counted every day according to the 2 nd period policy specification.
In one embodiment, the server may further calculate the start date and the end date of each detail period according to the parameter of the start date in the input statistical context by the operation of "calculating the detail period" in the period policy to obtain the returned list of the detail periods.
In one embodiment, the server, in determining the period policy, may first determine the period policy in the system that is in an enabled state. The server may then determine one of the time period policies to choose from.
In one embodiment, when the server calls the calculation policy interface, it may input parameters such as a source class identifier, a detailed time period list, a matching rule, a statistical context, and the like corresponding to each source class through a "calculate predicted available inventory" operation therein, and calculate a plurality of service documents in the source class to obtain a preliminary calculation result corresponding to the source class. And then, the server can collect and correspondingly calculate the preliminary calculation results of all the source classes according to all the detail time intervals to obtain the final calculation result.
S104: and obtaining a statistical result of the predicted available inventory according to a predefined standard result interface and a calculation result.
In the embodiment of the application, the server can definitely predict the data structure of the statistical result of the available inventory according to the predefined standard result interface, and assign values to the parameters in the statistical result according to the calculation result to obtain the final statistical result.
In one embodiment, for each source class to be counted, the server may determine a mapping relationship between each attribute of the source class and an attribute of a predefined standard result interface according to the source class attribute mapping configuration. Therefore, according to the preliminary calculation result of the source class, the server can assign the attribute corresponding to the statistical result according to the attribute value in the preliminary calculation result to obtain the preliminary statistical result corresponding to the source class. Finally, the server can perform statistical calculation according to the preliminary statistical results obtained from all the source classes and the dimensions of materials, detail time intervals and the like to obtain the final statistical result of the predicted available inventory.
In one embodiment, the source class attribute mapping is configured to represent a mapping between attributes of a business document of the source class and attributes in the standard result interface.
The source attribute mapping configuration comprises attributes such as identification, source identification, standard interface attribute and source attribute. The 'identification' is used for uniquely identifying the attribute mapping record of one source class; the "source class identifier" is used to indicate to which source class the attribute mapping relationship belongs; the 'standard interface attribute' is used for representing the attribute in the standard result interface corresponding to the attribute mapping relation; the "source class attribute" is used to indicate the attribute of the source class corresponding to the attribute mapping relationship, the attribute is mapped with the attribute in the standard result interface, and when the expected available inventory is counted, the value of the attribute in the standard result interface is taken as the value of the attribute.
The standard result interface is used for defining a data structure of a statistical result, and comprises attributes such as transceiving type, inventory organization, materials, material versions, accounting companies, sales orders, suppliers, profit centers, customers, storage places, goods spaces, measurement units, batches, feature codes, quality levels, free items, processes, items, tasks, quantity, source type types, source type identifiers, source type row identifiers, source type sub-row identifiers and the like.
The receiving and sending type is used for indicating the direction of warehouse-out or warehouse-in, the warehouse-out can be indicated by negative numbers, and the warehouse-in can be indicated by positive numbers; "inventory organization" is used to refer to a management organization that forecasts available inventory; "materials" is used to refer to products, commodities that participate in projected available inventory statistics; the 'material version' is used for representing the version difference between the same materials, and statistics can be carried out according to the versions when inventory statistics is carried out; "accounting company" is used to indicate to which company the expected available inventory belongs in terms of finances; "sales order" is used to indicate that the projected available inventory is order inventory, used only for a particular order; "supplier" is used to indicate the supplier of the projected available inventory of material; "profit center" is used to mean a profit center that predicts the available inventory, facilitating financial accounting; "customer" is used to indicate a particular customer to which the projected available inventory belongs, and is used only by that particular customer; "storage location" is used to refer to a storage warehouse that is projected to have available inventory; "Bid" is used to indicate a storage bin for inventory expected to be available; "units of measure" is used to indicate the unit of measure of the material with coarse expected available stock, and the same material, if the unit of measure is different, will also be counted as different expected available stock; "batch" is used to mean a different batch to which the projected available inventory belongs, materials belonging to a different batch will also be counted as a different projected available inventory; "feature code" is used to indicate the feature code that the expected available inventory has, and different feature codes will be counted as different expected available inventories; "quality rating" is used to indicate the quality rating of the projected available inventory, different quality ratings will be counted as different projected available inventory; the free item is used for representing an adjustable free dimension, and during statistics, the predicted available inventory can be counted according to the content of the free dimension; "process" is used to indicate different processing stages of a product in inventory, including finished products, semi-finished products, etc.; "item" is used to indicate that the expected available inventory is counted in terms of items, different items cannot be borrowed from each other; "task" is used to mean that the forecasted available inventory is counted according to task, and different tasks cannot be mutually lent; "quantity" means the quantity of the expected available stock, the quantity is a positive number when the type of transmission and reception is expected, and the quantity is a negative number when the type of transmission and reception is expected; "source class category" is used to indicate which documents the available inventory is expected to be generated from; "Source class identifier" is used to indicate which document the available inventory is expected to be generated from; "source class line identification" is used to predict from which detailed line of the document the available inventory was generated; the "source class sub-row identification" is used to indicate from which detail sub-row the available inventory is expected to be generated. It should be noted that, in practical applications, each attribute in the standard result interface may be set as needed, which is not limited in this application.
In the embodiment of the application, the output standard of the standard result interface is established for predicting the available inventory, the consistent attribute of each source class is set, the mapping relation metadata of each source class and the standard output result is established, the data structure of the statistical result of the available inventory can be predicted uniformly, the source classes are ensured to adopt the same statistical and calculation method, the repeated construction of the statistical method is avoided, the situation that the same semantic generates divergence and even contradiction in setting is avoided, the input and the output are uniform and standardized, and the statistical efficiency is favorably improved. And moreover, the matching rules among the attributes are determined, errors such as attribute mismatching and the like can be avoided in the calculation and statistics processes, and the accuracy of statistics is improved.
For ease of understanding, the present application illustrates a statistical process for predicting available inventory by way of example for a sales order. The statistical process of the projected available inventory includes the following steps:
first, the server may determine a statistical context of the inventory expected to be available. As shown in Table 1, the left column is the attribute of the statistical context and the right column is the corresponding attribute value.
TABLE 1
| Attribute name | Value of |
| Range of materials | Product A |
| Tissue range | Tissue B |
| Scope of warehouse | Warehouses a-c |
| Date of start | Month 5 and 11Day(s) day |
| Statistical policy identification | Standard |
| Time period strategy identification | General |
Secondly, the server can call a corresponding statistical strategy according to the statistical strategy identifier in the statistical context to obtain the source class and the corresponding matching rule.
As shown in table 2, the statistical strategy corresponding to the Standard is shown, the left column is the attribute of the statistical strategy, and the right column is the corresponding attribute value.
TABLE 2
It can be known from the description of the statistical strategy that the source classes corresponding to the statistical strategy are three source classes of a sales order, a purchase order and a production order, and the matching rule corresponding to the statistical strategy is limited to match only the materials.
Therefore, the server can obtain the source class identifications corresponding to the three source classes through the policy source class sub-entity. Table 3 shows the contents of the policy source class sub-entity, wherein 1 is the attribute of the policy source class, and 2-4 rows respectively show the attribute values corresponding to the three source classes.
TABLE 3
| Identification | Statistical policy identification | Source class identification |
| 1 | Standard | SalesOrder |
| 2 | Standard | PurchaseOrder |
| 3 | Standard | ManufactureOrder |
Then, the server can determine the corresponding source class according to the obtained source class identifiers SalesOrder, purchaseOrder and ManufactureOrder. As shown in Table 4, the contents of the sales order source class are listed on the left as the attributes of the sales order source class and on the right as the corresponding attribute values.
TABLE 4
| Attribute name | Value of |
| Identification | SalesOrder |
| Source class encoding | SalesOrder |
| Source class name | SaleOrder form |
| Projected available inventory item types | It is expected to |
| Whether the system is prefabricated | Is that |
The contents of the purchase order source class and the production order source class are similar to those of table 4, and are not described herein again.
And the server can also determine a matching rule corresponding to the statistical strategy through the statistical strategy identifier. As shown in table 5, the content of the matching rule is shown in line 1, which represents the attribute of the matching rule, and line 2 represents the corresponding attribute value.
TABLE 5
| Identification | Statistical policy identification | Properties | Matching rules |
| 1 | Standard | Material(s) | Strict matching |
Third, the server may invoke a compute policy interface to compute the source class.
In the calculation process, the server may first invoke a corresponding period policy according to the period policy identifier in the statistical context. As shown in Table 6 for General corresponding period policy, the left column identifies the attributes of the period policy and the right column indicates the corresponding attribute values.
TABLE 6
| Attribute name | Means of |
| Identification | General |
| Time period strategy encoding | General |
| Time period policy name | Universal time period strategy |
| Whether or not to start | Is that |
| Whether or not the system is built in | Is that |
| Remarks for note | |
And the server can determine the period policy details corresponding to the period policy identification according to the period policy identification General. As shown in table 7, the content of the period policy statement is shown in line 1, where the attribute of the period policy statement is shown in line 2, and the attribute values corresponding to the period policy statements are shown in line 4.
TABLE 7
Assuming that the current date is 7 months and 7 days, table 7 may indicate that, in the 1 st period policy specification, if there are 7 periods of the period type "day", within 7 days (i.e., 7.1 to 7.7) in which the current date is pushed forward, statistics is performed on the expected available inventory once a day; in the 2 nd time interval strategy specification, if the number of the time intervals with the time interval type of week is 3, the predicted available inventory is counted once per week within 3 weeks (namely 6.10-6.30) of continuing to push forward; in the 3 rd period policy specification, if there are 1 periods with period type "month", then within 1 month of continuing the move forward (i.e., 5.11-6.9), a monthly statistic of the projected available inventory is made. Therefore, more detailed statistics can be carried out on the predicted available inventory in a time period close to the current date, the key points of the statistics can be made clear, meanwhile, part of the statistical workload is saved, and the statistical efficiency is improved.
Then, the server may invoke a "calculate forecasted available inventory" operation of the calculation policy, and for each source class, such as a sales order, the source class identifier of the sales order, the time period policy details, the matching rules, and the statistical context are input, and through this operation, a preliminary calculation result obtained by determining statistics of all sales orders in the sales order source class is calculated.
Then, the server can determine the mapping relation between each attribute in the sales order source class and each attribute in the standard result interface according to the sales order source class attribute mapping. As shown in table 8, line 1 represents the attributes of the source attribute map, and the following lines are all corresponding attribute values. Wherein, the 3 rd column and the 4 th column represent two attributes having a mapping relationship.
TABLE 8
The server can assign the preliminary calculation result of the sales order source class to the data structure in the standard result interface according to the mapping relation so as to obtain the preliminary statistical result corresponding to the sales order source class. The calculation process of the preliminary statistical results of the purchase order source class and the production order source class is the same as the above calculation process of the sales order source class, and the description thereof is omitted here.
Through the preliminary statistics, the server can respectively obtain the preliminary statistical results corresponding to the sales order source class, the purchase order source class and the production order source class, and the data structures of the three preliminary statistical results are the same.
And then, the server can perform combined statistical calculation on the three primary statistical results from dimensions such as materials, detail time periods and the like to obtain a final statistical result of the predicted available inventory.
Based on the same inventive concept, the metadata-based method for statistics of forecasted available inventory provided by the embodiment of the present application further provides a corresponding apparatus for statistics of forecasted available inventory based on metadata, as shown in fig. 2.
Fig. 2 is a schematic structural diagram of a device for statistics of forecasted available inventory based on metadata according to an embodiment of the present application, which specifically includes:
adetermination module 201 that determines a projected available inventory statistics context; the statistical context comprises a material range and a statistical strategy identifier;
the obtainingmodule 202 calls a corresponding statistical strategy according to the statistical strategy identifier to obtain a plurality of source classes to be counted;
thecalling module 203 calls a calculation strategy interface to calculate the source classes to be counted;
theresult module 204 obtains the statistical result of the predicted available inventory according to the predefined standard result interface and the calculation result.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the present application pertains. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.