A cost granularity dynamic division method and system supporting multiple pricing modes

CN122948181APending Publication Date: 2026-10-20BEIJING ZHIBANG INT SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611183018.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0005]本申请提供一种支持多计价方式的成本颗粒度动态划分方法及系统,旨在解决现有技术在企业资源计划系统的成本核算过程中,多种成本计价方式下成本数据管理复杂、成本核算对象的细化程度适配性不足以及计价方式变化时成本数据连续性难以保证的问题

Benefits of technology

[0070]本申请基于对现有技术问题的进一步分析和研究,认识到在企业资源计划系统的成本核算过程中,多种成本计价方式下成本数据管理复杂、成本核算对象的细化程度适配性不足以及计价方式变化时成本数据连续性难以保证的问题,通过获取目标存货对象在当前核算周期对应的第一计价方式及成本业务日志,根据计价方式与成本颗粒度规则之间的映射关系确定第一目标颗粒度字段集合,使成本业务日志能够按照与当前计价方式相适配的核算维度进行归组和成本核算,并将形成的成本日志组及成本核算结果统一存储为成本汇总记录,由此无需针对不同计价方式分别设置彼此独立的成本数据处理结构,能够降低多计价方式并存时的成本数据管理复杂度;同时,通过获取下一核算周期对应的第二计价方式并判断计价方式是否发生变化,在计价方式发生变化时确定待结转成本业务日志,并依据第二计价方式对应的第二目标颗粒度字段集合对待结转成本业务日志重新归组和成本重算,使原核算周期的结存成本能够转换为与下一核算周期计价方式相适配的期初成本汇总记录,进而建立待结转成本业务日志与期初成本汇总记录之间的关联关系,因此,能够根据不同计价方式动态调整成本核算对象的细化程度,并保持计价方式变化前后成本数据的衔接关系,从而解决多种成本计价方式下成本数据管理复杂、成本核算对象细化程度适配性不足以及计价方式变化时成本数据连续性难以保证的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This application discloses a method and system for dynamically dividing cost granularity that supports multiple pricing methods, relating to the field of enterprise resource planning cost accounting technology. The method obtains the first pricing method and cost business logs of the target inventory object in the current accounting period. Based on the mapping relationship between the pricing method and cost granularity rules, it determines the first target granularity field set, groups and calculates the cost business logs, and generates cost summary records and establishes relationships in the unified cost master table. It then obtains the second pricing method for the next accounting period. When the pricing method changes, it determines the cost business logs to be carried forward, regroups and recalculates the costs according to the second target granularity field set, and generates initial cost summary records and corresponding relationships. Therefore, it can dynamically adapt the cost accounting granularity to different pricing methods, reduce the complexity of cost data management, and ensure the continuity and consistency of cost data before and after changes in pricing methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of enterprise resource planning cost accounting technology, and in particular to a method and system for dynamically dividing cost granularity that supports multiple pricing methods. Background Technology

[0002] As businesses expand and their operations diversify, they typically utilize Enterprise Resource Planning (ERP) systems to manage procurement, production, inventory, sales, and finance in a unified manner. Inventory cost accounting is a crucial component of the financial management within ERP systems. It reflects cost changes in inventory during acquisition, circulation, consumption, and inventory balance, providing a data foundation for financial accounting, operational analysis, and management decision-making. Because different companies differ in the nature of their inventory, business processes, and management requirements, different cost valuation methods are often employed in practice to meet the cost accounting needs of various scenarios.

[0003] Existing enterprise resource planning (ERP) systems typically record and calculate cost data based on pre-defined business rules. However, different cost valuation methods focus on different cost accounting objects and have varying levels of data granularity. As the number of product types, business documents, and cost data increases, the relationships between cost data in the system can easily become complex, increasing the burden of data maintenance and cost accounting processing. Furthermore, enterprises may adjust the cost valuation methods used for their products due to changes in business strategies, management systems, or business needs. When there are differences in the cost accounting basis and data organization methods before and after the adjustment, difficulties can arise in connecting the original cost data with subsequent cost data, affecting the continuity of historical cost information and the consistency of cost accounting results.

[0004] Therefore, in the cost accounting process of enterprise resource planning systems, the complexity of cost data management under multiple cost pricing methods, the insufficient adaptability of the level of detail of cost accounting objects, and the difficulty in ensuring the continuity of cost data when pricing methods change have become urgent problems to be solved. Summary of the Invention

[0005] This application provides a method and system for dynamically dividing cost granularity that supports multiple pricing methods. It aims to solve the problems in the cost accounting process of enterprise resource planning systems, such as the complexity of cost data management under multiple cost pricing methods, insufficient adaptability of the level of detail of cost accounting objects, and difficulty in ensuring the continuity of cost data when the pricing method changes.

[0006] Firstly, a method for dynamically dividing cost granularity that supports multiple pricing methods, the method comprising:

[0007] Obtain the first valuation method and cost business log for the target inventory object in the current accounting period;

[0008] Based on the preset mapping relationship between pricing methods and cost granularity rules, determine the first target granularity field set corresponding to the first pricing method;

[0009] Based on the first target granularity field set, the cost business logs are grouped and cost accounting is performed to obtain the first cost log group and the corresponding cost accounting result. Based on the first cost log group and the cost accounting result, a cost summary record is generated in the unified cost master table, and the association between the cost business logs and the corresponding cost summary record is established.

[0010] Obtain the second pricing method corresponding to the target inventory object in the next accounting period, and determine whether the first pricing method and the second pricing method have changed;

[0011] When the first pricing method and the second pricing method change, the business log of costs to be carried forward is determined, the second target granularity field set is determined according to the second pricing method, the business log of costs to be carried forward is regrouped and the cost is recalculated based on the second target granularity field set, the second cost log group and the initial cost accounting result are obtained, and the initial cost summary record corresponding to the next accounting period is generated in the unified cost master table according to the second cost log group and the initial cost accounting result, and the association relationship between the business log of costs to be carried forward and the corresponding initial cost summary record is established.

[0012] In the above scheme, optionally, the mapping relationship between the pricing method and the cost granularity rule is established through the following steps:

[0013] Obtain the pricing method configuration data corresponding to each pricing method and the basic information corresponding to the target inventory object to obtain a set of candidate cost dimension fields;

[0014] Extract the cost accounting dimensions corresponding to each pricing method from the pricing method configuration data to obtain the cost dimension selection conditions corresponding to each pricing method;

[0015] Based on the selection criteria for each cost dimension, the cost dimension fields participating in the cost granularity division are selected from the set of candidate cost dimension fields to obtain the granularity field combination corresponding to each pricing method.

[0016] Each pricing method is associated with its corresponding granularity field to obtain the mapping relationship between the pricing method and the cost granularity rule.

[0017] Optionally, in the above scheme, obtaining the granularity field combination corresponding to each pricing method includes:

[0018] Obtain the product identifier, first product attribute identifier, second product attribute identifier, unit identifier, inbound detail identifier, and accounting cycle identifier of the target inventory object to obtain the granularity basic fields;

[0019] The product identifier, the first product attribute identifier, the second product attribute identifier, and the accounting cycle identifier are combined to obtain the cycle granularity field combination corresponding to the monthly average pricing method.

[0020] The product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier are combined to obtain the unit granularity field combination corresponding to the moving average pricing method;

[0021] The product identifier, the first product attribute identifier, the second product attribute identifier, and the warehousing detail identifier are combined to obtain the source granularity field combination corresponding to the warehousing source pricing method; wherein, the warehousing source pricing method is either an individual pricing method or a first-in-first-out pricing method;

[0022] The periodic granularity field combination, the unit granularity field combination, and the source granularity field combination are associated with their respective pricing methods to obtain the granularity field combination corresponding to each pricing method.

[0023] Optionally, in the above scheme, the step of grouping and calculating costs of the cost business logs based on the first target granularity field set includes:

[0024] Extract business source information, cost quantity information, cost amount information and unit information from each cost business log to obtain the original cost elements corresponding to each cost business log.

[0025] Read the field values ​​corresponding to the first target granularity field set from each cost business log, and combine the field values ​​according to the preset field order to obtain the first granularity identifier corresponding to each cost business log;

[0026] Cost business logs with the same first granularity identifier are divided into the same cost log group to obtain the first cost log group;

