示例#1
0
        public Item findBomItem(MasterStructure incommingMasPart, Item parent = null, Item child = null)
        {
            CItemTools itemTool = this;

            // load up the parent item from the master structure item if its not sent in
            if (parent == null)
            {
                parent = itemTool.findItem("Part", incommingMasPart.parentPart, incommingMasPart.parentRevision.ToString());
            }
            // get the BOM item. If the rev is 999, get the most recent
            // 999 is a key to indicate that we are looking for the most current revision. if its not 999, find the most recent rev
            if (child == null)
            {
                if (incommingMasPart.revisionLevel != 999)
                {
                    child = itemTool.findItem("Part", incommingMasPart.partNumber, incommingMasPart.revisionLevel.ToString());
                }
                else
                {
                    child = itemTool.findItem("Part", incommingMasPart.partNumber);
                }
            }
            if (child == null || parent == null)
            {
                throw new Exception();
            }
            string childQuant = incommingMasPart.bomQuantity.ToString();
            // check to see if the BOM item is in the parent assembly
            var bomSearch = this.theConnection.newItem("Part BOM", "get");

            bomSearch.setAttribute("select", "related_id,quantity,source_id");
            bomSearch.setProperty("related_id", child.getID());
            bomSearch.setPropertyCondition("related_id", "eq");
            bomSearch.setProperty("quantity", childQuant);
            bomSearch.setPropertyCondition("quantity", "eq");
            bomSearch.setProperty("source_id", parent.getID());
            bomSearch.setPropertyCondition("source_id", "eq");
            var results = bomSearch.apply();
            int count   = results.getItemCount();

            if (count < 1)
            {
                return(null);
            }
            else
            {
                //Console.WriteLine("Item exsists in BOM already incomming:" + incommingMasPart);
                return(results.getItemByIndex(0));
            }
        }
        /// Depracated
        /// <summary>
        /// takes in an input row from MAS and updates the BOMs in ARAS
        /// works on the current level revision
        /// </summary>
        ///

        /*public void updateBomRevisions(MasterStructure masterBomItem) {
         *  // turns out that there are parts in the newest version of thre BOM export that Ted provided me.
         *  // check if component rev ==0, not worth running if so
         *  CItemTools itemsTool = new CItemTools(this.theConnection);
         *  if (masterBomItem.revisionLevel != 0)
         *  {
         *      Item sourcItem = itemsTool.findItem("part", masterBomItem.parentPart);
         *      Item bomItemNewRev = itemsTool.findItem("part", masterBomItem.partNumber, masterBomItem.revisionLevel.ToString());
         *      Item bomItemCurrentRev = itemsTool.findItem("part", masterBomItem.partNumber, "0");
         *      Console.ReadLine();
         *      // description is in the masBomItem.comment
         *      if (sourcItem != null && bomItemCurrentRev != null && bomItemCurrentRev != null)
         *      {
         *          Console.WriteLine(masterBomItem.ToString());
         *          Console.ReadLine();
         *          var bomSearch = this.theConnection.newItem("Part BOM", "get");
         *          //bomSearch.setAction("lock");
         *          //bomSearch.apply();
         *          bomSearch.setAttribute("select", "related_id,quantity,source_id");
         *          bomSearch.setProperty("related_id", bomItemCurrentRev.getID());
         *          bomSearch.setPropertyCondition("related_id", "eq");
         *          bomSearch.setProperty("quantity", masterBomItem.bomQuantity.ToString());
         *          bomSearch.setPropertyCondition("quantity", "eq");
         *          bomSearch.setProperty("source_id", sourcItem.getID());
         *          bomSearch.setPropertyCondition("source_id", "eq");
         *          var results = bomSearch.apply();
         *          int count = results.getItemCount();
         *          if (count == 1)
         *          {
         *              //var bomItem = this.theConnection.newItem("Part BOM", "add");
         *              //if (quantity == "0")
         *              //   quantity = "1";
         *              //bomItem.setProperty("related_id", thePart.getID());
         *              //bomItem.setProperty("quantity", quantity);
         *              //parent.addRelationship(bomItem);
         *              //parent.apply();
         *              //System.Threading.Thread.Sleep(100);
         *
         *          }
         *
         *          // apply changes, unlock
         *          bomSearch.setAction("update");
         *          bomSearch.apply();
         *          bomSearch.setAction("unlock");
         *          // current part is version and unlocked.
         *          bomSearch.apply();
         *
         *      }
         *      else
         *      {
         *
         *          Console.WriteLine("Item not in current DB" + masterBomItem.ToString());
         *          Console.WriteLine("Current Part Search Results:" + bomItemCurrentRev);
         *          Console.ReadLine();
         *      }
         *  }
         *  else {
         *      Console.WriteLine(masterBomItem.revisionLevel);
         *
         *  }
         *
         *
         * }*/
        public void updateAmStatus(List <MoldsStatus> theMoldsData)
        {
            CItemTools itemTool = new CItemTools(this.theConnection);

            foreach (MoldsStatus statusItem in theMoldsData)
            {
                Item thePart = itemTool.findItem("Part", statusItem.AMNum);
                if (thePart != null)
                {
                    string action = null;
                    switch (statusItem.Status)
                    {
                    case "Obsolete":
                        action = "Obsolete";
                        break;

                    case "Prototype":
                        action = "Preliminary";
                        break;

                    case "In Design":
                        action = "Preliminary";
                        break;

                    case "Inactive":
                        action = "Superseded";
                        break;

                    case "Active":
                        action = "Released";
                        break;

                    default: action = "void";
                        break;
                    }
                    if (action != "void")
                    {
                        Console.WriteLine("Part Updated:" + statusItem.AMNum + " State:" + statusItem.Status);
                        thePart.promote(action, "Manual Revision Move");
                        var results = thePart.apply();
                    }
                }
                else
                {
                    Console.WriteLine("Part Not found From Molds DB:" + statusItem.AMNum);
                }
            }
            return;
        }
        public Item revisionPart(Item thePart)
        {
            CItemTools itemsTool = new CItemTools(this.theConnection);

            thePart.setAction("version");
            Item returnedAction = thePart.apply();
            // the new revision is currently locked, so unlock it to release it
            Item newRevision = itemsTool.findItem("part", thePart.getProperty("item_number"));

            //newRevision.setAction("unlock");
            //newRevision.apply();
            newRevision.promote("Released", "Manual Release");
            // new revision is released, move on
            newRevision.apply();
            return(thePart);
        }
        /// <summary>
        /// reads a folder from the user and then loops through the directory recursively.
        /// Each xml file is ran through recursively.
        /// any xml node that has a type="Change Controlled Item" will have that item
        /// searched upon. What ever positive search match is returned, that item id is used to replace the
        /// item id in the xml file
        /// </summary>
        public void rFolderAffectedItemRelink()
        {
            using (var fbd = new FolderBrowserDialog())
            {
                // lets make the aras tool for working on this
                ArasTools    theTool  = new ArasTools();
                CItemTools   itemTool = new CItemTools(theTool.theConnection);
                DialogResult result   = fbd.ShowDialog();
                string[]     files    = null;

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    files = Directory.GetFiles(fbd.SelectedPath, "*.xml", SearchOption.AllDirectories);

                    System.Windows.Forms.MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
                }
                //string[] fileList = Directory.GetFiles("C:\\", "*.xml", SearchOption.AllDirectories); //new DirectoryInfo("c:\\users\\tom").GetFiles(" *.xml", SearchOption.AllDirectories);

                /*Parallel.ForEach(files, (theFile) =>
                 * {
                 *  XmlDocument readDoc = new XmlDocument();
                 *  readDoc.Load(theFile);
                 *  Console.WriteLine(theFile);
                 *  TraverseNodes(readDoc.ChildNodes, itemTool);
                 *  readDoc.Save(@theFile);
                 *
                 *
                 *  XmlNodeList list = readDoc.SelectNodes("//Item[@id='xxxx']");
                 *  foreach (XmlNode n in list)
                 *  {
                 *
                 *  }
                 * });*/
                foreach (string fileName in files)
                {
                    XmlDocument readDoc = new XmlDocument();
                    readDoc.Load(fileName);
                    Console.WriteLine(fileName);
                    TraverseNodes(readDoc.ChildNodes, itemTool);
                    readDoc.Save(@fileName);
                }
            }
        }
        /// <summary>
        /// Re-Assigns PR's to the highest level revision assembly available for part numbers
        /// </summary>
        public void pushPrsUpRevisions()
        {
            CItemTools  itemsTool   = new CItemTools(this.theConnection);
            List <Item> thePrSearch = itemsTool.findItemsList("PR");

            Parallel.ForEach(thePrSearch, (thePR) =>
            { //(Item thePR in thePrSearch){
                // get the PR and its associated parts
                // should be the ID's for the parts
                Console.WriteLine("parallel processing pr");
                string affectedPart    = thePR.getProperty("affected_item");
                string rootCausePart   = thePR.getProperty("root_cause_part");
                Item affectedPartItem  = itemsTool.findItemById(affectedPart, "part");
                Item rootCausePartItem = itemsTool.findItemById(rootCausePart, "part");
                // lock item for changes
                thePR.setAction("lock");
                thePR.apply();
                // fix the affected item part relationship if its set
                if (affectedPartItem != null)
                {
                    // get the item number, get the part, set the part
                    string affectedPartItemNumber = affectedPartItem.getProperty("item_number");
                    // default behavior is to higest rev when rev is not set
                    Item affectedPartItemLatestRev = itemsTool.findItem("part", affectedPartItemNumber);
                    thePR.setProperty("affected_item", affectedPartItemLatestRev.getID());
                }
                // fix the root cause item part relationship if its set
                if (rootCausePartItem != null)
                {
                    // get the item number, get the part, set the part
                    string rootCausePartItemNumber = rootCausePartItem.getProperty("item_number");
                    // default behavior is to higest rev when rev is not set
                    Item rootCausePartItemLatestRev = itemsTool.findItem("part", rootCausePartItemNumber);
                    thePR.setProperty("root_cause_part", rootCausePartItemLatestRev.getID());
                }
                // apply changes, unlock
                thePR.setAction("update");
                thePR.apply();
                thePR.setAction("unlock");
                // current part is version and unlocked.
                thePR.apply();
            });
        }
 private static void TraverseNodes(XmlNodeList nodes, CItemTools itemTool)
 {
     foreach (XmlNode node in nodes)
     {
         // Do something with the node.
         if (node.Attributes != null && node.Attributes["type"] != null)
         {
             // fix part links
             if (node.Attributes["type"].Value == "Change Controlled Item" || node.Attributes["type"].Value == "Part")
             {
                 //Console.WriteLine(node.Attributes["type"].Value);
                 //Console.WriteLine(node.InnerText);
                 //Console.WriteLine(node.Attributes["keyed_name"].Value);
                 string oldId      = node.InnerText;
                 string partNumber = node.Attributes["keyed_name"].Value;
                 if (partNumber == "AS-UTA")
                 {
                     partNumber = "AS-UTA-006";
                 }
                 Item arasItem = itemTool.findItem("Part", partNumber);
                 while (arasItem == null)
                 {
                     Console.WriteLine("Part not found - Enter a new Part Number:" + partNumber);
                     partNumber = Console.ReadLine();
                     arasItem   = itemTool.findItem("Part", partNumber);
                 }
                 if (arasItem != null)
                 {
                     //Console.WriteLine("Old Item ID" + oldId + " New ID:" + arasItem.getID() + "");
                     node.InnerText = arasItem.getID();
                     node.Attributes["keyed_name"].Value = partNumber;
                     //Console.WriteLine("New Item ID" + node.InnerText + " New ID:" + arasItem.getID() + "");
                 }
                 else
                 {
                     Console.WriteLine("Item not found on ARAS" + partNumber);
                 }
             }
         }
         TraverseNodes(node.ChildNodes, itemTool);
     }
 }
        public bool movePartToRevLevel(StdBomStructures thePart)
        {
            bool       success   = false;
            CItemTools itemsTool = new CItemTools(this.theConnection);
            // go find the item we are attempting to revision
            Item theArasPart = itemsTool.findItem("part", thePart.BillNo.ToString(), thePart.Revision.ToString());

            // found the revision. no need to increment.
            if (theArasPart != null)
            {
                string arasRevLevel = theArasPart.getProperty("major_rev");
                Console.WriteLine("Revision Found:" + arasRevLevel + " MAS Rev:" + thePart.Revision.ToString() + " Imported Part Data:" + thePart.ToString());
            }
            else if (thePart.Revision <= 99 && theArasPart == null)
            {
                // find the highest revision part
                Item highestRevLevelPart = itemsTool.findItem("part", thePart.BillNo.ToString());
                if (highestRevLevelPart != null)
                {
                    Console.WriteLine("cranking revision level:" + thePart.ToString());
                    string majorRev     = highestRevLevelPart.getProperty("major_rev");
                    int    arasRevLevel = int.Parse(majorRev);
                    while (arasRevLevel < thePart.Revision)
                    {
                        // go ahead and revision the part, then fetcht he revision level to try and satisfy the while loop
                        this.revisionPart(highestRevLevelPart);
                        highestRevLevelPart = itemsTool.findItem("part", thePart.BillNo.ToString());
                        majorRev            = highestRevLevelPart.getProperty("major_rev");
                        arasRevLevel        = int.Parse(majorRev);
                        //Console.WriteLine("Wrote:"+ arasRevLevel + " Of:" + thePart.Revision);
                    }
                }
                else
                {
                    Console.WriteLine("Missing Part or part rev in excess of Aras Limit " + thePart);
                }
            }
            return(success);
        }
