Skip to main content
1-Visitor
June 30, 2016
Question

Code or webject to create MBOM

  • June 30, 2016
  • 1 reply
  • 1144 views

Is there anyone who has an example of code or webject to create an MBOM from an EBOM or a part?

Thanks,

/Gustav

1 reply

12-Amethyst
July 3, 2016

Hi Gustav,

You can use below method to create WTPart with Manufacturing view from Design view.

The code is only for a Part.

/**

     * Creating manugfacturing part.

     *

     * @param latestPartDesign

     *            given {@link WTPart}.

     *

     * @return {@link WTPart}.

     *

     * @throws WTPropertyVetoException

     *             throws {@link WTPropertyVetoException}.

     *

     * @throws WTException

     *             throws {@link WTException}.

     */

    public static WTPart createManufacturingPart(WTPart latestPartDesign)

            throws WTPropertyVetoException, WTException {

        WTPart partManufacturing = null;

        WTPart latestPart = latestPartDesign;

        LOG.debug("Latest part view :: " + latestPart.getViewName());

        if (!"Manufacturing".equalsIgnoreCase(latestPart.getViewName())) {

            partManufacturing = ((WTPart) ViewHelper.service.newBranchForView(

                    latestPartDesign, "Manufacturing"));

            partManufacturing = ((WTPart) PersistenceHelper.manager

                    .store(partManufacturing));

        } else {

            partManufacturing = (WTPart) PersistenceHelper.manager

                    .refresh(latestPart);

        }

        return partManufacturing;

    }

Regards,

Kaushik