This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Federated Items

esteimle - Thursday, January 5, 2012 12:00 PM:

I'm new to Aras but I have written a fair number of database based systems in the past.  Full disclosure though I'm a circuit designer not a software engineer :)   Anyway I want to get my ORCAD CIP parts from my database into Aras so Aras can be the single source for BOMs etc.    I don't want Aras to manipulate or add any information to my CIP database at this time.

From reading the forums I've come to understand that my first step is to create a federated item and use the onGet request to populate that with data from the CIP database.   I trying to get that working now, and if anyone has any examples other than the two standard federation articles on the Aras site I'd appreciate it.

The real thing I don't understand yet is, after I get this federated item to work, how do I get it to appear to my user?  I mean how to do I show these CIP parts in a table like ARAS shows it's regular parts?   Any hints in the right direction would be great.

 

Thank you!



RobMcAveney - Saturday, January 7, 2012 12:13 PM:

From your other posts it seems like you've gotten pretty far already, but I have a couple of hints that might help.  You've clearly chosen to use a Federated ItemType, which I think is a good choice in this case.  Just keep in mind that federating an entire ItemType does take a bit more effort than the other techniques.  You are effectively replacing the storage, search and retrieval of these items (normally handled by the Aras server) with your own logic.  Your goal should be to make the Aras server and client not see any difference between the standard search/retrieval logic and your custom logic.  The client should only know that it submitted a request for some CIP items and received some back in the expected format.  It literally has no idea where the data is stored or how it was retrieved.  It just expects a response that it understands.

I think the key here (as usual) is AML.  If you understand the request/response format it will be much easier to simulate the internal logic.  I suggest taking a look at some of the requests generated when you search for standard parts from the client.  You can do this a few ways, but the easiest is just saving the requests (Tools->Admin->Save Requests).  You then get a file in your working directory for each request made to the server.  That will help you determine how different search criteria defined in the UI affects the request.  You can then cut/paste the requests into the Nash (raw AML) client to see what the response looks like.  There are some things in the response (like paging info) that are important to make the client work correctly.  Looking at examples of raw responses is the best  way I know to get a feel for what you need to do.

Keep posting any questions you have.  I'll try to answer them a little quicker in the future.  Good luck!



esteimle - Saturday, January 7, 2012 2:00 PM:

Rob thanks for the response.   After much banging around and forum searching I was able to get my federated CIP parts into Innovator.   It was easier after I figured out the main grid sends an AML item to my function for queries and such.   Anyway now I can see all my parts in Innovator under the Design tab on the TOC and I can move through them page by page.  Still haven't really added searching by properties yet though.

My ultimate goal is to have groups of those CIP parts associated with an Innovator Part  for each board assembly.  I'm thinking that I can import a .csv BOM file that orcad generates, convert it to an AML request, and then run that request to create the associations in the actual innovator BOM or maybe my own BOM.   Does that sound reasonable? I'm worried I'm missing something here.

My second challenge is that each CIP part also has multiple manufacturers associated with it.  My plan there is to bring the manufacturers parts in as a a federated item.   Then do some kind of federated relationship between the manufacturers parts and the CIP parts?  I'm not too clear on that part yet, but I plan to work on it next week.

My end goal is to be able to output a full BOM from innovator including all the CIP parts and manufacturer part information, so that Aras becomes our one source for data.  Right now though I've just been going over this in my head wondering if I'm going about it right so if you have any advice that would be great :)

Thank you,

-Eric

 

 



RobMcAveney - Tuesday, January 10, 2012 8:56 AM:

Looks like you're on the right track, Eric.  Generating AML from a CSV file sounds like a reasonable approach to creating relatively simple BOMs.  If you're looking to do more, there are also some commercial solutions available from Aras partners, like this one.

Regarding your second challenge, you can certainly federate both CIP parts and manufacturer parts, then create a relationship between them.  I've done this type of thing before.  The key will be to make sure you include consistent unique ids for both items so the relationship will be maintained properly.  I noticed in the code you posted that you were just using getNewID() to set the id of each federated item.  This means that there will be a different id every time you retrieve a CIP part.  It would probably be best to reuse whatever unique id ORCAD uses (or a hash if it's not a 32 character GUID).

You might also consider managing Manufacturers and Manufacturer Parts in Aras and pushing them back into ORCAD.  Sourcing/procurement is a business function after all.  If you do it in ORCAD, you are either forcing business users to use an engineering system or forcing engineers to perform a business function.  Just food for thought...

Rob



esteimle - Tuesday, January 10, 2012 3:12 PM:

Thanks for the advice, I didn't realize I could specify my own IDs so I modified the code to use a unique 32 bit id from the CIP database.   I had thought about pushing parts from Aras to CIP (that's how Omnify does it).   But I want the features of CIP, namely automatic importation of parametric data from vendors catalogs like Arrow, digikey etc.  It really speeds up the new part creating time.    I'm not ready to give that up and since I'm the guy writing the software for the PLM system, and the guy designing the boards, I guess I'm a little biased towards engineering ;)

I've been looking at the system for most of the day trying to plan my attack.   When I added a regular part to another part's bom, I went through all of the AML requests and never saw an add or create request.   When I delete a part I do see an AML delete request though.

So either I've missed something or when you choose  to add a part to a bom from the gui, there is another call that I'm missing.   Like an onAdd function or something.   I did figure out how to copy PART BOM to CIP PART BOM, and make that appear as new tab under all parts.   So far I'm missing what I need to do to make the relationship happen though.   