[0027] Based on the first pricing method and the primary unit identifier of the target inventory object, the target accounting unit corresponding to each first cost log group is determined, and the cost quantity in each first cost log group is converted to the target accounting unit according to the unit conversion ratio to obtain the standardized cost quantity; wherein, when the first pricing method is the full-month average pricing method or the inbound source pricing method, the primary unit corresponding to the primary unit identifier is used as the target accounting unit; when the first pricing method is the moving average pricing method, the unit corresponding to the unit identifier in the corresponding first granularity identifier is used as the target accounting unit.

[0028] The standardized cost quantity and cost amount in each first cost log group are summarized respectively, and the corresponding unit cost is determined based on the summarized standardized cost quantity and cost amount to obtain the cost accounting result; wherein, the inbound source pricing method is either individual pricing method or first-in-first-out pricing method.

[0029] Optionally, in the above scheme, establishing the association between the cost business log and the corresponding cost summary record includes:

[0030] Extract the business document identifier and business change type from each cost business log to obtain the cost source node corresponding to each cost business log.

[0031] Obtain the cost deduction identifier and cost binding identifier recorded in each cost business log, and determine the upstream and downstream relationships between each cost business log based on the cost deduction identifier and the cost binding identifier to obtain a set of cost log association edges;

[0032] By connecting the corresponding cost source nodes according to the cost log association edge set, a cost log association structure representing the cost increase, cost deduction and cost adjustment process is obtained;

[0033] By associating each cost business log in the cost log association structure with the corresponding cost summary record, a cost traceability chain consisting of business documents, cost business logs, and cost summary records is obtained.

[0034] Optionally, in the above scheme, determining the business log of costs to be carried forward includes:

[0035] Obtain the cost summary record corresponding to the current accounting period and the cost business log associated with the cost summary record to obtain the cost data to be processed;

[0036] Set the end time of the current accounting period as the valid end time of the cost summary record to obtain the historical cost summary record;

[0037] Based on the type of business change corresponding to each cost business log, the cost business logs are divided into cost increase logs and cost deduction logs;

[0038] Based on the cost source identifier corresponding to each cost deduction log, each cost deduction log is matched with the corresponding cost increase log to obtain the cumulative deduction quantity and cumulative deduction amount corresponding to each cost increase log;

[0039] Based on the cost increase quantity, cost increase amount, cumulative deduction quantity, and cumulative deduction amount corresponding to each cost increase log, determine the remaining cost quantity and remaining cost amount corresponding to each cost source, and obtain the ending inventory cost information;

[0040] Based on the ending inventory cost information, the cost business logs corresponding to the ending inventory costs are filtered from the cost business logs to obtain the cost business logs to be carried forward.

[0041] The association identifier between the business log of costs to be carried forward and the historical cost summary record is updated to a temporary association identifier to obtain the set of cost logs to be reconstructed.

[0042] Optionally, in the above scheme, the step of regrouping and recalculating the cost business logs to be carried forward based on the second target granularity field set includes:

[0043] By comparing the field relationships between the first target granularity field set and the second target granularity field set, the granularity change type is obtained;

[0044] When the granularity change type represents the cost granularity changing from fine to coarse, the cost business logs in the cost log set to be reconstructed are merged according to the field values ​​corresponding to the second target granularity field set to obtain a merged cost log group.

[0045] When the granularity change type characterizes the cost granularity from coarse to fine, the cost source group is determined according to the original business source identifier corresponding to each cost business log, and the set of cost logs to be reconstructed is split according to the remaining cost quantity and remaining cost amount corresponding to each cost source group to obtain the split cost log group;

[0046] When the granularity change type characterizes the first target granularity field set and the second target granularity field set as partially overlapping, the cost business logs in the cost log set to be reconstructed are recombined according to the field values ​​corresponding to the second target granularity field set to obtain the reconstructed cost log group;

[0047] The merged cost log group, split cost log group, or reorganized cost log group corresponding to the granularity change type is determined as the second cost log group;

[0048] The remaining cost quantity and remaining cost amount in each second cost log group are summarized separately, and the initial unit cost is determined based on the summarized remaining cost quantity and remaining cost amount to obtain the initial cost accounting result.

[0049] Optionally, the above scheme may also include:

[0050] When the first pricing method and the second pricing method remain unchanged, the remaining cost quantity and remaining cost amount corresponding to each cost source are calculated based on the cost business log corresponding to the current accounting period to obtain the end-of-period continuation cost information.

[0051] Generate the beginning cost business log for the next accounting period based on the end-of-period renewal cost information, and determine the beginning renewal type based on the first pricing method;

[0052] When the initial renewal type is the full-month average renewal type, the next accounting cycle identifier is added to the first target granularity field set to generate the next cycle granularity identifier. Based on the next cycle granularity identifier, a new cost summary record is generated in the unified cost master table. The cost quantity of the cost business log to be renewed is converted into the main unit of the target inventory object. The converted cost business log to be renewed and one of the initial cost business logs are associated with the new cost summary record to obtain the cycle creation result.

[0053] When the initial renewal type is the moving average renewal type, a unit renewal granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier. The original cost summary record in the unified cost master table is queried and retained based on the unit renewal granularity identifier. The initial cost business log is associated with the original cost summary record to obtain the unit renewal result.

[0054] When the initial continuation type is the source continuation type, a source continuation granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the warehousing details identifier. The original cost summary record in the unified cost master table is queried and retained based on the source continuation granularity identifier. The initial cost business log is associated with the original cost summary record to obtain the source continuation result. The source continuation type corresponds to an individual pricing method or a first-in-first-out pricing method.

[0055] When the initial renewal type is a moving average renewal type or a source renewal type, and the original cost summary record is not found, a supplementary cost summary record is generated in the unified cost master table according to the corresponding unit renewal granularity identifier or source renewal granularity identifier and the end-of-period renewal cost information. The initial cost business log is then associated with the supplementary cost summary record to obtain the cost record supplementation result.

[0056] Optionally, the above scheme may also include:

[0057] Obtain the cost business logs, cost summary records and their valid time intervals generated after regrouping or initial continuation, and obtain the set of cost data to be verified.

[0058] Check whether each cost to be carried forward business log or initial cost business log is uniquely associated with a single cost summary record, and obtain the log attribution integrity verification result;

[0059] The cost summary records are sorted according to the target inventory object and the corresponding granularity identifier, and the effective time intervals of adjacent cost summary records are checked for overlap or discontinuity to obtain the time continuity verification result.

[0060] Based on the cost quantity of the associated cost business logs corresponding to the target accounting unit of each cost summary record, the cost quantity and cost amount of the associated cost business logs of each cost summary record are summarized respectively, and the summary results are compared with the cost quantity and cost amount recorded in the corresponding cost summary record to obtain the cost balance verification result;

[0061] When the log ownership integrity verification result, the time continuity verification result, and the cost balance verification result all meet the preset verification conditions, the cost data set to be verified is persisted to the corresponding data table to obtain the cost data update result.

[0062] If any verification result does not meet the preset verification conditions, the persistence of the cost data set to be verified is prevented, and an exception prompt message is generated based on the corresponding verification result.

[0063] Secondly, a cost granularity dynamic partitioning system supporting multiple pricing methods, the system comprising:

[0064] The data acquisition module is used to acquire the first pricing method and cost business log of the target inventory object in the current accounting period, and to acquire the second pricing method of the target inventory object in the next accounting period;

[0065] The granularity determination module is used to determine a first target granularity field set corresponding to the first pricing method based on the preset mapping relationship between pricing methods and cost granularity rules, and to determine a second target granularity field set based on the second pricing method.

[0066] The current cycle cost processing module is used to group and calculate the cost business logs based on the first target granularity field set, obtain the first cost log group and the corresponding cost calculation result, and generate a cost summary record in the unified cost master table according to the first cost log group and the cost calculation result, and establish the association relationship between the cost business logs and the corresponding cost summary record.

[0067] The pricing method detection module is used to determine whether the first pricing method and the second pricing method have changed;

[0068] The cost restructuring module is used to determine the cost business logs to be carried forward when the first pricing method and the second pricing method change, regroup and recalculate the cost business logs to be carried forward based on the second target granularity field set, obtain the second cost log group and the initial cost accounting result, and generate the initial cost summary record corresponding to the next accounting period in the unified cost master table according to the second cost log group and the initial cost accounting result, and establish the association relationship between the cost business logs to be carried forward and the corresponding initial cost summary record.

[0069] Compared with the prior art, this application has at least the following beneficial effects:

