Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: BOM - SOA get BOMWindow with packed BomLines

Siemens Phenom Siemens Phenom
Siemens Phenom

You are setting the flag with this line.

 BomWindows2.BomWinPropFlagMap.Add("is_packed_by_default", true);

I believe the values need to be strings, so you may need to use

BomWindows2.BomWinPropFlagMap.Add("is_packed_by_default", "true");

 

I've attached some sample code that uses this technique.

On my system with some sample data it produces the following;

 

Please enter user credentials (return to quit):
User Name: xxxxxx
Password:  xxxxxx
Enter Item ID: 000621
Got Item Revision:000621/A;1-Test Assy
BOM Expansion - packing = false
===============================
 000621/A;1-Test Assy |  | 1
   000622/A;1-SubAssy1 |  | 1
     000624/A;1-Part1 |  | 1
     000625/A;1-Part2 |  | 1
     000625/A;1-Part2 |  | 1
     000625/A;1-Part2 |  | 1
   000622/A;1-SubAssy1 |  | 1
     000624/A;1-Part1 |  | 1
     000625/A;1-Part2 |  | 1
     000625/A;1-Part2 |  | 1
     000625/A;1-Part2 |  | 1
   000623/A;1-SubAssy2 |  | 1
     000626/A;1-Part3 x 2 | 2 | 1
     000626/A;1-Part3 x 2 | 2 | 1
     000626/A;1-Part3 x 2 | 2 | 1
     000626/A;1-Part3 x 2 | 2 | 1
     000626/A;1-Part3 x 2 | 2 | 1
BOM Expansion - packing = true
==============================
 000621/A;1-Test Assy |  | 1
   000622/A;1-SubAssy1 x 2 | 2 | 2
     000624/A;1-Part1 |  | 1
     000625/A;1-Part2 x 3 | 3 | 3
   000623/A;1-SubAssy2 |  | 1
     000626/A;1-Part3 x 10 | 10 | 5

 

Where the packed parts all have the same item and find numbers.

The columns output are bl_formatted_title, bl_quantity, bl_pack_count.

 

Re: BOM - SOA get BOMWindow with packed BomLines

Pioneer
Pioneer

Hi Jonathan.

 

Thank your for your response.

 

I tried to use your code on my TC implementation.

 

The change in the option "packed_by_default" has no effect on the result.

 

This is my output:

 

 

Got Item Revision:RT20150604000/c/CONJUNTO EJEMPLO
BOM Expansion - packing = false
===============================
 RT20150604000/c/CONJUNTO EJEMPLO (View) |  | 1
   RT20150604003/A0/PIEZA 3 x 1 | 1 | 1
   RT20150604003/A0/PIEZA 3 x 1 | 1 | 1
   RT20141217001/--/Abuelo (View) x 1 | 1 | 1
     RT20141217003/--/Padre (View) x 1 | 1 | 1
       RT20141217004/--/Hijo x 1 | 1 | 1
   RT20150604002/--/PIEZA 2 x 1 | 1 | 1
   RT20150602001/A0/PIEZA 1 REV2 x 1 | 1 | 1

BOM Expansion - packing = true
==============================
 RT20150604000/c/CONJUNTO EJEMPLO (View) |  | 1
   RT20150604003/A0/PIEZA 3 x 1 | 1 | 1
   RT20150604003/A0/PIEZA 3 x 1 | 1 | 1
   RT20141217001/--/Abuelo (View) x 1 | 1 | 1
     RT20141217003/--/Padre (View) x 1 | 1 | 1
       RT20141217004/--/Hijo x 1 | 1 | 1
   RT20150604002/--/PIEZA 2 x 1 | 1 | 1
   RT20150602001/A0/PIEZA 1 REV2 x 1 | 1 | 1

 

 

Maybe there is an TC config option that prevents get the packed lines?
I am really getting out of ideas...

 

I attach the code, if it may help. As you can see, my code is exactly like yours.

 

Thank you so much.

Re: BOM - SOA get BOMWindow with packed BomLines

Siemens Phenom Siemens Phenom
Siemens Phenom

If you take the same structure, and login to the rich client with the same user and group as your SOA code then does the structure pack OK?

 

Out-of-the-box the packing criteria are

Same Item Revision

Same Find Number

No variant conditions or all have the same variant condition.

No substitutes, or the same substitutes.

 

There are some preferences that can be used to change behaviour;

BOMExcludeFromPackCheck

BOM_Additional_Packing_Criteria

PSEAutoPackPref

 

 

 

Re: BOM - SOA get BOMWindow with packed BomLines

Pioneer
Pioneer

Yes, If i search the BOM structure of the example item I get the lines packed. I attach an image with the result from rich client.

I mark packed lines in the BOM Manager

 

I use same user / group item and revision in rich client

 

I think so there are no substitutes and no variant conditions.

 

I check the preferences values too:

 

BOMExcludeFromPackCheck  --> none

BOM_Additional_Packing_Criteria --> has no value (empty value)

PSEAutoPackPref --> 1 (packed by default, i think)

 

Thank you so much

Re: BOM - SOA get BOMWindow with packed BomLines

Siemens Phenom Siemens Phenom
Siemens Phenom

Interesting.  If you can pack the BOM in Structure Manager then you should be able to get the same result through SOA.

 

I've given the code a try on Teamcenter 10.1.6.1 and 11.3 and it seems to work ok.

Which version are you on?

 

In the meantime I've attached a modification of the code that uses PackOrUnpack instead of trying to set is_packed_by_default.

The trick here is that PackOrUnpack returns updated parent and children BOMLines in the ServiceData.

The parent will now return a different set of children from when you retrieved it in its unpacked state.

To get the packed children you need to retrieve then by calling ExpandPSOneLevel again.

 

Re: BOM - SOA get BOMWindow with packed BomLines

Pioneer
Pioneer

Hi Jonathan.

 

I adapted your latest code to my TC enviroment and finally that works!

I put my output using packed lines:

 

 

BOM Expansion - packing = true
==============================
 RT20150604000/c/CONJUNTO EJEMPLO (View) |  | 1 |
   RT20150604003/A0/PIEZA 3 x 2 | 2 | 2 | 01
   RT20141217001/--/Abuelo (View) x 1 | 1 | 1 | 02
     RT20141217003/--/Padre (View) x 1 | 1 | 1 | 01
       RT20141217004/--/Hijo x 1 | 1 | 1 | 01
   RT20150604002/--/PIEZA 2 x 1 | 1 | 1 | 03
   RT20150602001/A0/PIEZA 1 REV2 x 1 | 1 | 1 | 04

This my be the solution for my problem.

 

I am goint to try to adapt this solution to my current project.

 

Thank you so much.

Re: BOM - SOA get BOMWindow with packed BomLines

Siemens Phenom Siemens Phenom
Siemens Phenom

Glad to have helped.

It's a shame that is_packed_by_default didn't work for you as that would be a better solution with less client-server round trips.

It maybe worth leaving a comment in the code so if you patch / upgrade you could update the code to be more efficient.