I'll keep plugging away but if you have any advice or documentation I should read just let me know.

Thanks again.

-Eriic



esteimle - Tuesday, January 10, 2012 3:31 PM:

Made a little more progress, realized I had my source and related item types backwards.   After I switched them I was able to add a single CIP part the CIP BOM for my Innovator part.   Or so I thought, when I tried to add as second part it did not work, and when I went to save the innovator part I got this message: 

 

The statement has been terminated. in SQL: UPDATE [CIP_PART_BOM] SET [RELATED_ID] = @related_id,[PERMISSION_ID] = 

 

src.[PERMISSION_ID], [TEAM_ID] = src.[TEAM_ID] FROM

(

SELECT [PERMISSION_ID], [TEAM_ID] FROM [PART] WHERE [ID] = @srcId

) AS src

WHERE [ID] = @id</af:legacy_detail><af:exception message="The UPDATE statement conflicted with the FOREIGN KEY 

 

constraint &quot;fk3548&quot;. The conflict occurred in database &quot;InnovatorSolutions&quot;, table 

 

&quot;innovator.CIP_PART&quot;, column 'id'.&#xD;&#xA;The statement has been terminated. in SQL: UPDATE 

 

[CIP_PART_BOM] SET [RELATED_ID] = @related_id,[PERMISSION_ID] = src.[PERMISSION_ID], [TEAM_ID] = src.[TEAM_ID] 

 

FROM&#xD;&#xA;(&#xD;&#xA; SELECT [PERMISSION_ID], [TEAM_ID] FROM [PART] WHERE [ID] = @srcId&#xD;&#xA;) AS 

 

src&#xD;&#xA;WHERE [ID] = @id" type="Aras.Server.Core.InnovatorDatabaseException"><af:innerException message="The 

 

UPDATE statement conflicted with the FOREIGN KEY constraint &quot;fk3548&quot;. The conflict occurred in database 

 

&quot;InnovatorSolutions&quot;, table &quot;innovator.CIP_PART&quot;, column 'id'.&#xD;&#xA;The statement has been 

 

terminated." 

 

More digging is needed I guess.



esteimle - Tuesday, January 10, 2012 5:20 PM:

Here's my failing AML add relationship request, I can re-create it in NASH too.  I tried hooking up SQL profiler to see if I could catch what the parameter values were but no such luck.

- <SOAP-ENV:Envelope xmlns:SOAP-ENV="schemas.xmlsoap.org/.../">
- <SOAP-ENV:Body>
- <ApplyItem>
- <Item type="Part" typeId="4F1AC04A2B484F3ABA4E20DB63808A88" id="4214E70DB239472FAB652E298B94F51E" levels="0" isDirty="1" action="update" LastModifiedOn="1326230994000">
  <config_id keyed_name="test-assembly" type="Part">4214E70DB239472FAB652E298B94F51E</config_id>
  <created_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</created_by_id>
  <created_on>2012-01-10T15:19:27</created_on>
  <current_state name="Preliminary" keyed_name="Preliminary" type="Life Cycle State">72A2322564FE4193933CFB5339487A06</current_state>
  <generation>1</generation>
  <has_change_pending>0</has_change_pending>
  <id keyed_name="test-assembly" type="Part">4214E70DB239472FAB652E298B94F51E</id>
  <is_current>1</is_current>
  <is_released>0</is_released>
  <keyed_name>test-assembly</keyed_name>
  <locked_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</locked_by_id>
  <major_rev>A</major_rev>
  <make_buy>Make</make_buy>
  <modified_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</modified_by_id>
  <modified_on>2012-01-10T15:19:27</modified_on>
  <name>test assembly</name>
  <new_version>1</new_version>
  <not_lockable>0</not_lockable>
  <permission_id keyed_name="New Part" type="Permission">5C07EB829D4241F6BB884952960FAF58</permission_id>
  <state>Preliminary</state>
  <unit>EA</unit>
  <item_number>test-assembly</item_number>
  <itemtype>4F1AC04A2B484F3ABA4E20DB63808A88</itemtype>
- <Relationships>
- <Item type="CIP Part BOM" id="D819977F9E20440A9317AB3C056495CD" action="add" loaded="1" levels="0" isTemp="1" typeId="D9A7D4DE0C01489FA57CAC2EC3B7F8C8" LastModifiedOn="1326230979000" isDirty="1">
  <quantity>100</quantity>
  <related_id>0BF585C814D84248BDA04D7EDBB7BAB2</related_id>
  <source_id keyed_name="test-assembly">4214E70DB239472FAB652E298B94F51E</source_id>
  <sort_order>1</sort_order>
  <reference_designator>U1</reference_designator>
  </Item>
  </Relationships>
  <fed_css />
  </Item>
  </ApplyItem>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>



esteimle - Wednesday, January 11, 2012 11:42 AM:

Well I got past this by deleting the foreign key, I think it was pointing back to the ID column in the CIP_PART table which is really the federated parts so there won't ever be any data there.

So now I can add and save one CIP_PART, but when I view the part again, in the CIP_BOM section all the fields say "Restricted" in red.   I'm guessing this is some kind of permission problem?  I've been trying to track it down by watching AML requests and looking in the dbase.



esteimle - Wednesday, January 11, 2012 1:32 PM:

Ignore me onAfterGet is my friend apparently.