[0070] This application, based on further analysis and research of existing technical problems, recognizes the following issues in the cost accounting process of Enterprise Resource Planning (ERP) systems: complex cost data management under multiple cost pricing methods, insufficient adaptability of cost accounting object granularity, and difficulty in ensuring cost data continuity when pricing methods change. By acquiring the first pricing method and cost business logs corresponding to the target inventory object in the current accounting cycle, and determining the first target granularity field set based on the mapping relationship between pricing methods and cost granularity rules, the cost business logs can be grouped and cost-calculated according to the accounting dimensions adapted to the current pricing method. The resulting cost log groups and cost accounting results are uniformly stored as cost summary records. This eliminates the need to set up independent cost data processing structures for different pricing methods, reducing the complexity of cost data management when multiple pricing methods coexist. Simultaneously, by obtaining the second pricing method corresponding to the next accounting period and determining whether the pricing method has changed, when the pricing method changes, the business log of costs to be transferred is determined, and the business log of costs to be transferred is regrouped and the costs are recalculated according to the second target granularity field set corresponding to the second pricing method. This allows the inventory costs of the original accounting period to be converted into the initial cost summary record that is compatible with the pricing method of the next accounting period, thereby establishing the association between the business log of costs to be transferred and the initial cost summary record. Therefore, it is possible to dynamically adjust the level of detail of cost accounting objects according to different pricing methods and maintain the connection between cost data before and after the change of pricing method, thereby solving the problems of complex cost data management, insufficient adaptability of the level of detail of cost accounting objects, and difficulty in ensuring the continuity of cost data when the pricing method changes under multiple cost pricing methods. Attached Figure Description

[0071] Figure 1 A flowchart illustrating a method for dynamically dividing cost granularity that supports multiple pricing methods, provided in one embodiment of this application;

[0072] Figure 2 A schematic diagram illustrating the relationship between the unified cost master table, the cost business log table, and the cost log detail sub-table provided in one embodiment of this application;

[0073] Figure 3 A flowchart illustrating the process of determining cost granularity and updating the unified cost master table based on the pricing method, as provided in one embodiment of this application;

[0074] Figure 4 This is an overall flowchart illustrating the initial reconfiguration of the pricing method provided in one embodiment of this application when the accounting period changes. Detailed Implementation

[0075] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0076] In one embodiment, the dynamic cost granularity partitioning method supporting multiple pricing methods operates in the financial cost accounting module of the enterprise resource planning system, and the method flow is as follows: Figure 1 As shown, an Enterprise Resource Planning (ERP) system may include an application server, a database server, and user terminals. The application server is used to perform processes such as pricing method identification, cost granularity determination, cost accounting, initial setup, data verification, and cost traceability. The database server is used to store basic information of target inventory objects, pricing method configuration data, cost business logs, and cost summary records. The user terminals are used to configure pricing methods, initiate month-end closing operations, and query cost accounting results.

[0077] The unified cost master table can be implemented using the MCostInfo table, used to store cost summary records generated under different pricing methods. Cost business logs can be stored in the MCostLog table, used to record changes in cost quantity and amount caused by transactions such as receiving, issuing, returns, cost adjustments, and initial carry-over. Fields in the unified cost master table may include ProductId, ProductAttr1 (first product attribute), ProductAttr2 (second product attribute), CostType (pricing method), KuinListId (receiving details), Unit, Date1 (effective start time), and Date2 (effective end time), and may also include auxiliary fields such as CkId (warehouse identifier) ​​and KuId (auxiliary source identifier). CkId and KuId are used for warehouse association or program processing and do not participate in the cost granularity division for each pricing method; Unit is used to store the primary unit under the full-month average pricing method and participates in cost granularity division under the moving average pricing method; KuListId participates in cost granularity division under the receiving source pricing method. The cost business log establishes a link between the cost summary record and the cost summary record in the unified cost master table through the cost summary record association identifier.

[0078] like Figure 3 As shown, the first step is to obtain the primary valuation method and cost transaction log for the target inventory object in the current accounting period. The target inventory object can be a product, material, commodity, or semi-finished product with independent cost accounting rules set in the enterprise resource planning system. Target inventory objects are distinguished by product identifiers and can be further associated with product attribute identifiers, warehouse identifiers, and unit identifiers. The current accounting period can be a calendar month or other cost settlement periods preset by the enterprise.

[0079] The first pricing method can be read from the cost accounting configuration record of the target inventory object, which contains a pricing method identifier. This identifier can represent a monthly average pricing method, a moving average pricing method, or a pricing method based on the source of inventory. The pricing method based on the source of inventory can be either a specific pricing method or a first-in, first-out (FIFO) pricing method. While the specific pricing method and the FIFO pricing method may differ in the order of cost deduction, they are both differentiated based on the source inventory details when dividing cost granularity. The cost transaction log is read from the cost transaction log table. The read cost transaction log includes at least the transaction document identifier, the target inventory object identifier, the transaction occurrence time, the transaction change type, the cost quantity, the cost amount, the unit identifier, and the cost summary record association identifier.

[0080] Based on the preset mapping relationship between pricing methods and cost granularity rules, a first target granularity field set corresponding to the first pricing method is determined. The mapping relationship between pricing methods and cost granularity rules is pre-stored in a configuration table or rule cache, and each pricing method is associated with a set of fields participating in cost grouping. After reading the first pricing method, the application server retrieves the corresponding field combination from the mapping relationship and determines the retrieved field combination as the first target granularity field set.

[0081] The first target granularity field set is used to determine the cost accounting scope represented by a cost summary record. Under the full-month average pricing method, the first target granularity field set includes the product identifier, the first product attribute identifier, the second product attribute identifier, and the accounting period identifier; under the moving average pricing method, the first target granularity field set includes the product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier; under the inbound source pricing method, the first target granularity field set includes the product identifier, the first product attribute identifier, the second product attribute identifier, and the inbound detail identifier. The warehouse identifier CkId and the auxiliary source identifier KuId are not included in any of the above target granularity field sets.

[0082] The application server reads the field values ​​corresponding to the first target granularity field set from each cost business log, and concatenates or encodes the field values ​​according to a preset field order to form a granularity identifier for each cost business log. Cost business logs with the same granularity identifier are grouped into the same first cost log group. Each first cost log group corresponds to a cost summary record in the unified cost master table.

[0083] The application server performs cost accounting for each first cost log group. For cost increase logs, it accumulates the corresponding cost quantity and cost amount; for cost deduction logs, it deducts inventory costs based on the corresponding cost source and deduction quantity; for cost adjustment logs, it increases or decreases the cost amount based on the adjustment direction. This yields the remaining quantity, remaining amount, and unit cost of the first cost log group, which are then used as the corresponding cost accounting results.

[0084] Based on the granularity identifier and cost accounting results of the first cost log group, cost summary records are generated in the unified cost master table. Each cost summary record includes the target inventory object identifier, valuation method identifier, field values ​​involved in granularity division, inventory quantity, cost amount, unit cost, and effective time interval. For the monthly average valuation method, cost summary records are distinguished by the accounting period identifier, with a new cost summary record generated for each accounting period. For the moving average valuation method and the inbound source valuation method, the original cost summary records are used until the valuation method changes or the corresponding granularity field values ​​change. Subsequently, the association identifier of the cost summary records in each cost business log in the first cost log group is updated to the record identifier of the corresponding cost summary record, thereby establishing the association between the cost business logs and the cost summary records.

[0085] When constructing cost data for the next accounting period, the system obtains the second valuation method for the target inventory object in the next accounting period and compares the first valuation method with the second valuation method. The second valuation method can be configured by the user before the next accounting period takes effect, or it can be automatically determined by the enterprise resource planning system based on the pre-designed pricing strategy.

[0086] When the first and second pricing methods are the same, the existing cost granularity rules can continue to be used to process cost data for the next accounting period. When the first and second pricing methods are different, the following steps should be initiated: Figure 4 The cross-accounting cycle cost restructuring process is shown.

[0087] The cross-accounting cycle cost restructuring process first determines the cost business logs to be carried forward from the cost business logs associated with the original cost summary record, based on the inventory quantity and amount at the end of the current accounting cycle. The cost business logs to be carried forward correspond to the sources of inbound costs that have not yet been fully deducted or the cost balances that still need to be carried forward to the next accounting cycle.

[0088] Based on the second pricing method, the mapping relationship between the pricing method and the cost granularity rules is queried to obtain the second target granularity field set. The application server rereads the field values ​​in each cost to be carried forward business log according to the second target granularity field set and forms a new granularity identifier; the cost to be carried forward business logs are re-divided according to the new granularity identifier to obtain the second cost log group.

