Aras Community

Welcome to Aras Community Sign in | Join | Help
in Search
Aras Community
Please Also Visit the Project Site to Download Add-Ons and Solutions
Jump to Projects

Auto Generated part/doc numbers

Last post 06-25-2008, 3:05 PM by thomas.hedberg. 11 replies.
Sort Posts: Previous Next
  •  04-26-2007, 12:00 PM 250

    Auto Generated part/doc numbers

    We have a requirement where the issuing of ID numbers is to be automated, but sometimes we must enter the number manually. I have no problems configuring Innovator for sequenced numbering, but then then no manual override is possible. Is there a way to allow either/or?

    Thanks

    Ron

     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  04-26-2007, 1:11 PM 251 in reply to 250

    Re: Auto Generated part/doc numbers

    Hi Ron -

    The easiest way to do this is to make the property a 'string' (instead of a 'sequence') and create a simple UI to fill in the property with an auto-generated number.  To do this, create an HTML field on the form and enter the following in the HTML Code (and replace 'Default Part' with the name of your Sequence) :

    <script>
    function getNumber() {
       var newNum="";
       newNum=top.aras.getNextSequence('','Default Part');
       newNum = newNum + document.forms[0].name.value;
       handleItemChange("item_number", newNum);
    }
    </script>
    <a href="BLOCKED SCRIPTgetNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

    Rob

  •  04-26-2007, 1:17 PM 253 in reply to 251

    Re: Auto Generated part/doc numbers

    In the above, replace "BLOCKED SCRIPT" with "javascript" and then a colon -- I guess the forum is configured to block that text.
  •  04-26-2007, 2:07 PM 254 in reply to 253

    Re: Auto Generated part/doc numbers

    I tried this but I am getting an error "error line 208 'Re_Reports' is undefined

    Here is what I used

     <script>
    function getNumber() {
       var newNum="";
       newNum=top.aras.getNextSequence('',Re_Reports);
       newNum = newNum + document.forms[0].name.value;
       handleItemChange("item_number", newNum);
    }
    </script>
    <a href="BLOCKED SCRIPTgetNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

     I have a sequence defined as Re_Reports


     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  04-26-2007, 2:34 PM 255 in reply to 254

    Re: Auto Generated part/doc numbers

    You need quotes around Re_Reports
  •  04-26-2007, 2:40 PM 256 in reply to 255

    Re: Auto Generated part/doc numbers

    Now that was just too simple......

     

    Thanks it works great.

     

    Ron

     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  04-26-2007, 3:21 PM 257 in reply to 255

    Re: Auto Generated part/doc numbers

    Hi Rob

     Is there a way to disable the select action after the user has selected newNum. I have looked at the field event but not sure what code to use to disable this field after click.

     

    Thanks

    Ron
     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  04-26-2007, 4:07 PM 258 in reply to 257

    Re: Auto Generated part/doc numbers

    Ron -

    The easiest way is probably just to hide the button after it's been clicked once, like this:

    <script>
    function getNumber() {
       var newNum="";
       newNum=top.aras.getNextSequence('',"Re_Reports");
       newNum = newNum + document.forms[0].name.value;
       handleItemChange("item_number", newNum);
      document.getElementById("seqButton").style.display="none";
    }
    </script>
    <a id="seqButton" href="BLOCKED SCRIPTgetNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

    Rob 

  •  04-26-2007, 4:31 PM 259 in reply to 258

    Re: Auto Generated part/doc numbers

    Yes it works fine, now the user can only get the number once. Now the next question can the Document number field be locked to prevent the user from over writing the seq. number?

    Ron

     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  04-26-2007, 5:19 PM 260 in reply to 259

    Re: Auto Generated part/doc numbers

    You can just disable the item_number field, like this:

     <script>
    function getNumber() {
       var newNum="";
       newNum=top.aras.getNextSequence('',"Re_Reports");
       newNum = newNum + document.forms[0].name.value;
       handleItemChange("item_number", newNum);
       document.getElementById("seqButton").style.display="none";
       document.getElementById("item_number").disabled="1";
    }
    </script>
    <a id="seqButton" href="BLOCKED SCRIPTgetNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

    Rob 

  •  04-27-2007, 9:56 AM 261 in reply to 260

    Re: Auto Generated part/doc numbers

    That worked great, now building on this theme. I will be using one sequence numbering system for different types of documents. I have identified the different types using classification, and for some types I will need to add a prefix to the sequenced number. Since I will be using the same sequence number I can not at the prefix directly to the sequence, therefore I was thinking based on this code that it would be possible to simply filter on Classification and add the prefix to the generated number. now my javascript is not good but taking a stab at it this is what i was thinking;

    <script>
    function getNumber() {
       var newNum="";
       if (document.getElementById("classification").value="Markers") {newNum="MK" + top.aras.getNextSequence('',"MES_Doc_Num")}
         else {newNum=top.aras.getNextSequence('',"MES_Doc_Num")};
       handleItemChange("item_number", newNum);
       document.getElementById("seqButton").style.display="none";
       document.getElementById("item_number").disabled="1";

    }
    </script>
    <a id="seqButton" href="BLOCKED SCRIPTgetNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

     

    but this is not quite working, it always places the MK prefix



    Any ideas

     

    Thanks

    Ron



     


    Ron Dignard
    Systems Integration Specialist
    Allen Vanguard
    ron.dignard@allenvanguard.com
    Tel: 613-288-5583
    www.allenvanguard.com

    “Sustainable Capability Against Evolving Threats”
  •  06-25-2008, 3:05 PM 927 in reply to 261

    Re: Auto Generated part/doc numbers

    Ron, 

    What I did was created a drop down box with all our customers which drive the prefix for our parts and docs.  I also add this field to the Part & Document ItemTypes so that we can search by the customer field as well.  I have included my script below for our Document form.

     <script>
    function getNumber() {
       var newNum="";
       var strCustPart="Default Part"
       strCustPart=document.forms[0].customer_doc.value;
       newNum=top.aras.getNextSequence('',strCustPart);
       newNum = newNum;
       handleItemChange("item_number", newNum);
       // document.getElementById("seqButton").style.display="none";
    }
    </script>
    <a id="seqButton" href="javascript':getNumber();"><img src="../images/icons/16x16/16x16_sequences.gif"  border="0" ></a>

    As you can see, I created a strCustPart variable which stores the value of the drop down box, that value then gets passed to the getNextSequence function.  The end result is a Part or Document number related to our Customer.

    I know this is not exactly what you are trying to do, but I hope that gives you some insight.

    Good Luck,
    Tom Hedberg, Jr.
    Advatech Pacific, Inc.


    Thomas D. Hedberg, Jr.
    Engineer II
    Advatech Pacific, Inc.
    Analysis & Design Division
    thomas.hedberg@advatechpacific.com
    480.598.4005 x414 office
    480.598.6767 fax

    www.advatechpacific.com

    "Changing the Way Engineering is Conducted"
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems