26.04.2012, 19:11 | #1 |
Участник
|
fed: Net requirements update in MRP Module and Working Set of MRP
Источник: http://fedotenko.info/?p=247
============== Most of Dynamics AX specialists (especially from support) heard about inventSumLogTTS table. Everyone knows that this table somehow is related to MRP; Everyone knows that if you do not run MRP, your inventSumLogTTS table grows bigger and bigger and eventually you need to clean it somehow. But since detailed documentation on static/dynamic plan update algorithms is absent, not many people understand how Axapta actually use this table for plan updates; what are advantages and caveats of dynamic vs static plan use;how order explosion differs from regeneration planning and so on… I wrote this text mostly from my experience with Dynamics AX 2009. In the new version (DAX2012) approach remained the same from functional point of view, only technical details changed, so this information can be useful also for people using DAX2012. A bit of history As I wrote in my blog before, inventSumLogTTS table began its life (somewhere in late releases Axapta 2.5) only as a tool to track a list of changes which was applied to inventSum table in independent DB transaction. Should the main transaction be rolled back, the system was to iterate over related records in inventSumLogTTS and programmatically rollback changes to inventSum. Starting from Axapta 3.0, inventSumLogTTS table started to be used to support dynamic update to MRP plan. In version Dynamics AX 4.0, the whole Inventory MultiTransaction System was dropped from Axapta and replaced with new approach. Nevertheless inventSumLogTTS table still exists in the system, but nowadays it is used only to support dynamic MRP plan update. Today, name of the table is misleading, because now it is not used to log InventSum updates. As of versions 4-2012 it is used only to keep track of inventTrans changes, which have not been applied to dynamic plan yet. How data gets into inventSumLogTTS The mechanism which now (in versions 4.0/2009/2012) is creating new records in inventSumLogTTS is the very same mechanism which is used to update inventSum. (I described this mechanism in details in the article I mentioned). When inventTrans is inserted/updated/deleted the system calls inventUpdateOnHand.addInventSumLogTTS() method to register deletion or insertion of inventTrans. (and update goes as a delete and insert). InventSumLogTTS records are kept in cache till the end of transaction and are actually written to database at the same time when the system updates inventSum records, related to inventory updated in transaction. To link two records of inventSumLogTTS related to the same update of an inventory transaction, the system uses the sequenceNumber field of the inventSumLogTTS table. The system registers changes of inventTrans record, till it become physically/financially updated (Deducted/Sold or Received/Purchased statuses). Only the very first change of the transaction to physical/financial status is registered to inventSumLogTTS. Later this change is to be applied to Net Requirement of On-Hand type by dynamic plan update mechanism. Subsequent changes to the same inventory transaction are not recorded, since they are not anymore relevant for MRP, since now the transaction is a part of OnHand Stock which is represented in Net Requirements as a one on-hand net requirement per item and coverage dimensions. Working Set of MRP and a bit of terminology To simplify further discussion I want to introduce a new term – Working Set. I will use this term to describe a list of net requirements which are participating in current MRP session. In different stages of MRP session, content of that list is different. After update phase, it contains issue net requirements to be covered, during coverage phas it contain mixture of covered issue net requirements, covering receipt net requirements and uncovered issue net requirements to be covered. After coverage phase, working set contains only covered/covering net requirements. But the point is: Working set of MRP session is the most fundamental thing for understanding of MRP process and it always defined by adding to it uncovered issue net requirements. Everything else is implementation details. Generally, there are two ways to start MRP: One is to start MRP from Master Planning->Periodic->Master planning; Another – to click Master Planning->Periodic->Master planning in Requirement Profile form. The menu items point to different classes. From implementation point of view, both classes use different algorithms. First class is optimized for multi-threaded scheduling of large number of net requirements. Second is optimized for scheduling for only 1 item, but it has good caching mechanisms, so it might work much faster sometimes. I will use term Full MRP for MRP from Periodic menu and term Item MRP for MRP from Requirement Profile form. From functional point of view, there is a serious difference between these two kinds of MRP. Item MRP runs on the level of specific net requirements; Full MRP works on the level of item-coverage dimension combination. When net requirement is added to Working Set of Full MRP, it implicitly adds whole net requirements with a given item and coverage dimension combination into Working Set. Technically speaking, Item MRP is implemented by combination of classes ReqCalcScheduleItem (Responsible for the planning process itself) and ReqTransCache_Daily(Responsible for Working Set support). ReqTransCache_daily class holds a set of itemIds in a Working Set, a set of coverage dimension combinations for every item in a Working Set and a map with Net Requirements of Working Set itself. Full MRP is implemented by combination of classes ReqCalcScheduleItemTable (responsible for planning process) and ReqTransCache_Periodic (Responsible for Working Set support).ReqTransCache_Periodic class holds only a set of items and set of coverage dimensions for items in a Working Set. (Technically these sets are stored as ReqProcessItemListLine and ReqProcessItemDim list tables). As we will see later, working set is created on Update phase of MRP session (I will use term Initial Working Set for it), but can grow as a result of Coverage phase of MRP Session (I will use term Extended Working Set for working set after extension by coverage planning). I will also occasionally use term Items in working set, to refer to the list of items which have net requirements in the given Working Set; Sometimes, I will also use term Session Item Set to designate the set of items defined before MRP start. In case of Item MRP, this item is defined by current content of Requirements Profile form; In case of Full MRP, the items are defined by query parameters in dialog box which is popping up in beginning of MRP process Simplest case: Regeneration of static plan Before we proceed our discussion any further, I want to discuss a bit the simplest case of MRP: Regeneration of static plan. If we are running MRP in regeneration mode, here is what happens:
More complex case: Regeneration of dynamic plan Regeneration of dynamic plan generally work the same way as regeneration of static plan only with few extra steps added:
I want specially mention, that the the net requirements updated on Dynamic Update Stage, are not automatically included into the Working Set. Dynamic Update Stage is not very fine-grained; It runs on level of item;It might be that Dynamic Update has updated net requirements with configuration, sizes or colors that have nothing in common with the current Session Item Set. Thus, inclusion of all updated net requirement for an item into a Working Set, would cause unnecessary increase in a Working Set size and increase complexity of planning. Interesting side effect of inventSumLogTTS application is that MRP session can adapt to latest changes to inventTrans made by users during planning session. Say, if we have item with BOM Level 4 in our Session Item Set, it might happen that between initial net requirements creation and coverage planning for BOM Level 4, a user will make a set of changes to inventTrans for the item. Since coverage planning for item starts from propagation of recent inventTrans changes to net requirements, results of MRP will be consistent with inventTrans state in the beginning of coverage process for given item. In case of regeneration of static plan, reqTrans state is consistent with the state of inventTrans during initial net requirement update phase; All subsequent changes to inventTrans are not reflected in net requirements. Net change update of dynamic plan In Net Change/Net Change minimized mode,update phase of MRP is executed in entirely different way. It is simply a sequence of Dynamic Updates for items in a Session Item Set. The system iterates over the Session Item Set and for every item it calls usual net requirement update mechanism (reqTransUpdate class), so that relevant net requirements will be updated with recent information from inventSumLogTTS. As a result of this update, some of net requirements are dropped, some are created, for some requirements quantity is changed. Next, during coverage phase, coverage process uncovered issue net requirements in Working Set. Again, before running coverage process for an item, the system run usual net requirements update mechanism as usual, so even items not in Session Item Set have their net requirements updated after coverage phase. Regarding requirement update phase, there are two difference between Net Change and Net Change minimized modes:
Say, you have a 80 pieces of an item in stock and a sales order for exactly 50 pieces item with delivery date in distant future. (Say – in 6 month). Regular nightly planning in regeneration mode, created coverage record between these two net requirements. SalesLine is fully covered with invent on-hand, while invent on-hand net requirement has 30 free pieces left. This 30 pieces can be used to cover something else. Suppose that on next morning a customer came and placed an urgent order for 70 pieces of the item with delivery date of tomorrow. Common sense tells us that we can use our current on-hand to cover this new urgent sales order and for remaining uncovered 40 pieces of non-urgent sales order we can create appropriate planned order with execution date in distant future (in a few days before non-urgent order’s delivery date). Instead of this, Net Change planning will use remaining 30 pieced of on-hand to cover urgent sales order and will create extra urgent planned order for remaining 40 pieces with execution date of today. It happens, because net change/net change minimized never touches net requirements which had not had related inventTrans changed. During update phase, the system creates new net requirement for 70 pieces for tomorrow. It cannot ‘release’ on-hand net requirement for more urgent order, because it cannot touch it! During coverage phase it creates coverage record for 30 pieces between existing (not touched by Dynamic Update) on-hand net requirement and new sales net requirement. For remaining 40 pieces, the system creates new planned order. The only way to solve this issue is to run regeneration mode scheduling for an item and all nested sub-components. If we run regen mode scheduling only for item in new urgent sales order, we won’t have the phenomena for the net requirements of item itself. But if this item is a BOM with sub-components, it means for sub-component items, the same problem can arise on next BOM Levels. I am a bit surprised, that standard Dynamics AX does not have some special ‘Explosion regen MRP’ which would take item or item mask as an input and then build INITIAL working set from all sub-components of item entered. I made this functionality for a couple of projects. It works much faster then full regeneration scheduling and it works somewhat slower then explosion. (Which is working on different set of principles and is just a special case of Net Change Minimized planning). This MRP extension also happens to fix the issue of incorrect planned orders for items with Period coverage code, which I mentioned in the section before previous. Explosion Explosion is a special kind of Net Change dynamic plan update. By definition, explosion only can be run for current dynamic plan. The most fundamental difference between explosion and regular MRP is that explosion includes into Initial Working Set ONLY net requirements belonging to the specific order or line of the order. It also means that it is the most fine-grained MRP kind. Since it is the most fine-grained kind of planning, it uses the same approach for working set update as Item MRP do. Working Set for explosion also stores working set as a set of particular net requirements, not as a set of item and coverage dimensions combinations. During requirement update stage, the system will simply run run Dynamic Update for the item of the net requirement being exploded and then create Initial Working Set from this net requirement and derived demand net requirements (sub-components for the planned production order or production order; derived net requirements on refill warehouse in case of planned transfer order and so on). The subsequent stages goes more or less in the same way as for Net Change Minimized dynamic plan update. There are three kinds of explosion:
Two plans scheme Standard MRP tutorials describes the idea of two plans schema in details. Shortly speaking, we have two plans – static and dynamic. Static plan is fully regenerated every night (or maybe every second night, every Saturday and so on…) and copied into dynamic plan. During daytime (between two static plan regenerations), production, purchase and logistics departments works with static plan. (Since it is stable and kept in ’up-to-the-rules’ state), while sales managers works with dynamic plan, running explosions for newly created sales orders. In this case, sales managers have a tool to make reasonable estimation for a sales order delivery time, while all other departments work with stable plan without irregularities caused by last moment change. In this case, if Full MRP is run and Session Item Set contains all items, update phase for static plan is also dropping all info from inventSumLogTTS table. The logic behind it is clear: Since we are running full regen and we are going to copy it results to dynamic plan anyway, there is no much point in keeping our old update log. In the beginning, we will drop inventSumLogTTS, create static plan from the scratch, then after MRP finish, we will copy static plan to dynamic. InventSumLogTTS at this moment will contain the list of updates to inventTrans made after initial plan regeneration. If user try to run explosion or dynamic plan update in Net Change/Net Change Minimized mode, the system will handle it in the same way as usual dynamic update of dynamic plan. Change of current dynamic plan If you try to change current dynamic plan settings in master planning parameters, you can encounter strange behavior. An attempt to change, the system will pop-up a dialog box with the message “Update and move transactions to new dynamic master plan?”. If you agree, on attempt to save changes, the system will hang for a while. After that you will be surprised a lot: Your new dynamic plan will contain exactly the same information as old dynamic plan. The system was hanging during parameters update just because it was copying old dynamic plan content into new dynamic plan… On a first sight it looks totally weird and counter-intuitive. We are deliberately changing dynamic plan and yet, as a results, we have the same plan under a different name. But if we think more about it, it is not so weird at all. Say, we just changed current dynamic plan without copying. What should the next explosion do ? We have a lot of recorded changes in inventSumLogTTS; Which of them should be applied to the new dynamic plan and which – should not ? There is no way to know. We have only one dynamic plan which is synchronized with inventTrans/InventSumLogTTS state. So, if we are changing current dynamic plan settings, there is only one relatively fast way to bring it to synchronous state – to copy old dynamic plan (which is kept in sync by definition) to new one. An alternative approach would be to run Full MRP in regeneration mode, but it would require much more time and DB/AOS server capacity. That’s why designers of MRP module in Dynamics AX decided to always copy dynamic plan on change of current dynamic plan setting. Dynamic Update process Dynamic update algorithm is pretty straightforward. The system runs over the inventSumLogTTS records for the specified item sorted by sequence id and apply every change to underlying net requirement record (reqTrans). There are few points to be made though:
Источник: http://fedotenko.info/?p=247
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
Теги |
сводное планирование |
|
Похожие темы | ||||
Тема | Ответов | |||
fed: Two stories about inventory closing and SQL Locks | 3 |
|