[0089] The application server summarizes the remaining cost quantity and amount in each second cost log group, and determines the initial quantity, initial amount, and initial unit cost for the next accounting period based on the summary results, thus obtaining the initial cost accounting results. Subsequently, the initial cost summary record for the next accounting period is generated in the unified cost master table, and the business logs of costs to be carried forward are associated with the corresponding initial cost summary record.

[0090] Taking material X as an example, material X uses the full-month average pricing method in February and March 2025. Independent cost summary records are generated for February and March according to product identifier, first product attribute identifier, second product attribute identifier, and the corresponding month, respectively. Each cost summary record is associated with only one beginning cost business log for the corresponding month. When switching to the inbound source pricing method in April 2025, the remaining cost business logs from the end of March are regrouped according to the source inbound details, generating corresponding beginning cost summary records for different inbound sources. When switching to the moving average pricing method in May 2025, the remaining costs from different inbound sources at the end of April are re-summarized according to product identifier, first product attribute identifier, second product attribute identifier, and unit identifier, generating cost summary records corresponding to the moving average pricing method. The front-end summary data can combine the summary results from the unified cost master table with the business sources in the cost business logs for user queries, while the underlying layer still retains the cost summary records and cost business logs separately.

[0091] Through the above processing, the cost granularity is dynamically determined according to the pricing method adopted by the target inventory object, and the cost summary records of different granularities are stored in the unified cost master table, which can reduce the data structure complexity when multiple pricing methods coexist. When the pricing method changes, the cost data is regrouped and recalculated according to the new granularity based on the business log of the cost to be transferred, which can maintain the continuity of cost data in the previous and subsequent accounting cycles and reduce the duplication, missing or inconsistent cost data caused by changes in pricing methods.

[0092] In this embodiment, the mapping relationship between the pricing method and the cost granularity rule can be established when the system is initialized, the enterprise account set is established, or the cost accounting configuration of the target inventory object changes.

[0093] First, obtain the pricing method configuration data for each pricing method and the basic information for the target inventory object. The pricing method configuration data includes the pricing method identifier, cost accounting level, allowed field types for cost granularity segmentation, and their corresponding activation status. The basic information for the target inventory object includes the availability status of the product identifier, first product attribute identifier, second product attribute identifier, unit identifier, primary unit identifier, inbound detail identifier, and accounting cycle identifier. Based on the above information, generate a set of candidate cost dimension fields.

[0094] The candidate cost dimension field set may include the product identifier field, the first product attribute identifier field, the second product attribute identifier field, the unit identifier field, the inbound detail identifier field, and the accounting cycle identifier field. The warehouse identifier CkId and the auxiliary source identifier KuId can be stored as auxiliary fields for cost records, but they are not included in the candidate cost dimension field set, nor do they participate in the cost granularity division.

[0095] Extract the cost accounting dimensions corresponding to each pricing method from the pricing method configuration data. The monthly average pricing method corresponds to the product attribute combination and accounting cycle level, the moving average pricing method corresponds to the product attribute combination and unit level, and the inbound source pricing method corresponds to the product attribute combination and source inbound detail level.

[0096] Cost dimension selection criteria are generated based on cost accounting dimensions. Product identifier, first product attribute identifier, and second product attribute identifier are fields used in common to the three pricing methods; accounting period identifier is a distinguishing field for the full-month average pricing method, unit identifier is a distinguishing field for the moving average pricing method, and inbound details identifier is a distinguishing field for the inbound source pricing method.

[0097] Based on the cost dimension selection criteria, the corresponding fields are selected from the candidate cost dimension field set to obtain the granular field combination corresponding to each pricing method. Then, the pricing method identifier and the corresponding granular field combination are written into the mapping configuration table to generate mapping entries. Each mapping entry may include the pricing method identifier, field list, field order, field activation conditions, and version information.

[0098] The application server can load the mapping entries into the rule cache so that when processing cost business logs, it can directly query the corresponding target granularity field set based on the pricing method identifier. When the pricing method configuration changes, the version of the mapping entry can be updated while retaining the original version and the corresponding valid time range, thereby supporting the querying of historical cost data according to historical rules.

[0099] Figure 3 In the process, after identifying the pricing method, the system enters the corresponding granularity to determine the branch through the mapping relationship, and then completes the cost business log grouping according to the corresponding field combination.

[0100] Through the above processing, the cost accounting level corresponding to the pricing method is converted into executable field selection rules and a configurable mapping relationship is formed. This makes the cost granularity no longer fixed in a single data structure, but can be dynamically determined according to the accounting requirements of different pricing methods and different target inventory objects, thereby improving the adaptability of cost data organization methods.

[0101] In this embodiment, the product identifier, the first product attribute identifier, and the second product attribute identifier constitute the common product dimension for all three pricing methods. The first product attribute identifier and the second product attribute identifier can represent color, size, specifications, grade, or other attributes that affect independent cost accounting, respectively. The warehouse identifier CkId and the auxiliary source identifier KuId are auxiliary fields in the specific implementation and do not participate in the cost granularity division corresponding to the pricing method.

[0102] Under the monthly average pricing method, the product identifier, the first product attribute identifier, the second product attribute identifier, and the accounting period identifier are combined to obtain the period granularity field combination. The accounting period identifier can be a monthly identifier, such as March 2025, or other cost accounting period identifiers configured by the enterprise.

[0103] Under the full-month average pricing method, the same product attribute combination corresponds to only one cost summary record within the same accounting period. When cost business logs are recorded using different business units, they all belong to the same cost summary record and are uniformly converted to the primary unit of the target inventory object for calculation according to the unit conversion ratio; the Unit field in the unified cost master table stores the primary unit, but the Unit field does not participate in the granularity division of the full-month average pricing method. A new cost summary record is created for each accounting period, and each cost summary record is associated with only one initial cost business log for the corresponding accounting period.

[0104] Under the moving average pricing method, the product identifier, first product attribute identifier, second product attribute identifier, and unit identifier are combined to obtain the unit granularity field combination. The cost business logs corresponding to different unit identifiers belong to different cost summary records. When the pricing method and unit identifier remain unchanged, the cost summary record is not re-established across multiple accounting periods, but the original cost summary record is used instead.

[0105] Under the moving average pricing method, each time an inventory receipt occurs, the original inventory cost and the newly received inventory cost are aggregated and the moving average unit cost under the corresponding unit is updated. When spanning accounting periods, multiple initial cost business logs can be generated and associated sequentially under the same cost summary record to record the initial status of each accounting period, while maintaining the original inventory receipt source information to support subsequent traceability and reconstruction.

[0106] Under the inbound source pricing method, the product identifier, first product attribute identifier, second product attribute identifier, and inbound detail identifier are combined to obtain the source granularity field combination. The inbound detail identifier KuinListId is used to store the source inbound detail identifier in the inbound / outbound flow order. The cost business logs corresponding to the same inventory root source belong to the same cost summary record and are no longer distinguished by unit identifier or accounting period identifier.

[0107] The inbound source pricing method can be either individual pricing or first-in-first-out (FIFO) pricing. Individual pricing can deduct costs based on the source inbound details specified by the business, while FIFO pricing can deduct costs according to the inbound time sequence of the source inbound details; both determine the cost summary record based on the inventory root source indicated by KuinListId. When the pricing method remains unchanged, cost summary records are not re-established across multiple accounting periods, and multiple initial cost business logs can be associated with the same cost summary record.

[0108] like Figure 3 As shown, the monthly average branch uses "product identifier, first product attribute identifier, second product attribute identifier and accounting period identifier" to determine the cost granularity, and converts different business units into the main unit; the moving average branch uses "product identifier, first product attribute identifier, second product attribute identifier and unit identifier" to determine the cost granularity; the inbound source branch uses "product identifier, first product attribute identifier, second product attribute identifier and inbound detail identifier" to determine the cost granularity.

[0109] Through the above processing, granular field combinations adapted to the cost accounting characteristics of monthly average, moving average, and individual pricing or first-in-first-out are established respectively. This can not only unify the monthly average cost of different business units to the master unit, but also retain the unit difference of moving average and the inventory root source difference of pricing based on the source of goods in the warehouse, and enable the three pricing methods to share a unified cost master table.

[0110] In this embodiment, when grouping and calculating costs from the cost business logs, the business source information, cost quantity information, cost amount information, and unit information are first extracted from each cost business log to obtain the original cost elements. The business source information may include the business document identifier, business document type, business detail identifier, and business occurrence time.

[0111] Cost quantity information indicates changes in inventory quantity caused by the corresponding business transaction, while cost amount information indicates changes in cost amount caused by the corresponding business transaction. Cost quantity and cost amount for cost increase transactions can be recorded as positive values, while cost deduction transactions can be recorded as negative values, or a combination of business change type and absolute value can be used.