示例#8
0
        public Item revisionPart(Item thePart)
        {
            CItemTools itemsTool = new CItemTools(this.theConnection);

            thePart.setAction("version");
            var    results     = thePart.apply();
            string errorString = results.getErrorString();

            if (errorString != "")
            {
                throw new Exception("Exception on part promote:" + errorString);
            }
            // the new revision is currently locked, so unlock it to release it
            Item newRevision = itemsTool.findItem("part", thePart.getProperty("item_number"));

            newRevision.setAction("unlock");
            results = newRevision.apply();
            newRevision.promote("Released", "Manual Release");
            // new revision is released, move on
            results     = newRevision.apply();
            errorString = results.getErrorString();
            return(thePart);
        }
示例#9
0
        static void Main(string[] args)
        {
            string userInput = "";

            //string rawAML = "<AML><Item type=\"File\" id=\"763E4E3C005E4D70B1D0763A1F75F38C\" action=\"add\"><checkedout_path /><file_type keyed_name=\"JPEG Image\" type=\"FileType\">992B142FCE6C4EF8B71417220CD7E92D</file_type><mimetype>image/jpeg</mimetype><actual_filename>C:\\Users\\tom\\Pictures\\317A thumbmail.png</actual_filename><filename>317A thumbmail.png</filename><Relationships><Item type=\"Located\" id=\"71DE550313744E029E2C61CBA44134F8\" action=\"add\"><file_version>4</file_version><related_id keyed_name=\"Default\" type=\"Vault\">67BBB9204FE84A8981ED8313049BA06C</related_id><sort_order>128</sort_order><source_id keyed_name=\"1st Floor.Names and Title.jpg\" type=\"File\">763E4E3C005E4D70B1D0763A1F75F38C</source_id></Item></Relationships></Item></AML>";
            //ArasTools theTool = new ArasTools();
            //var results = theTool.theConnection.applyAML(rawAML);
            //if (results.getErrorString() != "")
            //    Console.WriteLine("Error String:" + results.getErrorString());

            while (userInput != "0")
            {
                Console.WriteLine("1. to delete parts and BOMs. \n2:Clear Old BOM Items \n3. Open/Save Operation \n4. Test manager function \n5. relink parts in aras export \n6. Push PR's" +
                                  " to current revs \n7. BOM Import Tool\n 8. Update Part States \n 9. Clear PR's on part and string search \n 0. to exit");
                userInput = Console.ReadLine();
                if (userInput == "1")
                {
                    ArasTools deleteTool = new ArasTools();
                    Console.WriteLine("Are you sure you want to delete all files? Y, N");
                    string confirm = Console.ReadLine();
                    if (confirm == "Y")
                    {
                        deleteTool.deleteAllItemTypes("Part");
                    }
                    else
                    {
                        Console.WriteLine("delete aborted");
                    }
                }

                else if (userInput == "2")
                {
                    ArasTools       theArasTool = new ArasTools();
                    MasterStructure master      = new MasterStructure();
                    master.importBom();
                    List <MasterStructure> theBoms   = master.ProcessedBom;
                    CItemTools             itemTools = new CItemTools(theArasTool.theConnection);
                    itemTools.clearOldPartBoms(theBoms, theArasTool);
                }
                else if (userInput == "3")
                {
                    ArasTools readSaveTool = new ArasTools();
                    Console.WriteLine("Open and save all files? Y, N");
                    string confirm = Console.ReadLine();
                    if (confirm == "Y" || confirm == "y")
                    {
                        Console.WriteLine("Name of the item types");
                        string itemType = Console.ReadLine();
                        readSaveTool.openAndSave(itemType);
                    }
                    else
                    {
                        Console.WriteLine("Re-Save aborted aborted");
                    }
                }
                else if (userInput == "4")
                {
                    ArasTools readSaveTool = new ArasTools();
                    Console.WriteLine("Test function? Y, N");
                    string confirm = Console.ReadLine();
                    if (confirm == "Y" || confirm == "y")
                    {
                        readSaveTool.setManager();
                    }
                    else
                    {
                        Console.WriteLine("Re-Save aborted aborted");
                    }
                }
                // standard BOM import
                else if (userInput == "5")
                {
                    ArasExportXmlTool xmlTool = new ArasExportXmlTool();
                    xmlTool.rFolderAffectedItemRelink();
                }
                else if (userInput == "6")
                {
                    ArasTools arasTool = new ArasTools();
                    arasTool.pushPrsUpRevisions();
                }

                else if (userInput == "7")
                {
                    // 1. remove all of the BOMs
                    ArasTools       arasTools = new ArasTools();
                    MasterStructure master    = new MasterStructure();
                    master.importBom();
                    List <MasterStructure> theBoms = master.ProcessedBom;
                    //Console.WriteLine("Deleting All BOMs & Parts");
                    System.Threading.Thread.Sleep(1000);
                    arasTools.deleteAllItemTypes("Part BOM");
                    arasTools.deleteAllItemTypes("Part");
                    // 2. add any parts in the MAS bom output that aren't currently in the db
                    // 3. push all revisions up, based upon the MAS bom output
                    // 4. Recreate the BOM's based upon the BOM Mas output
                    // 5. reassociate all of the PR's w/ the most current BOMS
                    // 6. Re-Associate all of the serials w/ the most current revisions



                    Console.WriteLine("Adding parts in records that are non exsistent");
                    System.Threading.Thread.Sleep(1000);
                    CItemTools itemTools = new CItemTools(arasTools.theConnection);
                    int        total     = theBoms.Count();
                    int        soFar     = 0;
                    Stopwatch  sw        = Stopwatch.StartNew();

                    // creating a list with new StdBomStructures Items. There will be nore parent part in this object
                    // the purpose of this list is to hold part numbers and revisions that have already been added to the database
                    // this will allow us to avoid a lot of queries looking for parts during the run.
                    List <MasterStructure> trackingList = new List <MasterStructure>();
                    foreach (MasterStructure bomItem in theBoms)
                    {
                        MasterStructure currentPartTracker = new MasterStructure();
                        currentPartTracker.partNumber    = bomItem.partNumber;
                        currentPartTracker.revisionLevel = bomItem.revisionLevel;
                        // The "locator" array is basically a search to make sure that the component we are looking at hasn't already been
                        // added to the ARAS database. There is a lot of overlap in a BOM structure, so this saves some query time.
                        var locator       = trackingList.FindAll(m => m.partNumber == bomItem.partNumber && m.revisionLevel == bomItem.revisionLevel);
                        var parentLocator = trackingList.FindAll(m => m.partNumber == bomItem.parentPart && m.revisionLevel == bomItem.parentRevision);
                        // check and see if the part has been added to the list of things we have already entered
                        if (locator.Count() < 1 || parentLocator.Count() < 1)
                        {
                            Item addedPart = itemTools.addStandardPart(bomItem);
                            currentPartTracker.partArasItem = addedPart;
                            trackingList.Add(currentPartTracker);
                            MasterStructure addParentToTracker = new MasterStructure();
                            addParentToTracker.partNumber    = bomItem.parentPart;
                            addParentToTracker.revisionLevel = bomItem.parentRevision;
                            trackingList.Add(addParentToTracker);

                            soFar++;
                            Console.WriteLine("check " + soFar);
                            int remainder = soFar % 300;
                            if (remainder == 0)
                            {
                                sw.Stop();
                                double avgRunTime   = (sw.Elapsed.TotalSeconds / soFar);
                                double totalRunTime = total * avgRunTime;
                                //NonBlockingConsole.WriteLine("Start:"+ sw.Elapsed.TotalMilliseconds/1000+" Total Count"+total+" Estimated Run Time:" + totalRunTime);
                                Console.WriteLine("Estimated Run Time:" + totalRunTime);
                                sw.Start();
                            }
                        }
                    }

                    //Console.WriteLine("Continue w/ PR Push");
                    //System.Threading.Thread.Sleep(5000);
                    //theArasTool.pushPrsUpRevisions();
                    Console.WriteLine("Continue w/ BOM Push");
                    System.Threading.Thread.Sleep(1000);
                    //var errorFile = new StreamWriter(@"errorLog.csv");
                    //using (errorFile)
                    //{
                    //    var writer = new CsvWriter(errorFile);
                    Parallel.ForEach(theBoms, (bomItem) => { arasTools.addPartToBom(bomItem); });

                    /*  foreach (MasterStructure bomItem in theBoms)
                     * {
                     *    arasTools.addPartToBom(bomItem);
                     * }*/
                    //}
                }
                else if (userInput == "8")
                {
                    MasterStructure    master           = new MasterStructure();
                    List <MoldsStatus> theStatusObjects = master.importMoldStatus();
                    ArasTools          theTool          = new ArasTools();
                    theTool.updateAmStatus(theStatusObjects);
                }
                else if (userInput == "9")
                {
                    Console.WriteLine("P.s. your screwed if you don't lock all the PR's before doing this. ok?");
                    Console.ReadLine();
                    ArasTools theArasTool = new ArasTools();
                    Console.WriteLine("Enter a section of part number for the affected item search. Hope you know what your doing. Careful....");
                    string partNumber = Console.ReadLine();
                    Console.WriteLine("Enter a string search to delete on. e.g. \'bubbles\'.  Hope you know what your doing. Careful....");
                    string  searchSTring = Console.ReadLine();
                    PrTools thePrTool    = new PrTools(theArasTool.theConnection);
                    thePrTool.clearPrWorkflow(partNumber, searchSTring);
                }
            }
        }
        public Item addPartToBom(MasterStructure lineItem)
        {
            // Ted has added a revision level of 999 for the moat master configuration.
            // i dont know MAS allows him to do that, but oh well... just ignore it
            // he has also added 0 quantity items that are essentially work instructions
            if (lineItem.parentRevision != 999 || lineItem.bomQuantity != 0)
            {
                CItemTools itemTool = new CItemTools(theConnection);

                // get the BOM item. If the rev is 999, get the most recent
                Item   Child;
                string childQuant = lineItem.bomQuantity.ToString();

                Item parent = itemTool.findItem("Part", lineItem.parentPart, lineItem.parentRevision.ToString());
                if (lineItem.revisionLevel != 999)
                {
                    Child = itemTool.findItem("Part", lineItem.partNumber, lineItem.revisionLevel.ToString());
                }
                else
                {
                    Child = itemTool.findItem("Part", lineItem.partNumber);
                }
                if (parent != null && Child != null)
                {
                    Item findBomItem = itemTool.findBomItem(lineItem, parent, Child);

                    if (findBomItem == null)
                    {
                        var bomItem = this.theConnection.newItem("Part BOM", "add");
                        if (childQuant == "0" || childQuant == "" || childQuant == null)
                        {
                            childQuant = "1";
                        }
                        bomItem.setProperty("related_id", Child.getID());
                        bomItem.setProperty("quantity", childQuant);
                        parent.addRelationship(bomItem);
                        var    result = parent.apply();
                        string error  = result.getErrorString();
                        if (error != "")
                        {
                            throw new Exception("Exception on part add:" + error);
                        }
                        Console.WriteLine(lineItem + " BOM added to" + parent.getProperty("item_number"));
                    }
                    else
                    {
                    }
                }

                /*// load up the parent item from the master structure item
                 * Item parent = itemTool.findItem("Part", lineItem.parentPart, lineItem.parentRevision.ToString());
                 * // get the BOM item. If the rev is 999, get the most recent
                 * Item Child;
                 * string childQuant = lineItem.bomQuantity.ToString();
                 * // 999 is a key to indicate that we are looking for the most current revision. if its not 999, find the most recent rev
                 * if (lineItem.revisionLevel != 999)
                 *  Child = itemTool.findItem("Part", lineItem.partNumber, lineItem.revisionLevel.ToString());
                 * else
                 *  Child = itemTool.findItem("Part", lineItem.partNumber);
                 *
                 * // check to see if the BOM item is in the parent assembly
                 * var bomSearch = this.theConnection.newItem("Part BOM", "get");
                 * bomSearch.setAttribute("select", "related_id,quantity,source_id");
                 * bomSearch.setProperty("related_id", Child.getID());
                 * bomSearch.setPropertyCondition("related_id", "eq");
                 * bomSearch.setProperty("quantity", childQuant);
                 * bomSearch.setPropertyCondition("quantity", "eq");
                 * bomSearch.setProperty("source_id", parent.getID());
                 * bomSearch.setPropertyCondition("source_id", "eq");
                 * var results = bomSearch.apply();
                 * int count = results.getItemCount();
                 * if (count < 1)
                 * {
                 *
                 *
                 * }
                 * else {
                 *
                 * }*/

                //Console.ReadLine();
                return(parent);
            }
            else
            {
                return(null);
            }
        }