Skip Headers

Agile Product Lifecycle Management SDK Developer Guide - Using APIs Release 9.3.3 E39307-01 |
| Contents

Previous | Next |

# 10 Managing Manufacturing Sites

Companies that practice distributed manufacturing use several different manufacturing sites for their products. Agile PLM site objects allow companies to maintain site-specific information for a product's parts. For example, the various manufacturing locations may have different effectivity dates for new revisions, different manufacturing instructions due to location, or different manufacturers from whom they buy components, due to location.

Changes can affect all manufacturing sites of an item or a specific site. The Affected Items table for a change lets you select the manufacturing sites that are affected. Items may have different effectivity dates and dispositions at each site. You specify effectivity dates and dispositions on the Affected Items tab of an ECO or SCO. To create a new revision when you assign the new effectivity date or disposition, use an ECO. To assign site-specific effectivity dates and dispositions without incrementing the revision, use an SCO.

For a more detailed overview of Agile PLM's manufacturing sites functionality, refer to the Agile PLM Product Collaboration Guide.

## 10.1 Controlling Access to Sites

In order to use manufacturing sites in your organization, the Sites module must be enabled in Agile Administrator. Your organization's agreement with Oracle determines the modules that are enabled in Agile PLM.

Access to manufacturing sites of users is controlled by their assigned roles and privileges and the Sites property in their profiles. Your organization can create an unlimited number of manufacturing sites, however a user will not have access to every site unless all sites are specified in his user profile Sites property. Your organization may have implemented the Agile PLM system in such a way that users can access only the information pertaining to certain sites, as determined by their user profile Sites property.

To create a site-specific BOM for an item, the item's subclass must have the Site-specific BOM property set to Allow. Otherwise, items of that subclass have BOMs that are common to all sites. For information on Sites and enabling sites, refer to the Agile PLM Administrator Guide.

## 10.2 Creating a Manufacturing Site

Manufacturing sites are identified uniquely by name. To create a manufacturing site, use the IAgileSession.createObject method, specifying both the class and the site name.

All users cannot create manufacturing sites. Only users who have the Create privilege for manufacturing site objects can create manufacturing sites.

Note When you create a manufacturing site, its Lifecycle Phase is set to Disabled by default. To use the site, make sure you enable it.

Example: Creating and enabling a manufacturing site

    try {
    // Create a manufacturing site

HashMap params = new HashMap();

params.put(ManufacturingSiteConstants.ATT_GENERAL_INFO_NAME, "Taipei");

IManufacturingSite mfrSite = (IManufacturingSite)m_session.createObject(

    ManufacturingSiteConstants.CLASS_SITE, params);
    // Enable the manufacturing site

ICell cell = mfrSite.getCell(

ManufacturingSiteConstants.ATT_GENERAL_INFO_LIFECYCLE_PHASE);

IAgileList values = cell.getAvailableValues();

values.setSelection(new Object[] { "Enabled" });

cell.setValue(values);

    } catch (APIException ex) {
    // Load the Hong Kong site
    }

System.out.println(ex);

## 10.3 Loading a Manufacturing Site

To load an IManufacturingSite object, use one of the IAgileSession.getObject() methods. The following example shows three different ways to specify the object type for a manufacturing site.

Example: Loading a manufacturing site

    try {

IManufacturingSite siteHK =

(IManufacturingSite)m_session.getObject(ManufacturingSiteConstants.CLASS_SITE, "Hong Kong");

    // Load the Taipei site
    private static void getSites(IItem item) throws APIException {

IManufacturingSite siteTaipei =

(IManufacturingSite)m_session.getObject(IManufacturingSite.OBJECT_TYPE, "Taipei");

    // Load the San Francisco site
    } catch (APIException ex) {

IManufacturingSite siteSF = (IManufacturingSite)m_session.getObject("Site", "San Francisco");

System.out.println(ex);

    }

## 10.4 Retrieving the Sites Table for an Item

Each item has a Sites table that lists the manufacturing sites where that item can be used. To retrieve the Sites table for an item, use the DataObject.getTable() method.

Example: Retrieving the Sites table

    //Get the Sites table

IRow row;

ITable table = item.getTable(ItemConstants.TABLE_SITES);

ITwoWayIterator it = table.getTableIterator();

while (it.hasNext()) {

row = (IRow)it.next();

    //Add code here to do something with the Sites table
    }

}

To determine the manufacturing sites associated with an item, use the IManufacturingSiteSelectable.getManufacturingSites() method. Of course, you can also iterate over the Sites table to get the same information, but using the getManufacturingSites() method is easier and faster. For an example that uses getManufacturingSites(), see Selecting the Current Manufacturing Site of an Item on page 160.

## 10.5 Adding a Manufacturing Site to the Sites Table

