InventCostUpdate Class [AX 2012]
The InventCostUpdate class controls the global storage and final saving of the inventCostTrans and inventCostTransVariance records per dataAreaId.
Syntax
class InventCostUpdate
Run On
Server
Methods
Method | Description | |
---|---|---|
addToMemory | Adds the InventCostTrans records for a specified RecordSortedList object to the RecordSortedList object for this class. | |
cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) | |
checkForPhysicalRecord | Check to see whether a record in a different state exists for a given record. | |
equal | Determines whether the specified object is equal to the current one. (Inherited from Object.) | |
finalizeCostTransVariance | Processes the RecordSortedList object and InventCostTransVariance map that are handed over. | |
getCostTrans | Returns the record from the KeyCostTransMap map if found. | |
getCostTransVarianceList | Returns a RecordSortedList object with all the InventCostTransVariance records for a given InventCostTrans object. | |
getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) | |
handle | Retrieves the handle of the class of the object. (Inherited from Object.) | |
init | Initialize the memory structures used in this class. | |
lockPrice | Handles the locking of the InventItemPrice records to ensure that a new price is not entered. | |
new | Creates a new instance of the InventCostUpdate class. | |
notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) | |
notifyAll | Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.) | |
objectOnServer | Determines whether the object is on a server. (Inherited from Object.) | |
owner | Returns the instance that owns the object. (Inherited from Object.) | |
reset | Resets the class variables. | |
setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
toString | Returns a string that represents the current object. (Inherited from Object.) | |
ttsNotifyAbort | Calls the InventCostUpdate.reset method to reset all the variables. | |
ttsNotifyPostBegin | Calls the inventCostUpdate.reset method to reset all the variables. | |
ttsNotifyPreCommit | Updates the database by using the information that has been stored in memory. | |
usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) | |
wait | Pauses a process. (Inherited from Object.) | |
writeInventCostTrans | Writes the costTransList recordSortedList to the database | |
writeInventCostTransVariance | Writes all inventCostTransVariance records to the database | |
xml | Returns an XML string that represents the current object. (Inherited from Object.) | |
::construct | Initializes a new instance of the InventCostUpdate class. |
Top
Remarks
The InventCostUpdate class will be initialized for each dataAreaId through the InventCostUpdateGlobal class. This class will be used to store the inventCostTrans records and the inventCostTransVariance records in memory, and write them to the database when the final commit is called.
This class will be reset for each company when the first ttsbegin is called.
This class interacts with the inventCostMovement, the inventCostRevaluate and the inventCostAdjust classes.
Whenever all the costTrans records and the costTransVariances records in one of these two classes has been calculated completely, this class is called to push the variances of the structures to memory or to the database. This class communicates with the database to write the inventCostTrans and inventCostTransVariance records.
This class uses a key to identify which entries in the record sorted lists belong together. It is a composite key that consists of: InventTransId#Voucher#TransDate#CostTransType. This key stores a map that holds a recordSortedList of costTransVariance records (summarized for each key). Based on this information, at the final TTSCommit, this information will be used to assign the variances to each costTrans record after it is written to the database.
IMPORTANT: This class currently supports only two modes:
The first is the use from InventCostMovement or InvenCostRevaluate. A single call of the inventCostUpdate.finalizeCostTransVariance method is made for all the inventCostTrans records that belong together. This means that only new records are processed and none are updated.
Here are multiple inventCostTrans records processed at the same time.
Example InventCostMovement:
- init InventCostMovement
- add multiple InventTrans records to inventCostMovement
- finalize inventCostMovement
The finalize will call the invenCostUpdate.finalizeCostTransVariance method only once for all the inventCostTrans records that belong together.
The second mode is the use from InventCostAdjust. Multiple calls of the invenCostUpdate.finalzeCostTransVariance method are made for one inventCostTrans record. Here is only one inventCostTrans record processed at the same time.
Example:
- Process one inventTrans record belonging to one inventCostTrans record.
- Call the invenCostUpdate.finalizeCostTransVariance method.
- Process one inventTrans record that belongs to the same inventCostTrans record.
- Call the invenCostUpdate.finalizeCostTransVariance method again.
This class does not support situations where multiple inventCostTrans records are processed at the same time with multiple calls of the invenCostUpdate.finalzeCostTransVariance method.
Inheritance Hierarchy
Object Class
InventCostUpdate Class