Versão atual:

Execauto MVC GFEA084

Fiz um execauto mvc da rotina gfe084 mas tá dizendo que o campo GWI_NRCALC está vazio

oModel := FWLoadModel("GFEA084")
oModelGWF := oModel:GetModel("GFEA084_GWF")
oModelGWI := oModel:GetModel("GFEA084_GWI")            
oModelGWH := oModel:GetModel("GFEA084_GWH")

oModel:SetOperation(3)    
oModel:Activate()

cNrCalc := GETSXENUM("GWF","GWF_NRCALC")

oModelGWF:SetValue("GWF_FILIAL",xFilial("GWF"))
oModelGWF:SetValue("GWF_NRCALC",cNrCalc)
oModelGWF:SetValue("GWF_DTPREN",Date())
oModelGWF:SetValue("GWF_HRPREN",Time())
oModelGWF:SetValue("GWF_ICMRET",0)
oModelGWF:SetValue("GWF_ADICIS","2")
oModelGWF:SetValue("GWF_IDFRVI","2")
oModelGWF:SetValue("GWF_OBS","FRETE COMBINADO")

oModelGWI:SetValue("GWI_FILIAL",xFilial("GWI"))
oModelGWI:SetValue("GWI_NRCALC",cNrCalc)
oModelGWI:SetValue("GWI_CDCOMP","FRETE COMB")
oModelGWI:SetValue("GWI_VLFRET",DAK->DAK_XVLNEG)
oModelGWI:SetValue("GWI_BASICM","1")
oModelGWI:SetValue("GWI_BASPIS","1")

dbSelectArea("GW1")
GW1->(dbSetOrder(9))
GW1->(dbSeek(xFilial("GW1")+GWN->GWN_NRROM))

oModelGWH:SetValue("GWH_FILIAL",xFilial("GWH"))
oModelGWH:SetValue("GWH_NRCALC",cNrCalc)
oModelGWH:SetValue("GWH_NRDC",GW1->GW1_NRDC)
oModelGWH:SetValue("GWH_CDTPDC",GW1->GW1_CDTPDC)
oModelGWH:SetValue("GWH_EMISDC",GW1->GW1_EMISDC)
oModelGWH:SetValue("GWH_SERDC",GW1->GW1_SERDC)

dbSelectArea("GWU")
GWU->(dbSetOrder(1))
GWU->(dbSeek(xFilial("GWU")+GW1->GW1_CDTPDC+GW1->GW1_EMISDC+GW1->GW1_SERDC+GW1->GW1_NRDC))

oModelGWH:SetValue("GWH_TRECHO",GWU->GWU_SEQ)

If oModel:VldData()        
    oModel:CommitData()    
EndIf    

oModel:DeActivate()

Versões (2):

Ver a versão formatada

Execauto MVC GFEA084

Comentário

new question