algoritimo em foxpro

Embed Size (px)

Citation preview

  • 7/31/2019 algoritimo em foxpro

    1/3

    al lc_setor,lc_ficha_id,produto,banho,cor asString

    ficha_id=""

    etor=""

    etor=alltrim(thisform.pgfichar.page1.cbsetor.Value)

    ficha_id=alltrim(thisform.pgfichar.page1.txficha.Value)

    mpty(lc_setor))

    messagebox("Campo Setor em Branco..! ",64,'Aviso..!')

    thisform.pgfichar.page1.cbsetor.SetFocus()

    urn

    f

    mpty(lc_ficha_id))

    messagebox("Campo Ficha em Branco..! ",64,'Aviso..!')

    thisform.pgfichar.page1.txficha.SetFocus()

    urn

    f

    ct * from producao where status_producao='100' and left(lote,1)='F' ;

    and alltrim(ficha_id)=lc_ficha_id intocursor TMPficha_prd

    ct TMPficha_prd

    wse

    duto=TMPficha_prd.produto_id

    ho=TMPficha_prd.banho_id

    =TMPficha_prd.cor_id

    ntfor !eof('TMPficha_prd') to IsLocsLoc > 0 )

    && Comea o processo de Validao da Ficha

    &&browse

    lcCpydate = datetime()

    selectdistinc s.setor_id,s.controle,p.atu_data,p.hist1 from setor s leftjoin producao p on

    _id=p.setor_id and p.status_producao='100' ;

    where p.ficha_id=lc_ficha_id intocursor TMPStCont

    select TMPStCont

    debug

    suspend

    if(TMPStCont.controle=.f. and empty(TMPStCont.atu_data))

    select opcao from opclist where grp_opc_id='SHID' intoarray IdHist

    NovoIdHist= val(IdHist)+1

    update opclist set opcao=str(NovoIdHist) where grp_opc_id='SHID' && Atualiza

    do Hist No Opclist

    update producao set setor_id=val(lc_setor), hist1=NovoIdHist,atu_data=lcCpydate

    produto_id=produto and banho_id=banho;

    and cor_id=cor and status_producao='100' and ficha_id=lc_ficha_id

    * gera lanamento no histrico

    *

    insertinto setor_hist(ficha_id,setor_id,usuario,data_hora,controle,atrasos,hist

    values (lc_ficha_id ,val(lc_setor),str(thisform.usuario),lcCpydate,'P',0,t)

    else && if(TMPStCont.controle=.f. and empty(TMPStCont.atu_data))

    select controle from setor where setor_id= val(lc_setor) intoarray

    o

    if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) and TMPStCo

    > 0 and (TMPStCont.setor_id val(lc_setor) and StProximo .f.))

    select opcao from opclist where grp_opc_id='SHID' intoarray I

    NovoIdHist= val(IdHist)+1

    update opclist set opcao=str(NovoIdHist) where grp_opc_id='SHI

    ualiza a Chave do Hist No Opclist

    update producao set setor_id=val(lc_setor), hist1=NovoIdHist,at

    Cpydate where produto_id=produto and banho_id=banho;and cor_id=cor and status_producao='100' and ficha_id=lc

    d

  • 7/31/2019 algoritimo em foxpro

    2/3

    * gera lanamento no histrico

    *

    update setor_hist set data_saida=lcCpydate wherehist=TMPStCon

    insertinto setor_hist(ficha_id,setor_id,usuario,controle,atraso

    values (lc_ficha_id ,val(lc_setor),str(thisform.usuario),

    oIdHist)

    else && if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) a

    Cont.hist1 > 0 and TMPStCont.setor_id val(lc_setor))

    select controle from setor where setor_id= val(lc_setor) int

    tProximo

    if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) and

    nt.hist1 > 0 and (TMPStCont.setor_id val(lc_setor) and StProximo .t.))

    select opcao from opclist where grp_opc_id='SHID' i

    y IdHist

    NovoIdHist= val(IdHist)+1

    update opclist set opcao=str(NovoIdHist) where grp

    SHID' && Atualiza a Chave do Hist No Opclist

    update producao set setor_id=val(lc_setor), hist1=N

    ,atu_data=lcCpydate where produto_id=produto and banho_id=banho;

    and cor_id=cor and status_producao='100' and

    d=lc_ficha_id

    * gera lanamento no histrico

    *

    update setor_hist set data_saida=lcCpydate wherehCont.hist1

    insertinto setor_hist(ficha_id,setor_id,usuario,dat

    ntrole,atrasos,hist) ;

    values (lc_ficha_id ,val(lc_setor),str(thisform

    ,lcCpydate,'P',0,NovoIdHist)

    else&&if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_da

    TMPStCont.hist1 > 0 and (TMPStCont.setor_id val(lc_setor) and StProximo .t.))

    selectcount(*) from setor_hist s leftjoin producao p on

    _id=p.ficha_id ;

    where s.ficha_id=lc_ficha_id and left(p.lote,2)='F

    tor_id=val(lc_setor) intoarray ExistLanc

    if(!empty(TMPStCont.atu_data) and TMPStCont.hist1 > 0 andanc > 0))

    doform fmmotivo.scx with lc_ficha_id , lc_

    tCont.hist1 to returno

    select opcao from opclist where grp_opc_id=

    oarray IdHist

    NovoIdHist= val(IdHist)+1

    update opclist set opcao=str(NovoIdHist) wh

    _opc_id='SHID' && Atualiza a Chave do Hist No Opclist

    update producao set setor_id=val(lc_setor),

    voIdHist,atu_data=lcCpydate where produto_id=produto and banho_id=banho;

    and cor_id=cor and status_producao='

    ficha_id=lc_ficha_id

    * gera lanamento no histrico

    *update setor_hist set data_saida=lcCpydate

    t=TMPStCont.hist1

    insertinto setor_hist(ficha_id,setor_id,usu

    a_hora,controle,atrasos,hist) ;

    values (lc_ficha_id ,val(lc_setor),str

    usuario),lcCpydate,'P',0,NovoIdHist)

    endif

  • 7/31/2019 algoritimo em foxpro

    3/3

    endif

    endif

    endif

    messagebox("Ficha No Localizada na Produo..! ",64,'Aviso..!')

    thisform.pgfichar.page1.txficha.Value=""

    thisform.pgfichar.page1.txficha.SetFocus()

    return

    f