Method change entity code [closed]

0

In a client in Mozambique I need to change entity code and use the PRIMAVERA API method

_erpBs.Comercial.Clientes.AlteraCodigoCliente(codigoAntigo, codigoNovo);

The problem is that this method has high performance costs, some suggestions for improvement?

    
asked by anonymous 21.06.2018 / 11:30

2 answers

1

The question of performance arises because of the high number of tables where the code has to be replaced (about 50/60 tables), in addition to having to do the uncheck / check of some constraints due to referential integrity.

Given that each database is a case (you can optimize in this case but not in others), you can always create indexes in the largest tables, such as Historico and / or LinhasLiq :

CREATE NONCLUSTERED INDEX IX_Historico_Entidade
ON Historico(Entidade)
INCLUDE(TipoEntidade)

CREATE NONCLUSTERED INDEX IX_Historico_EntidadeComercial
ON Historico(EntidadeComercial)
INCLUDE(TipoEntidadeComercial)

CREATE NONCLUSTERED INDEX IX_Historico_EntidadeDestino
ON Historico(EntidadeDestino)
INCLUDE(TipoEntidadeDestino)

CREATE NONCLUSTERED INDEX IX_LinhasLiq_Entidade
ON LinhasLiq(Entidade)
INCLUDE(TipoEntidade)

The Accounting table, Movimentos , already has indexes for the Entidade and Terceiro columns.

    
21.06.2018 / 12:46
2

Changing the customer code requires that all related information be updated, hence the need to execute through the function.

_erpBs.Comercial.Clientes.AlteraCodigoCliente(codigoAntigo, codigoNovo);

This function updates all dependencies for the client to update.

Note that using this function ensures that you always update all necessary dependencies, since whenever a new one is added, Spring will add the new dependency here in this function.

That's why it's important to use it.

    
21.06.2018 / 12:51