Lesson 14 (3:20). Optimization of posting the Services document

 


After studying the previous lesson, you learned a lot about the query language. You are ready to proceed to one of the most important lessons in this book, which describes the optimization of the Services document. In particular, you will completely refactor its Posting event handler.

You might ask why you have to do it. There are three reasons.

First, the Posting event handler accesses the MaterialServiceType attribute of the MaterialsAndServices catalog using dot (.), which can slow down the procedure execution for documents with large tabular sections.

Second, the management at Jack of All Trades finally decided to wrap up the practice of entering the costs of consumed materials manually and now wants you to implement automatic calculation of the average cost of materials.

Third, when a Services document is posted, you need to monitor the item balances in the warehouses. If the number of items is not sufficient, a warning should be displayed and the document should not be posted.

Therefore, the changes you will make to the Services document will accomplish three purposes:

  • Improve the procedure performance
  • Calculate the cost of consumed materials automatically when a document is posted
  • Split the document posting algorithm into real-time posting and regular posting and implement the check of balances for real-time posting.

Before you proceed to these tasks, let us briefly discuss the specifics of storing and using reference data in 1C:Enterprise.


Comments
0
Add comment