Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Handling of EP in the system

Bloco de código
languagecpp
themeRDark
titleHandling of EP in the system
lRet := ExecBlock( "AF380VLIN", .F., .F.,{oGetD:aHeader,oGetD:aCols,nInc,nOpc,lEfetiva } )

...

Bloco de código
languagecpp
themeRDark
titleEP Example
#Include 'Protheus.ch'

//Example entry point to validate row in export or import

User Function AF380VLIN()

      Local aHeaVLin := ParamIXB[1]
      Local aColsVLin := ParamIXB[2]
      Local nLinAt := ParamIXB[3]
      Local nOpc := ParamIXB[4]
      Local lEfetiva_ := ParamIXB[5]
      Local lRet := .T.
      Local cQuery := ""
      Local aArea := GetArea()
      Local cAliasQry := CriaTrab(,.F.)
      Local nPosBem := aScan( aHeaVLin, {|x| Upper( AllTrim( x[2] ) ) == "NJ_BEM" } )
      Local nPosItBem := aScan( aHeaVLin, {|x| Upper( AllTrim( x[2] ) ) == "NJ_ITBEM" } )

      If nOpc == 7 .And. lEfetiva_ .And. nPosBem > 0 .And. nPosItBem > 0

            //import with activation has to validate if the asset is not already in another simulation

            cQuery := " SELECT NI_STATUS FROM "
            cQuery += " SNI000 SNI, SNJ000 SNJ "
            cQuery += " WHERE "          
            cQuery += "  NI_STATUS = '1' "
            cQuery += " AND SNI.D_E_L_E_T_ = ' ' "
            cQuery += " AND NI_FILIAL = NJ_FILIAL "
            cQuery += " AND NI_PROC = NJ_PROC "  
            cQuery += " AND SNJ.D_E_L_E_T_ = ' ' "

            dbUseArea(.T., "TOPCONN", TcGenQry(,, cQuery ), cAliasQry, .T.,.F. )

            If (cAliasQry)->( !Eof() ) //if found it returns .F. to caller
               (cAliasQry)->( DbCloseArea() )
               //MsgInfo("Asset : "+aColsVLin[nLinAt, nPosBem]+"/"+aColsVLin[nLinAt, nPosItBem]+" - found in another simulation, File cannot be imported.")
               lRet := .F.
            EndIf

      EndIf

      RestArea(aArea)

Return(lRet)

...