Customizing Operator Advisor > Updating Material Use Values
Updating Material Use Values
A material use value is used to indicate the intended use for a particular material. The MaterialUse property is found on both work definition material specifications (PTC.SCA.SCO.WorkDefinitionMaterialSpecification) and job order material requirements (PTC.SCA.SCO.JobOrderMaterialRequirement). The MaterialUse property value is an integer that maps to an enumerated list of material use values. By default, the available material use values include Consumed, Produced, Destroyed, Disassembled, and OperatedOn.
Services are available on the default production order manager Thing (PTC.SCA.SCO.DefaultProductionOrderManager) to create new material use values, update or delete existing values, or retrieve the material use values present in the system. You can also customize the mappings for part allocation types from Windchill to material use values when converting process plans.
Creating Material Use Values
Using the CreateMaterialUses service, you can create multiple material use values by adding them to the MaterialUses input parameter table.
Once you execute the CreateMaterialUses service, it returns the list of material use values that were created, along with their UIDs.
Retrieving Material Use Values
Using the GetMaterialUse service, individual material use values can be retrieved for viewing by entering the UID of the material use value in the UID input parameter.
Alternatively, you can use the GetMaterialUses service to retrieve all material use values in the database, including their UIDs.
Updating Material Use Values
The names of existing material use values can be updated using the UpdateMaterialUses service. In the MaterialUses input parameter table, enter the UID for the material use value to be updated, then enter the new Name value for the material use. Executing the service returns the list of material use values that were updated, along with their UIDs.
Deleting Material Use Values
You can delete any previously created material use value using the DeleteMaterialUse service, and providing the UID of the material use value to be deleted. Attempting to retrieve a deleted (or non-existent) material use value yields an empty result table.
* 
Exercise caution when deleting material use values. The system does not prevent you from deleting a material use value that is already in use or has been used.
Customize the Mappings Between Windchill Allocation Types and Material Use Values
During the process plan conversion, the allocationType property values from the Windchill MPMOperationToPartLink and MPMOperationToOperatedPartLink objects are mapped to material use values in Operator Advisor. The out-of-the-box mappings are as follows:
Allocation Type Value
Material Use Value
All MPMOperationToOperatedPartLink allocation types, including disassembled, reassembled, and null
OperatedOn
For MPMOperationToPartLink allocation types:
consumed
Consumed
produced
Produced
destroyed
Destroyed
disassembled
Disassembled
* 
The Consumable material use value provided with Operator Advisor is not mapped to a Windchill allocation type out-of-the-box. It is available for custom mappings.
If the allocation type from Windchill is unknown, or not included in the mappings, then the material use value in Operator Advisor is left empty.
If you have altered the provided list of material use enumeration values using the provided create, update, and delete services, or have additional allocation types on MPMOperationToPartLink objects in Windchill that you want mapped in the conversion, you can customize the mappings.
To customize the mappings:
1. In ThingWorx Composer, navigate to the work definition converter Thing (PTC.SCA.SCO.MPMLinkWorkDefinitionConverter).
2. Under Services, find and override the GetMaterialUseValue service.
3. In the service editor, edit the code to update the existing mappings, or to add mappings. The following service code is provided with Operator Advisor:
Service editor for the GetMaterialUseValue service.
The value for each materialUse is the allocation type value from Windchill, and is case-sensitive. The result is the UID for a material use value. Multiple allocation types can map to a single material use value UID.
* 
You must ensure that the mappings are appropriate for the material use values that are currently present in your system. This is especially necessary if you have altered the list of material use values provided with Operator Advisor using the provided create, update, and delete services. To see the current list of material use values, with their UIDs, execute the GetMaterialUses service on the default production order manager Thing (PTC.SCA.SCO.DefaultProductionOrderManager).
For example, to map an additional allocation type from Windchill (myAllocationType) to a new material use value which has a UID of 9, add the following code:
} else if (materialUse === "myAllocationType") {
result = "9";
4. Click Save and Continue to save the updated service.
5. Click Save to save the work definition converter Thing.
The customized mappings are applied for any subsequent process plan conversions.
Was this helpful?