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 - Adjusting Life Cycle Map and Workflows

RonCK - Wednesday, August 26, 2009 5:19 PM:

I have all of our old, previously released parts in the database now at 1 revision less than they are at.  For example, part 10004568 should be at revision -, so we loaded it at revision 9.  All parts are now at Lifecycle state Preliminary.  I need to 'release' all of these parts to Released state and up their revision by 1.  It does not appear that there is a straight forward way to do this.  I'm thinking I need to write a method that can be assigned to the transition from In Review to Released that will update the revision.  Should it be a Pre or Post Server Method? Is this correct?  What does that method need to look like? 

Once all of our old parts are released, we'd like to force an ECN process to occur to achieve the state change from In Review to Release along with an upgrade from any revision 1 to 9 directly to rev -.  It looks like I need both another method on that transition and to assign the workflow to the In Review State.  Is this also correct?

 

thanks,

RonCK



RonCK - Friday, August 28, 2009 11:09 AM:

OK, I was able to answer half my question from an old forum posting.  I've updated all of the Preliminary drawings to there correct rev using a server side method.  Now I just need help figuring out how to adapt the Lifecycle or the ECN workflow so that engineers can jump versions from our numerical pre-release to production releases to the released for production rev -, followed by alphabetical characters.

How can I include a button on an ECN form that will cause the release or edit to jump directly to Rev -?

 

thanks,

RonCK



Brian - Wednesday, September 2, 2009 11:11 PM:

Hi Ron,

Not entirely sure about this but I would look at the Lifecycle Transiton for the ECN from In Work to In Review.

It is here that the Affected and Superseding items are Promoted to their respective new states in the Server Event "Affected Item Promotion". I would consider writing a "Post" server event method which updates the new items to the desired revision based on a flag in the ECN.

If you have a look at the "Affected Item Promotion" method you will see how to get to all of the desired "Change Controlled Items" listed on the ECN.

You could, of course, edit the "Affected Item Promotion" method to update the Revision at the same time as the other work is being done.

Hope this helps.

Cheers,

Brian. 



RonCK - Thursday, September 3, 2009 12:22 PM:

Thanks Brian, this sounds like it will do what I want.  So I'll give it a try.

best regards,

RonCK



RonCK - Friday, September 11, 2009 5:07 PM:

Hi Brian,

 

   I've been working on this for far too long now.  I've found it better to make the changes in the Affected Item Handling method.  My code already works for affected items of type 'Add'.  I've been trying to get the code to work for affected items of type 'Change'.  I think the issue I'm fighting is a de-referencing issue.  The code I need to edit is this:

