cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Code or webject to create MBOM

gjärund
4-Participant

Code or webject to create MBOM

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 1
KD
4-Participant
4-Participant
(To:gjärund)

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

Top Tags