PERGUNTAS E RESPOSTAS
 
Bem Vindo, Visitante  Todos os Fórums
  ADVPL
Enviar para a impressoraImprimir  Enviar e-mail para um amigoEnviar Para um Amigo
Precisa estar Logado

Subject Assunto:
ERRO MVC ALTERAR
Versão:
12.1.25
Plataforma:
Microsoft
Complemento:
DB:
SQL Server
Complemento:
LinkedIn
Foto
Mensagem do Enviar e-mail Abrir o Perfil do usuário RA_MOERBEK RA_MOERBEK em 30/12/2019, 13:09 h
Local: SP  Registro: 06/12/2019  Postagens: 2
Boa tarde Galera , preciso de uma ajuda com esse fonte.

Estou tentando alterar um registro que eu inclui via MVC , porém , na hora de visualizar ou alterar , da esse erro .

erro no parâmetroFWFormGridModel: A linha 0 é inválida !!! on FWFORMGRIDMODEL:GETVALUE(FWFORMGRIDMODEL.PRX) 12/07/2019 17:27:31 line : 2581

Segue o font.


User Function CRONO002()
    Local oBrowse
    Local aArea   := GetArea()
    oBrowse := FWMBrowse():New()
    oBrowse:SetAlias(‘SZ1‘)
    oBrowse:SetDescription(‘Importacao‘)
    oBrowse:AddLegend("Z1_STATUS==‘1‘","RED" ,"Não Integrado")
    oBrowse:AddLegend("Z1_STATUS==‘2‘","GREEN","Importado e Gerado NF")
    oBrowse:Activate()
    RestArea(aArea)
Return

Static Function MenuDef()
    Local aRotina := {}

    ADD OPTION aRotina TITLE ‘Visualizar‘ ACTION ‘VIEWDEF.CRONO002‘ OPERATION 2 ACCESS 0
    ADD OPTION aRotina TITLE ‘Incluir‘    ACTION ‘VIEWDEF.CRONO002‘ OPERATION 3 ACCESS 0
    ADD OPTION aRotina TITLE ‘Alterar‘    ACTION ‘VIEWDEF.CRONO002‘ OPERATION 4 ACCESS 0
    ADD OPTION aRotina TITLE ‘Excluir‘    ACTION ‘VIEWDEF.CRONO002‘ OPERATION 5 ACCESS 0
    ADD OPTION aRotina TITLE ‘Imprimir‘   ACTION ‘VIEWDEF.CRONO002‘ OPERATION 8 ACCESS 0
    ADD OPTION aRotina TITLE ‘Copiar‘     ACTION ‘VIEWDEF.CRONO002‘ OPERATION 9 ACCESS 0

Return aRotina

Static Function ModelDef()
    Local oModel
    Local oStruSZ1 := FWFormStruct(1,‘SZ1‘)
    Local oStruSZ2 := FWFormStruct(1,‘SZ2‘)
    oStruSZ1:SetProperty(‘Z1_DATA‘,     MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))                                  //Modo de Edi��o
    oStruSZ1:SetProperty(‘Z1_STATUS‘,   MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_TIPONF‘, MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_SERIE‘,   MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_FORN‘,   MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_COND‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_EST‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_ESPECIE‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_EMISSAO‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_NSU‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_CLIENT‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_CLILOJA‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_NATUR‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_CODAUTO‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ1:SetProperty(‘Z1_DOC‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))

    oStruSZ2:SetProperty(‘Z2_ITEM‘,       MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_COD‘,     MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))                                  //Modo de Edi��o
    oStruSZ2:SetProperty(‘Z2_QUANT‘,   MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_PRCVEN‘,       MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_TOTAL‘,   MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_TES‘,      MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_CFOP‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_DESCITE‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_NFORI‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_SERIEOR‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_ITEMORI‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_PEDIDO‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_ITEMPV‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_NUMSEQ‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_CLASFIS‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_LOCALIZ‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_NUMSERI‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_CC‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_VLBRTO‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_VLRLQD‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_DOC‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_FORNEC‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_SERIE‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_LOJA‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_OK‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))
    oStruSZ2:SetProperty(‘Z2_NSU‘,    MODEL_FIELD_WHEN,    FwBuildFeature(STRUCT_FEATURE_WHEN,    ‘.T.‘))

    oModel := MPFormModel():New("MODELCRONO")
    oModel:SetDescription("Importação do Vivo Go")
    oModel:addFields(‘MASTERSZ1‘,,oStruSZ1)
    oModel:addGrid(‘DETAILSZ2‘,‘MASTERSZ1‘,oStruSZ2)

    oModel:getModel(‘MASTERSZ1‘):SetDescription(‘Cabeçalho‘)
    oModel:getModel(‘DETAILSZ2‘):SetDescription(‘Itens‘)
    oModel:SetRelation("DETAILSZ2",{{"Z1_FILIAL","Z2_FILIAL"},{"Z1_DOC","Z2_DOC"},{"Z1_SERIE","Z2_SERIE"}},SZ2->(IndexKey(1)))
    oModel:SetPrimaryKey({ ‘Z2_FILIAL‘, ‘Z2_DOC‘,‘Z2_SERIE‘ })

Return oModel

Static Function ViewDef()
    Local oModel := ModelDef()
    Local oView
    Local oStrSZ1:= FWFormStruct(2, ‘SZ1‘)
    Local oStrSZ2:= FWFormStruct(2, ‘SZ2‘)
    Local aStruSB1     := SZ1->(DbStruct())
     Local aStruSB2     := SZ2->(DbStruct())

    oView := FWFormView():New()
    oView:SetModel(oModel)
    oView:AddField(‘FORM_CABECA‘ , oStrSZ1,‘MASTERSZ1‘ )
    oView:AddGrid(‘FORM_ITENS‘ , oStrSZ2,‘DETAILSZ2‘)

    oView:CreateHorizontalBox( ‘BOX_FORM_CABECA‘, 40)
    oView:CreateHorizontalBox( ‘BOX_FORM_ITENS‘, 60)

    oView:SetOwnerView(‘FORM_CABECA‘,‘BOX_FORM_CABECA‘)
    oView:SetOwnerView(‘FORM_ITENS‘,‘BOX_FORM_ITENS‘)
    oView:EnableTitleView(‘FORM_CABECA‘,‘Cabeçalho‘)
    oView:EnableTitleView(‘FORM_ITENS‘,‘Itens‘)

    oView:AddIncrementField( ‘FORM_ITENS‘, ‘Z2_ITEM‘ )

Return oView

Preciso de uma ajuda

Foto
Mensagem do Enviar e-mail Abrir o Perfil do usuário VRTN VRTN em 30/12/2019, 14:52 h
Local: MG  Registro: 09/11/2009  Postagens: 182
Acho que o problema pode estar no relacionamento das duas tabelas, tente trocar pelo seguinte:

oModel:SetRelation("DETAILSZ2",{{"Z2_FILIAL","xFilial(‘Z02‘)"},{"Z2_DOC","Z1_DOC"},{"Z2_SERIE","Z1_SERIE"}},SZ2->(IndexKey(1)))


Everton Alves

Para postar no Fórum você precisa efetuar o seu login ou se registrar

 Mudar para Fórum

 

 

 
 
   
Pagina Principal Shopping PROTHEUS Tire suas duvidas Vagas Microsiga em todo Brasil Aprofunde seus conhecimentos Noticias Online Fale Conosco Pagina Principal