Você está na página 1de 3

local lc_setor,lc_ficha_id,produto,banho,cor as String lc_ficha_id="" lc_setor="" lc_setor=alltrim(thisform.pgfichar.page1.cbsetor.Value) lc_ficha_id=alltrim(thisform.pgfichar.page1.txficha.Value) if(empty(lc_setor)) messagebox("Campo Setor em Branco..! ",64,'Aviso..!') thisform.pgfichar.page1.cbsetor.

SetFocus() return endif if(empty(lc_ficha_id)) messagebox("Campo Ficha em Branco..! ",64,'Aviso..!') thisform.pgfichar.page1.txficha.SetFocus() return endif select * from producao where status_producao='100' and left(lote,1)='F' ; and alltrim(ficha_id)=lc_ficha_id into cursor TMPficha_prd select TMPficha_prd browse

produto=TMPficha_prd.produto_id banho=TMPficha_prd.banho_id cor=TMPficha_prd.cor_id count for !eof('TMPficha_prd') to IsLoc if(IsLoc > 0 ) && Comea o processo de Validao da Ficha &&browse lcCpydate = datetime() select distinc s.setor_id,s.controle,p.atu_data,p.hist1 from setor s left join producao p on s.se tor_id=p.setor_id and p.status_producao='100' ; where p.ficha_id=lc_ficha_id into cursor TMPStCont select TMPStCont *!* *!* *!* debug suspend if(TMPStCont.controle=.f. and empty(TMPStCont.atu_data)) select opcao from opclist where grp_opc_id='SHID' into array IdHist NovoIdHist= val(IdHist)+1 update opclist set opcao=str(NovoIdHist) where grp_opc_id='SHID' && Atualiza a Cha ve do Hist No Opclist update producao set setor_id=val(lc_setor), hist1=NovoIdHist,atu_data=lcCpydate whe re 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 * insert into 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,NovoI dHist) else ximo if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) and TMPStCont.hi st1 > 0 and (TMPStCont.setor_id <> val(lc_setor) and StProximo <> .f.)) select opcao from opclist where grp_opc_id='SHID' into array IdHist NovoIdHist= val(IdHist)+1 update opclist set opcao=str(NovoIdHist) where grp_opc_id='SHID' & & Atualiza a Chave do Hist No Opclist update producao set setor_id=val(lc_setor), hist1=NovoIdHist,atu_dat = alcCpydate where produto_id=produto and banho_id=banho; and cor_id=cor and status_producao='100' and ficha_id=lc_fich a_id && if(TMPStCont.controle=.f. and empty(TMPStCont.atu_data)) select controle from setor where setor_id= val(lc_setor) into array StPro

* gera lanamento no histrico * update setor_hist set data_saida=lcCpydate t1 ) t ;

where hist=TMPStCont.his

insert into setor_hist(ficha_id,setor_id,usuario,controle,atrasos,his values (lc_ficha_id ,val(lc_setor),str(thisform.usuario),'P',0 N ,ovoIdHist) else && if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) and TM PStCont.hist1 > 0 and TMPStCont.setor_id <> val(lc_setor)) select controle from setor where setor_id= val(lc_setor) into arr ay StProximo if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) and TMPS tCont.hist1 > 0 and (TMPStCont.setor_id <> val(lc_setor) and StProximo <> .t.)) select opcao from opclist where grp_opc_id='SHID' into a rray IdHist NovoIdHist= val(IdHist)+1 update opclist set opcao=str(NovoIdHist) where grp_opc_ id='SHID' && Atualiza a Chave do Hist No Opclist update producao set setor_id=val(lc_setor), hist1=NovoId Hist,atu_data=lcCpydate where produto_id=produto and banho_id=banho; and cor_id=cor and status_producao='100' and fich a_id=lc_ficha_id * gera lanamento no histrico * update setor_hist set data_saida=lcCpydate where hist=T MPStCont.hist1 insert into setor_hist(ficha_id,setor_id,usuario,data_hor , acontrole,atrasos,hist) ; values (lc_ficha_id ,val(lc_setor),str(thisform.usua rio),lcCpydate,'P',0,NovoIdHist) else &&if(TMPStCont.controle=.f. and !empty(TMPStCont.atu_data) a nd TMPStCont.hist1 > 0 and (TMPStCont.setor_id <> val(lc_setor) and StProximo <> .t.)) select count(*) from setor_hist s left join producao p on s.fi cha_id=p.ficha_id ; where s.ficha_id=lc_ficha_id and left(p.lote,2)='F' and s.setor_id=val(lc_setor) into array ExistLanc if(!empty(TMPStCont.atu_data) and TMPStCont.hist1 > 0 and (Exi stLanc > 0)) do form fmmotivo.scx with lc_ficha_id , lc_setor T ,MPStCont.hist1 to returno select opcao from opclist where grp_opc_id='SHID 'into array IdHist NovoIdHist= val(IdHist)+1 update opclist set opcao=str(NovoIdHist) where grp_opc_id='SHID' && Atualiza a Chave do Hist No Opclist update producao set setor_id=val(lc_setor), hist = 1NovoIdHist,atu_data=lcCpydate where 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 * update setor_hist set data_saida=lcCpydate wher ehist=TMPStCont.hist1 insert into setor_hist(ficha_id,setor_id,usuario, data_hora,controle,atrasos,hist) ; values (lc_ficha_id ,val(lc_setor),str(thisf orm.usuario),lcCpydate,'P',0,NovoIdHist)

endif

endif endif endif else messagebox("Ficha No Localizada na Produo..! ",64,'Aviso..!') thisform.pgfichar.page1.txficha.Value="" thisform.pgfichar.page1.txficha.SetFocus() return endif

Você também pode gostar