[0112] When the target inventory object supports multiple units of measurement, the unit conversion ratio corresponding to the unit information of each cost business log is obtained. The unit conversion ratio can be stored as LogUnitBl. For the full-month average pricing method and the inbound source pricing method, the cost quantity of different business units within the group is uniformly converted to the primary unit of the target inventory object; for the moving average pricing method, the unit identifier participates in the granularity division, and the logs of different units are first divided into different cost log groups, and then cost accounting is performed according to the corresponding unit.

[0113] Cost accounting rules can be executed by a cost accounting rule component, which can be implemented by InventoryCostRuleClass. The cost accounting rule component determines the cost quantity, cost amount, and unit cost calculation order based on the valuation method of the target inventory object, the type of business change, and the unit conversion ratio, and handles any decimal differences arising from unit conversion.

[0114] The field values ​​corresponding to the first target granularity field set are read from each cost business log and standardized and encoded according to the preset field order. Under the full-month average pricing method, the product identifier, first product attribute identifier, second product attribute identifier, and accounting period identifier are encoded sequentially; under the moving average pricing method, the product identifier, first product attribute identifier, second product attribute identifier, and unit identifier are encoded sequentially; under the inbound source pricing method, the product identifier, first product attribute identifier, second product attribute identifier, and inbound detail identifier are encoded sequentially, thus obtaining the first granularity identifier.

[0115] Cost logs with the same first granularity identifier are grouped into the same cost log group. Grouping can be achieved through database grouping queries or using a hash mapping structure in the application server. The first granularity identifier serves as the key of the hash mapping structure, and the corresponding set of cost logs serves as the value.

[0116] Summarize the standardized cost quantity and cost amount in each first cost log group. Under the inbound source valuation method, calculate the remaining quantity and remaining amount according to the root source of the inventory; under the moving average valuation method, update the inventory quantity, inventory amount, and moving average unit cost after each inbound transaction for the corresponding unit; under the full-month average valuation method, summarize the beginning cost, current inbound cost, and current valuable quantity according to the main unit in each accounting period, and determine the average unit cost for that accounting period.

[0117] When the cost quantity is not zero, the unit cost can be determined based on the ratio of cost amount to cost quantity; when the cost quantity is zero, the unit cost can be set to a null value, a zero value, or the most recent valid unit cost can be retained according to preset rules. For cost adjustment orders, the cost amount can be adjusted directly according to the adjustment type, or the cost quantity and cost amount can be adjusted simultaneously.

[0118] In this embodiment, the front-end summary data can read the remaining quantity, cost amount and unit cost from the cost summary record, and at the same time associate the business source in the cost business log so that users can review the underlying cost calculation process.

[0119] Through the above processing, different business units are converted to the main unit under the monthly average pricing method and the inbound source pricing method, and the unit identifier is retained to distinguish the granularity under the moving average pricing method. This can avoid grouping errors caused by using the same unit processing rule for different pricing methods. Generating a stable granularity identifier based on the corresponding granularity field can improve the accuracy of cost accounting results.

[0120] In this embodiment, when establishing the association between cost business logs and cost summary records, business document identifiers and business change types are extracted from each cost business log to obtain cost source nodes. Cost source nodes can correspond to purchase receipt details, production receipt details, sales delivery details, material requisition details, return details, cost adjustment details, or beginning balance records.

[0121] For cost increase logs, the cost source node records the corresponding inbound source; for cost deduction logs, the cost source node records the outbound business source and the deducted cost increase log; for cost adjustment logs, the cost source node records the corresponding cost object before and after the adjustment and the reason for the adjustment.

[0122] The cost business log can be configured with a cost deduction identifier (DeductLogId) and a cost binding identifier (BindLogId). The cost deduction identifier points to the cost increase log that has been deducted by the current cost deduction log, while the cost binding identifier indicates the inheritance, adjustment, or carry-over relationship between two or more cost business logs.

[0123] The application server reads the cost deduction identifier and cost binding identifier to determine the upstream and downstream logs between each cost business log, thus obtaining a set of cost log association edges. Cost increase logs can serve as upstream nodes, and cost deduction logs or cost adjustment logs can serve as downstream nodes. A single cost increase log can connect to multiple cost deduction logs, and multiple cost increase logs can also be connected to a single summary or carry-over log.

[0124] The cost log association structure is formed by connecting the corresponding cost source nodes through the set of associated edges, creating a tree-like or directed graph-like structure. This structure can represent the process of cost transfer from initial receipt, inventory balance, business outbound shipment to cost adjustment and initial carry-forward.

[0125] The cost log association structure links cost business logs to their corresponding cost summary records. A single cost summary record in the unified cost master table can serve as a summary node for a group of cost business logs, while multiple logs in the cost business log table act as detail nodes. Detailed cost log sub-tables can be linked to cost business logs using cost log identifiers, and are used to record detailed cost components such as materials, labor, and expenses. Figure 2The relationship between the unified cost master table, the cost business log table, and the cost log detail sub-table is shown.

[0126] When a user queries a specific cost summary record, they can trace the cost traceability chain downwards to find the inbound, adjustment, and carry-over logs that led to the current cost, or they can trace the cost traceability chain upwards to find which inbound batches a specific outbound cost originated from. For certain pricing methods, the user can also reconstruct the cost deduction process for a specific batch based on the inbound detail identifier and cost deduction identifier.

[0127] Through the above processing, a multi-level traceability relationship is established between cost summary records and business documents, connected by cost business logs. This enables cost results to not only reflect the summary values ​​but also to be traced back to specific inbound, outbound, and adjustment sources, thereby improving the auditability of cost data and providing a complete data foundation for the reconstruction of historical costs after changes in pricing methods.

[0128] In this embodiment, when the first pricing method changes to the second pricing method, the cost summary record corresponding to the current accounting period and the cost business log associated with the cost summary record are obtained to obtain the cost data to be processed. The cost summary record corresponding to the current accounting period can be determined by the target inventory object identifier, the first pricing method, and the matching relationship between the current time and the effective time interval.

[0129] The end time of the current accounting period is set as the effective end time of the corresponding cost summary record to obtain the historical cost summary record. For example, if the first pricing method is effective in April 2025 and the second pricing method is effective from May 1, 2025, then the effective end time of the original cost summary record is set to April 30, 2025. This ensures that the original cost summary record is only used for querying and accounting during the effective period of the first pricing method.

[0130] Based on the type of business change, the cost business logs associated with historical cost summary records are divided into cost increase logs and cost deduction logs. Purchase receipts, production receipts, return receipts, and beginning balance transfers can generate cost increase logs, while sales shipments, production requisitions, transfer shipments, and return shipments can generate cost deduction logs.

[0131] Based on the cost source identifier or cost deduction identifier in the cost deduction log, each cost deduction log is matched with its corresponding cost increase log. For a cost increase log, all cost deduction logs pointing to that cost increase log can be aggregated to obtain the cumulative deduction quantity and cumulative deduction amount.

[0132] Subtract the cumulative deduction from the cost increase quantity in the cost increase log to obtain the remaining cost quantity for the corresponding cost source; subtract the cumulative deduction from the cost increase amount to obtain the remaining cost amount for the corresponding cost source. Based on the remaining cost quantity and remaining cost amount for each cost source, the ending inventory cost information is generated.

[0133] When using moving average or full-month average pricing methods, and the cost deduction log is not directly linked to a specific inbound source, the current inventory cost can be restored to a cost source that can be reconstructed for the next accounting cycle, based on the binding relationships, accounting order, and remaining quantity allocation rules in the cost log. If it is not possible to restore to the original batch, an initial cost source node can be generated to carry the current inventory quantity and inventory amount.

[0134] From the ending cost inventory information, select cost sources with a remaining cost quantity greater than zero or remaining cost amounts that meet preset carry-forward conditions, and identify the corresponding cost business logs as cost business logs to be carried forward. Logs that have been fully deducted and have no remaining costs will not participate in the cost restructuring of the next accounting period.

[0135] While retaining the business source information, cost deduction relationships, and cost binding relationships of the cost business logs to be carried forward, the current association identifier between the cost business logs to be carried forward and the historical cost summary records is updated to a temporary association identifier, resulting in the set of cost logs to be reconstructed. The temporary association identifier can be implemented using system-reserved values, such as temporarily setting the cost summary record association identifier to -9999, or the cost logs to be reconstructed can be stored in an independent temporary mapping set.