Each row of the Sites table references a different IManufacturingSite object. To add a manufacturing site to the Sites table, use the ITable.createRow() method.

If a manufacturing site is not listed on an item's Sites table, then that item cannot be included in a parent item's BOM specific to that manufacturing site. For example, to add item P1001 to another item's Taipei-specific BOM, P1001 must have the Taipei site listed on its Sites table.

Example: Adding a row to the Sites table

    private static void addSite(String itemNumber, IManufacturingSite site)
    //Load the item

throws APIException {

IItem item = (IItem)session.getObject(IItem.OBJECT_TYPE, itemNumber);

    //Get the Sites table
    //Add the manufacturing site to the table

ITable table = item.getTable(ItemConstants.TABLE_SITES);

IRow row = table.createRow(site);

    }

## 10.6 Selecting the Current Manufacturing Site of an Item

BOM and Manufacturers tables (or AMLs) can be different for each manufacturing site used for an assembly. When you retrieve a BOM or Manufacturers table for an item, you can display information for all sites or for a specific site. If you choose a specific site, only that site's information is included in the table.

The IManufacturingSiteSelectable interface provides methods for getting and setting the manufacturing site for an item. To get the current manufacturing site selected for an item, use the IManufacturingSiteSelectable.getManufacturingSite() method.

Example: Getting the currently selected manufacturing site for an item

    private static IManufacturingSite getCurrentSite(IItem item)

throws APIException {

IManufacturingSite site = item.getManufacturingSite();

return site;

    }

The IManufacturingSiteSelectable.getManufacturingSites() method retrieves all available manufacturing sites that have been added to an item's Sites table.

Example: Getting all manufacturing sites associated with an item

    private static void getItemSites(IItem item)

throws APIException {

IManufacturingSite[] sites = item.getManufacturingSites();

    //Print the name of each site

for (int i = 0; i < sites.length; ++i) {

String siteName = (String)sites[i].getValue(

ManufacturingSiteConstants.ATT_GENERAL_INFO_NAME);

System.out.println(siteName);

}

    }

The IManufacturingSiteSelectable.setManufacturingSite() method sets the current manufacturing site for an item. You can specify that an item has a specific manufacturing site, is not site-specific, or uses All Sites. To specify that an item is not site-specific, use ManufacturingSiteConstants.COMMON_SITE. To specify All Sites, pass the ManufacturingSiteConstants.ALL_SITES value.

When you set the manufacturing site for an item, the item is updated to reflect site-specific information. Consequently, your program should update the BOM and Manufacturers tables by iterating over the rows again to refresh them.

Example: Setting the current manufacturing site for an item

    try {
    // Load sites

IManufacturingSite siteSF =

(IManufacturingSite)m_session.getObject("Site", "San Francisco");

IManufacturingSite siteHK = (IManufacturingSite)m_session.getObject("Site", "Hong Kong");

    // Load an item
    // Set the site to Hong Kong

IItem item = (IItem)m_session.getObject("Part", "1000-02");

item.setManufacturingSite(siteHK);

String desc = (String)item.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);

System.out.println("Hong Kong description = " + desc);

    // Set the site to San Francisco

item.setManufacturingSite(siteSF);

desc = (String)item.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);

System.out.println("San Francisco description = " + desc);

    // Set the item to use all sites

item.setManufacturingSite(ManufacturingSiteConstants.ALL_SITES);

desc = (String)item.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);

System.out.println("All Sites description = " + desc);

    // Set the item to be common site (the item is not site-specific)

item.setManufacturingSite(ManufacturingSiteConstants.COMMON_SITE);

desc = (String)item.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);

System.out.println("Global description = " + desc);

    // Set the item to use the user's default site

item.setManufacturingSite(((IAgileList)m_session.getCurrentUser().getValue(UserConstants.ATT_GENERAL_INFO_DEFAULT_SITE)).getSelection()[0].getValue());

desc = (String)item.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);

System.out.println("User's Default Site description = " + desc);

    } catch (APIException ex) {
    }

System.out.println(ex);

## 10.7 Disabling a Site

A manufacturing site can have one of two lifecycle phases, enabled or disabled. If a site is disabled, it can no longer be used to create site-specific BOMs, AMLs, and changes.

To disable a manufacturing site, set the value for the Lifecycle Phase attribute to Disabled.

Example: Disabling a manufacturing site

    private static void disableSite(IManufacturingSite site)
    // Get the Lifecycle Phase cell

throws APIException {

ICell cell = site.getCell(

ManufacturingSiteConstants.ATT_GENERAL_INFO_LIFECYCLE_PHASE

);

// Get available list values for Lifecycle Phase

IAgileList values = cell.getAvailableValues();

    // Set the value to Disabled

values.setSelection(new Object[] { "Disabled" });

cell.setValue(values);

    }