Saltar al contenido principal

beas form events

Comentarios

5 comentarios

  • Phil Sparkes

    Apologies - beas script (obviously)........

  • Martin Heigl

    Hi Phil,

     

    the reservation system is a little special form. What do you want to change? Do you have an example?

     

    regards

    Martin

  • Phil Sparkes

    Hi Martin,

    The customer wants to simplify the life of the operator in a cutting operation. I open the form with a custom filter showing lines with the same material. When the user hits the button it opens an input box to ask for the number of sheets - using the ratio in the work order bill of material it divides the number of sheets into all of the jobs displayed on the screen - issuing each line . The customer wants me to run the code automatically when the form opens instead of the user having to hit a button. The code is below.


    // take number of sheets entered and distribute across orders
    // check first if there is available stock.
    Input=Host Quantity:=ll_sheets=0=cancel

    // Issue sheets to multiple jobs
    //messagebox=<dw_2.item.itemcode:[1].value>

    setvar=ll_nooflines=0
    setvar=ll_wos=

    // check inventory is there
    sql=select "OnHand" from "OITM" where "ItemCode"='<dw_2.item.itemcode:[1].value>'
    setvar=ll_result=%sub(<wert1>,<ll_sum>)
    if <ll_result> <= 0 then
    messagebox=Not enough sheets in stock (<wert1>).
    cancel
    end if

    // loop through and sum requirements, then loop through again and issue all components
    setvar=ll_sum=0
    for ll_loop=1 to <dw_2.rowcount>
    setvar=ll_sum=%numadd(<ll_sum>,<dw_2.item.neededqty:[ll_loop].value>)
    next
    //messagebox=<ll_sum> - Total
    if <ll_sum> = 0 then
    question=id=check_requirements<tab>text=0 sheets are required. Are you sure you want to continue?<tab>yes=carryon<tab>no=cancel
    end if

    [carryon]
    //messagebox=<ll_sum,0.0000>
    declare=res=ue_reservation
    res=planned=new=issuewo

    for ll_loop=1 to <dw_2.rowcount>
    setvar=ll_percent=%dif(<dw_2.item.neededqty:[ll_loop].value,0.0000>,<ll_sum,0.0000>)
    setvar=ll_wo=<dw_2.item.docentry:[ll_loop].value>
    setvar=ll_belpos=<dw_2.item.linenum:[ll_loop].value>
    setvar=ll_pos=<dw_2.item.linenum2:[ll_loop].value>
    setvar=ll_itemcode=<dw_2.item.itemcode:[ll_loop].value>
    setvar=ll_whs=<dw_2.item.whscode:[ll_loop].value>
    //messagebox=<ll_loop> - <ll_percent>
    setvar=ll_qtytoiss=%mul(<ll_percent>,<ll_sheets>)
    //messagebox=<ll_loop> - Percent <ll_percent,0.0000> - Qty <ll_qtytoiss>
    res=planned=addline=base_doctype=wo<tab>base_docentry=<ll_wo><tab>base_linenum=<ll_belpos><tab>base_linenum2=<ll_pos><tab>itemcode=<ll_itemcode><tab>whscode=<ll_whs><tab>quantity=<ll_qtytoiss,0.0000><tab>save

    next
    res=issuewo
    form.reload
    messagebox=All host material issued.
    form.show

     

     

  • Phil Sparkes

    Martin,

    This is the reservation form but being used to production issue....... if you like I'll show you what's being built for the customer if you are interested.

    Phil

  • Martin Heigl

    Hi Phil,

    i think, this script is part of button click

    what do you want to insert in the form_open event?

Iniciar sesión para dejar un comentario.