How to get serial number in windchill via API

How to get serial number for WT.Part or Wt.Document in Windchill via API?

When I create WT.Part - a number automatically generated. But I can not find any method that returns the next number. I am using Info*Engine .

+5
source share
3 answers

As a temporary solution - create a new Part , read the number and either use it or delete it.

0
source

When creating a WTPart object WTPart creating a windchill uses OOTB oracle_seqence to automatically generate a number. The sequence name is referenced in the OIR corresponding object. like for

WTPart is: WTPARTID_seq

For

WTDocument is: WTDOCUMENTID_seq , etc.

So, if you want to get the next WTPart number, you can directly call wt.fc.PersistenceHelper.manager.getNextSequence("WTPARTID_seq"); out of your task * engine *.

For different objects, the sequence name will be different.

In 10.2 PTC introduces another getCurrentSequence("SEQ_NAME") method to get the current value of the sequence without increasing it.

+2
source

Are you familiar with using Java with InfoEngine? If so, you can get the sequence:

 wt.fc.PersistenceHelper.manager.getNextSequence("SEQUENCE_NUMBER_OF_YOUR_OBJECT") 

The sequence number will be listed inside the "object initialization rule" associated with your object type.

+1
source

Source: https://habr.com/ru/post/1243059/


All Articles