[0136] like Figure 4 As shown, the temporary association processing is located after the original cost summary record time is truncated and before the new granularity grouping, so that the business log of the cost to be transferred can be removed from the original granularity constraint while retaining the historical source, so as to be regrouped according to the second pricing method.

[0137] Through the above processing, only cost business logs with remaining costs at the end of the period are included in the cross-period reconstruction. By updating the temporary association identifier, the cost logs are logically separated from the original cost summary records. This avoids the repeated participation of historical logs that have already been deducted in the initial calculation, and at the same time provides an accurate and continuous data source for reconstructing the initial costs according to the new pricing method.

[0138] In this embodiment, a first target granularity field set and a second target granularity field set are obtained, and the field inclusion relationship, field quantity relationship and field type relationship between the two field sets are compared to obtain the granularity change type.

[0139] When the second target granularity field set reduces the number of fields used to distinguish cost records compared to the first target granularity field set, it can be determined that the cost granularity has changed from fine to coarse. For example, when switching from the inbound source pricing method to the moving average pricing method, the second target granularity field set no longer includes the inbound detail identifier; when switching from the moving average pricing method to the full-month average pricing method, the second target granularity field set no longer distinguishes records by unit identifier, but adds the identifier for the next accounting period.

[0140] When the cost granularity is changed from fine to coarse, the value of the second target granularity field in the cost log set to be reconstructed is read, and cost business logs with the same field value are merged into the same cost log group to obtain a merged cost log group. For example, by summarizing the remaining quantity and remaining amount corresponding to multiple inbound details according to product identifier and unit identifier, the initial cost data corresponding to the moving average pricing method can be obtained.

[0141] When the first target granularity field set is a subset of the second target granularity field set, it can be determined that the cost granularity changes from coarse to fine. For example, when switching from a monthly average pricing method to an individual pricing method, it is necessary to refine the original product-level inventory costs to the level of the source of goods received.

[0142] When the cost granularity is refined, the cost source group is determined based on the original business source identifier in the cost business log to be reconstructed, and then split according to the remaining cost quantity and remaining cost amount of each cost source group. If the historical cost business log retains specific inbound sources and remaining quantities, the split is performed according to the actual source; if only the quantity ratio of each source can be determined, the remaining cost amount is allocated according to the remaining quantity ratio of each source; if the original inbound source cannot be recovered, one or more initial inbound detail identifiers can be generated to represent the virtual initial batch formed during the switch.

[0143] When the distinguishing fields of the first target granularity field set and the second target granularity field set are different, it can be determined as granularity reorganization. For example, if the first target granularity field set distinguishes cost records by unit identifier and the second target granularity field set distinguishes cost records by inbound detail identifier, then the field values ​​are reread and grouped according to the second target granularity field set to obtain the reorganized cost log group.

[0144] During the merging, splitting, and reorganization process, the original business source identifier, cost deduction identifier, and cost binding identifier in the cost business log remain unchanged, or the binding relationship between them and the historical log is retained by adding a new initial log, so that changes in granularity will not disrupt the original cost traceability chain.

[0145] The corresponding merged cost log group, split cost log group, or reorganized cost log group is designated as the second cost log group. The remaining cost quantity and remaining cost amount in each second cost log group are summarized, and the initial unit cost is determined based on the summary results to obtain the initial cost accounting results.

[0146] Based on the second granularity identifier corresponding to the second cost log group and the initial cost accounting results, an initial cost summary record is generated in the unified cost master table. The effective start time of the initial cost summary record is set to the start time of the next accounting period, such as the 1st of the next month; the effective end time can be set to a preset maximum forward time. Corresponding initial cost business logs are generated for each second cost log group, and a binding relationship is established between the initial cost business logs and the historical cost business logs to be carried forward.

[0147] Figure 4 The overall restructuring process is shown when the pricing method changes. The cross-month change relationship can include multiple original cost records being merged into one new cost record, one original cost record being split into multiple new cost records, and multiple original cost records being recombined into multiple new cost records.

[0148] By using the above processing, the merging, splitting, or reorganizing methods can be selected based on the granularity field relationship between the two accounting periods. This can adapt to changes in pricing methods, such as from fine-grained to coarse-grained, from coarse-grained to fine-grained, and between different dimensions. Maintaining the relationship between quantity, amount, and business source during the reconstruction process can achieve a smooth transition when switching pricing methods, ensuring that the initial cost results are consistent with the ending inventory cost of the previous accounting period.

[0149] In this embodiment, when the first and second pricing methods are the same, different initial continuation processing is adopted according to the pricing method type. The monthly average pricing method creates a new cost summary record in each accounting period; the moving average pricing method and the inbound source pricing method retain the original cost summary record when the pricing method and the granularity field value do not change.

[0150] Based on the cost business log corresponding to the current accounting period, calculate the remaining cost quantity and remaining cost amount corresponding to each cost source according to the cost increase quantity, cost deduction quantity, cost increase amount and cost deduction amount, obtain the end-of-period continuation cost information, and generate the beginning-of-period cost business log corresponding to the next accounting period accordingly.

[0151] The initial cost business log is used to record the initial quantity, initial amount, initial unit cost, and source accounting period for the next accounting period. For the same granularity group, one initial cost business log is generated for each accounting period to retain the initial status of different accounting periods.

[0152] When the first pricing method is the full-month average pricing method, the next accounting period identifier is combined with the product identifier, the first product attribute identifier, and the second product attribute identifier to generate the next period granularity identifier, and a new cost summary record is generated in the unified cost master table. After converting the pending cost business logs of different business units into master units, they are associated with the new cost summary record along with one beginning cost business log of the next accounting period.

[0153] In the new cost summary record corresponding to the monthly average pricing method, the Unit field is written with the primary unit identifier, but the Unit field is not used as a granularity distinguishing field. Because the accounting period identifier participates in the granularity division, the same product attribute combination corresponds to different cost summary records in different accounting periods, and each cost summary record corresponds to only one accounting period and one initial cost business log.

[0154] When the first pricing method is moving average pricing, a unit continuation granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier. Then, the original cost summary record in the unified cost master table is queried based on the unit continuation granularity identifier. When an original cost summary record is matched, a new cost summary record is not created; instead, the beginning cost business log for the next accounting period is associated with the original cost summary record.

[0155] When the first pricing method is the inbound source pricing method, a source continuation granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the inbound detail identifier. Then, the original cost summary record in the unified cost master table is queried based on the source continuation granularity identifier. When an original cost summary record is matched, a new cost summary record is not created according to the unit or accounting period. Instead, the initial cost business log of the next accounting period is associated with the original cost summary record.

[0156] For moving average pricing or inbound source pricing, the same cost summary record can be sequentially associated with the initial cost business logs of multiple accounting periods. If the original cost summary record is missing due to abnormal operation, the cost summary record can be recreated according to the corresponding unit continuation granularity identifier or source continuation granularity identifier, and the association between the initial cost business log and the cost summary record can be restored.

[0157] The above initial continuation processing and Figure 3 The three granularity classification rules shown correspond to each other; Figure 4 This is used to illustrate the initial restructuring process when the pricing method changes. In this process, after the original cost summary record is truncated, the business log of the cost to be carried forward is regrouped according to the changed set of granularity fields.

[0158] Through the above processing, the monthly average pricing method can generate an independent cost record version according to the accounting cycle, the moving average pricing method can continue the same cost summary record across accounting cycles when the unit dimension remains unchanged, and the inventory source pricing method can continue the same cost summary record across accounting cycles when the inventory root source remains unchanged, so that the generation method of the initial cost business log is consistent with the actual cost granularity of each pricing method.

[0159] In this embodiment, after the cost business logs are regrouped or the cost logs are continued, the resulting cost business logs, cost summary records and their valid time intervals are obtained, thus obtaining the set of cost data to be verified.

[0160] First, perform a log attribution integrity check. For each cost business log to be carried forward or to be continued, check whether it is associated with a valid cost summary record. If a cost business log is not associated with any cost summary record, it indicates an omission; if a cost business log is associated with multiple cost summary records, it indicates duplicate attribution.

[0161] Next, a time continuity check is performed. Cost summary records are grouped according to the target inventory object and granularity identifier, and then sorted by their effective start time. The effective end time and effective start time of adjacent cost summary records are compared sequentially to determine if there are any overlapping or discontinuous time intervals.

[0162] For adjacent cost summary records at the same granularity, the effective end time of the previous record should be earlier than the effective start time of the next record; when the system requires continuous version management, there should be no uncovered accounting dates between the effective end time of the previous record and the effective start time of the next record.

