Adding an Alternate Part from a Third-Party System
Servigistics InService enables you to add a part from a third-party system as an alternate part. To add an alternate part from a third-party system, you use a custom delegate that implements the
com.ptc.sc.services.plugins.PricingDelgate interface. The interface must call the
injectPricing() and
getAlternativePart (SCItem item) methods. For more information about creating custom delegates, see
Creating Custom Delegates on the Server.
You can implement the following processes in the custom delegate:
• Make available the alternate part from the third-party system to Servigistics InService. You specify the logic for this process in the injectPricing() method of the custom delegate.
• Make available the location and other details of the alternate part from the third-party system to Servigistics InService. You specify the logic for this process in the getAlternativePart (SCItem item) method of the custom delegate.
Example Code for Adding an Alternate Part from a Third-Party System
The following example code in the injectPricing() and getAlternativePart (SCItem item) methods of the custom delegate obtains the alternate part number 000012345 and its details from a third-party system:
@Override
public void injectPricing(SCId scId, SCList scList) throws Exception {
if (!DownloadCenterUtils.isAgentMode()) {
priceFormatter = createNumberFormatter();
logMetaData(scList);
// Inject pricing for each item in the list
for (SCItem item : scList.retrieveItems()) {
clearPricing(item);
injectPricing(item);
getAlternativePart(item);
}
private void getAlternativePart(SCItem item) {
/*We have used static data just as an example.Actual
* implementation should be to fetch data from 3rd party system */
SCValue alternatePartNumber = new SCValue();
alternatePartNumber.setKey("Partnumber");
alternatePartNumber.setValue("000012345");
alternatePartNumber.setTitle("Partnumber");
SCValue alternatePartOrgName = new SCValue();
alternatePartOrgName.setKey("orgName");
alternatePartOrgName.setValue("AMP_Org");
alternatePartOrgName.setTitle("orgName");
SCValue alternatePartLocation = new SCValue();
alternatePartLocation.setKey("location");
alternatePartLocation.setValue("India");
alternatePartLocation.setTitle("Location");
item.putCustomMetadata(alternatePartNumber);
item.putCustomMetadata(alternatePartOrgName);
item.putCustomMetadata(alternatePartLocation);
}