Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
DEF VAR cNrPedcli LIKE ped-venda.nr-pedcli NO-UNDO.
DEF VAR vItemDiv  LIKE wam-ped-item-div.it-codigo NO-UNDO.
DEF VAR vChamado  AS CHAR NO-UNDO. 

ASSIGN cNrPedcli = "6703939A".         // IMFORMAR O PEDIDO
ASSIGN vItemDiv  = "530149".   tarefa  // INFORMAR O ITEM QUE TEM DIVERGENCIA NA QUANTIDADE
                                       // DEPOIS DE INFORMAR O ITEM APAGAR A PALAVRA TAREFA  
ASSIGN vChamado  = "SANTIBR-81459".    // INFORMAR O CHAMADO

FOR EACH wam-ped-venda WHERE wam-ped-venda.nr-pedcli = cNrPedcli:
    CREATE wam-ped-venda-div.
    ASSIGN wam-ped-venda-div.cod-estabel    = wam-ped-venda.cod-estabel  
           wam-ped-venda-div.dt-acao        = ?      
           wam-ped-venda-div.hr-acao        = ""      
           wam-ped-venda-div.nome-abrev     = wam-ped-venda.nome-abrev   
           wam-ped-venda-div.nr-pedcli      = wam-ped-venda.nr-pedcli    
           wam-ped-venda-div.nr-pedcli-pai  = wam-ped-venda.nr-pedcli-pai
           wam-ped-venda-div.obdNo          = wam-ped-venda.obdNo        
           wam-ped-venda-div.qtd-vol        = 1      
           wam-ped-venda-div.situacao       = 1     
           wam-ped-venda-div.tip-vol        = "CX"      
           wam-ped-venda-div.usuario        = "".     

    FOR EACH wam-ped-item WHERE wam-ped-item.nr-pedcli = wam-ped-venda.nr-pedcli:
        CREATE wam-ped-item-div. 
        ASSIGN wam-ped-item-div.it-codigo     = wam-ped-item.it-codigo   
               wam-ped-item-div.nome-abrev    = wam-ped-item.nome-abrev  
               wam-ped-item-div.nr-pedcli     = wam-ped-item.nr-pedcli   
               wam-ped-item-div.nr-sequencia  = wam-ped-item.nr-sequencia
               wam-ped-item-div.qt-conferida  = wam-ped-item.qt-pedida
               wam-ped-item-div.qt-pedida     = wam-ped-item.qt-pedida   
               wam-ped-item-div.situacao      = 1.
               
    END.
    ASSIGN wam-ped-venda.situacao     = 8
           wam-ped-venda.data-retorno = TODAY
           wam-ped-venda.hora-retorno = STRING(TIME, "HH:MM")
           wam-ped-venda.mensagem     = "Divergência de quantidades, enviado para painel".
  
END.

FOR EACH wam-ped-venda-div WHERE wam-ped-venda-div.nr-pedcli = cNrPedcli:
    FOR EACH wam-ped-item-div WHERE
        wam-ped-item-div.nome-abrev = wam-ped-venda-div.nome-abrev AND
        wam-ped-item-div.nr-pedcli  = wam-ped-venda-div.nr-pedcli  AND
        wam-ped-item-div.it-codigo = vItemDiv:                             
        DISPLAY wam-ped-item-div.it-codigo wam-ped-item-div.qt-pedida.

        UPDATE wam-ped-item-div.qt-conferida.
        FIND FIRST wam-ped-item WHERE
            wam-ped-item.nome-abrev   = wam-ped-item-div.nome-abrev AND
            wam-ped-item.nr-pedcli    = wam-ped-item-div.nr-pedcli  AND
            wam-ped-item.nr-sequencia = wam-ped-item-div.nr-sequencia NO-ERROR.
        IF AVAIL wam-ped-item THEN DO: 
           ASSIGN wam-ped-item.qt-conferida = wam-ped-item-div.qt-conferida
                  wam-ped-item.msg-erp = "Quantidade conferida alterada pelo usuário Ana Paula via chamado: " + vChamado.
        END.
    END.
END. 

...