Skip to main content

Set Batchnumber using Beas script 2020.05

Comments

9 comments

  • Peter Tarr

    Hi Martin,

     

    Thank for your reply.

     

    I am trying to use that function, and  also different combination, but it is still asking for the batch:

    Is it possible to set up the batchnumber using that function without asking for the batch number?

    If yes, could you share  the part of the code in the script ?

    Thanks in advance,

  • Martin Heigl

    Item master data -> set to "Automatic batch determination"

     

    Note: If anything is not working then it's always good to post
    - Beas Version
    - Debug log

  • Peter Tarr

    Hi Martin,

    So you mean that if the Batch determination is set tu "manual entry", then is not possible to pass the batchnumber and the system will not ask it ? Like is in our current version of Beas script ?

  • Martin Heigl

    Hi Peter,

     

    correct. Manual means Manual
    But set to autoamtically and you can ask for batch Number in your script

    function GetBatchNumber
    select coalesce(max(substring("DistNumber",10,4)),0) into myCounter from "OBTN" where left("DistNumber",9) = '<today,yyyymmdd>-'
    setvar=myCounter=%numadd(myCounter,1)
    setvar=myCounter=000<myCounter,#0>
    setvar=e_DistNumber=<today,yyyymmdd>-<myCounter,right 4>
    input=Batch number=e_DistNumber=<e_DistNumber>
    end function

    Note: Cancel is not possible in this process

  • Peter Tarr

    Hi Martin,

    Thanks for the code. I have figured out.

    So to summarize it. I had to change the Batch managment from "manual" to "Automatc" then use the "GetBatchNumber" function in workordermanagement and callit from the event "receiptline" like this:

    function receiptline
    GetBatchNumber()
    end function

     

  • Martin Heigl

    Hi Peter,

    no!
    Beas execute the GetBatchNumber() automatically.
    Don't insert this in function receiptLine()

     

    regards

    Martin

  • Peter Tarr

    But forexample, I am not using the "counter" as part of the batch number.

    My batchnumber is simply the WO number. 

    So if I exclude those lines then my batchnumber will be assigned according to the batch counter.

    Or as a workaround I should pass the WO number to that counter, and in that case I can exclude those lines.

     

    .

  • Martin Heigl

    Hi Peter,

    correct

Please sign in to leave a comment.