// Version Changed items to '-' if appropriate, added by Phoenix - RCK
if (affItemRel.getItemsByXPath(rootXPath+"Item[@type='Affected Item'][action='Change'][interchangeable='1'][phnx_release_to_dash='1']").getItemCount() > 0)
{
   Item z = this.newItem("SQL", "SQL PROCESS");
   z.setProperty("name", "PE_GetAffectedItemHandlingOrder");
   z.setProperty("PROCESS", "CALL");
   z.setProperty("ARG1", this.getID());
   z.setProperty("TYPE", affItemRelType);
   z = z.apply();

   for (int i=0; i<z.getItemCount(); i++)
   {
      String thisId = z.getItemByIndex(i).getProperty("obj_affected_item_id",".");
      Item thisItem = affItemRel.getItemsByXPath(rootXPath+"Item[@type='Affected Item'][action='Change'][interchangeable='1'][../../@id='"+thisId+"']");
      if (thisItem.getItemCount() == 1)
      {
         Item tempItem = this.newItem();
         tempItem.loadAML("<Item typeId='"+thisItem.getPropertyItem("affected_id").getProperty("itemtype", "")+"' action='version'/>");
         tempItem.setID(thisItem.getProperty("affected_id","NON_EXISTING"));
         tempItem = tempItem.apply();
         if (tempItem.isError())
         {
            return inn.newError("Affected Item Error: Error versioning item: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }
         tempItem = tempItem.apply("unlock");
         if (tempItem.isError())
         {
              return inn.newError("Affected Item Error: Error unlocking item: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }

         // CHANGE GOES HERE?


         affItem = this.newItem("Affected Item","edit");
         affItem.setID(thisItem.getID());
         affItem.setAttribute("serverEvents","0");
         affItem.setAttribute("doGetItem","0");
         affItem.setProperty("new_item_id",tempItem.getID());
         affItem = affItem.apply();
         if (affItem.isError())
         {
              return inn.newError("Affected Item Error: Error editing Affected Item: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }
      }
   }
}

I know that I need Aras to create a new version of the affected part to set to the new rev level.  I believe the Action="version" line does this.  I want to be able to punch in to that new version and force it to be rev '-'.  However, this code at the spot doesn't work:


         tempItem.setAttribute("Action","edit");
         tempItem.setProperty("major_rev","-");
         tempItem.setAttribute("version","0");
         //tempItem = tempItem.apply();
         if (tempItem.isError())
         {
             return inn.newError("Affected Item Error: Can't Fix Version: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }

It also doesn't return an error.  So, what is it doing?  I thought maybe tempItem wasn't of type=Part, but of type=Affected_Part, but changing major_rev out for new_item_rev doesn't fix anything either.

 

Any suggestions would be appreciated.

best regards,

RonCK



Brian - Sunday, September 13, 2009 6:33 AM:

Ron,

I am away from work for a few days and can't remote login to Innovator to test this stuff (new computer not setup right yet)

I can have a look at it later in the week but won't be able to help until then.

Sorry.

Brian.



RonCK - Tuesday, September 15, 2009 11:22 AM:

Brian,

 

   I got it.  Here's the code that worked:

 

// Version Changed items to '-' if appropriate, added by Phoenix - RCK
if (affItemRel.getItemsByXPath(rootXPath+"Item[@type='Affected Item'][action='Change'][interchangeable='1'][phnx_release_to_dash='1']").getItemCount() > 0)
{
   Item z = this.newItem("SQL", "SQL PROCESS");
   z.setProperty("name", "PE_GetAffectedItemHandlingOrder");
   z.setProperty("PROCESS", "CALL");
   z.setProperty("ARG1", this.getID());
   z.setProperty("TYPE", affItemRelType);
   z = z.apply();

   string versionId;
   for (int i=0; i<z.getItemCount(); i++)
   {
      string thisId = z.getItemByIndex(i).getProperty("obj_affected_item_id",".");
      Item thisItem = affItemRel.getItemsByXPath(rootXPath+"Item[@type='Affected Item'][action='Change'][interchangeable='1'][../../@id='"+thisId+"']");
      if (thisItem.getItemCount() == 1)
      {
         Item tempItem = this.newItem();
         tempItem.loadAML("<Item typeId='"+thisItem.getPropertyItem("affected_id").getProperty("itemtype", "")+"' action='version'/>");
         tempItem.setID(thisItem.getProperty("affected_id","NON_EXISTING"));
         tempItem = tempItem.apply();
         partNumber = tempItem.getProperty("keyed_name");
         partRev = tempItem.getProperty("major_rev");
         itemTypeId = thisItem.getPropertyItem("affected_id").getProperty("itemtype", "");
         versionId = tempItem.getID();
         if (tempItem.isError())
         {
            return inn.newError("Affected Item Error: Error versioning item: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }
         tempItem = tempItem.apply("unlock");
         if (tempItem.isError())
         {
              return inn.newError("Affected Item Error: Error unlocking item: "+thisItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
         }
         if((partRev[0] != '-') && (partRev[0] <= 'A'))
         {
            tempItem.setAttribute("action","edit");
            tempItem.setAttribute("id",versionId);
            tempItem.setProperty("major_rev","-");
            tempItem.setAttribute("version","0");           
            tempItem = tempItem.apply();
            if (tempItem.isError())
            {
              return inn.newError("Affected Item Error: Can't Fix Version: "+tempItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown"));
            }
         }
         affItem = this.newItem("Affected Item","edit");
         affItem.setID(thisItem.getID());
         affItem.setAttribute("serverEvents","0");
         affItem.setAttribute("doGetItem","0");
         affItem.setProperty("new_item_id",tempItem.getID());
         affItem.setProperty("new_item_rev","-");
         affItem = affItem.apply();
         if (affItem.isError())
         {
            return inn.newError("Affected Item Error: Error editing Affected Item: "+tempItem.getPropertyItem("affected_id").getProperty("keyed_name","unknown")+" to rev: "+tempItem.getProperty("major_rev"));
         }
      }
   }
}

It was a dereferencing error.

thanks,

RonCK