[0163] Further cost balance verification is performed. For the monthly average pricing method and the inbound source pricing method, the cost quantities in each cost business log are converted to the master unit; for the moving average pricing method, the quantities are summarized according to the unit corresponding to each cost summary record. Subsequently, the cost quantity and cost amount of the logs associated with each cost summary record are summarized and compared with the inventory quantity and cost amount recorded in the corresponding cost summary record.

[0164] Cost balance verification can be set with preset error ranges to handle unit conversions, rounding, and decimal differences. If both the quantity difference and the amount difference are within the preset error range, the cost balance verification passes; otherwise, the corresponding cost summary record, difference quantity, difference amount, and related cost business logs are recorded.

[0165] It can also perform closed-loop verification of the cost traceability chain, check whether the cost increase log pointed to by each cost deduction log exists, whether the cumulative deduction quantity exceeds the corresponding cost increase quantity, and whether the log pointed to by the cost binding identifier belongs to the same target inventory object.

[0166] When the log ownership integrity verification result, time continuity verification result, and cost balance verification result all meet the preset verification conditions, the set of cost data to be verified is persisted to the unified cost master table and the cost business log table, resulting in updated cost data. The persistence process can be completed within the same database transaction to ensure that master table records, log records, and related identifiers are updated synchronously.

[0167] If any verification result fails to meet the preset verification conditions, the persistence of the cost data set to be verified is prevented, and an exception message is generated. The exception message may include the exception type, target inventory object, accounting period, granularity identifier, relevant cost summary records and discrepancy data, so that the user can correct and re-execute.

[0168] Through the above processing, before the cost data is officially written into the database, verification is performed from multiple aspects such as log attribution, time interval, and quantity and amount balance. This can promptly identify anomalies such as duplicate associations, data gaps, and accounting imbalances, preventing erroneous reconstruction results from entering the official cost data and improving the reliability and consistency of cost processing across pricing methods.

[0169] In this embodiment, as Figures 2 to 4 As shown, the cost granularity dynamic partitioning system that supports multiple pricing methods can be deployed on the application server of the enterprise resource planning system and connected to the database that stores the unified cost master table, cost business log table, basic information of target inventory objects and pricing method configuration data.

[0170] The data acquisition module is used to obtain the first pricing method and cost business logs corresponding to the target inventory object in the current accounting period, and to obtain the second pricing method corresponding to the target inventory object in the next accounting period. The data acquisition module can construct query conditions using the target inventory object identifier and the accounting period, read the pricing method identifier from the configuration table, and read the corresponding logs from the cost business log table.

[0171] The granularity determination module is used to determine the first target granularity field set and the second target granularity field set based on the mapping relationship between the pricing method and the cost granularity rules. The granularity determination module may include a rule reading unit, a field filtering unit, and a granularity identifier generation unit, which are used to read mapping entries, filter fields participating in granularity division, and combine corresponding field values, respectively.

[0172] The current cycle cost processing module is used to group and calculate costs from business logs according to the first target granularity field set. This module can call the cost accounting rule component and unit conversion component: under the full-month average pricing method and the inbound source pricing method, it converts different business units into the primary unit of the target inventory object; under the moving average pricing method, it divides different cost log groups according to the unit identifier and calculates costs separately.

[0173] The current cycle cost processing module is also used to generate cost summary records in the unified cost master table and establish the association between the cost business log and the corresponding cost summary records. The unified cost master table can be implemented using the MCostInfo table, and the cost business log table can be implemented using the MCostLog table. The summary data presented on the front end is formed by a joint query of the unified cost master table and the cost business log table, and is not used as a separate basic data source for cost accounting.

[0174] The pricing method detection module is used to compare the first pricing method and the second pricing method. The pricing method detection module can run during the month-end or the beginning of the next accounting period and send the comparison results to the cost refactoring module or the cost log continuation processing unit.

[0175] The cost restructuring module is used to identify the business logs of costs to be carried forward when the first and second pricing methods change, and to regroup and recalculate costs according to the second target granularity field set. The cost restructuring module can be implemented by the month-end closing and beginning-of-period construction program. Its processing includes truncating the original cost summary records, temporarily stripping the business logs of costs to be carried forward, identifying the type of granularity change, merging or splitting cost logs, calculating beginning-of-period costs, and establishing new relationships.

[0176] When generating the initial cost summary record, the cost restructuring module writes the start time of the next accounting period into the valid start time field, the preset maximum forward time into the valid end time field, and the second pricing method and corresponding granularity field value. The initial cost business log and the historical cost to be carried forward business log are linked through a cost binding identifier to maintain the cost traceability relationship across accounting periods.

[0177] The system may also include an initial cost continuation module and a data verification module. The initial cost continuation module is used to create new cost summary records for the monthly average pricing method according to the accounting cycle when the pricing method remains unchanged, retain the original cost summary records for the moving average pricing method according to the unit granularity, and retain the original cost summary records for the inbound source pricing method according to the source inbound detail granularity, and generate the initial cost business log for the corresponding accounting cycle; the data verification module is used to perform log ownership integrity verification, time continuity verification, and cost balance verification.

[0178] Through the collaborative processing between the above modules, different pricing methods can share a unified cost data storage structure and automatically select the corresponding cost granularity according to the pricing method. When the pricing method changes across accounting cycles, the initial cost data of the next accounting cycle can be reconstructed based on historical cost business logs, while retaining the business source and cost relationship, thereby improving the adaptability, continuity and traceability of cost accounting for multiple pricing methods in the enterprise resource planning system.

[0179] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A method for dynamically dividing cost granularity that supports multiple pricing methods, characterized in that, The method includes: Obtain the first valuation method and cost business log for the target inventory object in the current accounting period; Based on the preset mapping relationship between pricing methods and cost granularity rules, determine the first target granularity field set corresponding to the first pricing method; Based on the first target granularity field set, the cost business logs are grouped and cost accounting is performed to obtain the first cost log group and the corresponding cost accounting result. Based on the first cost log group and the cost accounting result, a cost summary record is generated in the unified cost master table, and the association between the cost business logs and the corresponding cost summary record is established. Obtain the second pricing method corresponding to the target inventory object in the next accounting period, and determine whether the first pricing method and the second pricing method have changed; When the first pricing method and the second pricing method change, the business log of costs to be carried forward is determined, the second target granularity field set is determined according to the second pricing method, the business log of costs to be carried forward is regrouped and the cost is recalculated based on the second target granularity field set, the second cost log group and the initial cost accounting result are obtained, and the initial cost summary record corresponding to the next accounting period is generated in the unified cost master table according to the second cost log group and the initial cost accounting result, and the association relationship between the business log of costs to be carried forward and the corresponding initial cost summary record is established.

2. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 1, characterized in that, The mapping relationship between the pricing method and the cost granularity rules is established through the following steps: Obtain the pricing method configuration data corresponding to each pricing method and the basic information corresponding to the target inventory object to obtain a set of candidate cost dimension fields; Extract the cost accounting dimensions corresponding to each pricing method from the pricing method configuration data to obtain the cost dimension selection conditions corresponding to each pricing method; Based on the selection criteria for each cost dimension, the cost dimension fields participating in the cost granularity division are selected from the set of candidate cost dimension fields to obtain the granularity field combination corresponding to each pricing method. Each pricing method is associated with its corresponding granularity field to obtain the mapping relationship between the pricing method and the cost granularity rule.

3. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 2, characterized in that, The combination of granular fields corresponding to each pricing method includes: Obtain the product identifier, first product attribute identifier, second product attribute identifier, unit identifier, inbound detail identifier, and accounting cycle identifier of the target inventory object to obtain the granularity basic fields; The product identifier, the first product attribute identifier, the second product attribute identifier, and the accounting cycle identifier are combined to obtain the cycle granularity field combination corresponding to the monthly average pricing method. The product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier are combined to obtain the unit granularity field combination corresponding to the moving average pricing method; The product identifier, the first product attribute identifier, the second product attribute identifier, and the warehousing detail identifier are combined to obtain the source granularity field combination corresponding to the warehousing source pricing method; wherein, the warehousing source pricing method is either an individual pricing method or a first-in-first-out pricing method; The periodic granularity field combination, the unit granularity field combination, and the source granularity field combination are associated with their respective pricing methods to obtain the granularity field combination corresponding to each pricing method.

4. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 1, characterized in that, The process of grouping and calculating costs from the cost business logs based on the first target granularity field set includes: Extract business source information, cost quantity information, cost amount information and unit information from each cost business log to obtain the original cost elements corresponding to each cost business log. Read the field values ​​corresponding to the first target granularity field set from each cost business log, and combine the field values ​​according to the preset field order to obtain the first granularity identifier corresponding to each cost business log; Cost business logs with the same first granularity identifier are divided into the same cost log group to obtain the first cost log group; Based on the first pricing method and the primary unit identifier of the target inventory object, the target accounting unit corresponding to each first cost log group is determined, and the cost quantity in each first cost log group is converted to the target accounting unit according to the unit conversion ratio to obtain the standardized cost quantity; wherein, when the first pricing method is the full-month average pricing method or the inbound source pricing method, the primary unit corresponding to the primary unit identifier is used as the target accounting unit; when the first pricing method is the moving average pricing method, the unit corresponding to the unit identifier in the corresponding first granularity identifier is used as the target accounting unit. The standardized cost quantity and cost amount in each first cost log group are summarized respectively, and the corresponding unit cost is determined based on the summarized standardized cost quantity and cost amount to obtain the cost accounting result; wherein, the inbound source pricing method is either individual pricing method or first-in-first-out pricing method.

5. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 4, characterized in that, Establishing the association between the cost business log and the corresponding cost summary record includes: Extract the business document identifier and business change type from each cost business log to obtain the cost source node corresponding to each cost business log. Obtain the cost deduction identifier and cost binding identifier recorded in each cost business log, and determine the upstream and downstream relationships between each cost business log based on the cost deduction identifier and the cost binding identifier to obtain a set of cost log association edges; By connecting the corresponding cost source nodes according to the cost log association edge set, a cost log association structure representing the cost increase, cost deduction and cost adjustment process is obtained; By associating each cost business log in the cost log association structure with the corresponding cost summary record, a cost traceability chain consisting of business documents, cost business logs, and cost summary records is obtained.

6. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 1, characterized in that, The process of determining the business log for costs to be carried forward includes: Obtain the cost summary record corresponding to the current accounting period and the cost business log associated with the cost summary record to obtain the cost data to be processed; Set the end time of the current accounting period as the valid end time of the cost summary record to obtain the historical cost summary record; Based on the type of business change corresponding to each cost business log, the cost business logs are divided into cost increase logs and cost deduction logs; Based on the cost source identifier corresponding to each cost deduction log, each cost deduction log is matched with the corresponding cost increase log to obtain the cumulative deduction quantity and cumulative deduction amount corresponding to each cost increase log; Based on the cost increase quantity, cost increase amount, cumulative deduction quantity, and cumulative deduction amount corresponding to each cost increase log, determine the remaining cost quantity and remaining cost amount corresponding to each cost source, and obtain the ending inventory cost information; Based on the ending inventory cost information, the cost business logs corresponding to the ending inventory costs are filtered from the cost business logs to obtain the cost business logs to be carried forward. The association identifier between the business log of costs to be carried forward and the historical cost summary record is updated to a temporary association identifier to obtain the set of cost logs to be reconstructed.

7. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 6, characterized in that, The regrouping and cost recalculation of the business logs to be carried forward based on the second target granularity field set includes: By comparing the field relationships between the first target granularity field set and the second target granularity field set, the granularity change type is obtained; When the granularity change type represents the cost granularity changing from fine to coarse, the cost business logs in the cost log set to be reconstructed are merged according to the field values ​​corresponding to the second target granularity field set to obtain a merged cost log group. When the granularity change type characterizes the cost granularity from coarse to fine, the cost source group is determined according to the original business source identifier corresponding to each cost business log, and the set of cost logs to be reconstructed is split according to the remaining cost quantity and remaining cost amount corresponding to each cost source group to obtain the split cost log group; When the granularity change type characterizes the first target granularity field set and the second target granularity field set as partially overlapping, the cost business logs in the cost log set to be reconstructed are recombined according to the field values ​​corresponding to the second target granularity field set to obtain the reconstructed cost log group; The merged cost log group, split cost log group, or reorganized cost log group corresponding to the granularity change type is determined as the second cost log group; The remaining cost quantity and remaining cost amount in each second cost log group are summarized separately, and the initial unit cost is determined based on the summarized remaining cost quantity and remaining cost amount to obtain the initial cost accounting result.

8. The method for dynamically dividing cost granularity supporting multiple pricing methods according to claim 1, characterized in that, Also includes: When the first pricing method and the second pricing method remain unchanged, the remaining cost quantity and remaining cost amount corresponding to each cost source are calculated based on the cost business log corresponding to the current accounting period to obtain the end-of-period continuation cost information. Generate the beginning cost business log for the next accounting period based on the end-of-period renewal cost information, and determine the beginning renewal type based on the first pricing method; When the initial renewal type is the full-month average renewal type, the next accounting cycle identifier is added to the first target granularity field set to generate the next cycle granularity identifier. Based on the next cycle granularity identifier, a new cost summary record is generated in the unified cost master table. The cost quantity of the cost business log to be renewed is converted into the main unit of the target inventory object. The converted cost business log to be renewed and one of the initial cost business logs are associated with the new cost summary record to obtain the cycle creation result. When the initial renewal type is the moving average renewal type, a unit renewal granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the unit identifier. The original cost summary record in the unified cost master table is queried and retained based on the unit renewal granularity identifier. The initial cost business log is associated with the original cost summary record to obtain the unit renewal result. When the initial continuation type is a source continuation type, a source continuation granularity identifier is generated based on the product identifier, the first product attribute identifier, the second product attribute identifier, and the warehousing details identifier. The original cost summary record in the unified cost master table is queried and retained based on the source continuation granularity identifier. The initial cost business log is associated with the original cost summary record to obtain the source continuation result. The source continuation type corresponds to an individual pricing method or a first-in-first-out pricing method. When the initial renewal type is a moving average renewal type or a source renewal type, and the original cost summary record is not found, a supplementary cost summary record is generated in the unified cost master table according to the corresponding unit renewal granularity identifier or source renewal granularity identifier and the end-of-period renewal cost information. The initial cost business log is then associated with the supplementary cost summary record to obtain the cost record supplementation result.

9. The method for dynamically dividing cost granularity according to claim 7 or 8, characterized in that, Also includes: Obtain the cost business logs, cost summary records and their valid time intervals generated after regrouping or initial continuation, and obtain the set of cost data to be verified. Check whether each cost to be carried forward business log or initial cost business log is uniquely associated with a single cost summary record, and obtain the log attribution integrity verification result; The cost summary records are sorted according to the target inventory object and the corresponding granularity identifier, and the effective time intervals of adjacent cost summary records are checked for overlap or discontinuity to obtain the time continuity verification result. Based on the cost quantity of the associated cost business logs corresponding to the target accounting unit of each cost summary record, the cost quantity and cost amount of the associated cost business logs of each cost summary record are summarized respectively, and the summary results are compared with the cost quantity and cost amount recorded in the corresponding cost summary record to obtain the cost balance verification result; When the log ownership integrity verification result, the time continuity verification result, and the cost balance verification result all meet the preset verification conditions, the cost data set to be verified is persisted to the corresponding data table to obtain the cost data update result. If any verification result does not meet the preset verification conditions, the persistence of the cost data set to be verified is prevented, and an exception prompt message is generated based on the corresponding verification result.

10. A dynamic cost granularity partitioning system supporting multiple pricing methods, characterized in that, The system includes: The data acquisition module is used to acquire the first pricing method and cost business log of the target inventory object in the current accounting period, and to acquire the second pricing method of the target inventory object in the next accounting period; The granularity determination module is used to determine a first target granularity field set corresponding to the first pricing method based on the preset mapping relationship between pricing methods and cost granularity rules, and to determine a second target granularity field set based on the second pricing method. The current cycle cost processing module is used to group and calculate the cost business logs based on the first target granularity field set, obtain the first cost log group and the corresponding cost calculation result, and generate a cost summary record in the unified cost master table according to the first cost log group and the cost calculation result, and establish the association relationship between the cost business logs and the corresponding cost summary record. The pricing method detection module is used to determine whether the first pricing method and the second pricing method have changed; The cost restructuring module is used to determine the cost business logs to be carried forward when the first pricing method and the second pricing method change, regroup and recalculate the cost business logs to be carried forward based on the second target granularity field set, obtain the second cost log group and the initial cost accounting result, and generate the initial cost summary record corresponding to the next accounting period in the unified cost master table according to the second cost log group and the initial cost accounting result, and establish the association relationship between the cost business logs to be carried forward and the corresponding initial cost summary record.